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/branch.hh>
00039
00040 namespace Gecode {
00041
00042 void
00043 assign(Space& home, const IntVarArgs& x, IntAssign vals,
00044 const ValBranchOptions& o_vals) {
00045 using namespace Int;
00046 if (home.failed()) return;
00047 ViewArray<IntView> xv(home,x);
00048 ViewSelNone<IntView> v(home,VarBranchOptions::def);
00049 switch (vals) {
00050 case INT_ASSIGN_MIN:
00051 {
00052 Branch::AssignValMin<IntView> a(home,o_vals);
00053 (void) new (home) ViewValBranching
00054 <ViewSelNone<IntView>,Branch::AssignValMin<IntView> >
00055 (home,xv,v,a);
00056 }
00057 break;
00058 case INT_ASSIGN_MED:
00059 {
00060 Branch::AssignValMed<IntView> a(home,o_vals);
00061 (void) new (home) ViewValBranching
00062 <ViewSelNone<IntView>,Branch::AssignValMed<IntView> >
00063 (home,xv,v,a);
00064 }
00065 break;
00066 case INT_ASSIGN_MAX:
00067 {
00068 Branch::AssignValMin<MinusView> a(home,o_vals);
00069 (void) new (home) ViewValBranching
00070 <ViewSelNone<IntView>,Branch::AssignValMin<MinusView> >
00071 (home,xv,v,a);
00072 }
00073 break;
00074 case INT_ASSIGN_RND:
00075 {
00076 Branch::AssignValRnd<IntView> a(home,o_vals);
00077 (void) new (home) ViewValBranching
00078 <ViewSelNone<IntView>,Branch::AssignValRnd<IntView> >
00079 (home,xv,v,a);
00080 }
00081 break;
00082 default:
00083 throw UnknownBranching("Int::assign");
00084 }
00085 }
00086
00087 void
00088 assign(Space& home, const BoolVarArgs& x, IntAssign vals,
00089 const ValBranchOptions& o_vals) {
00090 using namespace Int;
00091 if (home.failed()) return;
00092 ViewArray<BoolView> xv(home,x);
00093 ViewSelNone<BoolView> v(home,VarBranchOptions::def);
00094 switch (vals) {
00095 case INT_ASSIGN_MIN:
00096 case INT_ASSIGN_MED: {
00097 Branch::AssignValZero<BoolView> a(home,o_vals);
00098 (void) new (home) ViewValBranching
00099 <ViewSelNone<BoolView>,Branch::AssignValZero<BoolView> >
00100 (home,xv,v,a);
00101 }
00102 break;
00103 case INT_ASSIGN_MAX: {
00104 Branch::AssignValZero<NegBoolView> a(home,o_vals);
00105 (void) new (home) ViewValBranching
00106 <ViewSelNone<BoolView>,Branch::AssignValZero<NegBoolView> >
00107 (home,xv,v,a);
00108 }
00109 break;
00110 case INT_ASSIGN_RND: {
00111 Branch::AssignValRnd<BoolView> a(home,o_vals);
00112 (void) new (home) ViewValBranching
00113 <ViewSelNone<BoolView>,Branch::AssignValRnd<BoolView> >
00114 (home,xv,v,a);
00115 }
00116 break;
00117 default:
00118 throw UnknownBranching("Int::assign");
00119 }
00120 }
00121
00122 }
00123
00124