ValSelCommitBase<SetView,int>* valselcommit(Space& home, const SetAssign& sa) { switch (sa.select()) { case SetAssign::SEL_MIN_INC: return new (home) ValSelCommit<ValSelMin,ValCommitInc>(home,sa); case SetAssign::SEL_MIN_EXC: return new (home) ValSelCommit<ValSelMin,ValCommitExc>(home,sa); case SetAssign::SEL_MED_INC: return new (home) ValSelCommit<ValSelMed,ValCommitInc>(home,sa); case SetAssign::SEL_MED_EXC: return new (home) ValSelCommit<ValSelMed,ValCommitExc>(home,sa); case SetAssign::SEL_MAX_INC: return new (home) ValSelCommit<ValSelMax,ValCommitInc>(home,sa); case SetAssign::SEL_MAX_EXC: return new (home) ValSelCommit<ValSelMax,ValCommitExc>(home,sa); case SetAssign::SEL_RND_INC: return new (home) ValSelCommit<ValSelRnd,ValCommitInc>(home,sa); case SetAssign::SEL_RND_EXC: return new (home) ValSelCommit<ValSelRnd,ValCommitExc>(home,sa); case SetAssign::SEL_VAL_COMMIT: if (sa.commit() == NULL) { return new (home) ValSelCommit<ValSelFunction<SetView>,ValCommitInc>(home,sa); } else { return new (home) ValSelCommit<ValSelFunction<SetView>,ValCommitFunction<SetView> >(home,sa); } default: throw UnknownBranching("Set::assign"); } }
ValSelCommitBase<BoolView,int>* valselcommitbool(Space& home, const IntAssign& ia) { switch (ia.select()) { case IntAssign::SEL_MIN: return new (home) ValSelCommit<ValSelMin<BoolView>,ValCommitEq<BoolView> >(home,ia); case IntAssign::SEL_MED: return new (home) ValSelCommit<ValSelMed<BoolView>,ValCommitEq<BoolView> >(home,ia); case IntAssign::SEL_MAX: return new (home) ValSelCommit<ValSelMax<BoolView>,ValCommitEq<BoolView> >(home,ia); case IntAssign::SEL_RND: return new (home) ValSelCommit<ValSelRnd<BoolView>,ValCommitEq<BoolView> >(home,ia); case IntAssign::SEL_VAL_COMMIT: if (ia.commit() == NULL) { return new (home) ValSelCommit<ValSelFunction<BoolView>,ValCommitEq<BoolView> >(home,ia); } else { return new (home) ValSelCommit<ValSelFunction<BoolView>,ValCommitFunction<BoolView> >(home,ia); } default: throw UnknownBranching("Bool::assign"); } }
ValSelCommitBase<IntView,int>* valselcommitint(Space& home, int n, const IntValBranch& ivb) { assert((ivb.select() != IntValBranch::SEL_VALUES_MIN) && (ivb.select() != IntValBranch::SEL_VALUES_MAX)); switch (ivb.select()) { case IntValBranch::SEL_MIN: return new (home) ValSelCommit<ValSelMin<IntView>,ValCommitEq<IntView> >(home,ivb); case IntValBranch::SEL_MED: return new (home) ValSelCommit<ValSelMed<IntView>,ValCommitEq<IntView> >(home,ivb); case IntValBranch::SEL_MAX: return new (home) ValSelCommit<ValSelMax<IntView>,ValCommitEq<IntView> >(home,ivb); case IntValBranch::SEL_RND: return new (home) ValSelCommit<ValSelRnd<IntView>,ValCommitEq<IntView> >(home,ivb); case IntValBranch::SEL_SPLIT_MIN: return new (home) ValSelCommit<ValSelAvg<IntView>,ValCommitLq<IntView> >(home,ivb); case IntValBranch::SEL_SPLIT_MAX: return new (home) ValSelCommit<ValSelAvg<IntView>,ValCommitGr<IntView> >(home,ivb); case IntValBranch::SEL_RANGE_MIN: return new (home) ValSelCommit<ValSelRangeMin,ValCommitLq<IntView> >(home,ivb); case IntValBranch::SEL_RANGE_MAX: return new (home) ValSelCommit<ValSelRangeMax,ValCommitGq<IntView> >(home,ivb); case IntValBranch::SEL_VAL_COMMIT: if (ivb.commit() == NULL) { return new (home) ValSelCommit<ValSelFunction<IntView>,ValCommitEq<IntView> >(home,ivb); } else { return new (home) ValSelCommit<ValSelFunction<IntView>,ValCommitFunction<IntView> >(home,ivb); } case IntValBranch::SEL_NEAR_MIN: case IntValBranch::SEL_NEAR_MAX: case IntValBranch::SEL_NEAR_INC: case IntValBranch::SEL_NEAR_DEC: { IntSharedArray v(ivb.values()); if (n != v.size()) throw ArgumentSizeMismatch("Int::branch"); for (int i=n; i--; ) Limits::check(v[i],"Int::branch"); switch (ivb.select()) { case IntValBranch::SEL_NEAR_MIN: return new (home) ValSelCommit<ValSelNearMinMax<IntView,true>, ValCommitEq<IntView> >(home,ivb); case IntValBranch::SEL_NEAR_MAX: return new (home) ValSelCommit<ValSelNearMinMax<IntView,false>, ValCommitEq<IntView> >(home,ivb); case IntValBranch::SEL_NEAR_INC: return new (home) ValSelCommit<ValSelNearIncDec<IntView,true>, ValCommitEq<IntView> >(home,ivb); case IntValBranch::SEL_NEAR_DEC: return new (home) ValSelCommit<ValSelNearIncDec<IntView,false>, ValCommitEq<IntView> >(home,ivb); default: GECODE_NEVER; } } default: throw UnknownBranching("Int::branch"); } }
ValSelCommitBase<BoolView,int>* valselcommitbool(Space& home, int n, const IntValBranch& ivb) { switch (ivb.select()) { case IntValBranch::SEL_MIN: case IntValBranch::SEL_MED: case IntValBranch::SEL_SPLIT_MIN: case IntValBranch::SEL_RANGE_MIN: case IntValBranch::SEL_VALUES_MIN: return new (home) ValSelCommit<ValSelMin<BoolView>,ValCommitEq<BoolView> >(home,ivb); case IntValBranch::SEL_MAX: case IntValBranch::SEL_SPLIT_MAX: case IntValBranch::SEL_RANGE_MAX: case IntValBranch::SEL_VALUES_MAX: return new (home) ValSelCommit<ValSelMax<BoolView>,ValCommitEq<BoolView> >(home,ivb); case IntValBranch::SEL_RND: return new (home) ValSelCommit<ValSelRnd<BoolView>,ValCommitEq<BoolView> >(home,ivb); case IntValBranch::SEL_VAL_COMMIT: if (ivb.commit() == NULL) { return new (home) ValSelCommit<ValSelFunction<BoolView>,ValCommitEq<BoolView> >(home,ivb); } else { return new (home) ValSelCommit<ValSelFunction<BoolView>,ValCommitFunction<BoolView> >(home,ivb); } case IntValBranch::SEL_NEAR_MIN: case IntValBranch::SEL_NEAR_MAX: case IntValBranch::SEL_NEAR_INC: case IntValBranch::SEL_NEAR_DEC: { IntSharedArray v(ivb.values()); if (n != v.size()) throw ArgumentSizeMismatch("Int::branch"); for (int i=n; i--; ) if ((v[i] < 0) || (v[i] > 1)) throw OutOfLimits("Int::branch"); switch (ivb.select()) { case IntValBranch::SEL_NEAR_MIN: return new (home) ValSelCommit<ValSelNearMinMax<BoolView,true>, ValCommitEq<BoolView> >(home,ivb); case IntValBranch::SEL_NEAR_MAX: return new (home) ValSelCommit<ValSelNearMinMax<BoolView,false>, ValCommitEq<BoolView> >(home,ivb); case IntValBranch::SEL_NEAR_INC: return new (home) ValSelCommit<ValSelNearIncDec<BoolView,true>, ValCommitEq<BoolView> >(home,ivb); case IntValBranch::SEL_NEAR_DEC: return new (home) ValSelCommit<ValSelNearIncDec<BoolView,false>, ValCommitEq<BoolView> >(home,ivb); default: GECODE_NEVER; } } default: throw UnknownBranching("Int::branch"); } }
void post(Space& home, ViewArray<IntView>& x, SelView& v, IntValBranch vals, const ValBranchOptions& o_vals, BranchFilter bf) { switch (vals) { case INT_VAL_MIN: { ValMin<IntView> a(home,o_vals); ViewValBrancher<SelView,ValMin<IntView> >::post(home,x,v,a,bf); } break; case INT_VAL_MED: { ValMed<IntView> a(home,o_vals); ViewValBrancher<SelView,ValMed<IntView> >::post(home,x,v,a,bf); } break; case INT_VAL_MAX: { ValMin<MinusView> a(home,o_vals); ViewValBrancher<SelView,ValMin<MinusView> >::post(home,x,v,a,bf); } break; case INT_VAL_RND: { ValRnd<IntView> a(home,o_vals); ViewValBrancher<SelView,ValRnd<IntView> >::post(home,x,v,a,bf); } break; case INT_VAL_SPLIT_MIN: { ValSplitMin<IntView> a(home,o_vals); ViewValBrancher<SelView,ValSplitMin<IntView> >::post(home,x,v,a,bf); } break; case INT_VAL_SPLIT_MAX: { ValSplitMin<MinusView> a(home,o_vals); ViewValBrancher<SelView,ValSplitMin<MinusView> >::post(home,x,v,a,bf); } break; case INT_VAL_RANGE_MIN: { ValRangeMin<IntView> a(home,o_vals); ViewValBrancher<SelView,ValRangeMin<IntView> >::post(home,x,v,a,bf); } break; case INT_VAL_RANGE_MAX: { ValRangeMin<MinusView> a(home,o_vals); ViewValBrancher<SelView,ValRangeMin<MinusView> >::post(home,x,v,a,bf); } break; case INT_VALUES_MIN: ViewValuesBrancher<SelView,IntView>::post(home,x,v,bf); break; case INT_VALUES_MAX: ViewValuesBrancher<SelView,MinusView>::post(home,x,v,bf); break; default: throw UnknownBranching("Int::branch"); } }
/// Create virtual view selector for tie-breaking void virtualize(Gecode::Home home, SetVarBranch vars, const Gecode::VarBranchOptions& o_vars, Gecode::ViewSelVirtualBase<SetView>*& v) { switch (vars) { case SET_VAR_RND: v = new (home) ViewSelVirtual<ViewSelRnd<SetView> >(home,o_vars); break; case SET_VAR_DEGREE_MIN: v = new (home) ViewSelVirtual<ViewSelDegreeMin<SetView> >(home,o_vars); break; case SET_VAR_DEGREE_MAX: v = new (home) ViewSelVirtual<ViewSelDegreeMax<SetView> >(home,o_vars); break; case SET_VAR_AFC_MIN: v = new (home) ViewSelVirtual<ViewSelAfcMin<SetView> >(home,o_vars); break; case SET_VAR_AFC_MAX: v = new (home) ViewSelVirtual<ViewSelAfcMax<SetView> >(home,o_vars); break; case SET_VAR_ACTIVITY_MIN: v = new (home) ViewSelVirtual<ViewSelActivityMin<SetView> >(home,o_vars); break; case SET_VAR_ACTIVITY_MAX: v = new (home) ViewSelVirtual<ViewSelActivityMax<SetView> >(home,o_vars); break; case SET_VAR_MIN_MIN: v = new (home) ViewSelVirtual<ByMinMin>(home,o_vars); break; case SET_VAR_MIN_MAX: v = new (home) ViewSelVirtual<ByMinMin>(home,o_vars); break; case SET_VAR_MAX_MIN: v = new (home) ViewSelVirtual<ByMaxMin>(home,o_vars); break; case SET_VAR_MAX_MAX: v = new (home) ViewSelVirtual<ByMaxMax>(home,o_vars); break; case SET_VAR_SIZE_MIN: v = new (home) ViewSelVirtual<BySizeMin>(home,o_vars); break; case SET_VAR_SIZE_MAX: v = new (home) ViewSelVirtual<BySizeMax>(home,o_vars); break; case SET_VAR_SIZE_DEGREE_MIN: v = new (home) ViewSelVirtual<BySizeDegreeMin>(home,o_vars); break; case SET_VAR_SIZE_DEGREE_MAX: v = new (home) ViewSelVirtual<BySizeDegreeMax>(home,o_vars); break; case SET_VAR_SIZE_AFC_MIN: v = new (home) ViewSelVirtual<BySizeAfcMin>(home,o_vars); break; case SET_VAR_SIZE_AFC_MAX: v = new (home) ViewSelVirtual<BySizeAfcMax>(home,o_vars); break; case SET_VAR_SIZE_ACTIVITY_MIN: v = new (home) ViewSelVirtual<BySizeActivityMin>(home,o_vars); break; case SET_VAR_SIZE_ACTIVITY_MAX: v = new (home) ViewSelVirtual<BySizeActivityMax>(home,o_vars); break; default: throw UnknownBranching("Set::branch"); } }
/// Create virtual view selector for tie-breaking void virtualize(Gecode::Home home, IntVarBranch vars, const Gecode::VarBranchOptions& o_vars, Gecode::ViewSelVirtualBase<BoolView>*& v) { switch (vars) { case INT_VAR_RND: v = new (home) ViewSelVirtual<ViewSelRnd<BoolView> >(home,o_vars); break; case INT_VAR_MIN_MIN: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; case INT_VAR_MIN_MAX: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; case INT_VAR_MAX_MIN: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; case INT_VAR_MAX_MAX: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; case INT_VAR_SIZE_MIN: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; case INT_VAR_SIZE_MAX: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; case INT_VAR_DEGREE_MIN: v = new (home) ViewSelVirtual<ViewSelDegreeMin<BoolView> >(home,o_vars); break; case INT_VAR_DEGREE_MAX: v = new (home) ViewSelVirtual<ViewSelDegreeMax<BoolView> >(home,o_vars); break; case INT_VAR_AFC_MIN: v = new (home) ViewSelVirtual<ViewSelAfcMin<BoolView> >(home,o_vars); break; case INT_VAR_AFC_MAX: v = new (home) ViewSelVirtual<ViewSelAfcMax<BoolView> >(home,o_vars); break; case INT_VAR_SIZE_DEGREE_MIN: v = new (home) ViewSelVirtual<ViewSelDegreeMax<BoolView> >(home,o_vars); break; case INT_VAR_SIZE_DEGREE_MAX: v = new (home) ViewSelVirtual<ViewSelDegreeMin<BoolView> >(home,o_vars); break; case INT_VAR_SIZE_AFC_MIN: v = new (home) ViewSelVirtual<ViewSelAfcMax<BoolView> >(home,o_vars); break; case INT_VAR_SIZE_AFC_MAX: v = new (home) ViewSelVirtual<ViewSelAfcMin<BoolView> >(home,o_vars); break; case INT_VAR_REGRET_MIN_MIN: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; case INT_VAR_REGRET_MIN_MAX: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; case INT_VAR_REGRET_MAX_MIN: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; case INT_VAR_REGRET_MAX_MAX: v = new (home) ViewSelVirtual<ViewSelNone<BoolView> >(home,o_vars); break; default: throw UnknownBranching("Int::branch"); } }
ViewSel<FloatView>* viewsel(Space& home, const FloatVarBranch& fvb) { switch (fvb.select()) { case FloatVarBranch::SEL_NONE: return new (home) ViewSelNone<FloatView>(home,fvb); case FloatVarBranch::SEL_RND: return new (home) ViewSelRnd<FloatView>(home,fvb); default: break; } if (fvb.tbl() != NULL) { switch (fvb.select()) { case FloatVarBranch::SEL_MERIT_MIN: return new (home) ViewSelMinTbl<MeritFunction<FloatView> >(home,fvb); case FloatVarBranch::SEL_MERIT_MAX: return new (home) ViewSelMaxTbl<MeritFunction<FloatView> >(home,fvb); case FloatVarBranch::SEL_MIN_MIN: return new (home) ViewSelMinTbl<MeritMin>(home,fvb); case FloatVarBranch::SEL_MIN_MAX: return new (home) ViewSelMaxTbl<MeritMin>(home,fvb); case FloatVarBranch::SEL_MAX_MIN: return new (home) ViewSelMinTbl<MeritMax>(home,fvb); case FloatVarBranch::SEL_MAX_MAX: return new (home) ViewSelMaxTbl<MeritMax>(home,fvb); case FloatVarBranch::SEL_SIZE_MIN: return new (home) ViewSelMinTbl<MeritSize>(home,fvb); case FloatVarBranch::SEL_SIZE_MAX: return new (home) ViewSelMaxTbl<MeritSize>(home,fvb); case FloatVarBranch::SEL_DEGREE_MIN: return new (home) ViewSelMinTbl<MeritDegree<FloatView> >(home,fvb); case FloatVarBranch::SEL_DEGREE_MAX: return new (home) ViewSelMaxTbl<MeritDegree<FloatView> >(home,fvb); case FloatVarBranch::SEL_AFC_MIN: return new (home) ViewSelMinTbl<MeritAFC<FloatView> >(home,fvb); case FloatVarBranch::SEL_AFC_MAX: return new (home) ViewSelMaxTbl<MeritAFC<FloatView> >(home,fvb); case FloatVarBranch::SEL_ACTIVITY_MIN: return new (home) ViewSelMinTbl<MeritActivity<FloatView> >(home,fvb); case FloatVarBranch::SEL_ACTIVITY_MAX: return new (home) ViewSelMaxTbl<MeritActivity<FloatView> >(home,fvb); case FloatVarBranch::SEL_DEGREE_SIZE_MIN: return new (home) ViewSelMinTbl<MeritDegreeSize>(home,fvb); case FloatVarBranch::SEL_DEGREE_SIZE_MAX: return new (home) ViewSelMaxTbl<MeritDegreeSize>(home,fvb); case FloatVarBranch::SEL_AFC_SIZE_MIN: return new (home) ViewSelMinTbl<MeritAFCSize>(home,fvb); case FloatVarBranch::SEL_AFC_SIZE_MAX: return new (home) ViewSelMaxTbl<MeritAFCSize>(home,fvb); case FloatVarBranch::SEL_ACTIVITY_SIZE_MIN: return new (home) ViewSelMinTbl<MeritActivitySize>(home,fvb); case FloatVarBranch::SEL_ACTIVITY_SIZE_MAX: return new (home) ViewSelMaxTbl<MeritActivitySize>(home,fvb); default: throw UnknownBranching("Float::branch"); } } else { switch (fvb.select()) { case FloatVarBranch::SEL_MERIT_MIN: return new (home) ViewSelMin<MeritFunction<FloatView> >(home,fvb); case FloatVarBranch::SEL_MERIT_MAX: return new (home) ViewSelMax<MeritFunction<FloatView> >(home,fvb); case FloatVarBranch::SEL_MIN_MIN: return new (home) ViewSelMin<MeritMin>(home,fvb); case FloatVarBranch::SEL_MIN_MAX: return new (home) ViewSelMax<MeritMin>(home,fvb); case FloatVarBranch::SEL_MAX_MIN: return new (home) ViewSelMin<MeritMax>(home,fvb); case FloatVarBranch::SEL_MAX_MAX: return new (home) ViewSelMax<MeritMax>(home,fvb); case FloatVarBranch::SEL_SIZE_MIN: return new (home) ViewSelMin<MeritSize>(home,fvb); case FloatVarBranch::SEL_SIZE_MAX: return new (home) ViewSelMax<MeritSize>(home,fvb); case FloatVarBranch::SEL_DEGREE_MIN: return new (home) ViewSelMin<MeritDegree<FloatView> >(home,fvb); case FloatVarBranch::SEL_DEGREE_MAX: return new (home) ViewSelMax<MeritDegree<FloatView> >(home,fvb); case FloatVarBranch::SEL_AFC_MIN: return new (home) ViewSelMin<MeritAFC<FloatView> >(home,fvb); case FloatVarBranch::SEL_AFC_MAX: return new (home) ViewSelMax<MeritAFC<FloatView> >(home,fvb); case FloatVarBranch::SEL_ACTIVITY_MIN: return new (home) ViewSelMin<MeritActivity<FloatView> >(home,fvb); case FloatVarBranch::SEL_ACTIVITY_MAX: return new (home) ViewSelMax<MeritActivity<FloatView> >(home,fvb); case FloatVarBranch::SEL_DEGREE_SIZE_MIN: return new (home) ViewSelMin<MeritDegreeSize>(home,fvb); case FloatVarBranch::SEL_DEGREE_SIZE_MAX: return new (home) ViewSelMax<MeritDegreeSize>(home,fvb); case FloatVarBranch::SEL_AFC_SIZE_MIN: return new (home) ViewSelMin<MeritAFCSize>(home,fvb); case FloatVarBranch::SEL_AFC_SIZE_MAX: return new (home) ViewSelMax<MeritAFCSize>(home,fvb); case FloatVarBranch::SEL_ACTIVITY_SIZE_MIN: return new (home) ViewSelMin<MeritActivitySize>(home,fvb); case FloatVarBranch::SEL_ACTIVITY_SIZE_MAX: return new (home) ViewSelMax<MeritActivitySize>(home,fvb); default: throw UnknownBranching("Float::branch"); } } GECODE_NEVER; return NULL; }