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 using namespace Int;
00043
00044 void
00045 branch(Space* home, const IntVarArgs& x,
00046 IntVarBranch vars, IntValBranch vals) {
00047 Branch::createBranch<ViewValBranching>(home,x,vars,vals);
00048 }
00049
00050 void
00051 branch(Space* home, const BoolVarArgs& x,
00052 IntVarBranch vars, IntValBranch vals) {
00053 Branch::createBranch<ViewValBranching>(home,x,vars,vals);
00054 }
00055
00056 void
00057 assign(Space* home, const IntVarArgs& x, IntAssign vals) {
00058 ViewArray<IntView> xv(home,x);
00059 switch (vals) {
00060 case INT_ASSIGN_MIN:
00061 if (home->failed()) return;
00062 (void) new (home)
00063 ViewValAssignment<IntView,int,
00064 Branch::ValMin<IntView> >(home,xv);
00065 break;
00066 case INT_ASSIGN_MED:
00067 if (home->failed()) return;
00068 (void) new (home)
00069 ViewValAssignment<IntView,int,
00070 Branch::ValMed<IntView> >(home,xv);
00071 break;
00072 case INT_ASSIGN_MAX:
00073 if (home->failed()) return;
00074 (void) new (home)
00075 ViewValAssignment<IntView,int,
00076 Branch::ValMax<IntView> >(home,xv);
00077 break;
00078 default:
00079 throw UnknownBranching("Int::assign");
00080 }
00081 }
00082
00083 void
00084 assign(Space* home, const BoolVarArgs& x, IntAssign vals) {
00085 ViewArray<BoolView> xv(home,x);
00086 switch (vals) {
00087 case INT_ASSIGN_MIN:
00088 case INT_ASSIGN_MED:
00089 if (home->failed()) return;
00090 (void) new (home)
00091 ViewValAssignment<BoolView,Branch::NoValue,
00092 Branch::ValZeroOne<BoolView> >(home,xv);
00093 break;
00094 case INT_ASSIGN_MAX:
00095 if (home->failed()) return;
00096 (void) new (home)
00097 ViewValAssignment<BoolView,Branch::NoValue,
00098 Branch::ValOneZero<BoolView> >(home,xv);
00099 break;
00100 default:
00101 throw UnknownBranching("Int::assign");
00102 }
00103 }
00104
00105 namespace Int { namespace Branch {
00106
00107 template<class View, class Val, template <class> class SelView>
00109 class Creator {
00110 public:
00111 Reflection::ActorRegistrar<ViewValBranching<View,Val,SelView<View>,
00112 Branch::ValMin<View> > > r1;
00113 Reflection::ActorRegistrar<ViewValBranching<View,Val,SelView<View>,
00114 ValMed<View> > > r2;
00115 Reflection::ActorRegistrar<ViewValBranching<View,Val,SelView<View>,
00116 ValMax<View> > > r3;
00117 Reflection::ActorRegistrar<ViewValBranching<View,Val,SelView<View>,
00118 ValSplitMin<View> > > r4;
00119 Reflection::ActorRegistrar<ViewValBranching<View,Val,SelView<View>,
00120 ValSplitMax<View> > > r5;
00121 };
00122
00123 Creator<IntView,int,BySizeMin> c1;
00124 Creator<IntView,int,BySizeMax> c2;
00125 Creator<IntView,int,ByMinMin> c3;
00126 Creator<IntView,int,ByMinMax> c4;
00127 Creator<IntView,int,ByMaxMin> c5;
00128 Creator<IntView,int,ByMaxMax> c6;
00129 Creator<IntView,int,ByNone> c7;
00130 Creator<IntView,int,ByRegretMinMin> c8;
00131 Creator<IntView,int,ByRegretMinMax> c9;
00132 Creator<IntView,int,ByRegretMaxMin> c10;
00133 Creator<IntView,int,ByRegretMaxMax> c11;
00134 Creator<IntView,int,ByDegreeMin> c12;
00135 Creator<IntView,int,ByDegreeMax> c13;
00136
00137 Reflection::ActorRegistrar<ViewValBranching<BoolView,NoValue,
00138 ByDegreeMaxNoTies<BoolView>,ValOneZero<BoolView> > > r1;
00139 Reflection::ActorRegistrar<ViewValBranching<BoolView,NoValue,
00140 ByDegreeMaxNoTies<BoolView>,ValZeroOne<BoolView> > > r2;
00141 Reflection::ActorRegistrar<ViewValBranching<BoolView,NoValue,
00142 ByDegreeMinNoTies<BoolView>,ValOneZero<BoolView> > > r3;
00143 Reflection::ActorRegistrar<ViewValBranching<BoolView,NoValue,
00144 ByDegreeMinNoTies<BoolView>,ValZeroOne<BoolView> > > r4;
00145 Reflection::ActorRegistrar<ViewValBranching<BoolView,NoValue,
00146 ByNone<BoolView>,ValOneZero<BoolView> > > r5;
00147 Reflection::ActorRegistrar<ViewValBranching<BoolView,NoValue,
00148 ByNone<BoolView>,ValZeroOne<BoolView> > > r6;
00149
00150 Reflection::ActorRegistrar<ViewValAssignment<IntView,int,
00151 ValMax<IntView> > > r7;
00152 Reflection::ActorRegistrar<ViewValAssignment<IntView,int,
00153 ValMed<IntView> > > r8;
00154 Reflection::ActorRegistrar<ViewValAssignment<IntView,int,
00155 ValMin<IntView> > > r9;
00156 Reflection::ActorRegistrar<ViewValAssignment<BoolView,NoValue,
00157 ValOneZero<BoolView> > > r10;
00158 Reflection::ActorRegistrar<ViewValAssignment<BoolView,NoValue,
00159 ValZeroOne<BoolView> > > r11;
00160
00161 }}
00162
00163 }
00164
00165
00166
00167