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 #include <gecode/set/branch.hh>
00035
00036 namespace Gecode { namespace Set { namespace Branch {
00037
00038 ValSelCommitBase<SetView,int>*
00039 valselcommit(Space& home, const SetValBranch& svb) {
00040 switch (svb.select()) {
00041 case SetValBranch::SEL_MIN_INC:
00042 return new (home) ValSelCommit<ValSelMin,ValCommitInc>(home,svb);
00043 case SetValBranch::SEL_MIN_EXC:
00044 return new (home) ValSelCommit<ValSelMin,ValCommitExc>(home,svb);
00045 case SetValBranch::SEL_MED_INC:
00046 return new (home) ValSelCommit<ValSelMed,ValCommitInc>(home,svb);
00047 case SetValBranch::SEL_MED_EXC:
00048 return new (home) ValSelCommit<ValSelMed,ValCommitExc>(home,svb);
00049 case SetValBranch::SEL_MAX_INC:
00050 return new (home) ValSelCommit<ValSelMax,ValCommitInc>(home,svb);
00051 case SetValBranch::SEL_MAX_EXC:
00052 return new (home) ValSelCommit<ValSelMax,ValCommitExc>(home,svb);
00053 case SetValBranch::SEL_RND_INC:
00054 return new (home) ValSelCommit<ValSelRnd,ValCommitInc>(home,svb);
00055 case SetValBranch::SEL_RND_EXC:
00056 return new (home) ValSelCommit<ValSelRnd,ValCommitExc>(home,svb);
00057 case SetValBranch::SEL_VAL_COMMIT:
00058 if (!svb.commit()) {
00059 return new (home)
00060 ValSelCommit<ValSelFunction<SetView>,ValCommitInc>(home,svb);
00061 } else {
00062 return new (home)
00063 ValSelCommit<ValSelFunction<SetView>,ValCommitFunction<SetView> >(home,svb);
00064 }
00065 default:
00066 throw UnknownBranching("Set::branch");
00067 }
00068 }
00069
00070 ValSelCommitBase<SetView,int>*
00071 valselcommit(Space& home, const SetAssign& sa) {
00072 switch (sa.select()) {
00073 case SetAssign::SEL_MIN_INC:
00074 return new (home) ValSelCommit<ValSelMin,ValCommitInc>(home,sa);
00075 case SetAssign::SEL_MIN_EXC:
00076 return new (home) ValSelCommit<ValSelMin,ValCommitExc>(home,sa);
00077 case SetAssign::SEL_MED_INC:
00078 return new (home) ValSelCommit<ValSelMed,ValCommitInc>(home,sa);
00079 case SetAssign::SEL_MED_EXC:
00080 return new (home) ValSelCommit<ValSelMed,ValCommitExc>(home,sa);
00081 case SetAssign::SEL_MAX_INC:
00082 return new (home) ValSelCommit<ValSelMax,ValCommitInc>(home,sa);
00083 case SetAssign::SEL_MAX_EXC:
00084 return new (home) ValSelCommit<ValSelMax,ValCommitExc>(home,sa);
00085 case SetAssign::SEL_RND_INC:
00086 return new (home) ValSelCommit<ValSelRnd,ValCommitInc>(home,sa);
00087 case SetAssign::SEL_RND_EXC:
00088 return new (home) ValSelCommit<ValSelRnd,ValCommitExc>(home,sa);
00089 case SetAssign::SEL_VAL_COMMIT:
00090 if (!sa.commit()) {
00091 return new (home)
00092 ValSelCommit<ValSelFunction<SetView>,ValCommitInc>(home,sa);
00093 } else {
00094 return new (home)
00095 ValSelCommit<ValSelFunction<SetView>,ValCommitFunction<SetView> >(home,sa);
00096 }
00097 default:
00098 throw UnknownBranching("Set::assign");
00099 }
00100 }
00101
00102 }}}
00103
00104
00105