C++ Reference
C++ Reference: Routing
Detailed Description
Solver Class.
A solver represents the main computation engine. It implements the entire range of Constraint Programming protocols:
- Reversibility
- Propagation
- Search
Usually, Constraint Programming code consists of
- the creation of the Solver,
- the creation of the decision variables of the model,
- the creation of the constraints of the model and their addition to the solver() through the AddConstraint() method,
- the creation of the main DecisionBuilder class,
- the launch of the solve() method with the decision builder.
For the time being, Solver is neither MT_SAFE nor MT_HOT.
Definition at line 253 of file constraint_solver.h.
Classes | |
struct | IntegerCastInfo |
Holds semantic information stating that the 'expression' has been cast into 'variable' using the Var() method, and that 'maintainer' is responsible for maintaining the equality between 'variable' and 'expression'. More... | |
struct | SearchLogParameters |
Creates a search monitor from logging parameters. More... | |
Public Types | |
enum | IntVarStrategy { INT_VAR_DEFAULT , INT_VAR_SIMPLE , CHOOSE_FIRST_UNBOUND , CHOOSE_RANDOM , CHOOSE_MIN_SIZE_LOWEST_MIN , CHOOSE_MIN_SIZE_HIGHEST_MIN , CHOOSE_MIN_SIZE_LOWEST_MAX , CHOOSE_MIN_SIZE_HIGHEST_MAX , CHOOSE_LOWEST_MIN , CHOOSE_HIGHEST_MAX , CHOOSE_MIN_SIZE , CHOOSE_MAX_SIZE , CHOOSE_MAX_REGRET_ON_MIN , CHOOSE_PATH } |
This enum describes the strategy used to select the next branching variable at each node during the search. More... | |
enum | IntValueStrategy { INT_VALUE_DEFAULT , INT_VALUE_SIMPLE , ASSIGN_MIN_VALUE , ASSIGN_MAX_VALUE , ASSIGN_RANDOM_VALUE , ASSIGN_CENTER_VALUE , SPLIT_LOWER_HALF , SPLIT_UPPER_HALF } |
This enum describes the strategy used to select the next variable value to set. More... | |
enum | EvaluatorStrategy { CHOOSE_STATIC_GLOBAL_BEST , CHOOSE_DYNAMIC_GLOBAL_BEST } |
This enum is used by Solver::MakePhase to specify how to select variables and values during the search. More... | |
enum | SequenceStrategy { SEQUENCE_DEFAULT , SEQUENCE_SIMPLE , CHOOSE_MIN_SLACK_RANK_FORWARD , CHOOSE_RANDOM_RANK_FORWARD } |
Used for scheduling. Not yet implemented. More... | |
enum | IntervalStrategy { INTERVAL_DEFAULT , INTERVAL_SIMPLE , INTERVAL_SET_TIMES_FORWARD , INTERVAL_SET_TIMES_BACKWARD } |
This enum describes the straregy used to select the next interval variable and its value to be fixed. More... | |
enum | LocalSearchOperators { TWOOPT , OROPT , RELOCATE , EXCHANGE , CROSS , MAKEACTIVE , MAKEINACTIVE , MAKECHAININACTIVE , SWAPACTIVE , EXTENDEDSWAPACTIVE , PATHLNS , FULLPATHLNS , UNACTIVELNS , INCREMENT , DECREMENT , SIMPLELNS } |
This enum is used in Solver::MakeOperator to specify the neighborhood to create. More... | |
enum | EvaluatorLocalSearchOperators { LK , TSPOPT , TSPLNS } |
This enum is used in Solver::MakeOperator associated with an evaluator to specify the neighborhood to create. More... | |
enum | LocalSearchFilterBound { GE , LE , EQ } |
This enum is used in Solver::MakeLocalSearchObjectiveFilter. More... | |
enum | DemonPriority { DELAYED_PRIORITY = 0 , VAR_PRIORITY = 1 , NORMAL_PRIORITY = 2 } |
This enum represents the three possible priorities for a demon in the Solver queue. More... | |
enum | BinaryIntervalRelation { ENDS_AFTER_END , ENDS_AFTER_START , ENDS_AT_END , ENDS_AT_START , STARTS_AFTER_END , STARTS_AFTER_START , STARTS_AT_END , STARTS_AT_START , STAYS_IN_SYNC } |
This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between the two intervals t1 and t2. More... | |
enum | UnaryIntervalRelation { ENDS_AFTER , ENDS_AT , ENDS_BEFORE , STARTS_AFTER , STARTS_AT , STARTS_BEFORE , CROSS_DATE , AVOID_DATE } |
This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between an interval t and an integer d. More... | |
enum | DecisionModification { NO_CHANGE , KEEP_LEFT , KEEP_RIGHT , KILL_BOTH , SWITCH_BRANCHES } |
The Solver is responsible for creating the search tree. More... | |
enum | MarkerType { SENTINEL , SIMPLE_MARKER , CHOICE_POINT , REVERSIBLE_ACTION } |
This enum is used internally in private methods Solver::PushState and Solver::PopState to tag states in the search tree. More... | |
enum | SolverState { OUTSIDE_SEARCH , IN_ROOT_NODE , IN_SEARCH , AT_SOLUTION , NO_MORE_SOLUTIONS , PROBLEM_INFEASIBLE } |
This enum represents the state of the solver w.r.t. the search. More... | |
enum | OptimizationDirection { NOT_SET , MAXIMIZATION , MINIMIZATION } |
Optimization directions. More... | |
typedef std::function< int64(int64)> | IndexEvaluator1 |
Callback typedefs. More... | |
typedef std::function< int64(int64, int64)> | IndexEvaluator2 |
typedef std::function< int64(int64, int64, int64)> | IndexEvaluator3 |
typedef std::function< bool(int64)> | IndexFilter1 |
typedef std::function< IntVar *(int64)> | Int64ToIntVar |
typedef std::function< int64(Solver *solver, const std::vector< IntVar * > &vars, int64 first_unbound, int64 last_unbound)> | VariableIndexSelector |
typedef std::function< int64(const IntVar *v, int64 id)> | VariableValueSelector |
typedef std::function< bool(int64, int64, int64)> | VariableValueComparator |
typedef std::function< DecisionModification()> | BranchSelector |
typedef std::function< void(Solver *)> | Action |
typedef std::function< void()> | Closure |
Public Member Functions | |
Solver (const std::string &name) | |
Solver API. More... | |
Solver (const std::string &name, const ConstraintSolverParameters ¶meters) | |
~Solver () | |
ConstraintSolverParameters | parameters () const |
Stored Parameters. More... | |
template<class T > | |
void | SaveValue (T *o) |
reversibility More... | |
template<typename T > | |
T * | RevAlloc (T *object) |
Registers the given object as being reversible. More... | |
template<typename T > | |
T * | RevAllocArray (T *object) |
Like RevAlloc() above, but for an array of objects: the array must have been allocated with the new[] operator. More... | |
void | AddConstraint (Constraint *const c) |
Adds the constraint 'c' to the model. More... | |
void | AddCastConstraint (CastConstraint *const constraint, IntVar *const target_var, IntExpr *const expr) |
Adds 'constraint' to the solver and marks it as a cast constraint, that is, a constraint created calling Var() on an expression. More... | |
bool | SolveAndCommit (DecisionBuilder *const db, const std::vector< SearchMonitor * > &monitors) |
SolveAndCommit using a decision builder and up to three search monitors, usually one for the objective, one for the limits and one to collect solutions. More... | |
bool | SolveAndCommit (DecisionBuilder *const db) |
bool | SolveAndCommit (DecisionBuilder *const db, SearchMonitor *const m1) |
bool | SolveAndCommit (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2) |
bool | SolveAndCommit (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3) |
bool | CheckAssignment (Assignment *const solution) |
Checks whether the given assignment satisfies all relevant constraints. More... | |
bool | CheckConstraint (Constraint *const ct) |
Checks whether adding this constraint will lead to an immediate failure. More... | |
SolverState | state () const |
State of the solver. More... | |
void | Fail () |
Abandon the current branch in the search tree. A backtrack will follow. More... | |
void | AddBacktrackAction (Action a, bool fast) |
When SaveValue() is not the best way to go, one can create a reversible action that will be called upon backtrack. More... | |
std::string | DebugString () const |
!defined(SWIG) More... | |
absl::Time | Now () const |
The 'absolute time' as seen by the solver. More... | |
int64 | wall_time () const |
DEPRECATED: Use Now() instead. More... | |
int64 | branches () const |
The number of branches explored since the creation of the solver. More... | |
int64 | solutions () const |
The number of solutions found since the start of the search. More... | |
int64 | unchecked_solutions () const |
The number of unchecked solutions found by local search. More... | |
int64 | demon_runs (DemonPriority p) const |
The number of demons executed during search for a given priority. More... | |
int64 | failures () const |
The number of failures encountered since the creation of the solver. More... | |
int64 | neighbors () const |
The number of neighbors created. More... | |
int64 | filtered_neighbors () const |
The number of filtered neighbors (neighbors accepted by filters). More... | |
int64 | accepted_neighbors () const |
The number of accepted neighbors. More... | |
uint64 | stamp () const |
The stamp indicates how many moves in the search tree we have performed. More... | |
uint64 | fail_stamp () const |
The fail_stamp() is incremented after each backtrack. More... | |
OptimizationDirection | optimization_direction () const |
The direction of optimization, getter and setter. More... | |
void | set_optimization_direction (OptimizationDirection direction) |
IntVar * | MakeIntVar (int64 min, int64 max, const std::string &name) |
MakeIntVar will create the best range based int var for the bounds given. More... | |
IntVar * | MakeIntVar (const std::vector< int64 > &values, const std::string &name) |
MakeIntVar will create a variable with the given sparse domain. More... | |
IntVar * | MakeIntVar (const std::vector< int > &values, const std::string &name) |
MakeIntVar will create a variable with the given sparse domain. More... | |
IntVar * | MakeIntVar (int64 min, int64 max) |
MakeIntVar will create the best range based int var for the bounds given. More... | |
IntVar * | MakeIntVar (const std::vector< int64 > &values) |
MakeIntVar will create a variable with the given sparse domain. More... | |
IntVar * | MakeIntVar (const std::vector< int > &values) |
MakeIntVar will create a variable with the given sparse domain. More... | |
IntVar * | MakeBoolVar (const std::string &name) |
MakeBoolVar will create a variable with a {0, 1} domain. More... | |
IntVar * | MakeBoolVar () |
MakeBoolVar will create a variable with a {0, 1} domain. More... | |
IntVar * | MakeIntConst (int64 val, const std::string &name) |
IntConst will create a constant expression. More... | |
IntVar * | MakeIntConst (int64 val) |
IntConst will create a constant expression. More... | |
void | MakeIntVarArray (int var_count, int64 vmin, int64 vmax, const std::string &name, std::vector< IntVar * > *vars) |
This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having name "name<i>" where is the index of the variable. More... | |
void | MakeIntVarArray (int var_count, int64 vmin, int64 vmax, std::vector< IntVar * > *vars) |
This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having no names. More... | |
IntVar ** | MakeIntVarArray (int var_count, int64 vmin, int64 vmax, const std::string &name) |
Same but allocates an array and returns it. More... | |
void | MakeBoolVarArray (int var_count, const std::string &name, std::vector< IntVar * > *vars) |
This method will append the vector vars with 'var_count' boolean variables having name "name<i>" where is the index of the variable. More... | |
void | MakeBoolVarArray (int var_count, std::vector< IntVar * > *vars) |
This method will append the vector vars with 'var_count' boolean variables having no names. More... | |
IntVar ** | MakeBoolVarArray (int var_count, const std::string &name) |
Same but allocates an array and returns it. More... | |
IntExpr * | MakeSum (IntExpr *const left, IntExpr *const right) |
left + right. More... | |
IntExpr * | MakeSum (IntExpr *const expr, int64 value) |
expr + value. More... | |
IntExpr * | MakeSum (const std::vector< IntVar * > &vars) |
sum of all vars. More... | |
IntExpr * | MakeScalProd (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefs) |
scalar product More... | |
IntExpr * | MakeScalProd (const std::vector< IntVar * > &vars, const std::vector< int > &coefs) |
scalar product More... | |
IntExpr * | MakeDifference (IntExpr *const left, IntExpr *const right) |
left - right More... | |
IntExpr * | MakeDifference (int64 value, IntExpr *const expr) |
value - expr More... | |
IntExpr * | MakeOpposite (IntExpr *const expr) |
-expr More... | |
IntExpr * | MakeProd (IntExpr *const left, IntExpr *const right) |
left * right More... | |
IntExpr * | MakeProd (IntExpr *const expr, int64 value) |
expr * value More... | |
IntExpr * | MakeDiv (IntExpr *const expr, int64 value) |
expr / value (integer division) More... | |
IntExpr * | MakeDiv (IntExpr *const numerator, IntExpr *const denominator) |
numerator / denominator (integer division). Terms need to be positive. More... | |
IntExpr * | MakeAbs (IntExpr *const expr) |
|expr| More... | |
IntExpr * | MakeSquare (IntExpr *const expr) |
expr * expr More... | |
IntExpr * | MakePower (IntExpr *const expr, int64 n) |
expr ^ n (n > 0) More... | |
IntExpr * | MakeElement (const std::vector< int64 > &values, IntVar *const index) |
values[index] More... | |
IntExpr * | MakeElement (const std::vector< int > &values, IntVar *const index) |
values[index] More... | |
IntExpr * | MakeElement (IndexEvaluator1 values, IntVar *const index) |
Function-based element. More... | |
IntExpr * | MakeMonotonicElement (IndexEvaluator1 values, bool increasing, IntVar *const index) |
Function based element. More... | |
IntExpr * | MakeElement (IndexEvaluator2 values, IntVar *const index1, IntVar *const index2) |
2D version of function-based element expression, values(expr1, expr2). More... | |
IntExpr * | MakeElement (const std::vector< IntVar * > &vars, IntVar *const index) |
vars[expr] More... | |
IntExpr * | MakeElement (Int64ToIntVar vars, int64 range_start, int64 range_end, IntVar *argument) |
vars(argument) More... | |
IntExpr * | MakeIndexExpression (const std::vector< IntVar * > &vars, int64 value) |
Returns the expression expr such that vars[expr] == value. More... | |
Constraint * | MakeIfThenElseCt (IntVar *const condition, IntExpr *const then_expr, IntExpr *const else_expr, IntVar *const target_var) |
Special cases with arrays of size two. More... | |
IntExpr * | MakeMin (const std::vector< IntVar * > &vars) |
std::min(vars) More... | |
IntExpr * | MakeMin (IntExpr *const left, IntExpr *const right) |
std::min (left, right) More... | |
IntExpr * | MakeMin (IntExpr *const expr, int64 value) |
std::min(expr, value) More... | |
IntExpr * | MakeMin (IntExpr *const expr, int value) |
std::min(expr, value) More... | |
IntExpr * | MakeMax (const std::vector< IntVar * > &vars) |
std::max(vars) More... | |
IntExpr * | MakeMax (IntExpr *const left, IntExpr *const right) |
std::max(left, right) More... | |
IntExpr * | MakeMax (IntExpr *const expr, int64 value) |
std::max(expr, value) More... | |
IntExpr * | MakeMax (IntExpr *const expr, int value) |
std::max(expr, value) More... | |
IntExpr * | MakeConvexPiecewiseExpr (IntExpr *expr, int64 early_cost, int64 early_date, int64 late_date, int64 late_cost) |
Convex piecewise function. More... | |
IntExpr * | MakeSemiContinuousExpr (IntExpr *const expr, int64 fixed_charge, int64 step) |
Semi continuous Expression (x <= 0 -> f(x) = 0; x > 0 -> f(x) = ax + b) a >= 0 and b >= 0. More... | |
IntExpr * | MakePiecewiseLinearExpr (IntExpr *expr, const PiecewiseLinearFunction &f) |
General piecewise-linear function expression, built from f(x) where f is piecewise-linear. More... | |
IntExpr * | MakeModulo (IntExpr *const x, int64 mod) |
Modulo expression x % mod (with the python convention for modulo). More... | |
IntExpr * | MakeModulo (IntExpr *const x, IntExpr *const mod) |
Modulo expression x % mod (with the python convention for modulo). More... | |
IntExpr * | MakeConditionalExpression (IntVar *const condition, IntExpr *const expr, int64 unperformed_value) |
Conditional Expr condition ? expr : unperformed_value. More... | |
Constraint * | MakeTrueConstraint () |
This constraint always succeeds. More... | |
Constraint * | MakeFalseConstraint () |
This constraint always fails. More... | |
Constraint * | MakeFalseConstraint (const std::string &explanation) |
Constraint * | MakeIsEqualCstCt (IntExpr *const var, int64 value, IntVar *const boolvar) |
boolvar == (var == value) More... | |
IntVar * | MakeIsEqualCstVar (IntExpr *const var, int64 value) |
status var of (var == value) More... | |
Constraint * | MakeIsEqualCt (IntExpr *const v1, IntExpr *v2, IntVar *const b) |
b == (v1 == v2) More... | |
IntVar * | MakeIsEqualVar (IntExpr *const v1, IntExpr *v2) |
status var of (v1 == v2) More... | |
Constraint * | MakeEquality (IntExpr *const left, IntExpr *const right) |
left == right More... | |
Constraint * | MakeEquality (IntExpr *const expr, int64 value) |
expr == value More... | |
Constraint * | MakeEquality (IntExpr *const expr, int value) |
expr == value More... | |
Constraint * | MakeIsDifferentCstCt (IntExpr *const var, int64 value, IntVar *const boolvar) |
boolvar == (var != value) More... | |
IntVar * | MakeIsDifferentCstVar (IntExpr *const var, int64 value) |
status var of (var != value) More... | |
IntVar * | MakeIsDifferentVar (IntExpr *const v1, IntExpr *const v2) |
status var of (v1 != v2) More... | |
Constraint * | MakeIsDifferentCt (IntExpr *const v1, IntExpr *const v2, IntVar *const b) |
b == (v1 != v2) More... | |
Constraint * | MakeNonEquality (IntExpr *const left, IntExpr *const right) |
left != right More... | |
Constraint * | MakeNonEquality (IntExpr *const expr, int64 value) |
expr != value More... | |
Constraint * | MakeNonEquality (IntExpr *const expr, int value) |
expr != value More... | |
Constraint * | MakeIsLessOrEqualCstCt (IntExpr *const var, int64 value, IntVar *const boolvar) |
boolvar == (var <= value) More... | |
IntVar * | MakeIsLessOrEqualCstVar (IntExpr *const var, int64 value) |
status var of (var <= value) More... | |
IntVar * | MakeIsLessOrEqualVar (IntExpr *const left, IntExpr *const right) |
status var of (left <= right) More... | |
Constraint * | MakeIsLessOrEqualCt (IntExpr *const left, IntExpr *const right, IntVar *const b) |
b == (left <= right) More... | |
Constraint * | MakeLessOrEqual (IntExpr *const left, IntExpr *const right) |
left <= right More... | |
Constraint * | MakeLessOrEqual (IntExpr *const expr, int64 value) |
expr <= value More... | |
Constraint * | MakeLessOrEqual (IntExpr *const expr, int value) |
expr <= value More... | |
Constraint * | MakeIsGreaterOrEqualCstCt (IntExpr *const var, int64 value, IntVar *const boolvar) |
boolvar == (var >= value) More... | |
IntVar * | MakeIsGreaterOrEqualCstVar (IntExpr *const var, int64 value) |
status var of (var >= value) More... | |
IntVar * | MakeIsGreaterOrEqualVar (IntExpr *const left, IntExpr *const right) |
status var of (left >= right) More... | |
Constraint * | MakeIsGreaterOrEqualCt (IntExpr *const left, IntExpr *const right, IntVar *const b) |
b == (left >= right) More... | |
Constraint * | MakeGreaterOrEqual (IntExpr *const left, IntExpr *const right) |
left >= right More... | |
Constraint * | MakeGreaterOrEqual (IntExpr *const expr, int64 value) |
expr >= value More... | |
Constraint * | MakeGreaterOrEqual (IntExpr *const expr, int value) |
expr >= value More... | |
Constraint * | MakeIsGreaterCstCt (IntExpr *const v, int64 c, IntVar *const b) |
b == (v > c) More... | |
IntVar * | MakeIsGreaterCstVar (IntExpr *const var, int64 value) |
status var of (var > value) More... | |
IntVar * | MakeIsGreaterVar (IntExpr *const left, IntExpr *const right) |
status var of (left > right) More... | |
Constraint * | MakeIsGreaterCt (IntExpr *const left, IntExpr *const right, IntVar *const b) |
b == (left > right) More... | |
Constraint * | MakeGreater (IntExpr *const left, IntExpr *const right) |
left > right More... | |
Constraint * | MakeGreater (IntExpr *const expr, int64 value) |
expr > value More... | |
Constraint * | MakeGreater (IntExpr *const expr, int value) |
expr > value More... | |
Constraint * | MakeIsLessCstCt (IntExpr *const v, int64 c, IntVar *const b) |
b == (v < c) More... | |
IntVar * | MakeIsLessCstVar (IntExpr *const var, int64 value) |
status var of (var < value) More... | |
IntVar * | MakeIsLessVar (IntExpr *const left, IntExpr *const right) |
status var of (left < right) More... | |
Constraint * | MakeIsLessCt (IntExpr *const left, IntExpr *const right, IntVar *const b) |
b == (left < right) More... | |
Constraint * | MakeLess (IntExpr *const left, IntExpr *const right) |
left < right More... | |
Constraint * | MakeLess (IntExpr *const expr, int64 value) |
expr < value More... | |
Constraint * | MakeLess (IntExpr *const expr, int value) |
expr < value More... | |
Constraint * | MakeSumLessOrEqual (const std::vector< IntVar * > &vars, int64 cst) |
Variation on arrays. More... | |
Constraint * | MakeSumGreaterOrEqual (const std::vector< IntVar * > &vars, int64 cst) |
Constraint * | MakeSumEquality (const std::vector< IntVar * > &vars, int64 cst) |
Constraint * | MakeSumEquality (const std::vector< IntVar * > &vars, IntVar *const var) |
Constraint * | MakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefficients, int64 cst) |
Constraint * | MakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64 cst) |
Constraint * | MakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefficients, IntVar *const target) |
Constraint * | MakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, IntVar *const target) |
Constraint * | MakeScalProdGreaterOrEqual (const std::vector< IntVar * > &vars, const std::vector< int64 > &coeffs, int64 cst) |
Constraint * | MakeScalProdGreaterOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coeffs, int64 cst) |
Constraint * | MakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefficients, int64 cst) |
Constraint * | MakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64 cst) |
Constraint * | MakeMinEquality (const std::vector< IntVar * > &vars, IntVar *const min_var) |
Constraint * | MakeMaxEquality (const std::vector< IntVar * > &vars, IntVar *const max_var) |
Constraint * | MakeElementEquality (const std::vector< int64 > &vals, IntVar *const index, IntVar *const target) |
Constraint * | MakeElementEquality (const std::vector< int > &vals, IntVar *const index, IntVar *const target) |
Constraint * | MakeElementEquality (const std::vector< IntVar * > &vars, IntVar *const index, IntVar *const target) |
Constraint * | MakeElementEquality (const std::vector< IntVar * > &vars, IntVar *const index, int64 target) |
Constraint * | MakeAbsEquality (IntVar *const var, IntVar *const abs_var) |
Creates the constraint abs(var) == abs_var. More... | |
Constraint * | MakeIndexOfConstraint (const std::vector< IntVar * > &vars, IntVar *const index, int64 target) |
This constraint is a special case of the element constraint with an array of integer variables, where the variables are all different and the index variable is constrained such that vars[index] == target. More... | |
Demon * | MakeConstraintInitialPropagateCallback (Constraint *const ct) |
This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct'. More... | |
Demon * | MakeDelayedConstraintInitialPropagateCallback (Constraint *const ct) |
This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct' with low priority. More... | |
Demon * | MakeActionDemon (Action action) |
Creates a demon from a callback. More... | |
Demon * | MakeClosureDemon (Closure closure) |
!defined(SWIG) More... | |
Constraint * | MakeBetweenCt (IntExpr *const expr, int64 l, int64 u) |
(l <= expr <= u) More... | |
Constraint * | MakeNotBetweenCt (IntExpr *const expr, int64 l, int64 u) |
(expr < l || expr > u) This constraint is lazy as it will not make holes in the domain of variables. More... | |
Constraint * | MakeIsBetweenCt (IntExpr *const expr, int64 l, int64 u, IntVar *const b) |
b == (l <= expr <= u) More... | |
IntVar * | MakeIsBetweenVar (IntExpr *const v, int64 l, int64 u) |
Constraint * | MakeMemberCt (IntExpr *const expr, const std::vector< int64 > &values) |
expr in set. More... | |
Constraint * | MakeMemberCt (IntExpr *const expr, const std::vector< int > &values) |
Constraint * | MakeNotMemberCt (IntExpr *const expr, const std::vector< int64 > &values) |
expr not in set. More... | |
Constraint * | MakeNotMemberCt (IntExpr *const expr, const std::vector< int > &values) |
Constraint * | MakeNotMemberCt (IntExpr *const expr, std::vector< int64 > starts, std::vector< int64 > ends) |
expr should not be in the list of forbidden intervals [start[i]..end[i]]. More... | |
Constraint * | MakeNotMemberCt (IntExpr *const expr, std::vector< int > starts, std::vector< int > ends) |
expr should not be in the list of forbidden intervals [start[i]..end[i]]. More... | |
Constraint * | MakeNotMemberCt (IntExpr *expr, SortedDisjointIntervalList intervals) |
expr should not be in the list of forbidden intervals. More... | |
Constraint * | MakeIsMemberCt (IntExpr *const expr, const std::vector< int64 > &values, IntVar *const boolvar) |
boolvar == (expr in set) More... | |
Constraint * | MakeIsMemberCt (IntExpr *const expr, const std::vector< int > &values, IntVar *const boolvar) |
IntVar * | MakeIsMemberVar (IntExpr *const expr, const std::vector< int64 > &values) |
IntVar * | MakeIsMemberVar (IntExpr *const expr, const std::vector< int > &values) |
Constraint * | MakeAtMost (std::vector< IntVar * > vars, int64 value, int64 max_count) |
|{i | vars[i] == value}| <= max_count More... | |
Constraint * | MakeCount (const std::vector< IntVar * > &vars, int64 value, int64 max_count) |
|{i | vars[i] == value}| == max_count More... | |
Constraint * | MakeCount (const std::vector< IntVar * > &vars, int64 value, IntVar *const max_count) |
|{i | vars[i] == value}| == max_count More... | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int64 > &values, const std::vector< IntVar * > &cards) |
Aggregated version of count: |{i | v[i] == values[j]}| == cards[j]. More... | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int > &values, const std::vector< IntVar * > &cards) |
Aggregated version of count: |{i | v[i] == values[j]}| == cards[j]. More... | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &cards) |
Aggregated version of count: |{i | v[i] == j}| == cards[j]. More... | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, int64 card_min, int64 card_max, int64 card_size) |
Aggregated version of count with bounded cardinalities: forall j in 0 . More... | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int64 > &card_min, const std::vector< int64 > &card_max) |
Aggregated version of count with bounded cardinalities: forall j in 0 . More... | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int > &card_min, const std::vector< int > &card_max) |
Aggregated version of count with bounded cardinalities: forall j in 0 . More... | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int64 > &values, const std::vector< int64 > &card_min, const std::vector< int64 > &card_max) |
Aggregated version of count with bounded cardinalities: forall j in 0 . More... | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int > &values, const std::vector< int > &card_min, const std::vector< int > &card_max) |
Aggregated version of count with bounded cardinalities: forall j in 0 . More... | |
Constraint * | MakeDeviation (const std::vector< IntVar * > &vars, IntVar *const deviation_var, int64 total_sum) |
Deviation constraint: sum_i |n * vars[i] - total_sum| <= deviation_var and sum_i vars[i] == total_sum n = #vars. More... | |
Constraint * | MakeAllDifferent (const std::vector< IntVar * > &vars) |
All variables are pairwise different. More... | |
Constraint * | MakeAllDifferent (const std::vector< IntVar * > &vars, bool stronger_propagation) |
All variables are pairwise different. More... | |
Constraint * | MakeAllDifferentExcept (const std::vector< IntVar * > &vars, int64 escape_value) |
All variables are pairwise different, unless they are assigned to the escape value. More... | |
Constraint * | MakeSortingConstraint (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &sorted) |
Creates a constraint binding the arrays of variables "vars" and "sorted_vars": sorted_vars[0] must be equal to the minimum of all variables in vars, and so on: the value of sorted_vars[i] must be equal to the i-th value of variables invars. More... | |
Constraint * | MakeLexicalLess (const std::vector< IntVar * > &left, const std::vector< IntVar * > &right) |
Creates a constraint that enforces that left is lexicographically less than right. More... | |
Constraint * | MakeLexicalLessOrEqual (const std::vector< IntVar * > &left, const std::vector< IntVar * > &right) |
Creates a constraint that enforces that left is lexicographically less than or equal to right. More... | |
Constraint * | MakeInversePermutationConstraint (const std::vector< IntVar * > &left, const std::vector< IntVar * > &right) |
Creates a constraint that enforces that 'left' and 'right' both represent permutations of [0..left.size()-1], and that 'right' is the inverse permutation of 'left', i.e. More... | |
Constraint * | MakeIndexOfFirstMaxValueConstraint (IntVar *index, const std::vector< IntVar * > &vars) |
Creates a constraint that binds the index variable to the index of the first variable with the maximum value. More... | |
Constraint * | MakeIndexOfFirstMinValueConstraint (IntVar *index, const std::vector< IntVar * > &vars) |
Creates a constraint that binds the index variable to the index of the first variable with the minimum value. More... | |
Constraint * | MakeNullIntersect (const std::vector< IntVar * > &first_vars, const std::vector< IntVar * > &second_vars) |
Creates a constraint that states that all variables in the first vector are different from all variables in the second group. More... | |
Constraint * | MakeNullIntersectExcept (const std::vector< IntVar * > &first_vars, const std::vector< IntVar * > &second_vars, int64 escape_value) |
Creates a constraint that states that all variables in the first vector are different from all variables from the second group, unless they are assigned to the escape value. More... | |
Constraint * | MakeNoCycle (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, IndexFilter1 sink_handler=nullptr) |
Prevent cycles. More... | |
Constraint * | MakeNoCycle (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, IndexFilter1 sink_handler, bool assume_paths) |
Constraint * | MakeCircuit (const std::vector< IntVar * > &nexts) |
Force the "nexts" variable to create a complete Hamiltonian path. More... | |
Constraint * | MakeSubCircuit (const std::vector< IntVar * > &nexts) |
Force the "nexts" variable to create a complete Hamiltonian path for those that do not loop upon themselves. More... | |
Constraint * | MakePathCumul (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, const std::vector< IntVar * > &cumuls, const std::vector< IntVar * > &transits) |
Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transits[i]. More... | |
Constraint * | MakeDelayedPathCumul (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, const std::vector< IntVar * > &cumuls, const std::vector< IntVar * > &transits) |
Delayed version of the same constraint: propagation on the nexts variables is delayed until all constraints have propagated. More... | |
Constraint * | MakePathCumul (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, const std::vector< IntVar * > &cumuls, IndexEvaluator2 transit_evaluator) |
Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transit_evaluator(i, next[i]). More... | |
Constraint * | MakePathCumul (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, const std::vector< IntVar * > &cumuls, const std::vector< IntVar * > &slacks, IndexEvaluator2 transit_evaluator) |
Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transit_evaluator(i, next[i]) + slacks[i]. More... | |
Constraint * | MakePathConnected (std::vector< IntVar * > nexts, std::vector< int64 > sources, std::vector< int64 > sinks, std::vector< IntVar * > status) |
Constraint enforcing that status[i] is true iff there's a path defined on next variables from sources[i] to sinks[i]. More... | |
Constraint * | MakePathPrecedenceConstraint (std::vector< IntVar * > nexts, const std::vector< std::pair< int, int > > &precedences) |
Contraint enforcing, for each pair (i,j) in precedences, i to be before j in paths defined by next variables. More... | |
Constraint * | MakePathPrecedenceConstraint (std::vector< IntVar * > nexts, const std::vector< std::pair< int, int > > &precedences, const std::vector< int > &lifo_path_starts, const std::vector< int > &fifo_path_starts) |
Same as MakePathPrecedenceConstraint but ensures precedence pairs on some paths follow a LIFO or FIFO order. More... | |
Constraint * | MakePathTransitPrecedenceConstraint (std::vector< IntVar * > nexts, std::vector< IntVar * > transits, const std::vector< std::pair< int, int > > &precedences) |
Same as MakePathPrecedenceConstraint but will force i to be before j if the sum of transits on the path from i to j is strictly positive. More... | |
Constraint * | MakeMapDomain (IntVar *const var, const std::vector< IntVar * > &actives) |
This constraint maps the domain of 'var' onto the array of variables 'actives'. More... | |
Constraint * | MakeAllowedAssignments (const std::vector< IntVar * > &vars, const IntTupleSet &tuples) |
This method creates a constraint where the graph of the relation between the variables is given in extension. More... | |
Constraint * | MakeTransitionConstraint (const std::vector< IntVar * > &vars, const IntTupleSet &transition_table, int64 initial_state, const std::vector< int64 > &final_states) |
This constraint create a finite automaton that will check the sequence of variables vars. More... | |
Constraint * | MakeTransitionConstraint (const std::vector< IntVar * > &vars, const IntTupleSet &transition_table, int64 initial_state, const std::vector< int > &final_states) |
This constraint create a finite automaton that will check the sequence of variables vars. More... | |
Constraint * | MakeNonOverlappingBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< IntVar * > &x_size, const std::vector< IntVar * > &y_size) |
This constraint states that all the boxes must not overlap. More... | |
Constraint * | MakeNonOverlappingBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< int64 > &x_size, const std::vector< int64 > &y_size) |
Constraint * | MakeNonOverlappingBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< int > &x_size, const std::vector< int > &y_size) |
Constraint * | MakeNonOverlappingNonStrictBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< IntVar * > &x_size, const std::vector< IntVar * > &y_size) |
This constraint states that all the boxes must not overlap. More... | |
Constraint * | MakeNonOverlappingNonStrictBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< int64 > &x_size, const std::vector< int64 > &y_size) |
Constraint * | MakeNonOverlappingNonStrictBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< int > &x_size, const std::vector< int > &y_size) |
Pack * | MakePack (const std::vector< IntVar * > &vars, int number_of_bins) |
This constraint packs all variables onto 'number_of_bins' variables. More... | |
IntervalVar * | MakeFixedDurationIntervalVar (int64 start_min, int64 start_max, int64 duration, bool optional, const std::string &name) |
Creates an interval var with a fixed duration. More... | |
void | MakeFixedDurationIntervalVarArray (int count, int64 start_min, int64 start_max, int64 duration, bool optional, const std::string &name, std::vector< IntervalVar * > *const array) |
This method fills the vector with 'count' interval variables built with the corresponding parameters. More... | |
IntervalVar * | MakeFixedDurationIntervalVar (IntVar *const start_variable, int64 duration, const std::string &name) |
Creates a performed interval var with a fixed duration. More... | |
IntervalVar * | MakeFixedDurationIntervalVar (IntVar *const start_variable, int64 duration, IntVar *const performed_variable, const std::string &name) |
Creates an interval var with a fixed duration, and performed_variable. More... | |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, int64 duration, const std::string &name, std::vector< IntervalVar * > *const array) |
This method fills the vector with 'count' interval var built with the corresponding start variables. More... | |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, const std::vector< int64 > &durations, const std::string &name, std::vector< IntervalVar * > *const array) |
This method fills the vector with interval variables built with the corresponding start variables. More... | |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, const std::vector< int > &durations, const std::string &name, std::vector< IntervalVar * > *const array) |
This method fills the vector with interval variables built with the corresponding start variables. More... | |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, const std::vector< int64 > &durations, const std::vector< IntVar * > &performed_variables, const std::string &name, std::vector< IntervalVar * > *const array) |
This method fills the vector with interval variables built with the corresponding start and performed variables. More... | |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, const std::vector< int > &durations, const std::vector< IntVar * > &performed_variables, const std::string &name, std::vector< IntervalVar * > *const array) |
This method fills the vector with interval variables built with the corresponding start and performed variables. More... | |
IntervalVar * | MakeFixedInterval (int64 start, int64 duration, const std::string &name) |
Creates a fixed and performed interval. More... | |
IntervalVar * | MakeIntervalVar (int64 start_min, int64 start_max, int64 duration_min, int64 duration_max, int64 end_min, int64 end_max, bool optional, const std::string &name) |
Creates an interval var by specifying the bounds on start, duration, and end. More... | |
void | MakeIntervalVarArray (int count, int64 start_min, int64 start_max, int64 duration_min, int64 duration_max, int64 end_min, int64 end_max, bool optional, const std::string &name, std::vector< IntervalVar * > *const array) |
This method fills the vector with 'count' interval var built with the corresponding parameters. More... | |
IntervalVar * | MakeMirrorInterval (IntervalVar *const interval_var) |
Creates an interval var that is the mirror image of the given one, that is, the interval var obtained by reversing the axis. More... | |
IntervalVar * | MakeFixedDurationStartSyncedOnStartIntervalVar (IntervalVar *const interval_var, int64 duration, int64 offset) |
Creates an interval var with a fixed duration whose start is synchronized with the start of another interval, with a given offset. More... | |
IntervalVar * | MakeFixedDurationStartSyncedOnEndIntervalVar (IntervalVar *const interval_var, int64 duration, int64 offset) |
Creates an interval var with a fixed duration whose start is synchronized with the end of another interval, with a given offset. More... | |
IntervalVar * | MakeFixedDurationEndSyncedOnStartIntervalVar (IntervalVar *const interval_var, int64 duration, int64 offset) |
Creates an interval var with a fixed duration whose end is synchronized with the start of another interval, with a given offset. More... | |
IntervalVar * | MakeFixedDurationEndSyncedOnEndIntervalVar (IntervalVar *const interval_var, int64 duration, int64 offset) |
Creates an interval var with a fixed duration whose end is synchronized with the end of another interval, with a given offset. More... | |
IntervalVar * | MakeIntervalRelaxedMin (IntervalVar *const interval_var) |
Creates and returns an interval variable that wraps around the given one, relaxing the min start and end. More... | |
IntervalVar * | MakeIntervalRelaxedMax (IntervalVar *const interval_var) |
Creates and returns an interval variable that wraps around the given one, relaxing the max start and end. More... | |
Constraint * | MakeIntervalVarRelation (IntervalVar *const t, UnaryIntervalRelation r, int64 d) |
This method creates a relation between an interval var and a date. More... | |
Constraint * | MakeIntervalVarRelation (IntervalVar *const t1, BinaryIntervalRelation r, IntervalVar *const t2) |
This method creates a relation between two interval vars. More... | |
Constraint * | MakeIntervalVarRelationWithDelay (IntervalVar *const t1, BinaryIntervalRelation r, IntervalVar *const t2, int64 delay) |
This method creates a relation between two interval vars. More... | |
Constraint * | MakeTemporalDisjunction (IntervalVar *const t1, IntervalVar *const t2, IntVar *const alt) |
This constraint implements a temporal disjunction between two interval vars t1 and t2. More... | |
Constraint * | MakeTemporalDisjunction (IntervalVar *const t1, IntervalVar *const t2) |
This constraint implements a temporal disjunction between two interval vars. More... | |
DisjunctiveConstraint * | MakeDisjunctiveConstraint (const std::vector< IntervalVar * > &intervals, const std::string &name) |
This constraint forces all interval vars into an non-overlapping sequence. More... | |
DisjunctiveConstraint * | MakeStrictDisjunctiveConstraint (const std::vector< IntervalVar * > &intervals, const std::string &name) |
This constraint forces all interval vars into an non-overlapping sequence. More... | |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int64 > &demands, int64 capacity, const std::string &name) |
This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity. More... | |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int > &demands, int64 capacity, const std::string &name) |
This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity. More... | |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int64 > &demands, IntVar *const capacity, const std::string &name) |
This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity. More... | |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int > &demands, IntVar *const capacity, const std::string &name) |
This constraint enforces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity. More... | |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< IntVar * > &demands, int64 capacity, const std::string &name) |
This constraint enforces that, for any integer t, the sum of demands corresponding to an interval containing t does not exceed the given capacity. More... | |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< IntVar * > &demands, IntVar *const capacity, const std::string &name) |
This constraint enforces that, for any integer t, the sum of demands corresponding to an interval containing t does not exceed the given capacity. More... | |
Constraint * | MakeCover (const std::vector< IntervalVar * > &vars, IntervalVar *const target_var) |
This constraint states that the target_var is the convex hull of the intervals. More... | |
Constraint * | MakeEquality (IntervalVar *const var1, IntervalVar *const var2) |
This constraints states that the two interval variables are equal. More... | |
Assignment * | MakeAssignment () |
This method creates an empty assignment. More... | |
Assignment * | MakeAssignment (const Assignment *const a) |
This method creates an assignment which is a copy of 'a'. More... | |
SolutionCollector * | MakeFirstSolutionCollector (const Assignment *const assignment) |
Collect the first solution of the search. More... | |
SolutionCollector * | MakeFirstSolutionCollector () |
Collect the first solution of the search. More... | |
SolutionCollector * | MakeLastSolutionCollector (const Assignment *const assignment) |
Collect the last solution of the search. More... | |
SolutionCollector * | MakeLastSolutionCollector () |
Collect the last solution of the search. More... | |
SolutionCollector * | MakeBestValueSolutionCollector (const Assignment *const assignment, bool maximize) |
Collect the solution corresponding to the optimal value of the objective of 'assignment'; if 'assignment' does not have an objective no solution is collected. More... | |
SolutionCollector * | MakeBestValueSolutionCollector (bool maximize) |
Collect the solution corresponding to the optimal value of the objective of 'assignment'; if 'assignment' does not have an objective no solution is collected. More... | |
SolutionCollector * | MakeNBestValueSolutionCollector (const Assignment *const assignment, int solution_count, bool maximize) |
Same as MakeBestValueSolutionCollector but collects the best solution_count solutions. More... | |
SolutionCollector * | MakeNBestValueSolutionCollector (int solution_count, bool maximize) |
SolutionCollector * | MakeAllSolutionCollector (const Assignment *const assignment) |
Collect all solutions of the search. More... | |
SolutionCollector * | MakeAllSolutionCollector () |
Collect all solutions of the search. More... | |
OptimizeVar * | MakeMinimize (IntVar *const v, int64 step) |
Creates a minimization objective. More... | |
OptimizeVar * | MakeMaximize (IntVar *const v, int64 step) |
Creates a maximization objective. More... | |
OptimizeVar * | MakeOptimize (bool maximize, IntVar *const v, int64 step) |
Creates a objective with a given sense (true = maximization). More... | |
OptimizeVar * | MakeWeightedMinimize (const std::vector< IntVar * > &sub_objectives, const std::vector< int64 > &weights, int64 step) |
Creates a minimization weighted objective. More... | |
OptimizeVar * | MakeWeightedMinimize (const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64 step) |
Creates a minimization weighted objective. More... | |
OptimizeVar * | MakeWeightedMaximize (const std::vector< IntVar * > &sub_objectives, const std::vector< int64 > &weights, int64 step) |
Creates a maximization weigthed objective. More... | |
OptimizeVar * | MakeWeightedMaximize (const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64 step) |
Creates a maximization weigthed objective. More... | |
OptimizeVar * | MakeWeightedOptimize (bool maximize, const std::vector< IntVar * > &sub_objectives, const std::vector< int64 > &weights, int64 step) |
Creates a weighted objective with a given sense (true = maximization). More... | |
OptimizeVar * | MakeWeightedOptimize (bool maximize, const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64 step) |
Creates a weighted objective with a given sense (true = maximization). More... | |
SearchMonitor * | MakeTabuSearch (bool maximize, IntVar *const v, int64 step, const std::vector< IntVar * > &vars, int64 keep_tenure, int64 forbid_tenure, double tabu_factor) |
MetaHeuristics which try to get the search out of local optima. More... | |
SearchMonitor * | MakeGenericTabuSearch (bool maximize, IntVar *const v, int64 step, const std::vector< IntVar * > &tabu_vars, int64 forbid_tenure) |
Creates a Tabu Search based on the vars |vars|. More... | |
SearchMonitor * | MakeSimulatedAnnealing (bool maximize, IntVar *const v, int64 step, int64 initial_temperature) |
Creates a Simulated Annealing monitor. More... | |
SearchMonitor * | MakeGuidedLocalSearch (bool maximize, IntVar *const objective, IndexEvaluator2 objective_function, int64 step, const std::vector< IntVar * > &vars, double penalty_factor) |
Creates a Guided Local Search monitor. More... | |
SearchMonitor * | MakeGuidedLocalSearch (bool maximize, IntVar *const objective, IndexEvaluator3 objective_function, int64 step, const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, double penalty_factor) |
SearchMonitor * | MakeLubyRestart (int scale_factor) |
This search monitor will restart the search periodically. More... | |
SearchMonitor * | MakeConstantRestart (int frequency) |
This search monitor will restart the search periodically after 'frequency' failures. More... | |
RegularLimit * | MakeTimeLimit (absl::Duration time) |
Creates a search limit that constrains the running time. More... | |
RegularLimit * | MakeTimeLimit (int64 time_in_ms) |
RegularLimit * | MakeBranchesLimit (int64 branches) |
Creates a search limit that constrains the number of branches explored in the search tree. More... | |
RegularLimit * | MakeFailuresLimit (int64 failures) |
Creates a search limit that constrains the number of failures that can happen when exploring the search tree. More... | |
RegularLimit * | MakeSolutionsLimit (int64 solutions) |
Creates a search limit that constrains the number of solutions found during the search. More... | |
RegularLimit * | MakeLimit (absl::Duration time, int64 branches, int64 failures, int64 solutions, bool smart_time_check=false, bool cumulative=false) |
Limits the search with the 'time', 'branches', 'failures' and 'solutions' limits. More... | |
RegularLimit * | MakeLimit (const RegularLimitParameters &proto) |
Creates a search limit from its protobuf description. More... | |
RegularLimit * | MakeLimit (int64 time, int64 branches, int64 failures, int64 solutions, bool smart_time_check=false, bool cumulative=false) |
RegularLimitParameters | MakeDefaultRegularLimitParameters () const |
Creates a regular limit proto containing default values. More... | |
SearchLimit * | MakeLimit (SearchLimit *const limit_1, SearchLimit *const limit_2) |
Creates a search limit that is reached when either of the underlying limit is reached. More... | |
ImprovementSearchLimit * | MakeImprovementLimit (IntVar *objective_var, bool maximize, double objective_scaling_factor, double objective_offset, double improvement_rate_coefficient, int improvement_rate_solutions_distance) |
Limits the search based on the improvements of 'objective_var'. More... | |
SearchLimit * | MakeCustomLimit (std::function< bool()> limiter) |
Callback-based search limit. More... | |
SearchMonitor * | MakeSearchLog (int branch_period) |
The SearchMonitors below will display a periodic search log on LOG(INFO) every branch_period branches explored. More... | |
SearchMonitor * | MakeSearchLog (int branch_period, IntVar *const var) |
At each solution, this monitor also display the var value. More... | |
SearchMonitor * | MakeSearchLog (int branch_period, std::function< std::string()> display_callback) |
At each solution, this monitor will also display result of display_callback . More... | |
SearchMonitor * | MakeSearchLog (int branch_period, IntVar *var, std::function< std::string()> display_callback) |
At each solution, this monitor will display the 'var' value and the result of display_callback . More... | |
SearchMonitor * | MakeSearchLog (int branch_period, OptimizeVar *const opt_var) |
OptimizeVar Search Logs At each solution, this monitor will also display the 'opt_var' value. More... | |
SearchMonitor * | MakeSearchLog (int branch_period, OptimizeVar *const opt_var, std::function< std::string()> display_callback) |
Creates a search monitor that will also print the result of the display callback. More... | |
SearchMonitor * | MakeSearchLog (SearchLogParameters parameters) |
SearchMonitor * | MakeSearchTrace (const std::string &prefix) |
Creates a search monitor that will trace precisely the behavior of the search. More... | |
SearchMonitor * | MakeEnterSearchCallback (std::function< void()> callback) |
--— Callback-based search monitors --— More... | |
SearchMonitor * | MakeExitSearchCallback (std::function< void()> callback) |
SearchMonitor * | MakeAtSolutionCallback (std::function< void()> callback) |
ModelVisitor * | MakePrintModelVisitor () |
Prints the model. More... | |
ModelVisitor * | MakeStatisticsModelVisitor () |
Displays some nice statistics on the model. More... | |
ModelVisitor * | MakeVariableDegreeVisitor (absl::flat_hash_map< const IntVar *, int > *const map) |
Compute the number of constraints a variable is attached to. More... | |
SearchMonitor * | MakeSymmetryManager (const std::vector< SymmetryBreaker * > &visitors) |
Symmetry Breaking. More... | |
SearchMonitor * | MakeSymmetryManager (SymmetryBreaker *const v1) |
SearchMonitor * | MakeSymmetryManager (SymmetryBreaker *const v1, SymmetryBreaker *const v2) |
SearchMonitor * | MakeSymmetryManager (SymmetryBreaker *const v1, SymmetryBreaker *const v2, SymmetryBreaker *const v3) |
SearchMonitor * | MakeSymmetryManager (SymmetryBreaker *const v1, SymmetryBreaker *const v2, SymmetryBreaker *const v3, SymmetryBreaker *const v4) |
Decision * | MakeAssignVariableValue (IntVar *const var, int64 val) |
Decisions. More... | |
Decision * | MakeVariableLessOrEqualValue (IntVar *const var, int64 value) |
Decision * | MakeVariableGreaterOrEqualValue (IntVar *const var, int64 value) |
Decision * | MakeSplitVariableDomain (IntVar *const var, int64 val, bool start_with_lower_half) |
Decision * | MakeAssignVariableValueOrFail (IntVar *const var, int64 value) |
Decision * | MakeAssignVariableValueOrDoNothing (IntVar *const var, int64 value) |
Decision * | MakeAssignVariablesValues (const std::vector< IntVar * > &vars, const std::vector< int64 > &values) |
Decision * | MakeFailDecision () |
Decision * | MakeDecision (Action apply, Action refute) |
DecisionBuilder * | Compose (DecisionBuilder *const db1, DecisionBuilder *const db2) |
Creates a decision builder which sequentially composes decision builders. More... | |
DecisionBuilder * | Compose (DecisionBuilder *const db1, DecisionBuilder *const db2, DecisionBuilder *const db3) |
DecisionBuilder * | Compose (DecisionBuilder *const db1, DecisionBuilder *const db2, DecisionBuilder *const db3, DecisionBuilder *const db4) |
DecisionBuilder * | Compose (const std::vector< DecisionBuilder * > &dbs) |
DecisionBuilder * | Try (DecisionBuilder *const db1, DecisionBuilder *const db2) |
Creates a decision builder which will create a search tree where each decision builder is called from the top of the search tree. More... | |
DecisionBuilder * | Try (DecisionBuilder *const db1, DecisionBuilder *const db2, DecisionBuilder *const db3) |
DecisionBuilder * | Try (DecisionBuilder *const db1, DecisionBuilder *const db2, DecisionBuilder *const db3, DecisionBuilder *const db4) |
DecisionBuilder * | Try (const std::vector< DecisionBuilder * > &dbs) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IntValueStrategy val_str) |
Phases on IntVar arrays. More... | |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 var_evaluator, IntValueStrategy val_str) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IndexEvaluator2 value_evaluator) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, VariableValueComparator var_val1_val2_comparator) |
var_val1_val2_comparator(var, val1, val2) is true iff assigning value "val1" to variable "var" is better than assigning value "val2". More... | |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 var_evaluator, IndexEvaluator2 value_evaluator) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IndexEvaluator2 value_evaluator, IndexEvaluator1 tie_breaker) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 var_evaluator, IndexEvaluator2 value_evaluator, IndexEvaluator1 tie_breaker) |
DecisionBuilder * | MakeDefaultPhase (const std::vector< IntVar * > &vars) |
DecisionBuilder * | MakeDefaultPhase (const std::vector< IntVar * > &vars, const DefaultPhaseParameters ¶meters) |
DecisionBuilder * | MakePhase (IntVar *const v0, IntVarStrategy var_str, IntValueStrategy val_str) |
Shortcuts for small arrays. More... | |
DecisionBuilder * | MakePhase (IntVar *const v0, IntVar *const v1, IntVarStrategy var_str, IntValueStrategy val_str) |
DecisionBuilder * | MakePhase (IntVar *const v0, IntVar *const v1, IntVar *const v2, IntVarStrategy var_str, IntValueStrategy val_str) |
DecisionBuilder * | MakePhase (IntVar *const v0, IntVar *const v1, IntVar *const v2, IntVar *const v3, IntVarStrategy var_str, IntValueStrategy val_str) |
Decision * | MakeScheduleOrPostpone (IntervalVar *const var, int64 est, int64 *const marker) |
Returns a decision that tries to schedule a task at a given time. More... | |
Decision * | MakeScheduleOrExpedite (IntervalVar *const var, int64 est, int64 *const marker) |
Returns a decision that tries to schedule a task at a given time. More... | |
Decision * | MakeRankFirstInterval (SequenceVar *const sequence, int index) |
Returns a decision that tries to rank first the ith interval var in the sequence variable. More... | |
Decision * | MakeRankLastInterval (SequenceVar *const sequence, int index) |
Returns a decision that tries to rank last the ith interval var in the sequence variable. More... | |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator2 eval, EvaluatorStrategy str) |
Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator. More... | |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator2 eval, IndexEvaluator1 tie_breaker, EvaluatorStrategy str) |
Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator. More... | |
DecisionBuilder * | MakePhase (const std::vector< IntervalVar * > &intervals, IntervalStrategy str) |
Scheduling phases. More... | |
DecisionBuilder * | MakePhase (const std::vector< SequenceVar * > &sequences, SequenceStrategy str) |
DecisionBuilder * | MakeDecisionBuilderFromAssignment (Assignment *const assignment, DecisionBuilder *const db, const std::vector< IntVar * > &vars) |
Returns a decision builder for which the left-most leaf corresponds to assignment, the rest of the tree being explored using 'db'. More... | |
DecisionBuilder * | MakeConstraintAdder (Constraint *const ct) |
Returns a decision builder that will add the given constraint to the model. More... | |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *const db) |
SolveOnce will collapse a search tree described by a decision builder 'db' and a set of monitors and wrap it into a single point. More... | |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1, SearchMonitor *const monitor2) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3, SearchMonitor *const monitor4) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *const db, const std::vector< SearchMonitor * > &monitors) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step) |
NestedOptimize will collapse a search tree described by a decision builder 'db' and a set of monitors and wrap it into a single point. More... | |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1, SearchMonitor *const monitor2) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3, SearchMonitor *const monitor4) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, const std::vector< SearchMonitor * > &monitors) |
DecisionBuilder * | MakeRestoreAssignment (Assignment *assignment) |
Returns a DecisionBuilder which restores an Assignment (calls void Assignment::Restore()) More... | |
DecisionBuilder * | MakeStoreAssignment (Assignment *assignment) |
Returns a DecisionBuilder which stores an Assignment (calls void Assignment::Store()) More... | |
LocalSearchOperator * | MakeOperator (const std::vector< IntVar * > &vars, LocalSearchOperators op) |
Local Search Operators. More... | |
LocalSearchOperator * | MakeOperator (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, LocalSearchOperators op) |
LocalSearchOperator * | MakeOperator (const std::vector< IntVar * > &vars, IndexEvaluator3 evaluator, EvaluatorLocalSearchOperators op) |
LocalSearchOperator * | MakeOperator (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, IndexEvaluator3 evaluator, EvaluatorLocalSearchOperators op) |
LocalSearchOperator * | MakeRandomLnsOperator (const std::vector< IntVar * > &vars, int number_of_variables) |
Creates a large neighborhood search operator which creates fragments (set of relaxed variables) with up to number_of_variables random variables (sampling with replacement is performed meaning that at most number_of_variables variables are selected). More... | |
LocalSearchOperator * | MakeRandomLnsOperator (const std::vector< IntVar * > &vars, int number_of_variables, int32 seed) |
LocalSearchOperator * | MakeMoveTowardTargetOperator (const Assignment &target) |
Creates a local search operator that tries to move the assignment of some variables toward a target. More... | |
LocalSearchOperator * | MakeMoveTowardTargetOperator (const std::vector< IntVar * > &variables, const std::vector< int64 > &target_values) |
Creates a local search operator that tries to move the assignment of some variables toward a target. More... | |
LocalSearchOperator * | ConcatenateOperators (const std::vector< LocalSearchOperator * > &ops) |
Creates a local search operator which concatenates a vector of operators. More... | |
LocalSearchOperator * | ConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, bool restart) |
LocalSearchOperator * | ConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, std::function< int64(int, int)> evaluator) |
LocalSearchOperator * | RandomConcatenateOperators (const std::vector< LocalSearchOperator * > &ops) |
Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor(). More... | |
LocalSearchOperator * | RandomConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, int32 seed) |
Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor(). More... | |
LocalSearchOperator * | MultiArmedBanditConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, double memory_coefficient, double exploration_coefficient, bool maximize) |
Creates a local search operator which concatenates a vector of operators. More... | |
LocalSearchOperator * | MakeNeighborhoodLimit (LocalSearchOperator *const op, int64 limit) |
Creates a local search operator that wraps another local search operator and limits the number of neighbors explored (i.e., calls to MakeNextNeighbor from the current solution (between two calls to Start()). More... | |
DecisionBuilder * | MakeLocalSearchPhase (Assignment *const assignment, LocalSearchPhaseParameters *const parameters) |
Local Search decision builders factories. More... | |
DecisionBuilder * | MakeLocalSearchPhase (const std::vector< IntVar * > &vars, DecisionBuilder *const first_solution, LocalSearchPhaseParameters *const parameters) |
DecisionBuilder * | MakeLocalSearchPhase (const std::vector< IntVar * > &vars, DecisionBuilder *const first_solution, DecisionBuilder *const first_solution_sub_decision_builder, LocalSearchPhaseParameters *const parameters) |
Variant with a sub_decison_builder specific to the first solution. More... | |
DecisionBuilder * | MakeLocalSearchPhase (const std::vector< SequenceVar * > &vars, DecisionBuilder *const first_solution, LocalSearchPhaseParameters *const parameters) |
SolutionPool * | MakeDefaultSolutionPool () |
Solution Pool. More... | |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder) |
Local Search Phase Parameters. More... | |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, RegularLimit *const limit) |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, RegularLimit *const limit, LocalSearchFilterManager *filter_manager) |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, SolutionPool *const pool, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder) |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, SolutionPool *const pool, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, RegularLimit *const limit) |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, SolutionPool *const pool, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, RegularLimit *const limit, LocalSearchFilterManager *filter_manager) |
LocalSearchFilter * | MakeAcceptFilter () |
Local Search Filters. More... | |
LocalSearchFilter * | MakeRejectFilter () |
LocalSearchFilter * | MakeVariableDomainFilter () |
IntVarLocalSearchFilter * | MakeSumObjectiveFilter (const std::vector< IntVar * > &vars, IndexEvaluator2 values, Solver::LocalSearchFilterBound filter_enum) |
IntVarLocalSearchFilter * | MakeSumObjectiveFilter (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, IndexEvaluator3 values, Solver::LocalSearchFilterBound filter_enum) |
void | TopPeriodicCheck () |
Performs PeriodicCheck on the top-level search; for instance, can be called from a nested solve to check top-level limits. More... | |
int | TopProgressPercent () |
Returns a percentage representing the propress of the search before reaching the limits of the top-level search (can be called from a nested solve). More... | |
void | PushState () |
The PushState and PopState methods manipulates the states of the reversible objects. More... | |
void | PopState () |
int | SearchDepth () const |
Gets the search depth of the current active search. More... | |
int | SearchLeftDepth () const |
Gets the search left depth of the current active search. More... | |
int | SolveDepth () const |
Gets the number of nested searches. More... | |
void | SetBranchSelector (BranchSelector bs) |
Sets the given branch selector on the current active search. More... | |
DecisionBuilder * | MakeApplyBranchSelector (BranchSelector bs) |
Creates a decision builder that will set the branch selector. More... | |
template<class T > | |
void | SaveAndSetValue (T *adr, T val) |
All-in-one SaveAndSetValue. More... | |
template<class T > | |
void | SaveAndAdd (T *adr, T val) |
All-in-one SaveAndAdd_value. More... | |
int64 | Rand64 (int64 size) |
Returns a random value between 0 and 'size' - 1;. More... | |
int32 | Rand32 (int32 size) |
Returns a random value between 0 and 'size' - 1;. More... | |
void | ReSeed (int32 seed) |
Reseed the solver random generator. More... | |
void | ExportProfilingOverview (const std::string &filename) |
Exports the profiling information in a human readable overview. More... | |
std::string | LocalSearchProfile () const |
Returns local search profiling information in a human readable format. More... | |
ConstraintSolverStatistics | GetConstraintSolverStatistics () const |
Returns detailed cp search statistics. More... | |
LocalSearchStatistics | GetLocalSearchStatistics () const |
Returns detailed local search statistics. More... | |
bool | CurrentlyInSolve () const |
Returns true whether the current search has been created using a Solve() call instead of a NewSearch one. More... | |
int | constraints () const |
Counts the number of constraints that have been added to the solver before the search. More... | |
void | Accept (ModelVisitor *const visitor) const |
Accepts the given model visitor. More... | |
Decision * | balancing_decision () const |
void | set_fail_intercept (std::function< void()> fail_intercept) |
Internal. More... | |
void | clear_fail_intercept () |
DemonProfiler * | demon_profiler () const |
Access to demon profiler. More... | |
void | SetUseFastLocalSearch (bool use_fast_local_search) |
enabled for metaheuristics. More... | |
bool | UseFastLocalSearch () const |
Returns true if fast local search is enabled. More... | |
bool | HasName (const PropagationBaseObject *object) const |
Returns whether the object has been named or not. More... | |
Demon * | RegisterDemon (Demon *const demon) |
Adds a new demon and wraps it inside a DemonProfiler if necessary. More... | |
IntExpr * | RegisterIntExpr (IntExpr *const expr) |
Registers a new IntExpr and wraps it inside a TraceIntExpr if necessary. More... | |
IntVar * | RegisterIntVar (IntVar *const var) |
Registers a new IntVar and wraps it inside a TraceIntVar if necessary. More... | |
IntervalVar * | RegisterIntervalVar (IntervalVar *const var) |
Registers a new IntervalVar and wraps it inside a TraceIntervalVar if necessary. More... | |
Search * | ActiveSearch () const |
Returns the active search, nullptr outside search. More... | |
ModelCache * | Cache () const |
Returns the cache of the model. More... | |
bool | InstrumentsDemons () const |
Returns whether we are instrumenting demons. More... | |
bool | IsProfilingEnabled () const |
Returns whether we are profiling the solver. More... | |
bool | IsLocalSearchProfilingEnabled () const |
Returns whether we are profiling local search. More... | |
bool | InstrumentsVariables () const |
Returns whether we are tracing variables. More... | |
bool | NameAllVariables () const |
Returns whether all variables should be named. More... | |
std::string | model_name () const |
Returns the name of the model. More... | |
PropagationMonitor * | GetPropagationMonitor () const |
Returns the propagation monitor. More... | |
void | AddPropagationMonitor (PropagationMonitor *const monitor) |
Adds the propagation monitor to the solver. More... | |
LocalSearchMonitor * | GetLocalSearchMonitor () const |
Returns the local search monitor. More... | |
void | AddLocalSearchMonitor (LocalSearchMonitor *monitor) |
Adds the local search monitor to the solver. More... | |
void | SetSearchContext (Search *search, const std::string &search_context) |
std::string | SearchContext () const |
std::string | SearchContext (const Search *search) const |
Assignment * | GetOrCreateLocalSearchState () |
Returns (or creates) an assignment representing the state of local search. More... | |
void | ClearLocalSearchState () |
Clears the local search state. More... | |
bool | IsBooleanVar (IntExpr *const expr, IntVar **inner_var, bool *is_negated) const |
Returns true if expr represents either boolean_var or 1 - boolean_var. More... | |
bool | IsProduct (IntExpr *const expr, IntExpr **inner_expr, int64 *coefficient) |
Returns true if expr represents a product of a expr and a constant. More... | |
IntExpr * | CastExpression (const IntVar *const var) const |
!defined(SWIG) More... | |
void | FinishCurrentSearch () |
Tells the solver to kill or restart the current search. More... | |
void | RestartCurrentSearch () |
void | ShouldFail () |
These methods are only useful for the SWIG wrappers, which need a way to externally cause the Solver to fail. More... | |
void | CheckFail () |
bool | Solve (DecisionBuilder *const db, const std::vector< SearchMonitor * > &monitors) |
bool | Solve (DecisionBuilder *const db) |
bool | Solve (DecisionBuilder *const db, SearchMonitor *const m1) |
bool | Solve (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2) |
bool | Solve (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3) |
bool | Solve (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3, SearchMonitor *const m4) |
void | NewSearch (DecisionBuilder *const db, const std::vector< SearchMonitor * > &monitors) |
void | NewSearch (DecisionBuilder *const db) |
void | NewSearch (DecisionBuilder *const db, SearchMonitor *const m1) |
void | NewSearch (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2) |
void | NewSearch (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3) |
void | NewSearch (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3, SearchMonitor *const m4) |
bool | NextSolution () |
void | RestartSearch () |
void | EndSearch () |
Static Public Member Functions | |
static ConstraintSolverParameters | DefaultSolverParameters () |
Create a ConstraintSolverParameters proto with all the default values. More... | |
static int64 | MemoryUsage () |
Current memory usage in bytes. More... | |
Public Attributes | |
std::vector< int64 > | tmp_vector_ |
Unsafe temporary vector. More... | |
Static Public Attributes | |
static constexpr int | kNumPriorities = 3 |
Number of priorities for demons. More... | |
Member Typedef Documentation
◆ Action
Definition at line 759 of file constraint_solver.h.
◆ BranchSelector
typedef std::function<DecisionModification()> BranchSelector |
Definition at line 757 of file constraint_solver.h.
◆ Closure
typedef std::function<void()> Closure |
Definition at line 760 of file constraint_solver.h.
◆ IndexEvaluator1
typedef std::function<int64(int64)> IndexEvaluator1 |
Callback typedefs.
Definition at line 743 of file constraint_solver.h.
◆ IndexEvaluator2
typedef std::function<int64(int64, int64)> IndexEvaluator2 |
Definition at line 744 of file constraint_solver.h.
◆ IndexEvaluator3
typedef std::function<int64(int64, int64, int64)> IndexEvaluator3 |
Definition at line 745 of file constraint_solver.h.
◆ IndexFilter1
typedef std::function<bool(int64)> IndexFilter1 |
Definition at line 747 of file constraint_solver.h.
◆ Int64ToIntVar
typedef std::function<IntVar*(int64)> Int64ToIntVar |
Definition at line 749 of file constraint_solver.h.
◆ VariableIndexSelector
typedef std::function<int64(Solver* solver, const std::vector<IntVar*>& vars, int64 first_unbound, int64 last_unbound)> VariableIndexSelector |
Definition at line 753 of file constraint_solver.h.
◆ VariableValueComparator
typedef std::function<bool(int64, int64, int64)> VariableValueComparator |
Definition at line 756 of file constraint_solver.h.
◆ VariableValueSelector
typedef std::function<int64(const IntVar* v, int64 id)> VariableValueSelector |
Definition at line 755 of file constraint_solver.h.
Member Enumeration Documentation
◆ BinaryIntervalRelation
This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between the two intervals t1 and t2.
Definition at line 627 of file constraint_solver.h.
◆ DecisionModification
enum DecisionModification |
The Solver is responsible for creating the search tree.
Thanks to the DecisionBuilder, it creates a new decision with two branches at each node: left and right. The DecisionModification enum is used to specify how the branch selector should behave.
Definition at line 695 of file constraint_solver.h.
◆ DemonPriority
enum DemonPriority |
This enum represents the three possible priorities for a demon in the Solver queue.
Note: this is for advanced users only.
Definition at line 613 of file constraint_solver.h.
◆ EvaluatorLocalSearchOperators
This enum is used in Solver::MakeOperator associated with an evaluator to specify the neighborhood to create.
Definition at line 572 of file constraint_solver.h.
◆ EvaluatorStrategy
enum EvaluatorStrategy |
This enum is used by Solver::MakePhase to specify how to select variables and values during the search.
In Solver::MakePhase(const std::vector<IntVar*>&, IntVarStrategy, IntValueStrategy), variables are selected first, and then the associated value. In Solver::MakePhase(const std::vector<IntVar*>& vars, IndexEvaluator2, EvaluatorStrategy), the selection is done scanning every pair <variable, possible value>. The next selected pair is then the best among all possibilities, i.e. the pair with the smallest evaluation. As this is costly, two options are offered: static or dynamic evaluation.
Definition at line 395 of file constraint_solver.h.
◆ IntervalStrategy
enum IntervalStrategy |
This enum describes the straregy used to select the next interval variable and its value to be fixed.
Definition at line 419 of file constraint_solver.h.
◆ IntValueStrategy
enum IntValueStrategy |
This enum describes the strategy used to select the next variable value to set.
Definition at line 355 of file constraint_solver.h.
◆ IntVarStrategy
enum IntVarStrategy |
This enum describes the strategy used to select the next branching variable at each node during the search.
Definition at line 274 of file constraint_solver.h.
◆ LocalSearchFilterBound
This enum is used in Solver::MakeLocalSearchObjectiveFilter.
It specifies the behavior of the objective filter to create. The goal is to define under which condition a move is accepted based on the current objective value.
Definition at line 600 of file constraint_solver.h.
◆ LocalSearchOperators
enum LocalSearchOperators |
This enum is used in Solver::MakeOperator to specify the neighborhood to create.
Definition at line 434 of file constraint_solver.h.
◆ MarkerType
enum MarkerType |
This enum is used internally in private methods Solver::PushState and Solver::PopState to tag states in the search tree.
Enumerator | |
---|---|
SENTINEL | |
SIMPLE_MARKER | |
CHOICE_POINT | |
REVERSIBLE_ACTION |
Definition at line 721 of file constraint_solver.h.
◆ OptimizationDirection
Optimization directions.
Enumerator | |
---|---|
NOT_SET | |
MAXIMIZATION | |
MINIMIZATION |
Definition at line 740 of file constraint_solver.h.
◆ SequenceStrategy
enum SequenceStrategy |
Used for scheduling. Not yet implemented.
Enumerator | |
---|---|
SEQUENCE_DEFAULT | |
SEQUENCE_SIMPLE | |
CHOOSE_MIN_SLACK_RANK_FORWARD | |
CHOOSE_RANDOM_RANK_FORWARD |
Definition at line 410 of file constraint_solver.h.
◆ SolverState
enum SolverState |
This enum represents the state of the solver w.r.t. the search.
Definition at line 724 of file constraint_solver.h.
◆ UnaryIntervalRelation
This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between an interval t and an integer d.
Definition at line 660 of file constraint_solver.h.
Constructor & Destructor Documentation
◆ Solver() [1/2]
◆ Solver() [2/2]
Solver | ( | const std::string & | name, |
const ConstraintSolverParameters & | parameters | ||
) |
◆ ~Solver()
~Solver | ( | ) |
Member Function Documentation
◆ Accept()
void Accept | ( | ModelVisitor *const | visitor | ) | const |
Accepts the given model visitor.
◆ accepted_neighbors()
|
inline |
The number of accepted neighbors.
Definition at line 1008 of file constraint_solver.h.
◆ ActiveSearch()
Search * ActiveSearch | ( | ) | const |
Returns the active search, nullptr outside search.
◆ AddBacktrackAction()
void AddBacktrackAction | ( | Action | a, |
bool | fast | ||
) |
When SaveValue() is not the best way to go, one can create a reversible action that will be called upon backtrack.
The "fast" parameter indicates whether we need restore all values saved through SaveValue() before calling this method.
◆ AddCastConstraint()
void AddCastConstraint | ( | CastConstraint *const | constraint, |
IntVar *const | target_var, | ||
IntExpr *const | expr | ||
) |
Adds 'constraint' to the solver and marks it as a cast constraint, that is, a constraint created calling Var() on an expression.
This is used internally.
◆ AddConstraint()
void AddConstraint | ( | Constraint *const | c | ) |
Adds the constraint 'c' to the model.
After calling this method, and until there is a backtrack that undoes the addition, any assignment of variables to values must satisfy the given constraint in order to be considered feasible. There are two fairly different use cases:
- the most common use case is modeling: the given constraint is really part of the problem that the user is trying to solve. In this use case, AddConstraint is called outside of search (i.e., with
state() == OUTSIDE_SEARCH
). Most users should only use AddConstraint in this way. In this case, the constraint will belong to the model forever: it cannot not be removed by backtracking. - a rarer use case is that 'c' is not a real constraint of the model. It may be a constraint generated by a branching decision (a constraint whose goal is to restrict the search space), a symmetry breaking constraint (a constraint that does restrict the search space, but in a way that cannot have an impact on the quality of the solutions in the subtree), or an inferred constraint that, while having no semantic value to the model (it does not restrict the set of solutions), is worth having because we believe it may strengthen the propagation. In these cases, it happens that the constraint is added during the search (i.e., with state() == IN_SEARCH or state() == IN_ROOT_NODE). When a constraint is added during a search, it applies only to the subtree of the search tree rooted at the current node, and will be automatically removed by backtracking.
This method does not take ownership of the constraint. If the constraint has been created by any factory method (Solver::MakeXXX), it will automatically be deleted. However, power users who implement their own constraints should do: solver.AddConstraint(solver.RevAlloc(new MyConstraint(...));
◆ AddLocalSearchMonitor()
void AddLocalSearchMonitor | ( | LocalSearchMonitor * | monitor | ) |
Adds the local search monitor to the solver.
This is called internally when a propagation monitor is passed to the Solve() or NewSearch() method.
◆ AddPropagationMonitor()
void AddPropagationMonitor | ( | PropagationMonitor *const | monitor | ) |
Adds the propagation monitor to the solver.
This is called internally when a propagation monitor is passed to the Solve() or NewSearch() method.
◆ balancing_decision()
|
inline |
Definition at line 2870 of file constraint_solver.h.
◆ branches()
|
inline |
The number of branches explored since the creation of the solver.
Definition at line 987 of file constraint_solver.h.
◆ Cache()
ModelCache * Cache | ( | ) | const |
Returns the cache of the model.
◆ CastExpression()
!defined(SWIG)
Internal. If the variables is the result of expr->Var(), this method returns expr, nullptr otherwise.
◆ CheckAssignment()
bool CheckAssignment | ( | Assignment *const | solution | ) |
Checks whether the given assignment satisfies all relevant constraints.
◆ CheckConstraint()
bool CheckConstraint | ( | Constraint *const | ct | ) |
Checks whether adding this constraint will lead to an immediate failure.
It will return false if the model is already inconsistent, or if adding the constraint makes it inconsistent.
◆ CheckFail()
|
inline |
Definition at line 2986 of file constraint_solver.h.
◆ clear_fail_intercept()
|
inline |
Definition at line 2878 of file constraint_solver.h.
◆ ClearLocalSearchState()
|
inline |
Clears the local search state.
Definition at line 2934 of file constraint_solver.h.
◆ Compose() [1/4]
DecisionBuilder * Compose | ( | const std::vector< DecisionBuilder * > & | dbs | ) |
◆ Compose() [2/4]
DecisionBuilder * Compose | ( | DecisionBuilder *const | db1, |
DecisionBuilder *const | db2 | ||
) |
Creates a decision builder which sequentially composes decision builders.
At each leaf of a decision builder, the next decision builder is therefore called. For instance, Compose(db1, db2) will result in the following tree: d1 tree | / | \ | db1 leaves | / | \ | db2 tree db2 tree db2 tree |
◆ Compose() [3/4]
DecisionBuilder * Compose | ( | DecisionBuilder *const | db1, |
DecisionBuilder *const | db2, | ||
DecisionBuilder *const | db3 | ||
) |
◆ Compose() [4/4]
DecisionBuilder * Compose | ( | DecisionBuilder *const | db1, |
DecisionBuilder *const | db2, | ||
DecisionBuilder *const | db3, | ||
DecisionBuilder *const | db4 | ||
) |
◆ ConcatenateOperators() [1/3]
LocalSearchOperator * ConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops | ) |
Creates a local search operator which concatenates a vector of operators.
Each operator from the vector is called sequentially. By default, when a neighbor is found the neighborhood exploration restarts from the last active operator (the one which produced the neighbor). This can be overridden by setting restart to true to force the exploration to start from the first operator in the vector.
The default behavior can also be overridden using an evaluation callback to set the order in which the operators are explored (the callback is called in LocalSearchOperator::Start()). The first argument of the callback is the index of the operator which produced the last move, the second argument is the index of the operator to be evaluated. Ownership of the callback is taken by ConcatenateOperators.
Example:
const int kPriorities = {10, 100, 10, 0}; int64 Evaluate(int active_operator, int current_operator) { return kPriorities[current_operator]; }
LocalSearchOperator* concat = solver.ConcatenateOperators(operators, NewPermanentCallback(&Evaluate));
The elements of the vector operators will be sorted by increasing priority and explored in that order (tie-breaks are handled by keeping the relative operator order in the vector). This would result in the following order: operators[3], operators[0], operators[2], operators[1].
◆ ConcatenateOperators() [2/3]
LocalSearchOperator * ConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
bool | restart | ||
) |
◆ ConcatenateOperators() [3/3]
LocalSearchOperator * ConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
std::function< int64(int, int)> | evaluator | ||
) |
◆ constraints()
|
inline |
Counts the number of constraints that have been added to the solver before the search.
Definition at line 2865 of file constraint_solver.h.
◆ CurrentlyInSolve()
bool CurrentlyInSolve | ( | ) | const |
Returns true whether the current search has been created using a Solve() call instead of a NewSearch one.
It returns false if the solver is not in search at all.
◆ DebugString()
std::string DebugString | ( | ) | const |
!defined(SWIG)
misc debug string.
◆ DefaultSolverParameters()
|
static |
Create a ConstraintSolverParameters proto with all the default values.
◆ demon_profiler()
|
inline |
Access to demon profiler.
Definition at line 2880 of file constraint_solver.h.
◆ demon_runs()
|
inline |
The number of demons executed during search for a given priority.
Definition at line 996 of file constraint_solver.h.
◆ EndSearch()
void EndSearch | ( | ) |
◆ ExportProfilingOverview()
void ExportProfilingOverview | ( | const std::string & | filename | ) |
Exports the profiling information in a human readable overview.
The parameter profile_level used to create the solver must be set to true.
◆ Fail()
void Fail | ( | ) |
Abandon the current branch in the search tree. A backtrack will follow.
◆ fail_stamp()
uint64 fail_stamp | ( | ) | const |
The fail_stamp() is incremented after each backtrack.
◆ failures()
|
inline |
The number of failures encountered since the creation of the solver.
Definition at line 999 of file constraint_solver.h.
◆ filtered_neighbors()
|
inline |
The number of filtered neighbors (neighbors accepted by filters).
Definition at line 1005 of file constraint_solver.h.
◆ FinishCurrentSearch()
void FinishCurrentSearch | ( | ) |
Tells the solver to kill or restart the current search.
◆ GetConstraintSolverStatistics()
ConstraintSolverStatistics GetConstraintSolverStatistics | ( | ) | const |
Returns detailed cp search statistics.
◆ GetLocalSearchMonitor()
LocalSearchMonitor * GetLocalSearchMonitor | ( | ) | const |
Returns the local search monitor.
◆ GetLocalSearchStatistics()
LocalSearchStatistics GetLocalSearchStatistics | ( | ) | const |
Returns detailed local search statistics.
◆ GetOrCreateLocalSearchState()
Assignment * GetOrCreateLocalSearchState | ( | ) |
Returns (or creates) an assignment representing the state of local search.
◆ GetPropagationMonitor()
PropagationMonitor * GetPropagationMonitor | ( | ) | const |
Returns the propagation monitor.
◆ HasName()
bool HasName | ( | const PropagationBaseObject * | object | ) | const |
Returns whether the object has been named or not.
◆ InstrumentsDemons()
bool InstrumentsDemons | ( | ) | const |
Returns whether we are instrumenting demons.
◆ InstrumentsVariables()
bool InstrumentsVariables | ( | ) | const |
Returns whether we are tracing variables.
◆ IsBooleanVar()
Returns true if expr represents either boolean_var or 1 - boolean_var.
In that case, it fills inner_var and is_negated to be true if the expression is 1 - boolean_var – equivalent to not(boolean_var).
◆ IsLocalSearchProfilingEnabled()
bool IsLocalSearchProfilingEnabled | ( | ) | const |
Returns whether we are profiling local search.
◆ IsProduct()
Returns true if expr represents a product of a expr and a constant.
In that case, it fills inner_expr and coefficient with these, and returns true. In the other case, it fills inner_expr with expr, coefficient with 1, and returns false.
◆ IsProfilingEnabled()
bool IsProfilingEnabled | ( | ) | const |
Returns whether we are profiling the solver.
◆ LocalSearchProfile()
std::string LocalSearchProfile | ( | ) | const |
Returns local search profiling information in a human readable format.
◆ MakeAbs()
◆ MakeAbsEquality()
Constraint * MakeAbsEquality | ( | IntVar *const | var, |
IntVar *const | abs_var | ||
) |
Creates the constraint abs(var) == abs_var.
◆ MakeAcceptFilter()
LocalSearchFilter * MakeAcceptFilter | ( | ) |
Local Search Filters.
◆ MakeActionDemon()
◆ MakeAllDifferent() [1/2]
Constraint * MakeAllDifferent | ( | const std::vector< IntVar * > & | vars | ) |
All variables are pairwise different.
This corresponds to the stronger version of the propagation algorithm.
◆ MakeAllDifferent() [2/2]
Constraint * MakeAllDifferent | ( | const std::vector< IntVar * > & | vars, |
bool | stronger_propagation | ||
) |
All variables are pairwise different.
If 'stronger_propagation' is true, stronger, and potentially slower propagation will occur. This API will be deprecated in the future.
◆ MakeAllDifferentExcept()
Constraint * MakeAllDifferentExcept | ( | const std::vector< IntVar * > & | vars, |
int64 | escape_value | ||
) |
All variables are pairwise different, unless they are assigned to the escape value.
◆ MakeAllowedAssignments()
Constraint * MakeAllowedAssignments | ( | const std::vector< IntVar * > & | vars, |
const IntTupleSet & | tuples | ||
) |
This method creates a constraint where the graph of the relation between the variables is given in extension.
There are 'arity' variables involved in the relation and the graph is given by a integer tuple set.
◆ MakeAllSolutionCollector() [1/2]
SolutionCollector * MakeAllSolutionCollector | ( | ) |
Collect all solutions of the search.
The variables will need to be added later.
◆ MakeAllSolutionCollector() [2/2]
SolutionCollector * MakeAllSolutionCollector | ( | const Assignment *const | assignment | ) |
Collect all solutions of the search.
◆ MakeApplyBranchSelector()
DecisionBuilder * MakeApplyBranchSelector | ( | BranchSelector | bs | ) |
Creates a decision builder that will set the branch selector.
◆ MakeAssignment() [1/2]
Assignment * MakeAssignment | ( | ) |
This method creates an empty assignment.
◆ MakeAssignment() [2/2]
Assignment * MakeAssignment | ( | const Assignment *const | a | ) |
This method creates an assignment which is a copy of 'a'.
◆ MakeAssignVariablesValues()
Decision * MakeAssignVariablesValues | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | values | ||
) |
◆ MakeAssignVariableValue()
◆ MakeAssignVariableValueOrDoNothing()
◆ MakeAssignVariableValueOrFail()
◆ MakeAtMost()
Constraint * MakeAtMost | ( | std::vector< IntVar * > | vars, |
int64 | value, | ||
int64 | max_count | ||
) |
|{i | vars[i] == value}| <= max_count
◆ MakeAtSolutionCallback()
SearchMonitor * MakeAtSolutionCallback | ( | std::function< void()> | callback | ) |
◆ MakeBestValueSolutionCollector() [1/2]
SolutionCollector * MakeBestValueSolutionCollector | ( | bool | maximize | ) |
Collect the solution corresponding to the optimal value of the objective of 'assignment'; if 'assignment' does not have an objective no solution is collected.
This collector only collects one solution corresponding to the best objective value (the first one found). The variables will need to be added later.
◆ MakeBestValueSolutionCollector() [2/2]
SolutionCollector * MakeBestValueSolutionCollector | ( | const Assignment *const | assignment, |
bool | maximize | ||
) |
Collect the solution corresponding to the optimal value of the objective of 'assignment'; if 'assignment' does not have an objective no solution is collected.
This collector only collects one solution corresponding to the best objective value (the first one found).
◆ MakeBetweenCt()
Constraint * MakeBetweenCt | ( | IntExpr *const | expr, |
int64 | l, | ||
int64 | u | ||
) |
(l <= expr <= u)
◆ MakeBoolVar() [1/2]
IntVar * MakeBoolVar | ( | ) |
MakeBoolVar will create a variable with a {0, 1} domain.
◆ MakeBoolVar() [2/2]
IntVar * MakeBoolVar | ( | const std::string & | name | ) |
MakeBoolVar will create a variable with a {0, 1} domain.
◆ MakeBoolVarArray() [1/3]
IntVar ** MakeBoolVarArray | ( | int | var_count, |
const std::string & | name | ||
) |
Same but allocates an array and returns it.
◆ MakeBoolVarArray() [2/3]
void MakeBoolVarArray | ( | int | var_count, |
const std::string & | name, | ||
std::vector< IntVar * > * | vars | ||
) |
This method will append the vector vars with 'var_count' boolean variables having name "name<i>" where is the index of the variable.
◆ MakeBoolVarArray() [3/3]
void MakeBoolVarArray | ( | int | var_count, |
std::vector< IntVar * > * | vars | ||
) |
This method will append the vector vars with 'var_count' boolean variables having no names.
◆ MakeBranchesLimit()
RegularLimit * MakeBranchesLimit | ( | int64 | branches | ) |
Creates a search limit that constrains the number of branches explored in the search tree.
◆ MakeCircuit()
Constraint * MakeCircuit | ( | const std::vector< IntVar * > & | nexts | ) |
Force the "nexts" variable to create a complete Hamiltonian path.
◆ MakeClosureDemon()
◆ MakeConditionalExpression()
IntExpr * MakeConditionalExpression | ( | IntVar *const | condition, |
IntExpr *const | expr, | ||
int64 | unperformed_value | ||
) |
Conditional Expr condition ? expr : unperformed_value.
◆ MakeConstantRestart()
SearchMonitor * MakeConstantRestart | ( | int | frequency | ) |
This search monitor will restart the search periodically after 'frequency' failures.
◆ MakeConstraintAdder()
DecisionBuilder * MakeConstraintAdder | ( | Constraint *const | ct | ) |
Returns a decision builder that will add the given constraint to the model.
◆ MakeConstraintInitialPropagateCallback()
Demon * MakeConstraintInitialPropagateCallback | ( | Constraint *const | ct | ) |
This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct'.
◆ MakeConvexPiecewiseExpr()
IntExpr * MakeConvexPiecewiseExpr | ( | IntExpr * | expr, |
int64 | early_cost, | ||
int64 | early_date, | ||
int64 | late_date, | ||
int64 | late_cost | ||
) |
Convex piecewise function.
◆ MakeCount() [1/2]
Constraint * MakeCount | ( | const std::vector< IntVar * > & | vars, |
int64 | value, | ||
int64 | max_count | ||
) |
|{i | vars[i] == value}| == max_count
◆ MakeCount() [2/2]
Constraint * MakeCount | ( | const std::vector< IntVar * > & | vars, |
int64 | value, | ||
IntVar *const | max_count | ||
) |
|{i | vars[i] == value}| == max_count
◆ MakeCover()
Constraint * MakeCover | ( | const std::vector< IntervalVar * > & | vars, |
IntervalVar *const | target_var | ||
) |
This constraint states that the target_var is the convex hull of the intervals.
If none of the interval variables is performed, then the target var is unperformed too. Also, if the target variable is unperformed, then all the intervals variables are unperformed too.
◆ MakeCumulative() [1/6]
Constraint * MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< int > & | demands, | ||
int64 | capacity, | ||
const std::string & | name | ||
) |
This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity.
Intervals and demands should be vectors of equal size.
Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.
◆ MakeCumulative() [2/6]
Constraint * MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< int > & | demands, | ||
IntVar *const | capacity, | ||
const std::string & | name | ||
) |
This constraint enforces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity.
Intervals and demands should be vectors of equal size.
Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.
◆ MakeCumulative() [3/6]
Constraint * MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< int64 > & | demands, | ||
int64 | capacity, | ||
const std::string & | name | ||
) |
This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity.
Intervals and demands should be vectors of equal size.
Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.
◆ MakeCumulative() [4/6]
Constraint * MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< int64 > & | demands, | ||
IntVar *const | capacity, | ||
const std::string & | name | ||
) |
This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity.
Intervals and demands should be vectors of equal size.
Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.
◆ MakeCumulative() [5/6]
Constraint * MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< IntVar * > & | demands, | ||
int64 | capacity, | ||
const std::string & | name | ||
) |
This constraint enforces that, for any integer t, the sum of demands corresponding to an interval containing t does not exceed the given capacity.
Intervals and demands should be vectors of equal size.
Demands should be positive.
◆ MakeCumulative() [6/6]
Constraint * MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< IntVar * > & | demands, | ||
IntVar *const | capacity, | ||
const std::string & | name | ||
) |
This constraint enforces that, for any integer t, the sum of demands corresponding to an interval containing t does not exceed the given capacity.
Intervals and demands should be vectors of equal size.
Demands should be positive.
◆ MakeCustomLimit()
SearchLimit * MakeCustomLimit | ( | std::function< bool()> | limiter | ) |
Callback-based search limit.
Search stops when limiter returns true; if this happens at a leaf the corresponding solution will be rejected.
◆ MakeDecision()
◆ MakeDecisionBuilderFromAssignment()
DecisionBuilder * MakeDecisionBuilderFromAssignment | ( | Assignment *const | assignment, |
DecisionBuilder *const | db, | ||
const std::vector< IntVar * > & | vars | ||
) |
Returns a decision builder for which the left-most leaf corresponds to assignment, the rest of the tree being explored using 'db'.
◆ MakeDefaultPhase() [1/2]
DecisionBuilder * MakeDefaultPhase | ( | const std::vector< IntVar * > & | vars | ) |
◆ MakeDefaultPhase() [2/2]
DecisionBuilder * MakeDefaultPhase | ( | const std::vector< IntVar * > & | vars, |
const DefaultPhaseParameters & | parameters | ||
) |
◆ MakeDefaultRegularLimitParameters()
RegularLimitParameters MakeDefaultRegularLimitParameters | ( | ) | const |
Creates a regular limit proto containing default values.
◆ MakeDefaultSolutionPool()
SolutionPool * MakeDefaultSolutionPool | ( | ) |
Solution Pool.
◆ MakeDelayedConstraintInitialPropagateCallback()
Demon * MakeDelayedConstraintInitialPropagateCallback | ( | Constraint *const | ct | ) |
This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct' with low priority.
◆ MakeDelayedPathCumul()
Constraint * MakeDelayedPathCumul | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
const std::vector< IntVar * > & | cumuls, | ||
const std::vector< IntVar * > & | transits | ||
) |
Delayed version of the same constraint: propagation on the nexts variables is delayed until all constraints have propagated.
◆ MakeDeviation()
Constraint * MakeDeviation | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | deviation_var, | ||
int64 | total_sum | ||
) |
Deviation constraint: sum_i |n * vars[i] - total_sum| <= deviation_var and sum_i vars[i] == total_sum n = #vars.
◆ MakeDifference() [1/2]
◆ MakeDifference() [2/2]
◆ MakeDisjunctiveConstraint()
DisjunctiveConstraint * MakeDisjunctiveConstraint | ( | const std::vector< IntervalVar * > & | intervals, |
const std::string & | name | ||
) |
This constraint forces all interval vars into an non-overlapping sequence.
Intervals with zero duration can be scheduled anywhere.
◆ MakeDistribute() [1/8]
Constraint * MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | card_min, | ||
const std::vector< int > & | card_max | ||
) |
Aggregated version of count with bounded cardinalities: forall j in 0 .
. card_size - 1: card_min[j] <= |{i | v[i] == j}| <= card_max[j]
◆ MakeDistribute() [2/8]
Constraint * MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | values, | ||
const std::vector< int > & | card_min, | ||
const std::vector< int > & | card_max | ||
) |
Aggregated version of count with bounded cardinalities: forall j in 0 .
. card_size - 1: card_min[j] <= |{i | v[i] == values[j]}| <= card_max[j]
◆ MakeDistribute() [3/8]
Constraint * MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | values, | ||
const std::vector< IntVar * > & | cards | ||
) |
Aggregated version of count: |{i | v[i] == values[j]}| == cards[j].
◆ MakeDistribute() [4/8]
Constraint * MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | card_min, | ||
const std::vector< int64 > & | card_max | ||
) |
Aggregated version of count with bounded cardinalities: forall j in 0 .
. card_size - 1: card_min[j] <= |{i | v[i] == j}| <= card_max[j]
◆ MakeDistribute() [5/8]
Constraint * MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | values, | ||
const std::vector< int64 > & | card_min, | ||
const std::vector< int64 > & | card_max | ||
) |
Aggregated version of count with bounded cardinalities: forall j in 0 .
. card_size - 1: card_min[j] <= |{i | v[i] == values[j]}| <= card_max[j]
◆ MakeDistribute() [6/8]
Constraint * MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | values, | ||
const std::vector< IntVar * > & | cards | ||
) |
Aggregated version of count: |{i | v[i] == values[j]}| == cards[j].
◆ MakeDistribute() [7/8]
Constraint * MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | cards | ||
) |
Aggregated version of count: |{i | v[i] == j}| == cards[j].
◆ MakeDistribute() [8/8]
Constraint * MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
int64 | card_min, | ||
int64 | card_max, | ||
int64 | card_size | ||
) |
Aggregated version of count with bounded cardinalities: forall j in 0 .
. card_size - 1: card_min <= |{i | v[i] == j}| <= card_max
◆ MakeDiv() [1/2]
◆ MakeDiv() [2/2]
numerator / denominator (integer division). Terms need to be positive.
◆ MakeElement() [1/6]
◆ MakeElement() [2/6]
◆ MakeElement() [3/6]
◆ MakeElement() [4/6]
IntExpr * MakeElement | ( | IndexEvaluator1 | values, |
IntVar *const | index | ||
) |
Function-based element.
The constraint takes ownership of the callback. The callback must be able to cope with any possible value in the domain of 'index' (potentially negative ones too).
◆ MakeElement() [5/6]
IntExpr * MakeElement | ( | IndexEvaluator2 | values, |
IntVar *const | index1, | ||
IntVar *const | index2 | ||
) |
2D version of function-based element expression, values(expr1, expr2).
◆ MakeElement() [6/6]
IntExpr * MakeElement | ( | Int64ToIntVar | vars, |
int64 | range_start, | ||
int64 | range_end, | ||
IntVar * | argument | ||
) |
vars(argument)
◆ MakeElementEquality() [1/4]
Constraint * MakeElementEquality | ( | const std::vector< int > & | vals, |
IntVar *const | index, | ||
IntVar *const | target | ||
) |
◆ MakeElementEquality() [2/4]
Constraint * MakeElementEquality | ( | const std::vector< int64 > & | vals, |
IntVar *const | index, | ||
IntVar *const | target | ||
) |
◆ MakeElementEquality() [3/4]
Constraint * MakeElementEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | index, | ||
int64 | target | ||
) |
◆ MakeElementEquality() [4/4]
Constraint * MakeElementEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | index, | ||
IntVar *const | target | ||
) |
◆ MakeEnterSearchCallback()
SearchMonitor * MakeEnterSearchCallback | ( | std::function< void()> | callback | ) |
--— Callback-based search monitors --—
◆ MakeEquality() [1/4]
Constraint * MakeEquality | ( | IntervalVar *const | var1, |
IntervalVar *const | var2 | ||
) |
This constraints states that the two interval variables are equal.
◆ MakeEquality() [2/4]
Constraint * MakeEquality | ( | IntExpr *const | expr, |
int | value | ||
) |
expr == value
◆ MakeEquality() [3/4]
Constraint * MakeEquality | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr == value
◆ MakeEquality() [4/4]
Constraint * MakeEquality | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left == right
◆ MakeExitSearchCallback()
SearchMonitor * MakeExitSearchCallback | ( | std::function< void()> | callback | ) |
◆ MakeFailDecision()
Decision * MakeFailDecision | ( | ) |
◆ MakeFailuresLimit()
RegularLimit * MakeFailuresLimit | ( | int64 | failures | ) |
Creates a search limit that constrains the number of failures that can happen when exploring the search tree.
◆ MakeFalseConstraint() [1/2]
Constraint * MakeFalseConstraint | ( | ) |
This constraint always fails.
◆ MakeFalseConstraint() [2/2]
Constraint * MakeFalseConstraint | ( | const std::string & | explanation | ) |
◆ MakeFirstSolutionCollector() [1/2]
SolutionCollector * MakeFirstSolutionCollector | ( | ) |
Collect the first solution of the search.
The variables will need to be added later.
◆ MakeFirstSolutionCollector() [2/2]
SolutionCollector * MakeFirstSolutionCollector | ( | const Assignment *const | assignment | ) |
Collect the first solution of the search.
◆ MakeFixedDurationEndSyncedOnEndIntervalVar()
IntervalVar * MakeFixedDurationEndSyncedOnEndIntervalVar | ( | IntervalVar *const | interval_var, |
int64 | duration, | ||
int64 | offset | ||
) |
Creates an interval var with a fixed duration whose end is synchronized with the end of another interval, with a given offset.
The performed status is also in sync with the performed status of the given interval variable.
◆ MakeFixedDurationEndSyncedOnStartIntervalVar()
IntervalVar * MakeFixedDurationEndSyncedOnStartIntervalVar | ( | IntervalVar *const | interval_var, |
int64 | duration, | ||
int64 | offset | ||
) |
Creates an interval var with a fixed duration whose end is synchronized with the start of another interval, with a given offset.
The performed status is also in sync with the performed status of the given interval variable.
◆ MakeFixedDurationIntervalVar() [1/3]
IntervalVar * MakeFixedDurationIntervalVar | ( | int64 | start_min, |
int64 | start_max, | ||
int64 | duration, | ||
bool | optional, | ||
const std::string & | name | ||
) |
Creates an interval var with a fixed duration.
The duration must be greater than 0. If optional is true, then the interval can be performed or unperformed. If optional is false, then the interval is always performed.
◆ MakeFixedDurationIntervalVar() [2/3]
IntervalVar * MakeFixedDurationIntervalVar | ( | IntVar *const | start_variable, |
int64 | duration, | ||
const std::string & | name | ||
) |
Creates a performed interval var with a fixed duration.
The duration must be greater than 0.
◆ MakeFixedDurationIntervalVar() [3/3]
IntervalVar * MakeFixedDurationIntervalVar | ( | IntVar *const | start_variable, |
int64 | duration, | ||
IntVar *const | performed_variable, | ||
const std::string & | name | ||
) |
Creates an interval var with a fixed duration, and performed_variable.
The duration must be greater than 0.
◆ MakeFixedDurationIntervalVarArray() [1/6]
void MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
const std::vector< int > & | durations, | ||
const std::string & | name, | ||
std::vector< IntervalVar * > *const | array | ||
) |
This method fills the vector with interval variables built with the corresponding start variables.
◆ MakeFixedDurationIntervalVarArray() [2/6]
void MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
const std::vector< int > & | durations, | ||
const std::vector< IntVar * > & | performed_variables, | ||
const std::string & | name, | ||
std::vector< IntervalVar * > *const | array | ||
) |
This method fills the vector with interval variables built with the corresponding start and performed variables.
◆ MakeFixedDurationIntervalVarArray() [3/6]
void MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
const std::vector< int64 > & | durations, | ||
const std::string & | name, | ||
std::vector< IntervalVar * > *const | array | ||
) |
This method fills the vector with interval variables built with the corresponding start variables.
◆ MakeFixedDurationIntervalVarArray() [4/6]
void MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
const std::vector< int64 > & | durations, | ||
const std::vector< IntVar * > & | performed_variables, | ||
const std::string & | name, | ||
std::vector< IntervalVar * > *const | array | ||
) |
This method fills the vector with interval variables built with the corresponding start and performed variables.
◆ MakeFixedDurationIntervalVarArray() [5/6]
void MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
int64 | duration, | ||
const std::string & | name, | ||
std::vector< IntervalVar * > *const | array | ||
) |
This method fills the vector with 'count' interval var built with the corresponding start variables.
◆ MakeFixedDurationIntervalVarArray() [6/6]
void MakeFixedDurationIntervalVarArray | ( | int | count, |
int64 | start_min, | ||
int64 | start_max, | ||
int64 | duration, | ||
bool | optional, | ||
const std::string & | name, | ||
std::vector< IntervalVar * > *const | array | ||
) |
This method fills the vector with 'count' interval variables built with the corresponding parameters.
◆ MakeFixedDurationStartSyncedOnEndIntervalVar()
IntervalVar * MakeFixedDurationStartSyncedOnEndIntervalVar | ( | IntervalVar *const | interval_var, |
int64 | duration, | ||
int64 | offset | ||
) |
Creates an interval var with a fixed duration whose start is synchronized with the end of another interval, with a given offset.
The performed status is also in sync with the performed status of the given interval variable.
◆ MakeFixedDurationStartSyncedOnStartIntervalVar()
IntervalVar * MakeFixedDurationStartSyncedOnStartIntervalVar | ( | IntervalVar *const | interval_var, |
int64 | duration, | ||
int64 | offset | ||
) |
Creates an interval var with a fixed duration whose start is synchronized with the start of another interval, with a given offset.
The performed status is also in sync with the performed status of the given interval variable.
◆ MakeFixedInterval()
IntervalVar * MakeFixedInterval | ( | int64 | start, |
int64 | duration, | ||
const std::string & | name | ||
) |
Creates a fixed and performed interval.
◆ MakeGenericTabuSearch()
SearchMonitor * MakeGenericTabuSearch | ( | bool | maximize, |
IntVar *const | v, | ||
int64 | step, | ||
const std::vector< IntVar * > & | tabu_vars, | ||
int64 | forbid_tenure | ||
) |
Creates a Tabu Search based on the vars |vars|.
A solution is "tabu" if all the vars in |vars| keep their value.
◆ MakeGreater() [1/3]
Constraint * MakeGreater | ( | IntExpr *const | expr, |
int | value | ||
) |
expr > value
◆ MakeGreater() [2/3]
Constraint * MakeGreater | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr > value
◆ MakeGreater() [3/3]
Constraint * MakeGreater | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left > right
◆ MakeGreaterOrEqual() [1/3]
Constraint * MakeGreaterOrEqual | ( | IntExpr *const | expr, |
int | value | ||
) |
expr >= value
◆ MakeGreaterOrEqual() [2/3]
Constraint * MakeGreaterOrEqual | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr >= value
◆ MakeGreaterOrEqual() [3/3]
Constraint * MakeGreaterOrEqual | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left >= right
◆ MakeGuidedLocalSearch() [1/2]
SearchMonitor * MakeGuidedLocalSearch | ( | bool | maximize, |
IntVar *const | objective, | ||
IndexEvaluator2 | objective_function, | ||
int64 | step, | ||
const std::vector< IntVar * > & | vars, | ||
double | penalty_factor | ||
) |
Creates a Guided Local Search monitor.
Description here: http://en.wikipedia.org/wiki/Guided_Local_Search
◆ MakeGuidedLocalSearch() [2/2]
SearchMonitor * MakeGuidedLocalSearch | ( | bool | maximize, |
IntVar *const | objective, | ||
IndexEvaluator3 | objective_function, | ||
int64 | step, | ||
const std::vector< IntVar * > & | vars, | ||
const std::vector< IntVar * > & | secondary_vars, | ||
double | penalty_factor | ||
) |
◆ MakeIfThenElseCt()
Constraint * MakeIfThenElseCt | ( | IntVar *const | condition, |
IntExpr *const | then_expr, | ||
IntExpr *const | else_expr, | ||
IntVar *const | target_var | ||
) |
Special cases with arrays of size two.
◆ MakeImprovementLimit()
ImprovementSearchLimit * MakeImprovementLimit | ( | IntVar * | objective_var, |
bool | maximize, | ||
double | objective_scaling_factor, | ||
double | objective_offset, | ||
double | improvement_rate_coefficient, | ||
int | improvement_rate_solutions_distance | ||
) |
Limits the search based on the improvements of 'objective_var'.
Stops the search when the improvement rate gets lower than a threshold value. This threshold value is computed based on the improvement rate during the first phase of the search.
◆ MakeIndexExpression()
Returns the expression expr such that vars[expr] == value.
It assumes that vars are all different.
◆ MakeIndexOfConstraint()
Constraint * MakeIndexOfConstraint | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | index, | ||
int64 | target | ||
) |
This constraint is a special case of the element constraint with an array of integer variables, where the variables are all different and the index variable is constrained such that vars[index] == target.
◆ MakeIndexOfFirstMaxValueConstraint()
Constraint * MakeIndexOfFirstMaxValueConstraint | ( | IntVar * | index, |
const std::vector< IntVar * > & | vars | ||
) |
Creates a constraint that binds the index variable to the index of the first variable with the maximum value.
◆ MakeIndexOfFirstMinValueConstraint()
Constraint * MakeIndexOfFirstMinValueConstraint | ( | IntVar * | index, |
const std::vector< IntVar * > & | vars | ||
) |
Creates a constraint that binds the index variable to the index of the first variable with the minimum value.
◆ MakeIntConst() [1/2]
IntVar * MakeIntConst | ( | int64 | val | ) |
IntConst will create a constant expression.
◆ MakeIntConst() [2/2]
IntVar * MakeIntConst | ( | int64 | val, |
const std::string & | name | ||
) |
IntConst will create a constant expression.
◆ MakeIntervalRelaxedMax()
IntervalVar * MakeIntervalRelaxedMax | ( | IntervalVar *const | interval_var | ) |
Creates and returns an interval variable that wraps around the given one, relaxing the max start and end.
Relaxing means making unbounded when optional. If the variable is non optional, this method returns interval_var.
More precisely, such an interval variable behaves as follows:
- When the underlying must be performed, the returned interval variable behaves exactly as the underlying;
- When the underlying may or may not be performed, the returned interval variable behaves like the underlying, except that it is unbounded on the max side;
- When the underlying cannot be performed, the returned interval variable is of duration 0 and must be performed in an interval unbounded on both sides.
This is very useful for implementing propagators that may only modify the start min or end min.
◆ MakeIntervalRelaxedMin()
IntervalVar * MakeIntervalRelaxedMin | ( | IntervalVar *const | interval_var | ) |
Creates and returns an interval variable that wraps around the given one, relaxing the min start and end.
Relaxing means making unbounded when optional. If the variable is non-optional, this method returns interval_var.
More precisely, such an interval variable behaves as follows:
- When the underlying must be performed, the returned interval variable behaves exactly as the underlying;
- When the underlying may or may not be performed, the returned interval variable behaves like the underlying, except that it is unbounded on the min side;
- When the underlying cannot be performed, the returned interval variable is of duration 0 and must be performed in an interval unbounded on both sides.
This is very useful to implement propagators that may only modify the start max or end max.
◆ MakeIntervalVar()
IntervalVar * MakeIntervalVar | ( | int64 | start_min, |
int64 | start_max, | ||
int64 | duration_min, | ||
int64 | duration_max, | ||
int64 | end_min, | ||
int64 | end_max, | ||
bool | optional, | ||
const std::string & | name | ||
) |
Creates an interval var by specifying the bounds on start, duration, and end.
◆ MakeIntervalVarArray()
void MakeIntervalVarArray | ( | int | count, |
int64 | start_min, | ||
int64 | start_max, | ||
int64 | duration_min, | ||
int64 | duration_max, | ||
int64 | end_min, | ||
int64 | end_max, | ||
bool | optional, | ||
const std::string & | name, | ||
std::vector< IntervalVar * > *const | array | ||
) |
This method fills the vector with 'count' interval var built with the corresponding parameters.
◆ MakeIntervalVarRelation() [1/2]
Constraint * MakeIntervalVarRelation | ( | IntervalVar *const | t, |
UnaryIntervalRelation | r, | ||
int64 | d | ||
) |
This method creates a relation between an interval var and a date.
◆ MakeIntervalVarRelation() [2/2]
Constraint * MakeIntervalVarRelation | ( | IntervalVar *const | t1, |
BinaryIntervalRelation | r, | ||
IntervalVar *const | t2 | ||
) |
This method creates a relation between two interval vars.
◆ MakeIntervalVarRelationWithDelay()
Constraint * MakeIntervalVarRelationWithDelay | ( | IntervalVar *const | t1, |
BinaryIntervalRelation | r, | ||
IntervalVar *const | t2, | ||
int64 | delay | ||
) |
This method creates a relation between two interval vars.
The given delay is added to the second interval. i.e.: t1 STARTS_AFTER_END of t2 with a delay of 2 means t1 will start at least two units of time after the end of t2.
◆ MakeIntVar() [1/6]
IntVar * MakeIntVar | ( | const std::vector< int > & | values | ) |
MakeIntVar will create a variable with the given sparse domain.
◆ MakeIntVar() [2/6]
IntVar * MakeIntVar | ( | const std::vector< int > & | values, |
const std::string & | name | ||
) |
MakeIntVar will create a variable with the given sparse domain.
◆ MakeIntVar() [3/6]
IntVar * MakeIntVar | ( | const std::vector< int64 > & | values | ) |
MakeIntVar will create a variable with the given sparse domain.
◆ MakeIntVar() [4/6]
IntVar * MakeIntVar | ( | const std::vector< int64 > & | values, |
const std::string & | name | ||
) |
MakeIntVar will create a variable with the given sparse domain.
◆ MakeIntVar() [5/6]
IntVar * MakeIntVar | ( | int64 | min, |
int64 | max | ||
) |
MakeIntVar will create the best range based int var for the bounds given.
◆ MakeIntVar() [6/6]
IntVar * MakeIntVar | ( | int64 | min, |
int64 | max, | ||
const std::string & | name | ||
) |
MakeIntVar will create the best range based int var for the bounds given.
◆ MakeIntVarArray() [1/3]
IntVar ** MakeIntVarArray | ( | int | var_count, |
int64 | vmin, | ||
int64 | vmax, | ||
const std::string & | name | ||
) |
Same but allocates an array and returns it.
◆ MakeIntVarArray() [2/3]
void MakeIntVarArray | ( | int | var_count, |
int64 | vmin, | ||
int64 | vmax, | ||
const std::string & | name, | ||
std::vector< IntVar * > * | vars | ||
) |
This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having name "name<i>" where is the index of the variable.
◆ MakeIntVarArray() [3/3]
void MakeIntVarArray | ( | int | var_count, |
int64 | vmin, | ||
int64 | vmax, | ||
std::vector< IntVar * > * | vars | ||
) |
This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having no names.
◆ MakeInversePermutationConstraint()
Constraint * MakeInversePermutationConstraint | ( | const std::vector< IntVar * > & | left, |
const std::vector< IntVar * > & | right | ||
) |
Creates a constraint that enforces that 'left' and 'right' both represent permutations of [0..left.size()-1], and that 'right' is the inverse permutation of 'left', i.e.
for all i in [0..left.size()-1], right[left[i]] = i.
◆ MakeIsBetweenCt()
Constraint * MakeIsBetweenCt | ( | IntExpr *const | expr, |
int64 | l, | ||
int64 | u, | ||
IntVar *const | b | ||
) |
b == (l <= expr <= u)
◆ MakeIsBetweenVar()
◆ MakeIsDifferentCstCt()
Constraint * MakeIsDifferentCstCt | ( | IntExpr *const | var, |
int64 | value, | ||
IntVar *const | boolvar | ||
) |
boolvar == (var != value)
◆ MakeIsDifferentCstVar()
◆ MakeIsDifferentCt()
Constraint * MakeIsDifferentCt | ( | IntExpr *const | v1, |
IntExpr *const | v2, | ||
IntVar *const | b | ||
) |
b == (v1 != v2)
◆ MakeIsDifferentVar()
◆ MakeIsEqualCstCt()
Constraint * MakeIsEqualCstCt | ( | IntExpr *const | var, |
int64 | value, | ||
IntVar *const | boolvar | ||
) |
boolvar == (var == value)
◆ MakeIsEqualCstVar()
◆ MakeIsEqualCt()
Constraint * MakeIsEqualCt | ( | IntExpr *const | v1, |
IntExpr * | v2, | ||
IntVar *const | b | ||
) |
b == (v1 == v2)
◆ MakeIsEqualVar()
◆ MakeIsGreaterCstCt()
Constraint * MakeIsGreaterCstCt | ( | IntExpr *const | v, |
int64 | c, | ||
IntVar *const | b | ||
) |
b == (v > c)
◆ MakeIsGreaterCstVar()
◆ MakeIsGreaterCt()
Constraint * MakeIsGreaterCt | ( | IntExpr *const | left, |
IntExpr *const | right, | ||
IntVar *const | b | ||
) |
b == (left > right)
◆ MakeIsGreaterOrEqualCstCt()
Constraint * MakeIsGreaterOrEqualCstCt | ( | IntExpr *const | var, |
int64 | value, | ||
IntVar *const | boolvar | ||
) |
boolvar == (var >= value)
◆ MakeIsGreaterOrEqualCstVar()
status var of (var >= value)
◆ MakeIsGreaterOrEqualCt()
Constraint * MakeIsGreaterOrEqualCt | ( | IntExpr *const | left, |
IntExpr *const | right, | ||
IntVar *const | b | ||
) |
b == (left >= right)
◆ MakeIsGreaterOrEqualVar()
status var of (left >= right)
◆ MakeIsGreaterVar()
status var of (left > right)
◆ MakeIsLessCstCt()
Constraint * MakeIsLessCstCt | ( | IntExpr *const | v, |
int64 | c, | ||
IntVar *const | b | ||
) |
b == (v < c)
◆ MakeIsLessCstVar()
◆ MakeIsLessCt()
Constraint * MakeIsLessCt | ( | IntExpr *const | left, |
IntExpr *const | right, | ||
IntVar *const | b | ||
) |
b == (left < right)
◆ MakeIsLessOrEqualCstCt()
Constraint * MakeIsLessOrEqualCstCt | ( | IntExpr *const | var, |
int64 | value, | ||
IntVar *const | boolvar | ||
) |
boolvar == (var <= value)
◆ MakeIsLessOrEqualCstVar()
◆ MakeIsLessOrEqualCt()
Constraint * MakeIsLessOrEqualCt | ( | IntExpr *const | left, |
IntExpr *const | right, | ||
IntVar *const | b | ||
) |
b == (left <= right)
◆ MakeIsLessOrEqualVar()
status var of (left <= right)
◆ MakeIsLessVar()
◆ MakeIsMemberCt() [1/2]
Constraint * MakeIsMemberCt | ( | IntExpr *const | expr, |
const std::vector< int > & | values, | ||
IntVar *const | boolvar | ||
) |
◆ MakeIsMemberCt() [2/2]
Constraint * MakeIsMemberCt | ( | IntExpr *const | expr, |
const std::vector< int64 > & | values, | ||
IntVar *const | boolvar | ||
) |
boolvar == (expr in set)
◆ MakeIsMemberVar() [1/2]
◆ MakeIsMemberVar() [2/2]
◆ MakeLastSolutionCollector() [1/2]
SolutionCollector * MakeLastSolutionCollector | ( | ) |
Collect the last solution of the search.
The variables will need to be added later.
◆ MakeLastSolutionCollector() [2/2]
SolutionCollector * MakeLastSolutionCollector | ( | const Assignment *const | assignment | ) |
Collect the last solution of the search.
◆ MakeLess() [1/3]
Constraint * MakeLess | ( | IntExpr *const | expr, |
int | value | ||
) |
expr < value
◆ MakeLess() [2/3]
Constraint * MakeLess | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr < value
◆ MakeLess() [3/3]
Constraint * MakeLess | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left < right
◆ MakeLessOrEqual() [1/3]
Constraint * MakeLessOrEqual | ( | IntExpr *const | expr, |
int | value | ||
) |
expr <= value
◆ MakeLessOrEqual() [2/3]
Constraint * MakeLessOrEqual | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr <= value
◆ MakeLessOrEqual() [3/3]
Constraint * MakeLessOrEqual | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left <= right
◆ MakeLexicalLess()
Constraint * MakeLexicalLess | ( | const std::vector< IntVar * > & | left, |
const std::vector< IntVar * > & | right | ||
) |
Creates a constraint that enforces that left is lexicographically less than right.
◆ MakeLexicalLessOrEqual()
Constraint * MakeLexicalLessOrEqual | ( | const std::vector< IntVar * > & | left, |
const std::vector< IntVar * > & | right | ||
) |
Creates a constraint that enforces that left is lexicographically less than or equal to right.
◆ MakeLimit() [1/4]
RegularLimit * MakeLimit | ( | absl::Duration | time, |
int64 | branches, | ||
int64 | failures, | ||
int64 | solutions, | ||
bool | smart_time_check = false , |
||
bool | cumulative = false |
||
) |
Limits the search with the 'time', 'branches', 'failures' and 'solutions' limits.
'smart_time_check' reduces the calls to the wall
◆ MakeLimit() [2/4]
RegularLimit * MakeLimit | ( | const RegularLimitParameters & | proto | ) |
Creates a search limit from its protobuf description.
◆ MakeLimit() [3/4]
RegularLimit * MakeLimit | ( | int64 | time, |
int64 | branches, | ||
int64 | failures, | ||
int64 | solutions, | ||
bool | smart_time_check = false , |
||
bool | cumulative = false |
||
) |
◆ MakeLimit() [4/4]
SearchLimit * MakeLimit | ( | SearchLimit *const | limit_1, |
SearchLimit *const | limit_2 | ||
) |
Creates a search limit that is reached when either of the underlying limit is reached.
That is, the returned limit is more stringent than both argument limits.
◆ MakeLocalSearchPhase() [1/4]
DecisionBuilder * MakeLocalSearchPhase | ( | Assignment *const | assignment, |
LocalSearchPhaseParameters *const | parameters | ||
) |
Local Search decision builders factories.
Local search is used to improve a given solution. This initial solution can be specified either by an Assignment or by a DecisionBulder, and the corresponding variables, the initial solution being the first solution found by the DecisionBuilder. The LocalSearchPhaseParameters parameter holds the actual definition of the local search phase:
- a local search operator used to explore the neighborhood of the current solution,
- a decision builder to instantiate unbound variables once a neighbor has been defined; in the case of LNS-based operators instantiates fragment variables; search monitors can be added to this sub-search by wrapping the decision builder with MakeSolveOnce.
- a search limit specifying how long local search looks for neighbors before accepting one; the last neighbor is always taken and in the case of a greedy search, this corresponds to the best local neighbor; first-accept (which is the default behavior) can be modeled using a solution found limit of 1,
- a vector of local search filters used to speed up the search by pruning unfeasible neighbors. Metaheuristics can be added by defining specialized search monitors; currently down/up-hill climbing is available through OptimizeVar, as well as Guided Local Search, Tabu Search and Simulated Annealing.
◆ MakeLocalSearchPhase() [2/4]
DecisionBuilder * MakeLocalSearchPhase | ( | const std::vector< IntVar * > & | vars, |
DecisionBuilder *const | first_solution, | ||
DecisionBuilder *const | first_solution_sub_decision_builder, | ||
LocalSearchPhaseParameters *const | parameters | ||
) |
Variant with a sub_decison_builder specific to the first solution.
◆ MakeLocalSearchPhase() [3/4]
DecisionBuilder * MakeLocalSearchPhase | ( | const std::vector< IntVar * > & | vars, |
DecisionBuilder *const | first_solution, | ||
LocalSearchPhaseParameters *const | parameters | ||
) |
◆ MakeLocalSearchPhase() [4/4]
DecisionBuilder * MakeLocalSearchPhase | ( | const std::vector< SequenceVar * > & | vars, |
DecisionBuilder *const | first_solution, | ||
LocalSearchPhaseParameters *const | parameters | ||
) |
◆ MakeLocalSearchPhaseParameters() [1/6]
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder | ||
) |
Local Search Phase Parameters.
◆ MakeLocalSearchPhaseParameters() [2/6]
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder, | ||
RegularLimit *const | limit | ||
) |
◆ MakeLocalSearchPhaseParameters() [3/6]
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder, | ||
RegularLimit *const | limit, | ||
LocalSearchFilterManager * | filter_manager | ||
) |
◆ MakeLocalSearchPhaseParameters() [4/6]
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
SolutionPool *const | pool, | ||
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder | ||
) |
◆ MakeLocalSearchPhaseParameters() [5/6]
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
SolutionPool *const | pool, | ||
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder, | ||
RegularLimit *const | limit | ||
) |
◆ MakeLocalSearchPhaseParameters() [6/6]
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
SolutionPool *const | pool, | ||
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder, | ||
RegularLimit *const | limit, | ||
LocalSearchFilterManager * | filter_manager | ||
) |
◆ MakeLubyRestart()
SearchMonitor * MakeLubyRestart | ( | int | scale_factor | ) |
This search monitor will restart the search periodically.
At the iteration n, it will restart after scale_factor * Luby(n) failures where Luby is the Luby Strategy (i.e. 1 1 2 1 1 2 4 1 1 2 1 1 2 4 8...).
◆ MakeMapDomain()
Constraint * MakeMapDomain | ( | IntVar *const | var, |
const std::vector< IntVar * > & | actives | ||
) |
This constraint maps the domain of 'var' onto the array of variables 'actives'.
That is for all i in [0 .. size - 1]: actives[i] == 1 <=> var->Contains(i);
◆ MakeMax() [1/4]
◆ MakeMax() [2/4]
◆ MakeMax() [3/4]
◆ MakeMax() [4/4]
◆ MakeMaxEquality()
Constraint * MakeMaxEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | max_var | ||
) |
◆ MakeMaximize()
OptimizeVar * MakeMaximize | ( | IntVar *const | v, |
int64 | step | ||
) |
Creates a maximization objective.
◆ MakeMemberCt() [1/2]
Constraint * MakeMemberCt | ( | IntExpr *const | expr, |
const std::vector< int > & | values | ||
) |
◆ MakeMemberCt() [2/2]
Constraint * MakeMemberCt | ( | IntExpr *const | expr, |
const std::vector< int64 > & | values | ||
) |
expr in set.
Propagation is lazy, i.e. this constraint does not creates holes in the domain of the variable.
◆ MakeMin() [1/4]
◆ MakeMin() [2/4]
◆ MakeMin() [3/4]
◆ MakeMin() [4/4]
◆ MakeMinEquality()
Constraint * MakeMinEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | min_var | ||
) |
◆ MakeMinimize()
OptimizeVar * MakeMinimize | ( | IntVar *const | v, |
int64 | step | ||
) |
Creates a minimization objective.
◆ MakeMirrorInterval()
IntervalVar * MakeMirrorInterval | ( | IntervalVar *const | interval_var | ) |
Creates an interval var that is the mirror image of the given one, that is, the interval var obtained by reversing the axis.
◆ MakeModulo() [1/2]
Modulo expression x % mod (with the python convention for modulo).
◆ MakeModulo() [2/2]
Modulo expression x % mod (with the python convention for modulo).
◆ MakeMonotonicElement()
IntExpr * MakeMonotonicElement | ( | IndexEvaluator1 | values, |
bool | increasing, | ||
IntVar *const | index | ||
) |
Function based element.
The constraint takes ownership of the callback. The callback must be monotonic. It must be able to cope with any possible value in the domain of 'index' (potentially negative ones too). Furtermore, monotonicity is not checked. Thus giving a non-monotonic function, or specifying an incorrect increasing parameter will result in undefined behavior.
◆ MakeMoveTowardTargetOperator() [1/2]
LocalSearchOperator * MakeMoveTowardTargetOperator | ( | const Assignment & | target | ) |
Creates a local search operator that tries to move the assignment of some variables toward a target.
The target is given as an Assignment. This operator generates neighbors in which the only difference compared to the current state is that one variable that belongs to the target assignment is set to its target value.
◆ MakeMoveTowardTargetOperator() [2/2]
LocalSearchOperator * MakeMoveTowardTargetOperator | ( | const std::vector< IntVar * > & | variables, |
const std::vector< int64 > & | target_values | ||
) |
Creates a local search operator that tries to move the assignment of some variables toward a target.
The target is given either as two vectors: a vector of variables and a vector of associated target values. The two vectors should be of the same length. This operator generates neighbors in which the only difference compared to the current state is that one variable that belongs to the given vector is set to its target value.
◆ MakeNBestValueSolutionCollector() [1/2]
SolutionCollector * MakeNBestValueSolutionCollector | ( | const Assignment *const | assignment, |
int | solution_count, | ||
bool | maximize | ||
) |
Same as MakeBestValueSolutionCollector but collects the best solution_count solutions.
Collected solutions are sorted in increasing optimality order (the best solution is the last one).
◆ MakeNBestValueSolutionCollector() [2/2]
SolutionCollector * MakeNBestValueSolutionCollector | ( | int | solution_count, |
bool | maximize | ||
) |
◆ MakeNeighborhoodLimit()
LocalSearchOperator * MakeNeighborhoodLimit | ( | LocalSearchOperator *const | op, |
int64 | limit | ||
) |
Creates a local search operator that wraps another local search operator and limits the number of neighbors explored (i.e., calls to MakeNextNeighbor from the current solution (between two calls to Start()).
When this limit is reached, MakeNextNeighbor() returns false. The counter is cleared when Start() is called.
◆ MakeNestedOptimize() [1/6]
DecisionBuilder * MakeNestedOptimize | ( | DecisionBuilder *const | db, |
Assignment *const | solution, | ||
bool | maximize, | ||
int64 | step | ||
) |
NestedOptimize will collapse a search tree described by a decision builder 'db' and a set of monitors and wrap it into a single point.
If there are no solutions to this nested tree, then NestedOptimize will fail. If there are solutions, it will find the best as described by the mandatory objective in the solution as well as the optimization direction, instantiate all variables to this solution, and return nullptr.
◆ MakeNestedOptimize() [2/6]
DecisionBuilder * MakeNestedOptimize | ( | DecisionBuilder *const | db, |
Assignment *const | solution, | ||
bool | maximize, | ||
int64 | step, | ||
const std::vector< SearchMonitor * > & | monitors | ||
) |
◆ MakeNestedOptimize() [3/6]
DecisionBuilder * MakeNestedOptimize | ( | DecisionBuilder *const | db, |
Assignment *const | solution, | ||
bool | maximize, | ||
int64 | step, | ||
SearchMonitor *const | monitor1 | ||
) |
◆ MakeNestedOptimize() [4/6]
DecisionBuilder * MakeNestedOptimize | ( | DecisionBuilder *const | db, |
Assignment *const | solution, | ||
bool | maximize, | ||
int64 | step, | ||
SearchMonitor *const | monitor1, | ||
SearchMonitor *const | monitor2 | ||
) |
◆ MakeNestedOptimize() [5/6]
DecisionBuilder * MakeNestedOptimize | ( | DecisionBuilder *const | db, |
Assignment *const | solution, | ||
bool | maximize, | ||
int64 | step, | ||
SearchMonitor *const | monitor1, | ||
SearchMonitor *const | monitor2, | ||
SearchMonitor *const | monitor3 | ||
) |
◆ MakeNestedOptimize() [6/6]
DecisionBuilder * MakeNestedOptimize | ( | DecisionBuilder *const | db, |
Assignment *const | solution, | ||
bool | maximize, | ||
int64 | step, | ||
SearchMonitor *const | monitor1, | ||
SearchMonitor *const | monitor2, | ||
SearchMonitor *const | monitor3, | ||
SearchMonitor *const | monitor4 | ||
) |
◆ MakeNoCycle() [1/2]
Constraint * MakeNoCycle | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
IndexFilter1 | sink_handler, | ||
bool | assume_paths | ||
) |
◆ MakeNoCycle() [2/2]
Constraint * MakeNoCycle | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
IndexFilter1 | sink_handler = nullptr |
||
) |
Prevent cycles.
The "nexts" variables represent the next in the chain. "active" variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem. A callback can be added to specify sink values (by default sink values are values >= vars.size()). Ownership of the callback is passed to the constraint. If assume_paths is either not specified or true, the constraint assumes the "nexts" variables represent paths (and performs a faster propagation); otherwise the constraint assumes they represent a forest.
◆ MakeNonEquality() [1/3]
Constraint * MakeNonEquality | ( | IntExpr *const | expr, |
int | value | ||
) |
expr != value
◆ MakeNonEquality() [2/3]
Constraint * MakeNonEquality | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr != value
◆ MakeNonEquality() [3/3]
Constraint * MakeNonEquality | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left != right
◆ MakeNonOverlappingBoxesConstraint() [1/3]
Constraint * MakeNonOverlappingBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
const std::vector< int > & | x_size, | ||
const std::vector< int > & | y_size | ||
) |
◆ MakeNonOverlappingBoxesConstraint() [2/3]
Constraint * MakeNonOverlappingBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
const std::vector< int64 > & | x_size, | ||
const std::vector< int64 > & | y_size | ||
) |
◆ MakeNonOverlappingBoxesConstraint() [3/3]
Constraint * MakeNonOverlappingBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
const std::vector< IntVar * > & | x_size, | ||
const std::vector< IntVar * > & | y_size | ||
) |
This constraint states that all the boxes must not overlap.
The coordinates of box i are: (x_vars[i], y_vars[i]), (x_vars[i], y_vars[i] + y_size[i]), (x_vars[i] + x_size[i], y_vars[i]), (x_vars[i] + x_size[i], y_vars[i] + y_size[i]). The sizes must be non-negative. Boxes with a zero dimension can be pushed like any box.
◆ MakeNonOverlappingNonStrictBoxesConstraint() [1/3]
Constraint * MakeNonOverlappingNonStrictBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
const std::vector< int > & | x_size, | ||
const std::vector< int > & | y_size | ||
) |
◆ MakeNonOverlappingNonStrictBoxesConstraint() [2/3]
Constraint * MakeNonOverlappingNonStrictBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
const std::vector< int64 > & | x_size, | ||
const std::vector< int64 > & | y_size | ||
) |
◆ MakeNonOverlappingNonStrictBoxesConstraint() [3/3]
Constraint * MakeNonOverlappingNonStrictBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
const std::vector< IntVar * > & | x_size, | ||
const std::vector< IntVar * > & | y_size | ||
) |
This constraint states that all the boxes must not overlap.
The coordinates of box i are: (x_vars[i], y_vars[i]), (x_vars[i], y_vars[i] + y_size[i]), (x_vars[i] + x_size[i], y_vars[i]), (x_vars[i] + x_size[i], y_vars[i] + y_size[i]). The sizes must be positive. Boxes with a zero dimension can be placed anywhere.
◆ MakeNotBetweenCt()
Constraint * MakeNotBetweenCt | ( | IntExpr *const | expr, |
int64 | l, | ||
int64 | u | ||
) |
(expr < l || expr > u) This constraint is lazy as it will not make holes in the domain of variables.
It will propagate only when expr->Min() >= l or expr->Max() <= u.
◆ MakeNotMemberCt() [1/5]
Constraint * MakeNotMemberCt | ( | IntExpr *const | expr, |
const std::vector< int > & | values | ||
) |
◆ MakeNotMemberCt() [2/5]
Constraint * MakeNotMemberCt | ( | IntExpr *const | expr, |
const std::vector< int64 > & | values | ||
) |
expr not in set.
◆ MakeNotMemberCt() [3/5]
Constraint * MakeNotMemberCt | ( | IntExpr *const | expr, |
std::vector< int > | starts, | ||
std::vector< int > | ends | ||
) |
expr should not be in the list of forbidden intervals [start[i]..end[i]].
◆ MakeNotMemberCt() [4/5]
Constraint * MakeNotMemberCt | ( | IntExpr *const | expr, |
std::vector< int64 > | starts, | ||
std::vector< int64 > | ends | ||
) |
expr should not be in the list of forbidden intervals [start[i]..end[i]].
◆ MakeNotMemberCt() [5/5]
Constraint * MakeNotMemberCt | ( | IntExpr * | expr, |
SortedDisjointIntervalList | intervals | ||
) |
expr should not be in the list of forbidden intervals.
◆ MakeNullIntersect()
Constraint * MakeNullIntersect | ( | const std::vector< IntVar * > & | first_vars, |
const std::vector< IntVar * > & | second_vars | ||
) |
Creates a constraint that states that all variables in the first vector are different from all variables in the second group.
Thus the set of values in the first vector does not intersect with the set of values in the second vector.
◆ MakeNullIntersectExcept()
Constraint * MakeNullIntersectExcept | ( | const std::vector< IntVar * > & | first_vars, |
const std::vector< IntVar * > & | second_vars, | ||
int64 | escape_value | ||
) |
Creates a constraint that states that all variables in the first vector are different from all variables from the second group, unless they are assigned to the escape value.
Thus the set of values in the first vector minus the escape value does not intersect with the set of values in the second vector.
◆ MakeOperator() [1/4]
LocalSearchOperator * MakeOperator | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | secondary_vars, | ||
IndexEvaluator3 | evaluator, | ||
EvaluatorLocalSearchOperators | op | ||
) |
◆ MakeOperator() [2/4]
LocalSearchOperator * MakeOperator | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | secondary_vars, | ||
LocalSearchOperators | op | ||
) |
◆ MakeOperator() [3/4]
LocalSearchOperator * MakeOperator | ( | const std::vector< IntVar * > & | vars, |
IndexEvaluator3 | evaluator, | ||
EvaluatorLocalSearchOperators | op | ||
) |
◆ MakeOperator() [4/4]
LocalSearchOperator * MakeOperator | ( | const std::vector< IntVar * > & | vars, |
LocalSearchOperators | op | ||
) |
Local Search Operators.
◆ MakeOpposite()
◆ MakeOptimize()
OptimizeVar * MakeOptimize | ( | bool | maximize, |
IntVar *const | v, | ||
int64 | step | ||
) |
Creates a objective with a given sense (true = maximization).
◆ MakePack()
This constraint packs all variables onto 'number_of_bins' variables.
For any given variable, a value of 'number_of_bins' indicates that the variable is not assigned to any bin. Dimensions, i.e., cumulative constraints on this packing, can be added directly from the pack class.
◆ MakePathConnected()
Constraint * MakePathConnected | ( | std::vector< IntVar * > | nexts, |
std::vector< int64 > | sources, | ||
std::vector< int64 > | sinks, | ||
std::vector< IntVar * > | status | ||
) |
Constraint enforcing that status[i] is true iff there's a path defined on next variables from sources[i] to sinks[i].
Check whether more propagation is needed.
◆ MakePathCumul() [1/3]
Constraint * MakePathCumul | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
const std::vector< IntVar * > & | cumuls, | ||
const std::vector< IntVar * > & | slacks, | ||
IndexEvaluator2 | transit_evaluator | ||
) |
Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transit_evaluator(i, next[i]) + slacks[i].
Active variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem. Ownership of transit_evaluator is taken and it must be a repeatable callback.
◆ MakePathCumul() [2/3]
Constraint * MakePathCumul | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
const std::vector< IntVar * > & | cumuls, | ||
const std::vector< IntVar * > & | transits | ||
) |
Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transits[i].
Active variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem.
◆ MakePathCumul() [3/3]
Constraint * MakePathCumul | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
const std::vector< IntVar * > & | cumuls, | ||
IndexEvaluator2 | transit_evaluator | ||
) |
Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transit_evaluator(i, next[i]).
Active variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem. Ownership of transit_evaluator is taken and it must be a repeatable callback.
◆ MakePathPrecedenceConstraint() [1/2]
Constraint * MakePathPrecedenceConstraint | ( | std::vector< IntVar * > | nexts, |
const std::vector< std::pair< int, int > > & | precedences | ||
) |
Contraint enforcing, for each pair (i,j) in precedences, i to be before j in paths defined by next variables.
the implementation can easily be modified to do that; evaluate the impact on models solved with local search.
◆ MakePathPrecedenceConstraint() [2/2]
Constraint * MakePathPrecedenceConstraint | ( | std::vector< IntVar * > | nexts, |
const std::vector< std::pair< int, int > > & | precedences, | ||
const std::vector< int > & | lifo_path_starts, | ||
const std::vector< int > & | fifo_path_starts | ||
) |
Same as MakePathPrecedenceConstraint but ensures precedence pairs on some paths follow a LIFO or FIFO order.
LIFO order: given 2 pairs (a,b) and (c,d), if a is before c on the path then d must be before b or b must be before c. FIFO order: given 2 pairs (a,b) and (c,d), if a is before c on the path then b must be before d. LIFO (resp. FIFO) orders are enforced only on paths starting by indices in lifo_path_starts (resp. fifo_path_start).
◆ MakePathTransitPrecedenceConstraint()
Constraint * MakePathTransitPrecedenceConstraint | ( | std::vector< IntVar * > | nexts, |
std::vector< IntVar * > | transits, | ||
const std::vector< std::pair< int, int > > & | precedences | ||
) |
Same as MakePathPrecedenceConstraint but will force i to be before j if the sum of transits on the path from i to j is strictly positive.
◆ MakePhase() [1/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntervalVar * > & | intervals, |
IntervalStrategy | str | ||
) |
Scheduling phases.
◆ MakePhase() [2/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IndexEvaluator1 | var_evaluator, | ||
IndexEvaluator2 | value_evaluator | ||
) |
◆ MakePhase() [3/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IndexEvaluator1 | var_evaluator, | ||
IndexEvaluator2 | value_evaluator, | ||
IndexEvaluator1 | tie_breaker | ||
) |
◆ MakePhase() [4/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IndexEvaluator1 | var_evaluator, | ||
IntValueStrategy | val_str | ||
) |
◆ MakePhase() [5/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IndexEvaluator2 | eval, | ||
EvaluatorStrategy | str | ||
) |
Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator.
The arguments passed to the evaluator callback are the indices of the variables in vars and the values of these variables. Ownership of the callback is passed to the decision builder.
◆ MakePhase() [6/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IndexEvaluator2 | eval, | ||
IndexEvaluator1 | tie_breaker, | ||
EvaluatorStrategy | str | ||
) |
Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator.
In case of tie breaks, the second callback is used to choose the best index in the array of equivalent pairs with equivalent evaluations. The arguments passed to the evaluator callback are the indices of the variables in vars and the values of these variables. Ownership of the callback is passed to the decision builder.
◆ MakePhase() [7/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IntVarStrategy | var_str, | ||
IndexEvaluator2 | value_evaluator | ||
) |
◆ MakePhase() [8/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IntVarStrategy | var_str, | ||
IndexEvaluator2 | value_evaluator, | ||
IndexEvaluator1 | tie_breaker | ||
) |
◆ MakePhase() [9/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IntVarStrategy | var_str, | ||
IntValueStrategy | val_str | ||
) |
Phases on IntVar arrays.
for all other functions that have several homonyms in this .h).
◆ MakePhase() [10/15]
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IntVarStrategy | var_str, | ||
VariableValueComparator | var_val1_val2_comparator | ||
) |
var_val1_val2_comparator(var, val1, val2) is true iff assigning value "val1" to variable "var" is better than assigning value "val2".
◆ MakePhase() [11/15]
DecisionBuilder * MakePhase | ( | const std::vector< SequenceVar * > & | sequences, |
SequenceStrategy | str | ||
) |
◆ MakePhase() [12/15]
DecisionBuilder * MakePhase | ( | IntVar *const | v0, |
IntVar *const | v1, | ||
IntVar *const | v2, | ||
IntVar *const | v3, | ||
IntVarStrategy | var_str, | ||
IntValueStrategy | val_str | ||
) |
◆ MakePhase() [13/15]
DecisionBuilder * MakePhase | ( | IntVar *const | v0, |
IntVar *const | v1, | ||
IntVar *const | v2, | ||
IntVarStrategy | var_str, | ||
IntValueStrategy | val_str | ||
) |
◆ MakePhase() [14/15]
DecisionBuilder * MakePhase | ( | IntVar *const | v0, |
IntVar *const | v1, | ||
IntVarStrategy | var_str, | ||
IntValueStrategy | val_str | ||
) |
◆ MakePhase() [15/15]
DecisionBuilder * MakePhase | ( | IntVar *const | v0, |
IntVarStrategy | var_str, | ||
IntValueStrategy | val_str | ||
) |
Shortcuts for small arrays.
◆ MakePiecewiseLinearExpr()
General piecewise-linear function expression, built from f(x) where f is piecewise-linear.
The resulting expression is f(expr). expressions.
◆ MakePower()
◆ MakePrintModelVisitor()
ModelVisitor * MakePrintModelVisitor | ( | ) |
Prints the model.
◆ MakeProd() [1/2]
◆ MakeProd() [2/2]
◆ MakeRandomLnsOperator() [1/2]
LocalSearchOperator * MakeRandomLnsOperator | ( | const std::vector< IntVar * > & | vars, |
int | number_of_variables | ||
) |
Creates a large neighborhood search operator which creates fragments (set of relaxed variables) with up to number_of_variables random variables (sampling with replacement is performed meaning that at most number_of_variables variables are selected).
Warning: this operator will always return neighbors; using it without a search limit will result in a non-ending search. Optionally a random seed can be specified.
◆ MakeRandomLnsOperator() [2/2]
LocalSearchOperator * MakeRandomLnsOperator | ( | const std::vector< IntVar * > & | vars, |
int | number_of_variables, | ||
int32 | seed | ||
) |
◆ MakeRankFirstInterval()
Decision * MakeRankFirstInterval | ( | SequenceVar *const | sequence, |
int | index | ||
) |
Returns a decision that tries to rank first the ith interval var in the sequence variable.
◆ MakeRankLastInterval()
Decision * MakeRankLastInterval | ( | SequenceVar *const | sequence, |
int | index | ||
) |
Returns a decision that tries to rank last the ith interval var in the sequence variable.
◆ MakeRejectFilter()
LocalSearchFilter * MakeRejectFilter | ( | ) |
◆ MakeRestoreAssignment()
DecisionBuilder * MakeRestoreAssignment | ( | Assignment * | assignment | ) |
Returns a DecisionBuilder which restores an Assignment (calls void Assignment::Restore())
◆ MakeScalProd() [1/2]
scalar product
◆ MakeScalProd() [2/2]
scalar product
◆ MakeScalProdEquality() [1/4]
Constraint * MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefficients, | ||
int64 | cst | ||
) |
◆ MakeScalProdEquality() [2/4]
Constraint * MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefficients, | ||
IntVar *const | target | ||
) |
◆ MakeScalProdEquality() [3/4]
Constraint * MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | coefficients, | ||
int64 | cst | ||
) |
◆ MakeScalProdEquality() [4/4]
Constraint * MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | coefficients, | ||
IntVar *const | target | ||
) |
◆ MakeScalProdGreaterOrEqual() [1/2]
Constraint * MakeScalProdGreaterOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coeffs, | ||
int64 | cst | ||
) |
◆ MakeScalProdGreaterOrEqual() [2/2]
Constraint * MakeScalProdGreaterOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | coeffs, | ||
int64 | cst | ||
) |
◆ MakeScalProdLessOrEqual() [1/2]
Constraint * MakeScalProdLessOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefficients, | ||
int64 | cst | ||
) |
◆ MakeScalProdLessOrEqual() [2/2]
Constraint * MakeScalProdLessOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | coefficients, | ||
int64 | cst | ||
) |
◆ MakeScheduleOrExpedite()
Decision * MakeScheduleOrExpedite | ( | IntervalVar *const | var, |
int64 | est, | ||
int64 *const | marker | ||
) |
Returns a decision that tries to schedule a task at a given time.
On the Apply branch, it will set that interval var as performed and set its end to 'est'. On the Refute branch, it will just update the 'marker' to 'est' - 1. This decision is used in the INTERVAL_SET_TIMES_BACKWARD strategy.
◆ MakeScheduleOrPostpone()
Decision * MakeScheduleOrPostpone | ( | IntervalVar *const | var, |
int64 | est, | ||
int64 *const | marker | ||
) |
Returns a decision that tries to schedule a task at a given time.
On the Apply branch, it will set that interval var as performed and set its start to 'est'. On the Refute branch, it will just update the 'marker' to 'est' + 1. This decision is used in the INTERVAL_SET_TIMES_FORWARD strategy.
◆ MakeSearchLog() [1/7]
SearchMonitor * MakeSearchLog | ( | int | branch_period | ) |
The SearchMonitors below will display a periodic search log on LOG(INFO) every branch_period branches explored.
◆ MakeSearchLog() [2/7]
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
IntVar *const | var | ||
) |
At each solution, this monitor also display the var value.
◆ MakeSearchLog() [3/7]
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
IntVar * | var, | ||
std::function< std::string()> | display_callback | ||
) |
At each solution, this monitor will display the 'var' value and the result of display_callback
.
◆ MakeSearchLog() [4/7]
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
OptimizeVar *const | opt_var | ||
) |
OptimizeVar Search Logs At each solution, this monitor will also display the 'opt_var' value.
◆ MakeSearchLog() [5/7]
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
OptimizeVar *const | opt_var, | ||
std::function< std::string()> | display_callback | ||
) |
Creates a search monitor that will also print the result of the display callback.
◆ MakeSearchLog() [6/7]
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
std::function< std::string()> | display_callback | ||
) |
At each solution, this monitor will also display result of display_callback
.
◆ MakeSearchLog() [7/7]
SearchMonitor * MakeSearchLog | ( | SearchLogParameters | parameters | ) |
◆ MakeSearchTrace()
SearchMonitor * MakeSearchTrace | ( | const std::string & | prefix | ) |
Creates a search monitor that will trace precisely the behavior of the search.
Use this only for low level debugging.
◆ MakeSemiContinuousExpr()
Semi continuous Expression (x <= 0 -> f(x) = 0; x > 0 -> f(x) = ax + b) a >= 0 and b >= 0.
◆ MakeSimulatedAnnealing()
SearchMonitor * MakeSimulatedAnnealing | ( | bool | maximize, |
IntVar *const | v, | ||
int64 | step, | ||
int64 | initial_temperature | ||
) |
Creates a Simulated Annealing monitor.
◆ MakeSolutionsLimit()
RegularLimit * MakeSolutionsLimit | ( | int64 | solutions | ) |
Creates a search limit that constrains the number of solutions found during the search.
◆ MakeSolveOnce() [1/6]
DecisionBuilder * MakeSolveOnce | ( | DecisionBuilder *const | db | ) |
SolveOnce will collapse a search tree described by a decision builder 'db' and a set of monitors and wrap it into a single point.
If there are no solutions to this nested tree, then SolveOnce will fail. If there is a solution, it will find it and returns nullptr.
◆ MakeSolveOnce() [2/6]
DecisionBuilder * MakeSolveOnce | ( | DecisionBuilder *const | db, |
const std::vector< SearchMonitor * > & | monitors | ||
) |
◆ MakeSolveOnce() [3/6]
DecisionBuilder * MakeSolveOnce | ( | DecisionBuilder *const | db, |
SearchMonitor *const | monitor1 | ||
) |
◆ MakeSolveOnce() [4/6]
DecisionBuilder * MakeSolveOnce | ( | DecisionBuilder *const | db, |
SearchMonitor *const | monitor1, | ||
SearchMonitor *const | monitor2 | ||
) |
◆ MakeSolveOnce() [5/6]
DecisionBuilder * MakeSolveOnce | ( | DecisionBuilder *const | db, |
SearchMonitor *const | monitor1, | ||
SearchMonitor *const | monitor2, | ||
SearchMonitor *const | monitor3 | ||
) |
◆ MakeSolveOnce() [6/6]
DecisionBuilder * MakeSolveOnce | ( | DecisionBuilder *const | db, |
SearchMonitor *const | monitor1, | ||
SearchMonitor *const | monitor2, | ||
SearchMonitor *const | monitor3, | ||
SearchMonitor *const | monitor4 | ||
) |
◆ MakeSortingConstraint()
Constraint * MakeSortingConstraint | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | sorted | ||
) |
Creates a constraint binding the arrays of variables "vars" and "sorted_vars": sorted_vars[0] must be equal to the minimum of all variables in vars, and so on: the value of sorted_vars[i] must be equal to the i-th value of variables invars.
This constraint propagates in both directions: from "vars" to "sorted_vars" and vice-versa.
Behind the scenes, this constraint maintains that:
- sorted is always increasing.
- whatever the values of vars, there exists a permutation that injects its values into the sorted variables.
For more info, please have a look at: https://mpi-inf.mpg.de/~mehlhorn/ftp/Mehlhorn-Thiel.pdf
◆ MakeSplitVariableDomain()
◆ MakeSquare()
◆ MakeStatisticsModelVisitor()
ModelVisitor * MakeStatisticsModelVisitor | ( | ) |
Displays some nice statistics on the model.
◆ MakeStoreAssignment()
DecisionBuilder * MakeStoreAssignment | ( | Assignment * | assignment | ) |
Returns a DecisionBuilder which stores an Assignment (calls void Assignment::Store())
◆ MakeStrictDisjunctiveConstraint()
DisjunctiveConstraint * MakeStrictDisjunctiveConstraint | ( | const std::vector< IntervalVar * > & | intervals, |
const std::string & | name | ||
) |
This constraint forces all interval vars into an non-overlapping sequence.
Intervals with zero durations cannot overlap with over intervals.
◆ MakeSubCircuit()
Constraint * MakeSubCircuit | ( | const std::vector< IntVar * > & | nexts | ) |
Force the "nexts" variable to create a complete Hamiltonian path for those that do not loop upon themselves.
◆ MakeSum() [1/3]
◆ MakeSum() [2/3]
◆ MakeSum() [3/3]
◆ MakeSumEquality() [1/2]
Constraint * MakeSumEquality | ( | const std::vector< IntVar * > & | vars, |
int64 | cst | ||
) |
◆ MakeSumEquality() [2/2]
Constraint * MakeSumEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | var | ||
) |
◆ MakeSumGreaterOrEqual()
Constraint * MakeSumGreaterOrEqual | ( | const std::vector< IntVar * > & | vars, |
int64 | cst | ||
) |
◆ MakeSumLessOrEqual()
Constraint * MakeSumLessOrEqual | ( | const std::vector< IntVar * > & | vars, |
int64 | cst | ||
) |
Variation on arrays.
◆ MakeSumObjectiveFilter() [1/2]
IntVarLocalSearchFilter * MakeSumObjectiveFilter | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | secondary_vars, | ||
IndexEvaluator3 | values, | ||
Solver::LocalSearchFilterBound | filter_enum | ||
) |
◆ MakeSumObjectiveFilter() [2/2]
IntVarLocalSearchFilter * MakeSumObjectiveFilter | ( | const std::vector< IntVar * > & | vars, |
IndexEvaluator2 | values, | ||
Solver::LocalSearchFilterBound | filter_enum | ||
) |
◆ MakeSymmetryManager() [1/5]
SearchMonitor * MakeSymmetryManager | ( | const std::vector< SymmetryBreaker * > & | visitors | ) |
Symmetry Breaking.
◆ MakeSymmetryManager() [2/5]
SearchMonitor * MakeSymmetryManager | ( | SymmetryBreaker *const | v1 | ) |
◆ MakeSymmetryManager() [3/5]
SearchMonitor * MakeSymmetryManager | ( | SymmetryBreaker *const | v1, |
SymmetryBreaker *const | v2 | ||
) |
◆ MakeSymmetryManager() [4/5]
SearchMonitor * MakeSymmetryManager | ( | SymmetryBreaker *const | v1, |
SymmetryBreaker *const | v2, | ||
SymmetryBreaker *const | v3 | ||
) |
◆ MakeSymmetryManager() [5/5]
SearchMonitor * MakeSymmetryManager | ( | SymmetryBreaker *const | v1, |
SymmetryBreaker *const | v2, | ||
SymmetryBreaker *const | v3, | ||
SymmetryBreaker *const | v4 | ||
) |
◆ MakeTabuSearch()
SearchMonitor * MakeTabuSearch | ( | bool | maximize, |
IntVar *const | v, | ||
int64 | step, | ||
const std::vector< IntVar * > & | vars, | ||
int64 | keep_tenure, | ||
int64 | forbid_tenure, | ||
double | tabu_factor | ||
) |
MetaHeuristics which try to get the search out of local optima.
Creates a Tabu Search monitor. In the context of local search the behavior is similar to MakeOptimize(), creating an objective in a given sense. The behavior differs once a local optimum is reached: thereafter solutions which degrade the value of the objective are allowed if they are not "tabu". A solution is "tabu" if it doesn't respect the following rules:
- improving the best solution found so far
- variables in the "keep" list must keep their value, variables in the "forbid" list must not take the value they have in the list. Variables with new values enter the tabu lists after each new solution found and leave the lists after a given number of iterations (called tenure). Only the variables passed to the method can enter the lists. The tabu criterion is softened by the tabu factor which gives the number of "tabu" violations which is tolerated; a factor of 1 means no violations allowed; a factor of 0 means all violations are allowed.
◆ MakeTemporalDisjunction() [1/2]
Constraint * MakeTemporalDisjunction | ( | IntervalVar *const | t1, |
IntervalVar *const | t2 | ||
) |
This constraint implements a temporal disjunction between two interval vars.
◆ MakeTemporalDisjunction() [2/2]
Constraint * MakeTemporalDisjunction | ( | IntervalVar *const | t1, |
IntervalVar *const | t2, | ||
IntVar *const | alt | ||
) |
This constraint implements a temporal disjunction between two interval vars t1 and t2.
'alt' indicates which alternative was chosen (alt == 0 is equivalent to t1 before t2).
◆ MakeTimeLimit() [1/2]
RegularLimit * MakeTimeLimit | ( | absl::Duration | time | ) |
Creates a search limit that constrains the running time.
◆ MakeTimeLimit() [2/2]
|
inline |
Definition at line 2211 of file constraint_solver.h.
◆ MakeTransitionConstraint() [1/2]
Constraint * MakeTransitionConstraint | ( | const std::vector< IntVar * > & | vars, |
const IntTupleSet & | transition_table, | ||
int64 | initial_state, | ||
const std::vector< int > & | final_states | ||
) |
This constraint create a finite automaton that will check the sequence of variables vars.
It uses a transition table called 'transition_table'. Each transition is a triple (current_state, variable_value, new_state). The initial state is given, and the set of accepted states is decribed by 'final_states'. These states are hidden inside the constraint. Only the transitions (i.e. the variables) are visible.
◆ MakeTransitionConstraint() [2/2]
Constraint * MakeTransitionConstraint | ( | const std::vector< IntVar * > & | vars, |
const IntTupleSet & | transition_table, | ||
int64 | initial_state, | ||
const std::vector< int64 > & | final_states | ||
) |
This constraint create a finite automaton that will check the sequence of variables vars.
It uses a transition table called 'transition_table'. Each transition is a triple (current_state, variable_value, new_state). The initial state is given, and the set of accepted states is decribed by 'final_states'. These states are hidden inside the constraint. Only the transitions (i.e. the variables) are visible.
◆ MakeTrueConstraint()
Constraint * MakeTrueConstraint | ( | ) |
This constraint always succeeds.
◆ MakeVariableDegreeVisitor()
ModelVisitor * MakeVariableDegreeVisitor | ( | absl::flat_hash_map< const IntVar *, int > *const | map | ) |
Compute the number of constraints a variable is attached to.
◆ MakeVariableDomainFilter()
LocalSearchFilter * MakeVariableDomainFilter | ( | ) |
◆ MakeVariableGreaterOrEqualValue()
◆ MakeVariableLessOrEqualValue()
◆ MakeWeightedMaximize() [1/2]
OptimizeVar * MakeWeightedMaximize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int > & | weights, | ||
int64 | step | ||
) |
Creates a maximization weigthed objective.
◆ MakeWeightedMaximize() [2/2]
OptimizeVar * MakeWeightedMaximize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int64 > & | weights, | ||
int64 | step | ||
) |
Creates a maximization weigthed objective.
◆ MakeWeightedMinimize() [1/2]
OptimizeVar * MakeWeightedMinimize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int > & | weights, | ||
int64 | step | ||
) |
Creates a minimization weighted objective.
The actual objective is scalar_prod(sub_objectives, weights).
◆ MakeWeightedMinimize() [2/2]
OptimizeVar * MakeWeightedMinimize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int64 > & | weights, | ||
int64 | step | ||
) |
Creates a minimization weighted objective.
The actual objective is scalar_prod(sub_objectives, weights).
◆ MakeWeightedOptimize() [1/2]
OptimizeVar * MakeWeightedOptimize | ( | bool | maximize, |
const std::vector< IntVar * > & | sub_objectives, | ||
const std::vector< int > & | weights, | ||
int64 | step | ||
) |
Creates a weighted objective with a given sense (true = maximization).
◆ MakeWeightedOptimize() [2/2]
OptimizeVar * MakeWeightedOptimize | ( | bool | maximize, |
const std::vector< IntVar * > & | sub_objectives, | ||
const std::vector< int64 > & | weights, | ||
int64 | step | ||
) |
Creates a weighted objective with a given sense (true = maximization).
◆ MemoryUsage()
|
static |
Current memory usage in bytes.
◆ model_name()
std::string model_name | ( | ) | const |
Returns the name of the model.
◆ MultiArmedBanditConcatenateOperators()
LocalSearchOperator * MultiArmedBanditConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
double | memory_coefficient, | ||
double | exploration_coefficient, | ||
bool | maximize | ||
) |
Creates a local search operator which concatenates a vector of operators.
Uses Multi-Armed Bandit approach for choosing the next operator to use. Sorts operators based on Upper Confidence Bound Algorithm which evaluates each operator as sum of average improvement and exploration function.
Updates the order of operators when accepts a neighbor with objective improvement.
◆ NameAllVariables()
bool NameAllVariables | ( | ) | const |
Returns whether all variables should be named.
◆ neighbors()
|
inline |
The number of neighbors created.
Definition at line 1002 of file constraint_solver.h.
◆ NewSearch() [1/6]
void NewSearch | ( | DecisionBuilder *const | db | ) |
◆ NewSearch() [2/6]
void NewSearch | ( | DecisionBuilder *const | db, |
const std::vector< SearchMonitor * > & | monitors | ||
) |
Decomposed search. The code for a top level search should look like solver->NewSearch(db); while (solver->NextSolution()) { //.. use the current solution } solver()->EndSearch();
◆ NewSearch() [3/6]
void NewSearch | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1 | ||
) |
◆ NewSearch() [4/6]
void NewSearch | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2 | ||
) |
◆ NewSearch() [5/6]
void NewSearch | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3 | ||
) |
◆ NewSearch() [6/6]
void NewSearch | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3, | ||
SearchMonitor *const | m4 | ||
) |
◆ NextSolution()
bool NextSolution | ( | ) |
◆ Now()
absl::Time Now | ( | ) | const |
The 'absolute time' as seen by the solver.
Unless a user-provided clock was injected via SetClock() (eg. for unit tests), this is a real walltime, shifted so that it was 0 at construction. All so-called "walltime" limits are relative to this time.
◆ optimization_direction()
|
inline |
The direction of optimization, getter and setter.
Definition at line 1018 of file constraint_solver.h.
◆ parameters()
|
inline |
Stored Parameters.
Definition at line 768 of file constraint_solver.h.
◆ PopState()
void PopState | ( | ) |
◆ PushState()
void PushState | ( | ) |
The PushState and PopState methods manipulates the states of the reversible objects.
They are visible only because they are useful to write unitary tests.
◆ Rand32()
|
inline |
Returns a random value between 0 and 'size' - 1;.
Definition at line 2834 of file constraint_solver.h.
◆ Rand64()
|
inline |
Returns a random value between 0 and 'size' - 1;.
Definition at line 2828 of file constraint_solver.h.
◆ RandomConcatenateOperators() [1/2]
LocalSearchOperator * RandomConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops | ) |
Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor().
◆ RandomConcatenateOperators() [2/2]
LocalSearchOperator * RandomConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
int32 | seed | ||
) |
Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor().
The provided seed is used to initialize the random number generator.
◆ RegisterDemon()
Adds a new demon and wraps it inside a DemonProfiler if necessary.
◆ RegisterIntervalVar()
IntervalVar * RegisterIntervalVar | ( | IntervalVar *const | var | ) |
Registers a new IntervalVar and wraps it inside a TraceIntervalVar if necessary.
◆ RegisterIntExpr()
Registers a new IntExpr and wraps it inside a TraceIntExpr if necessary.
◆ RegisterIntVar()
Registers a new IntVar and wraps it inside a TraceIntVar if necessary.
◆ ReSeed()
|
inline |
Reseed the solver random generator.
Definition at line 2840 of file constraint_solver.h.
◆ RestartCurrentSearch()
void RestartCurrentSearch | ( | ) |
◆ RestartSearch()
void RestartSearch | ( | ) |
◆ RevAlloc()
|
inline |
Registers the given object as being reversible.
By calling this method, the caller gives ownership of the object to the solver, which will delete it when there is a backtrack out of the current state.
Returns the argument for convenience: this way, the caller may directly invoke a constructor in the argument, without having to store the pointer first.
This function is only for users that define their own subclasses of BaseObject: for all subclasses predefined in the library, the corresponding factory methods (e.g., MakeIntVar(...), MakeAllDifferent(...) already take care of the registration.
Definition at line 796 of file constraint_solver.h.
◆ RevAllocArray()
|
inline |
Like RevAlloc() above, but for an array of objects: the array must have been allocated with the new[] operator.
The entire array will be deleted when backtracking out of the current state.
This method is valid for arrays of int, int64, uint64, bool, BaseObject*, IntVar*, IntExpr*, and Constraint*.
Definition at line 807 of file constraint_solver.h.
◆ SaveAndAdd()
|
inline |
All-in-one SaveAndAdd_value.
Definition at line 2820 of file constraint_solver.h.
◆ SaveAndSetValue()
|
inline |
All-in-one SaveAndSetValue.
Definition at line 2811 of file constraint_solver.h.
◆ SaveValue()
|
inline |
reversibility
SaveValue() saves the value of the corresponding object. It must be called before modifying the object. The value will be restored upon backtrack.
Definition at line 779 of file constraint_solver.h.
◆ SearchContext() [1/2]
std::string SearchContext | ( | ) | const |
◆ SearchContext() [2/2]
std::string SearchContext | ( | const Search * | search | ) | const |
◆ SearchDepth()
int SearchDepth | ( | ) | const |
Gets the search depth of the current active search.
Returns -1 if there is no active search opened.
◆ SearchLeftDepth()
int SearchLeftDepth | ( | ) | const |
Gets the search left depth of the current active search.
Returns -1 if there is no active search opened.
◆ set_fail_intercept()
|
inline |
Internal.
Definition at line 2874 of file constraint_solver.h.
◆ set_optimization_direction()
|
inline |
Definition at line 1021 of file constraint_solver.h.
◆ SetBranchSelector()
void SetBranchSelector | ( | BranchSelector | bs | ) |
Sets the given branch selector on the current active search.
◆ SetSearchContext()
void SetSearchContext | ( | Search * | search, |
const std::string & | search_context | ||
) |
◆ SetUseFastLocalSearch()
|
inline |
enabled for metaheuristics.
Disables/enables fast local search.
Definition at line 2884 of file constraint_solver.h.
◆ ShouldFail()
|
inline |
These methods are only useful for the SWIG wrappers, which need a way to externally cause the Solver to fail.
Definition at line 2985 of file constraint_solver.h.
◆ solutions()
int64 solutions | ( | ) | const |
The number of solutions found since the start of the search.
◆ Solve() [1/6]
bool Solve | ( | DecisionBuilder *const | db | ) |
◆ Solve() [2/6]
bool Solve | ( | DecisionBuilder *const | db, |
const std::vector< SearchMonitor * > & | monitors | ||
) |
Solves the problem using the given DecisionBuilder and returns true if a solution was found and accepted.
These methods are the ones most users should use to search for a solution. Note that the definition of 'solution' is subtle. A solution here is defined as a leaf of the search tree with respect to the given decision builder for which there is no failure. What this means is that, contrary to intuition, a solution may not have all variables of the model bound. It is the responsibility of the decision builder to keep returning decisions until all variables are indeed bound. The most extreme counterexample is calling Solve with a trivial decision builder whose Next() method always returns nullptr. In this case, Solve immediately returns 'true', since not assigning any variable to any value is a solution, unless the root node propagation discovers that the model is infeasible.
This function must be called either from outside of search, or from within the Next() method of a decision builder.
Solve will terminate whenever any of the following event arise:
- A search monitor asks the solver to terminate the search by calling solver()->FinishCurrentSearch().
- A solution is found that is accepted by all search monitors, and none of the search monitors decides to search for another one.
Upon search termination, there will be a series of backtracks all the way to the top level. This means that a user cannot expect to inspect the solution by querying variables after a call to Solve(): all the information will be lost. In order to do something with the solution, the user must either:
- Use a search monitor that can process such a leaf. See, in particular, the SolutionCollector class.
- Do not use Solve. Instead, use the more fine-grained approach using methods NewSearch(...), NextSolution(), and EndSearch().
- Parameters
-
db The decision builder that will generate the search tree. monitors A vector of search monitors that will be notified of various events during the search. In their reaction to these events, such monitors may influence the search.
◆ Solve() [3/6]
bool Solve | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1 | ||
) |
◆ Solve() [4/6]
bool Solve | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2 | ||
) |
◆ Solve() [5/6]
bool Solve | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3 | ||
) |
◆ Solve() [6/6]
bool Solve | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3, | ||
SearchMonitor *const | m4 | ||
) |
◆ SolveAndCommit() [1/5]
bool SolveAndCommit | ( | DecisionBuilder *const | db | ) |
◆ SolveAndCommit() [2/5]
bool SolveAndCommit | ( | DecisionBuilder *const | db, |
const std::vector< SearchMonitor * > & | monitors | ||
) |
SolveAndCommit using a decision builder and up to three search monitors, usually one for the objective, one for the limits and one to collect solutions.
The difference between a SolveAndCommit() and a Solve() method call is the fact that SolveAndCommit will not backtrack all modifications at the end of the search. This method is only usable during the Next() method of a decision builder.
◆ SolveAndCommit() [3/5]
bool SolveAndCommit | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1 | ||
) |
◆ SolveAndCommit() [4/5]
bool SolveAndCommit | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2 | ||
) |
◆ SolveAndCommit() [5/5]
bool SolveAndCommit | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3 | ||
) |
◆ SolveDepth()
int SolveDepth | ( | ) | const |
Gets the number of nested searches.
It returns 0 outside search, 1 during the top level search, 2 or more in case of nested searches.
◆ stamp()
uint64 stamp | ( | ) | const |
The stamp indicates how many moves in the search tree we have performed.
It is useful to detect if we need to update same lazy structures.
◆ state()
|
inline |
State of the solver.
Definition at line 957 of file constraint_solver.h.
◆ TopPeriodicCheck()
void TopPeriodicCheck | ( | ) |
Performs PeriodicCheck on the top-level search; for instance, can be called from a nested solve to check top-level limits.
◆ TopProgressPercent()
int TopProgressPercent | ( | ) |
Returns a percentage representing the propress of the search before reaching the limits of the top-level search (can be called from a nested solve).
◆ Try() [1/4]
DecisionBuilder * Try | ( | const std::vector< DecisionBuilder * > & | dbs | ) |
◆ Try() [2/4]
DecisionBuilder * Try | ( | DecisionBuilder *const | db1, |
DecisionBuilder *const | db2 | ||
) |
Creates a decision builder which will create a search tree where each decision builder is called from the top of the search tree.
For instance the decision builder Try(db1, db2) will entirely explore the search tree of db1 then the one of db2, resulting in the following search tree: Tree root | / \ | db1 tree db2 tree |
This is very handy to try a decision builder which partially explores the search space and if it fails to try another decision builder. "Try"-builders "recursively". For instance, Try(a,b,c,d) will give a tree unbalanced to the right, whereas Try(Try(a,b), Try(b,c)) will give a balanced tree. Investigate if we should only provide the binary version and/or if we should balance automatically.
◆ Try() [3/4]
DecisionBuilder * Try | ( | DecisionBuilder *const | db1, |
DecisionBuilder *const | db2, | ||
DecisionBuilder *const | db3 | ||
) |
◆ Try() [4/4]
DecisionBuilder * Try | ( | DecisionBuilder *const | db1, |
DecisionBuilder *const | db2, | ||
DecisionBuilder *const | db3, | ||
DecisionBuilder *const | db4 | ||
) |
◆ unchecked_solutions()
int64 unchecked_solutions | ( | ) | const |
The number of unchecked solutions found by local search.
◆ UseFastLocalSearch()
|
inline |
Returns true if fast local search is enabled.
Definition at line 2888 of file constraint_solver.h.
◆ wall_time()
int64 wall_time | ( | ) | const |
DEPRECATED: Use Now() instead.
Time elapsed, in ms since the creation of the solver.
Member Data Documentation
◆ kNumPriorities
|
staticconstexpr |
Number of priorities for demons.
Definition at line 270 of file constraint_solver.h.
◆ tmp_vector_
std::vector<int64> tmp_vector_ |
Unsafe temporary vector.
It is used to avoid leaks in operations that need storage and that may fail. See IntVar::SetValues() for instance. It is not locked; do not use in a multi-threaded or reentrant setup.
Definition at line 2940 of file constraint_solver.h.
The documentation for this class was generated from the following file: