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