extensional.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include <gecode/int/extensional.hh>
00039
00040 namespace Gecode {
00041
00042 void
00043 extensional(Home home, const IntVarArgs& x, DFA dfa,
00044 IntPropLevel) {
00045 using namespace Int;
00046 if (x.same())
00047 throw ArgumentSame("Int::extensional");
00048 GECODE_POST;
00049 GECODE_ES_FAIL(Extensional::post_lgp(home,x,dfa));
00050 }
00051
00052 void
00053 extensional(Home home, const BoolVarArgs& x, DFA dfa,
00054 IntPropLevel) {
00055 using namespace Int;
00056 if (x.same())
00057 throw ArgumentSame("Int::extensional");
00058 GECODE_POST;
00059 GECODE_ES_FAIL(Extensional::post_lgp(home,x,dfa));
00060 }
00061
00062 void
00063 extensional(Home home, const IntVarArgs& x, const TupleSet& t,
00064 IntPropLevel) {
00065 using namespace Int;
00066 if (!t.finalized())
00067 throw NotYetFinalized("Int::extensional");
00068 if (t.arity() != x.size())
00069 throw ArgumentSizeMismatch("Int::extensional");
00070 GECODE_POST;
00071
00072 if (t.tuples()==0) {
00073 if (x.size()!=0) {
00074 home.fail();
00075 }
00076 return;
00077 }
00078
00079
00080 ViewArray<IntView> xv(home,x);
00081 GECODE_ES_FAIL(Extensional::postcompact<IntView>(home,xv,t));
00082 }
00083
00084 void
00085 extensional(Home home, const BoolVarArgs& x, const TupleSet& t,
00086 IntPropLevel) {
00087 using namespace Int;
00088 if (!t.finalized())
00089 throw NotYetFinalized("Int::extensional");
00090 if (t.arity() != x.size())
00091 throw ArgumentSizeMismatch("Int::extensional");
00092 if ((t.min() < 0) || (t.max() > 1))
00093 throw NotZeroOne("Int::extensional");
00094 GECODE_POST;
00095
00096 if (t.tuples()==0) {
00097 if (x.size()!=0) {
00098 home.fail();
00099 }
00100 return;
00101 }
00102
00103
00104 ViewArray<BoolView> xv(home,x);
00105 GECODE_ES_FAIL(Extensional::postcompact<BoolView>(home,xv,t));
00106 }
00107
00108 }
00109
00110