![]() |
OR-Tools
8.2
|
Solver Class.
A solver represents the main computation engine. It implements the entire range of Constraint Programming protocols:
Usually, Constraint Programming code consists of
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 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... | |
Definition at line 759 of file constraint_solver.h.
typedef std::function<DecisionModification()> BranchSelector |
Definition at line 757 of file constraint_solver.h.
typedef std::function<void()> Closure |
Definition at line 760 of file constraint_solver.h.
typedef std::function<int64(int64)> IndexEvaluator1 |
Callback typedefs.
Definition at line 743 of file constraint_solver.h.
typedef std::function<int64(int64, int64)> IndexEvaluator2 |
Definition at line 744 of file constraint_solver.h.
typedef std::function<int64(int64, int64, int64)> IndexEvaluator3 |
Definition at line 745 of file constraint_solver.h.
typedef std::function<bool(int64)> IndexFilter1 |
Definition at line 747 of file constraint_solver.h.
typedef std::function<IntVar*(int64)> Int64ToIntVar |
Definition at line 749 of file constraint_solver.h.
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.
typedef std::function<bool(int64, int64, int64)> VariableValueComparator |
Definition at line 756 of file constraint_solver.h.
typedef std::function<int64(const IntVar* v, int64 id)> VariableValueSelector |
Definition at line 755 of file constraint_solver.h.
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.
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.
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.
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.
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.
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.
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.
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.
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.
enum LocalSearchOperators |
This enum is used in Solver::MakeOperator to specify the neighborhood to create.
Enumerator | |
---|---|
TWOOPT | Operator which reverses a sub-chain of a path. It is called TwoOpt because it breaks two arcs on the path; resulting paths are called two-optimal. Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5 (where (1, 5) are first and last nodes of the path and can therefore not be moved): 1 -> [3 -> 2] -> 4 -> 5 1 -> [4 -> 3 -> 2] -> 5 1 -> 2 -> [4 -> 3] -> 5 |
OROPT | Relocate: OROPT and RELOCATE. Operator which moves a sub-chain of a path to another position; the specified chain length is the fixed length of the chains being moved. When this length is 1, the operator simply moves a node to another position. Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5, for a chain length of 2 (where (1, 5) are first and last nodes of the path and can therefore not be moved): 1 -> 4 -> [2 -> 3] -> 5 1 -> [3 -> 4] -> 2 -> 5 Using Relocate with chain lengths of 1, 2 and 3 together is equivalent to the OrOpt operator on a path. The OrOpt operator is a limited version of 3Opt (breaks 3 arcs on a path). |
RELOCATE | Relocate neighborhood with length of 1 (see OROPT comment). |
EXCHANGE | Operator which exchanges the positions of two nodes. Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5 (where (1, 5) are first and last nodes of the path and can therefore not be moved): 1 -> [3] -> [2] -> 4 -> 5 1 -> [4] -> 3 -> [2] -> 5 1 -> 2 -> [4] -> [3] -> 5 |
CROSS | Operator which cross exchanges the starting chains of 2 paths, including exchanging the whole paths. First and last nodes are not moved. Possible neighbors for the paths 1 -> 2 -> 3 -> 4 -> 5 and 6 -> 7 -> 8 (where (1, 5) and (6, 8) are first and last nodes of the paths and can therefore not be moved): 1 -> [7] -> 3 -> 4 -> 5 6 -> [2] -> 8 1 -> [7] -> 4 -> 5 6 -> [2 -> 3] -> 8 1 -> [7] -> 5 6 -> [2 -> 3 -> 4] -> 8 |
MAKEACTIVE | Operator which inserts an inactive node into a path. Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive (where 1 and 4 are first and last nodes of the path) are: 1 -> [5] -> 2 -> 3 -> 4 1 -> 2 -> [5] -> 3 -> 4 1 -> 2 -> 3 -> [5] -> 4 |
MAKEINACTIVE | Operator which makes path nodes inactive. Possible neighbors for the path 1 -> 2 -> 3 -> 4 (where 1 and 4 are first and last nodes of the path) are: 1 -> 3 -> 4 with 2 inactive 1 -> 2 -> 4 with 3 inactive |
MAKECHAININACTIVE | Operator which makes a "chain" of path nodes inactive. Possible neighbors for the path 1 -> 2 -> 3 -> 4 (where 1 and 4 are first and last nodes of the path) are: 1 -> 3 -> 4 with 2 inactive 1 -> 2 -> 4 with 3 inactive 1 -> 4 with 2 and 3 inactive |
SWAPACTIVE | Operator which replaces an active node by an inactive one. Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive (where 1 and 4 are first and last nodes of the path) are: 1 -> [5] -> 3 -> 4 with 2 inactive 1 -> 2 -> [5] -> 4 with 3 inactive |
EXTENDEDSWAPACTIVE | Operator which makes an inactive node active and an active one inactive. It is similar to SwapActiveOperator except that it tries to insert the inactive node in all possible positions instead of just the position of the node made inactive. Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive (where 1 and 4 are first and last nodes of the path) are: 1 -> [5] -> 3 -> 4 with 2 inactive 1 -> 3 -> [5] -> 4 with 2 inactive 1 -> [5] -> 2 -> 4 with 3 inactive 1 -> 2 -> [5] -> 4 with 3 inactive |
PATHLNS | Operator which relaxes two sub-chains of three consecutive arcs each. Each sub-chain is defined by a start node and the next three arcs. Those six arcs are relaxed to build a new neighbor. PATHLNS explores all possible pairs of starting nodes and so defines n^2 neighbors, n being the number of nodes. Note that the two sub-chains can be part of the same path; they even may overlap. |
FULLPATHLNS | Operator which relaxes one entire path and all inactive nodes, thus defining num_paths neighbors. |
UNACTIVELNS | Operator which relaxes all inactive nodes and one sub-chain of six consecutive arcs. That way the path can be improved by inserting inactive nodes or swapping arcs. |
INCREMENT | Operator which defines one neighbor per variable. Each neighbor tries to increment by one the value of the corresponding variable. When a new solution is found the neighborhood is rebuilt from scratch, i.e., tries to increment values in the variable order. Consider for instance variables x and y. x is incremented one by one to its max, and when it is not possible to increment x anymore, y is incremented once. If this is a solution, then next neighbor tries to increment x. |
DECREMENT | Operator which defines a neighborhood to decrement values. The behavior is the same as INCREMENT, except values are decremented instead of incremented. |
SIMPLELNS | Operator which defines one neighbor per variable. Each neighbor relaxes one variable. When a new solution is found the neighborhood is rebuilt from scratch. Consider for instance variables x and y. First x is relaxed and the solver is looking for the best possible solution (with only x relaxed). Then y is relaxed, and the solver is looking for a new solution. If a new solution is found, then the next variable to be relaxed is x. |
Definition at line 434 of file constraint_solver.h.
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.
Optimization directions.
Enumerator | |
---|---|
NOT_SET | |
MAXIMIZATION | |
MINIMIZATION |
Definition at line 740 of file constraint_solver.h.
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.
enum SolverState |
This enum represents the state of the solver w.r.t. the search.
Definition at line 724 of file constraint_solver.h.
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.
|
explicit |
Solver API.
Definition at line 1417 of file constraint_solver.cc.
Solver | ( | const std::string & | name, |
const ConstraintSolverParameters & | parameters | ||
) |
Definition at line 1406 of file constraint_solver.cc.
~Solver | ( | ) |
Definition at line 1471 of file constraint_solver.cc.
void Accept | ( | ModelVisitor *const | visitor | ) | const |
Accepts the given model visitor.
Definition at line 1693 of file constraint_solver.cc.
|
inline |
The number of accepted neighbors.
Definition at line 1008 of file constraint_solver.h.
Search * ActiveSearch | ( | ) | const |
Returns the active search, nullptr outside search.
Definition at line 1127 of file constraint_solver.cc.
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.
Definition at line 1589 of file constraint_solver.cc.
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.
Definition at line 1681 of file constraint_solver.cc.
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:
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.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(...));
Definition at line 1657 of file constraint_solver.cc.
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.
Definition at line 3206 of file constraint_solver.cc.
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.
Definition at line 3129 of file constraint_solver.cc.
|
inline |
Definition at line 2870 of file constraint_solver.h.
|
inline |
The number of branches explored since the creation of the solver.
Definition at line 987 of file constraint_solver.h.
ModelCache * Cache | ( | ) | const |
Returns the cache of the model.
Definition at line 849 of file model_cache.cc.
!defined(SWIG)
Internal. If the variables is the result of expr->Var(), this method returns expr, nullptr otherwise.
Definition at line 2437 of file constraint_solver.cc.
bool CheckAssignment | ( | Assignment *const | solution | ) |
Checks whether the given assignment satisfies all relevant constraints.
Definition at line 2293 of file constraint_solver.cc.
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.
Definition at line 2372 of file constraint_solver.cc.
|
inline |
Definition at line 2986 of file constraint_solver.h.
|
inline |
Definition at line 2878 of file constraint_solver.h.
|
inline |
Clears the local search state.
Definition at line 2934 of file constraint_solver.h.
DecisionBuilder * Compose | ( | const std::vector< DecisionBuilder * > & | dbs | ) |
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 |
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 | ||
) |
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].
Definition at line 2015 of file local_search.cc.
LocalSearchOperator * ConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
bool | restart | ||
) |
Definition at line 2020 of file local_search.cc.
LocalSearchOperator * ConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
std::function< int64(int, int)> | evaluator | ||
) |
Definition at line 2032 of file local_search.cc.
|
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.
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.
Definition at line 1746 of file constraint_solver.cc.
std::string DebugString | ( | ) | const |
|
static |
Create a ConstraintSolverParameters proto with all the default values.
Definition at line 118 of file constraint_solver.cc.
|
inline |
Access to demon profiler.
Definition at line 2880 of file constraint_solver.h.
|
inline |
The number of demons executed during search for a given priority.
Definition at line 996 of file constraint_solver.h.
void EndSearch | ( | ) |
Definition at line 2263 of file constraint_solver.cc.
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.
Definition at line 430 of file demon_profiler.cc.
void Fail | ( | ) |
Abandon the current branch in the search tree. A backtrack will follow.
Definition at line 2416 of file constraint_solver.cc.
uint64 fail_stamp | ( | ) | const |
The fail_stamp() is incremented after each backtrack.
Definition at line 1645 of file constraint_solver.cc.
|
inline |
The number of failures encountered since the creation of the solver.
Definition at line 999 of file constraint_solver.h.
|
inline |
The number of filtered neighbors (neighbors accepted by filters).
Definition at line 1005 of file constraint_solver.h.
void FinishCurrentSearch | ( | ) |
Tells the solver to kill or restart the current search.
Definition at line 2427 of file constraint_solver.cc.
ConstraintSolverStatistics GetConstraintSolverStatistics | ( | ) | const |
Returns detailed cp search statistics.
Definition at line 1546 of file constraint_solver.cc.
LocalSearchMonitor * GetLocalSearchMonitor | ( | ) | const |
Returns the local search monitor.
Definition at line 3211 of file constraint_solver.cc.
LocalSearchStatistics GetLocalSearchStatistics | ( | ) | const |
Returns detailed local search statistics.
Definition at line 3850 of file local_search.cc.
Assignment * GetOrCreateLocalSearchState | ( | ) |
Returns (or creates) an assignment representing the state of local search.
Definition at line 3228 of file constraint_solver.cc.
PropagationMonitor * GetPropagationMonitor | ( | ) | const |
Returns the propagation monitor.
Definition at line 3134 of file constraint_solver.cc.
bool HasName | ( | const PropagationBaseObject * | object | ) | const |
Returns whether the object has been named or not.
Definition at line 2485 of file constraint_solver.cc.
bool InstrumentsDemons | ( | ) | const |
Returns whether we are instrumenting demons.
Definition at line 169 of file constraint_solver.cc.
bool InstrumentsVariables | ( | ) | const |
Returns whether we are tracing variables.
Definition at line 183 of file constraint_solver.cc.
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).
Definition at line 7443 of file expressions.cc.
bool IsLocalSearchProfilingEnabled | ( | ) | const |
Returns whether we are profiling local search.
Definition at line 178 of file constraint_solver.cc.
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.
Definition at line 7461 of file expressions.cc.
bool IsProfilingEnabled | ( | ) | const |
Returns whether we are profiling the solver.
Definition at line 173 of file constraint_solver.cc.
std::string LocalSearchProfile | ( | ) | const |
Returns local search profiling information in a human readable format.
Definition at line 3843 of file local_search.cc.
|expr|
Definition at line 6984 of file expressions.cc.
Constraint * MakeAbsEquality | ( | IntVar *const | var, |
IntVar *const | abs_var | ||
) |
Creates the constraint abs(var) == abs_var.
Definition at line 6977 of file expressions.cc.
LocalSearchFilter * MakeAcceptFilter | ( | ) |
Local Search Filters.
Definition at line 2537 of file local_search.cc.
Demon * MakeActionDemon | ( | Solver::Action | action | ) |
Creates a demon from a callback.
Definition at line 507 of file constraints.cc.
Constraint * MakeAllDifferent | ( | const std::vector< IntVar * > & | vars | ) |
All variables are pairwise different.
This corresponds to the stronger version of the propagation algorithm.
Definition at line 690 of file alldiff_cst.cc.
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.
Definition at line 694 of file alldiff_cst.cc.
Constraint * MakeAllDifferentExcept | ( | const std::vector< IntVar * > & | vars, |
int64 | escape_value | ||
) |
All variables are pairwise different, unless they are assigned to the escape value.
Definition at line 720 of file alldiff_cst.cc.
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.
Definition at line 1251 of file constraint_solver/table.cc.
SolutionCollector * MakeAllSolutionCollector | ( | ) |
SolutionCollector * MakeAllSolutionCollector | ( | const Assignment *const | assignment | ) |
DecisionBuilder * MakeApplyBranchSelector | ( | BranchSelector | bs | ) |
Creates a decision builder that will set the branch selector.
Definition at line 1167 of file constraint_solver.cc.
Assignment * MakeAssignment | ( | ) |
This method creates an empty assignment.
Definition at line 1037 of file constraint_solver/assignment.cc.
Assignment * MakeAssignment | ( | const Assignment *const | a | ) |
This method creates an assignment which is a copy of 'a'.
Definition at line 1039 of file constraint_solver/assignment.cc.
Constraint * MakeAtMost | ( | std::vector< IntVar * > | vars, |
int64 | value, | ||
int64 | max_count | ||
) |
|{i | vars[i] == value}| <= max_count
Definition at line 955 of file count_cst.cc.
SearchMonitor * MakeAtSolutionCallback | ( | std::function< void()> | callback | ) |
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.
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).
Constraint * MakeBetweenCt | ( | IntExpr *const | expr, |
int64 | l, | ||
int64 | u | ||
) |
(l <= expr <= u)
Definition at line 920 of file expr_cst.cc.
IntVar * MakeBoolVar | ( | ) |
MakeBoolVar will create a variable with a {0, 1} domain.
Definition at line 6379 of file expressions.cc.
IntVar * MakeBoolVar | ( | const std::string & | name | ) |
MakeBoolVar will create a variable with a {0, 1} domain.
Definition at line 6375 of file expressions.cc.
IntVar ** MakeBoolVarArray | ( | int | var_count, |
const std::string & | name | ||
) |
Same but allocates an array and returns it.
Definition at line 6516 of file expressions.cc.
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.
Definition at line 6503 of file expressions.cc.
void MakeBoolVarArray | ( | int | var_count, |
std::vector< IntVar * > * | vars | ||
) |
This method will append the vector vars with 'var_count' boolean variables having no names.
Definition at line 6510 of file expressions.cc.
RegularLimit * MakeBranchesLimit | ( | int64 | branches | ) |
Constraint * MakeCircuit | ( | const std::vector< IntVar * > & | nexts | ) |
Force the "nexts" variable to create a complete Hamiltonian path.
Definition at line 638 of file graph_constraints.cc.
Demon * MakeClosureDemon | ( | Solver::Closure | closure | ) |
IntExpr * MakeConditionalExpression | ( | IntVar *const | condition, |
IntExpr *const | expr, | ||
int64 | unperformed_value | ||
) |
Conditional Expr condition ? expr : unperformed_value.
Definition at line 7216 of file expressions.cc.
SearchMonitor * MakeConstantRestart | ( | int | frequency | ) |
DecisionBuilder * MakeConstraintAdder | ( | Constraint *const | ct | ) |
Returns a decision builder that will add the given constraint to the model.
Definition at line 2368 of file constraint_solver.cc.
Demon * MakeConstraintInitialPropagateCallback | ( | Constraint *const | ct | ) |
This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct'.
Definition at line 33 of file constraints.cc.
IntExpr * MakeConvexPiecewiseExpr | ( | IntExpr * | expr, |
int64 | early_cost, | ||
int64 | early_date, | ||
int64 | late_date, | ||
int64 | late_cost | ||
) |
Convex piecewise function.
Definition at line 7129 of file expressions.cc.
Constraint * MakeCount | ( | const std::vector< IntVar * > & | vars, |
int64 | value, | ||
int64 | max_count | ||
) |
|{i | vars[i] == value}| == max_count
Definition at line 30 of file count_cst.cc.
Constraint * MakeCount | ( | const std::vector< IntVar * > & | vars, |
int64 | value, | ||
IntVar *const | max_count | ||
) |
|{i | vars[i] == value}| == max_count
Definition at line 45 of file count_cst.cc.
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.
Definition at line 585 of file sched_constraints.cc.
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.
Definition at line 2600 of file resource.cc.
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.
Definition at line 2618 of file resource.cc.
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.
Definition at line 2586 of file resource.cc.
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.
Definition at line 2606 of file resource.cc.
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.
Definition at line 2627 of file resource.cc.
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.
Definition at line 2645 of file resource.cc.
SearchLimit * MakeCustomLimit | ( | std::function< bool()> | limiter | ) |
DecisionBuilder * MakeDecisionBuilderFromAssignment | ( | Assignment *const | assignment, |
DecisionBuilder *const | db, | ||
const std::vector< IntVar * > & | vars | ||
) |
DecisionBuilder * MakeDefaultPhase | ( | const std::vector< IntVar * > & | vars | ) |
Definition at line 1110 of file default_search.cc.
DecisionBuilder * MakeDefaultPhase | ( | const std::vector< IntVar * > & | vars, |
const DefaultPhaseParameters & | parameters | ||
) |
Definition at line 1115 of file default_search.cc.
RegularLimitParameters MakeDefaultRegularLimitParameters | ( | ) | const |
SolutionPool * MakeDefaultSolutionPool | ( | ) |
Solution Pool.
Definition at line 4769 of file local_search.cc.
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.
Definition at line 38 of file constraints.cc.
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.
Definition at line 1325 of file graph_constraints.cc.
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.
Definition at line 411 of file deviation.cc.
value - expr
Definition at line 6674 of file expressions.cc.
left - right
Definition at line 6634 of file expressions.cc.
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.
Definition at line 2574 of file resource.cc.
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]
Definition at line 1052 of file count_cst.cc.
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]
Definition at line 1075 of file count_cst.cc.
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].
Definition at line 993 of file count_cst.cc.
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]
Definition at line 1032 of file count_cst.cc.
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]
Definition at line 1058 of file count_cst.cc.
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].
Definition at line 964 of file count_cst.cc.
Constraint * MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | cards | ||
) |
Aggregated version of count: |{i | v[i] == j}| == cards[j].
Definition at line 999 of file count_cst.cc.
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
Definition at line 1013 of file count_cst.cc.
expr / value (integer division)
Definition at line 6956 of file expressions.cc.
numerator / denominator (integer division). Terms need to be positive.
Definition at line 6918 of file expressions.cc.
values[index]
Definition at line 657 of file element.cc.
values[index]
Definition at line 647 of file element.cc.
vars[expr]
Definition at line 1605 of file element.cc.
IntExpr * MakeElement | ( | Solver::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).
Definition at line 852 of file element.cc.
IntExpr * MakeElement | ( | Solver::IndexEvaluator2 | values, |
IntVar *const | index1, | ||
IntVar *const | index2 | ||
) |
2D version of function-based element expression, values(expr1, expr2).
Definition at line 1102 of file element.cc.
IntExpr * MakeElement | ( | Int64ToIntVar | vars, |
int64 | range_start, | ||
int64 | range_end, | ||
IntVar * | argument | ||
) |
vars(argument)
Definition at line 1652 of file element.cc.
Constraint * MakeElementEquality | ( | const std::vector< int > & | vals, |
IntVar *const | index, | ||
IntVar *const | target | ||
) |
Definition at line 1673 of file element.cc.
Constraint * MakeElementEquality | ( | const std::vector< int64 > & | vals, |
IntVar *const | index, | ||
IntVar *const | target | ||
) |
Definition at line 1667 of file element.cc.
Constraint * MakeElementEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | index, | ||
int64 | target | ||
) |
Definition at line 1706 of file element.cc.
Constraint * MakeElementEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | index, | ||
IntVar *const | target | ||
) |
Definition at line 1679 of file element.cc.
SearchMonitor * MakeEnterSearchCallback | ( | std::function< void()> | callback | ) |
Constraint * MakeEquality | ( | IntervalVar *const | var1, |
IntervalVar *const | var2 | ||
) |
This constraints states that the two interval variables are equal.
Definition at line 595 of file sched_constraints.cc.
Constraint * MakeEquality | ( | IntExpr *const | expr, |
int | value | ||
) |
expr == value
Definition at line 99 of file expr_cst.cc.
Constraint * MakeEquality | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr == value
Definition at line 84 of file expr_cst.cc.
Constraint * MakeEquality | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left == right
Definition at line 512 of file range_cst.cc.
SearchMonitor * MakeExitSearchCallback | ( | std::function< void()> | callback | ) |
Decision * MakeFailDecision | ( | ) |
Definition at line 1379 of file constraint_solver.cc.
RegularLimit * MakeFailuresLimit | ( | int64 | failures | ) |
Constraint * MakeFalseConstraint | ( | ) |
This constraint always fails.
Definition at line 520 of file constraints.cc.
Constraint * MakeFalseConstraint | ( | const std::string & | explanation | ) |
Definition at line 524 of file constraints.cc.
SolutionCollector * MakeFirstSolutionCollector | ( | ) |
SolutionCollector * MakeFirstSolutionCollector | ( | const Assignment *const | assignment | ) |
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.
Definition at line 2417 of file interval.cc.
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.
Definition at line 2410 of file interval.cc.
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.
Definition at line 2239 of file interval.cc.
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.
Definition at line 2266 of file interval.cc.
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.
Definition at line 2277 of file interval.cc.
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.
Definition at line 2326 of file interval.cc.
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.
Definition at line 2340 of file interval.cc.
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.
Definition at line 2312 of file interval.cc.
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.
Definition at line 2354 of file interval.cc.
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.
Definition at line 2298 of file interval.cc.
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.
Definition at line 2253 of file interval.cc.
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.
Definition at line 2403 of file interval.cc.
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.
Definition at line 2396 of file interval.cc.
IntervalVar * MakeFixedInterval | ( | int64 | start, |
int64 | duration, | ||
const std::string & | name | ||
) |
Creates a fixed and performed interval.
Definition at line 2234 of file interval.cc.
SearchMonitor * MakeGenericTabuSearch | ( | bool | maximize, |
IntVar *const | v, | ||
int64 | step, | ||
const std::vector< IntVar * > & | tabu_vars, | ||
int64 | forbid_tenure | ||
) |
Constraint * MakeGreater | ( | IntExpr *const | expr, |
int | value | ||
) |
expr > value
Definition at line 201 of file expr_cst.cc.
Constraint * MakeGreater | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr > value
Definition at line 190 of file expr_cst.cc.
Constraint * MakeGreater | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left > right
Definition at line 560 of file range_cst.cc.
Constraint * MakeGreaterOrEqual | ( | IntExpr *const | expr, |
int | value | ||
) |
expr >= value
Definition at line 179 of file expr_cst.cc.
Constraint * MakeGreaterOrEqual | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr >= value
Definition at line 168 of file expr_cst.cc.
Constraint * MakeGreaterOrEqual | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left >= right
Definition at line 542 of file range_cst.cc.
SearchMonitor * MakeGuidedLocalSearch | ( | bool | maximize, |
IntVar *const | objective, | ||
Solver::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
SearchMonitor * MakeGuidedLocalSearch | ( | bool | maximize, |
IntVar *const | objective, | ||
Solver::IndexEvaluator3 | objective_function, | ||
int64 | step, | ||
const std::vector< IntVar * > & | vars, | ||
const std::vector< IntVar * > & | secondary_vars, | ||
double | penalty_factor | ||
) |
Constraint * MakeIfThenElseCt | ( | IntVar *const | condition, |
IntExpr *const | then_expr, | ||
IntExpr *const | else_expr, | ||
IntVar *const | target_var | ||
) |
Special cases with arrays of size two.
Definition at line 1597 of file element.cc.
ImprovementSearchLimit * MakeImprovementLimit | ( | IntVar * | objective_var, |
bool | maximize, | ||
double | objective_scaling_factor, | ||
double | objective_offset, | ||
double | improvement_rate_coefficient, | ||
int | improvement_rate_solutions_distance | ||
) |
Returns the expression expr such that vars[expr] == value.
It assumes that vars are all different.
Definition at line 1745 of file element.cc.
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.
Definition at line 1730 of file element.cc.
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.
Definition at line 555 of file constraints.cc.
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.
Definition at line 560 of file constraints.cc.
IntConst will create a constant expression.
Definition at line 6458 of file expressions.cc.
IntConst will create a constant expression.
Definition at line 6447 of file expressions.cc.
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:
This is very useful for implementing propagators that may only modify the start min or end min.
Definition at line 2209 of file interval.cc.
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:
This is very useful to implement propagators that may only modify the start max or end max.
Definition at line 2218 of file interval.cc.
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.
Definition at line 2370 of file interval.cc.
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.
Definition at line 2379 of file interval.cc.
Constraint * MakeIntervalVarRelation | ( | IntervalVar *const | t, |
Solver::UnaryIntervalRelation | r, | ||
int64 | d | ||
) |
This method creates a relation between an interval var and a date.
Definition at line 113 of file timetabling.cc.
Constraint * MakeIntervalVarRelation | ( | IntervalVar *const | t1, |
Solver::BinaryIntervalRelation | r, | ||
IntervalVar *const | t2 | ||
) |
This method creates a relation between two interval vars.
Definition at line 232 of file timetabling.cc.
Constraint * MakeIntervalVarRelationWithDelay | ( | IntervalVar *const | t1, |
Solver::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.
Definition at line 238 of file timetabling.cc.
IntVar * MakeIntVar | ( | const std::vector< int > & | values | ) |
MakeIntVar will create a variable with the given sparse domain.
Definition at line 6443 of file expressions.cc.
IntVar * MakeIntVar | ( | const std::vector< int > & | values, |
const std::string & | name | ||
) |
MakeIntVar will create a variable with the given sparse domain.
Definition at line 6438 of file expressions.cc.
MakeIntVar will create a variable with the given sparse domain.
Definition at line 6434 of file expressions.cc.
MakeIntVar will create a variable with the given sparse domain.
Definition at line 6383 of file expressions.cc.
MakeIntVar will create the best range based int var for the bounds given.
Definition at line 6371 of file expressions.cc.
MakeIntVar will create the best range based int var for the bounds given.
Definition at line 6355 of file expressions.cc.
Same but allocates an array and returns it.
Definition at line 6494 of file expressions.cc.
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.
Definition at line 6479 of file expressions.cc.
This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having no names.
Definition at line 6487 of file expressions.cc.
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.
Definition at line 550 of file constraints.cc.
Constraint * MakeIsBetweenCt | ( | IntExpr *const | expr, |
int64 | l, | ||
int64 | u, | ||
IntVar *const | b | ||
) |
b == (l <= expr <= u)
Definition at line 1048 of file expr_cst.cc.
Definition at line 1084 of file expr_cst.cc.
Constraint * MakeIsDifferentCstCt | ( | IntExpr *const | var, |
int64 | value, | ||
IntVar *const | boolvar | ||
) |
boolvar == (var != value)
Definition at line 587 of file expr_cst.cc.
status var of (var != value)
Definition at line 578 of file expr_cst.cc.
Constraint * MakeIsDifferentCt | ( | IntExpr *const | v1, |
IntExpr *const | v2, | ||
IntVar *const | b | ||
) |
b == (v1 != v2)
Definition at line 686 of file range_cst.cc.
status var of (v1 != v2)
Definition at line 641 of file range_cst.cc.
Constraint * MakeIsEqualCstCt | ( | IntExpr *const | var, |
int64 | value, | ||
IntVar *const | boolvar | ||
) |
boolvar == (var == value)
Definition at line 485 of file expr_cst.cc.
status var of (var == value)
Definition at line 460 of file expr_cst.cc.
Constraint * MakeIsEqualCt | ( | IntExpr *const | v1, |
IntExpr * | v2, | ||
IntVar *const | b | ||
) |
b == (v1 == v2)
Definition at line 622 of file range_cst.cc.
status var of (v1 == v2)
Definition at line 577 of file range_cst.cc.
Constraint * MakeIsGreaterCstCt | ( | IntExpr *const | v, |
int64 | c, | ||
IntVar *const | b | ||
) |
b == (v > c)
Definition at line 714 of file expr_cst.cc.
status var of (var > value)
Definition at line 694 of file expr_cst.cc.
Constraint * MakeIsGreaterCt | ( | IntExpr *const | left, |
IntExpr *const | right, | ||
IntVar *const | b | ||
) |
b == (left > right)
Definition at line 800 of file range_cst.cc.
Constraint * MakeIsGreaterOrEqualCstCt | ( | IntExpr *const | var, |
int64 | value, | ||
IntVar *const | boolvar | ||
) |
boolvar == (var >= value)
Definition at line 698 of file expr_cst.cc.
status var of (var >= value)
Definition at line 677 of file expr_cst.cc.
Constraint * MakeIsGreaterOrEqualCt | ( | IntExpr *const | left, |
IntExpr *const | right, | ||
IntVar *const | b | ||
) |
b == (left >= right)
Definition at line 790 of file range_cst.cc.
status var of (left >= right)
Definition at line 785 of file range_cst.cc.
status var of (left > right)
Definition at line 796 of file range_cst.cc.
Constraint * MakeIsLessCstCt | ( | IntExpr *const | v, |
int64 | c, | ||
IntVar *const | b | ||
) |
b == (v < c)
Definition at line 813 of file expr_cst.cc.
status var of (var < value)
Definition at line 793 of file expr_cst.cc.
Constraint * MakeIsLessCt | ( | IntExpr *const | left, |
IntExpr *const | right, | ||
IntVar *const | b | ||
) |
b == (left < right)
Definition at line 773 of file range_cst.cc.
Constraint * MakeIsLessOrEqualCstCt | ( | IntExpr *const | var, |
int64 | value, | ||
IntVar *const | boolvar | ||
) |
boolvar == (var <= value)
Definition at line 797 of file expr_cst.cc.
status var of (var <= value)
Definition at line 776 of file expr_cst.cc.
Constraint * MakeIsLessOrEqualCt | ( | IntExpr *const | left, |
IntExpr *const | right, | ||
IntVar *const | b | ||
) |
b == (left <= right)
Definition at line 730 of file range_cst.cc.
status var of (left <= right)
Definition at line 698 of file range_cst.cc.
status var of (left < right)
Definition at line 742 of file range_cst.cc.
Constraint * MakeIsMemberCt | ( | IntExpr *const | expr, |
const std::vector< int > & | values, | ||
IntVar *const | boolvar | ||
) |
Definition at line 1484 of file expr_cst.cc.
Constraint * MakeIsMemberCt | ( | IntExpr *const | expr, |
const std::vector< int64 > & | values, | ||
IntVar *const | boolvar | ||
) |
boolvar == (expr in set)
Definition at line 1478 of file expr_cst.cc.
Definition at line 1497 of file expr_cst.cc.
Definition at line 1490 of file expr_cst.cc.
SolutionCollector * MakeLastSolutionCollector | ( | ) |
SolutionCollector * MakeLastSolutionCollector | ( | const Assignment *const | assignment | ) |
Constraint * MakeLess | ( | IntExpr *const | expr, |
int | value | ||
) |
expr < value
Definition at line 298 of file expr_cst.cc.
Constraint * MakeLess | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr < value
Definition at line 287 of file expr_cst.cc.
Constraint * MakeLess | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left < right
Definition at line 546 of file range_cst.cc.
Constraint * MakeLessOrEqual | ( | IntExpr *const | expr, |
int | value | ||
) |
expr <= value
Definition at line 276 of file expr_cst.cc.
Constraint * MakeLessOrEqual | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr <= value
Definition at line 265 of file expr_cst.cc.
Constraint * MakeLessOrEqual | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left <= right
Definition at line 526 of file range_cst.cc.
Constraint * MakeLexicalLess | ( | const std::vector< IntVar * > & | left, |
const std::vector< IntVar * > & | right | ||
) |
Creates a constraint that enforces that left is lexicographically less than right.
Definition at line 540 of file constraints.cc.
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.
Definition at line 545 of file constraints.cc.
RegularLimit * MakeLimit | ( | absl::Duration | time, |
int64 | branches, | ||
int64 | failures, | ||
int64 | solutions, | ||
bool | smart_time_check = false , |
||
bool | cumulative = false |
||
) |
RegularLimit * MakeLimit | ( | const RegularLimitParameters & | proto | ) |
RegularLimit * MakeLimit | ( | int64 | time, |
int64 | branches, | ||
int64 | failures, | ||
int64 | solutions, | ||
bool | smart_time_check = false , |
||
bool | cumulative = false |
||
) |
SearchLimit * MakeLimit | ( | SearchLimit *const | limit_1, |
SearchLimit *const | limit_2 | ||
) |
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:
Definition at line 4773 of file local_search.cc.
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.
Definition at line 4791 of file local_search.cc.
DecisionBuilder * MakeLocalSearchPhase | ( | const std::vector< IntVar * > & | vars, |
DecisionBuilder *const | first_solution, | ||
LocalSearchPhaseParameters *const | parameters | ||
) |
Definition at line 4781 of file local_search.cc.
DecisionBuilder * MakeLocalSearchPhase | ( | const std::vector< SequenceVar * > & | vars, |
DecisionBuilder *const | first_solution, | ||
LocalSearchPhaseParameters *const | parameters | ||
) |
Definition at line 4802 of file local_search.cc.
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder | ||
) |
Local Search Phase Parameters.
Definition at line 4329 of file local_search.cc.
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder, | ||
RegularLimit *const | limit | ||
) |
Definition at line 4337 of file local_search.cc.
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder, | ||
RegularLimit *const | limit, | ||
LocalSearchFilterManager * | filter_manager | ||
) |
Definition at line 4345 of file local_search.cc.
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
SolutionPool *const | pool, | ||
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder | ||
) |
Definition at line 4354 of file local_search.cc.
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
SolutionPool *const | pool, | ||
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder, | ||
RegularLimit *const | limit | ||
) |
Definition at line 4362 of file local_search.cc.
LocalSearchPhaseParameters * MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
SolutionPool *const | pool, | ||
LocalSearchOperator *const | ls_operator, | ||
DecisionBuilder *const | sub_decision_builder, | ||
RegularLimit *const | limit, | ||
LocalSearchFilterManager * | filter_manager | ||
) |
Definition at line 4370 of file local_search.cc.
SearchMonitor * MakeLubyRestart | ( | int | scale_factor | ) |
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);
Definition at line 535 of file constraints.cc.
std::max(vars)
Definition at line 3321 of file expr_array.cc.
std::max(expr, value)
Definition at line 7125 of file expressions.cc.
std::max(expr, value)
Definition at line 7111 of file expressions.cc.
std::max(left, right)
Definition at line 7093 of file expressions.cc.
Constraint * MakeMaxEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | max_var | ||
) |
Definition at line 3386 of file expr_array.cc.
OptimizeVar * MakeMaximize | ( | IntVar *const | v, |
int64 | step | ||
) |
Constraint * MakeMemberCt | ( | IntExpr *const | expr, |
const std::vector< int > & | values | ||
) |
Definition at line 1224 of file expr_cst.cc.
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.
Definition at line 1160 of file expr_cst.cc.
std::min(vars)
Definition at line 3278 of file expr_array.cc.
std::min(expr, value)
Definition at line 7089 of file expressions.cc.
std::min(expr, value)
Definition at line 7075 of file expressions.cc.
std::min (left, right)
Definition at line 7057 of file expressions.cc.
Constraint * MakeMinEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | min_var | ||
) |
Definition at line 3364 of file expr_array.cc.
OptimizeVar * MakeMinimize | ( | IntVar *const | v, |
int64 | step | ||
) |
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.
Definition at line 2204 of file interval.cc.
Modulo expression x % mod (with the python convention for modulo).
Definition at line 7240 of file expressions.cc.
Modulo expression x % mod (with the python convention for modulo).
Definition at line 7251 of file expressions.cc.
IntExpr * MakeMonotonicElement | ( | Solver::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.
Definition at line 859 of file element.cc.
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.
Definition at line 269 of file local_search.cc.
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.
Definition at line 285 of file local_search.cc.
SolutionCollector * MakeNBestValueSolutionCollector | ( | const Assignment *const | assignment, |
int | solution_count, | ||
bool | maximize | ||
) |
SolutionCollector * MakeNBestValueSolutionCollector | ( | int | solution_count, |
bool | maximize | ||
) |
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.
Definition at line 1882 of file local_search.cc.
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.
DecisionBuilder * MakeNestedOptimize | ( | DecisionBuilder *const | db, |
Assignment *const | solution, | ||
bool | maximize, | ||
int64 | step, | ||
const std::vector< SearchMonitor * > & | monitors | ||
) |
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 | ||
) |
Constraint * MakeNoCycle | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
Solver::IndexFilter1 | sink_handler, | ||
bool | assume_paths | ||
) |
Definition at line 619 of file graph_constraints.cc.
Constraint * MakeNoCycle | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
Solver::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.
Definition at line 631 of file graph_constraints.cc.
Constraint * MakeNonEquality | ( | IntExpr *const | expr, |
int | value | ||
) |
expr != value
Definition at line 392 of file expr_cst.cc.
Constraint * MakeNonEquality | ( | IntExpr *const | expr, |
int64 | value | ||
) |
expr != value
Definition at line 377 of file expr_cst.cc.
Constraint * MakeNonEquality | ( | IntExpr *const | left, |
IntExpr *const | right | ||
) |
left != right
Definition at line 564 of file range_cst.cc.
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 | ||
) |
Definition at line 315 of file constraint_solver/diffn.cc.
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 | ||
) |
Definition at line 303 of file constraint_solver/diffn.cc.
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.
Definition at line 297 of file constraint_solver/diffn.cc.
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 | ||
) |
Definition at line 345 of file constraint_solver/diffn.cc.
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 | ||
) |
Definition at line 333 of file constraint_solver/diffn.cc.
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.
Definition at line 327 of file constraint_solver/diffn.cc.
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.
Definition at line 953 of file expr_cst.cc.
Constraint * MakeNotMemberCt | ( | IntExpr *const | expr, |
const std::vector< int > & | values | ||
) |
Definition at line 1292 of file expr_cst.cc.
Constraint * MakeNotMemberCt | ( | IntExpr *const | expr, |
const std::vector< int64 > & | values | ||
) |
expr not in set.
Definition at line 1229 of file expr_cst.cc.
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]].
Definition at line 1578 of file expr_cst.cc.
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]].
Definition at line 1571 of file expr_cst.cc.
Constraint * MakeNotMemberCt | ( | IntExpr * | expr, |
SortedDisjointIntervalList | intervals | ||
) |
expr should not be in the list of forbidden intervals.
Definition at line 1585 of file expr_cst.cc.
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.
Definition at line 733 of file alldiff_cst.cc.
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.
Definition at line 738 of file alldiff_cst.cc.
LocalSearchOperator * MakeOperator | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | secondary_vars, | ||
Solver::IndexEvaluator3 | evaluator, | ||
Solver::EvaluatorLocalSearchOperators | op | ||
) |
Definition at line 2429 of file local_search.cc.
LocalSearchOperator * MakeOperator | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | secondary_vars, | ||
Solver::LocalSearchOperators | op | ||
) |
Definition at line 2315 of file local_search.cc.
LocalSearchOperator * MakeOperator | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator3 | evaluator, | ||
Solver::EvaluatorLocalSearchOperators | op | ||
) |
Definition at line 2423 of file local_search.cc.
LocalSearchOperator * MakeOperator | ( | const std::vector< IntVar * > & | vars, |
Solver::LocalSearchOperators | op | ||
) |
Local Search Operators.
Definition at line 2310 of file local_search.cc.
-expr
Definition at line 6728 of file expressions.cc.
OptimizeVar * MakeOptimize | ( | bool | maximize, |
IntVar *const | v, | ||
int64 | step | ||
) |
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.
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.
Definition at line 1434 of file graph_constraints.cc.
Constraint * MakePathCumul | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
const std::vector< IntVar * > & | cumuls, | ||
const std::vector< IntVar * > & | slacks, | ||
Solver::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.
Definition at line 1315 of file graph_constraints.cc.
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.
Definition at line 1297 of file graph_constraints.cc.
Constraint * MakePathCumul | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
const std::vector< IntVar * > & | cumuls, | ||
Solver::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.
Definition at line 1306 of file graph_constraints.cc.
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.
Definition at line 1619 of file graph_constraints.cc.
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).
Definition at line 1625 of file graph_constraints.cc.
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.
Definition at line 1642 of file graph_constraints.cc.
DecisionBuilder * MakePhase | ( | const std::vector< IntervalVar * > & | intervals, |
IntervalStrategy | str | ||
) |
Scheduling phases.
Definition at line 848 of file sched_search.cc.
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator1 | var_evaluator, | ||
Solver::IndexEvaluator2 | value_evaluator | ||
) |
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator1 | var_evaluator, | ||
Solver::IndexEvaluator2 | value_evaluator, | ||
Solver::IndexEvaluator1 | tie_breaker | ||
) |
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator1 | var_evaluator, | ||
Solver::IntValueStrategy | val_str | ||
) |
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator2 | eval, | ||
Solver::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.
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator2 | eval, | ||
Solver::IndexEvaluator1 | tie_breaker, | ||
Solver::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.
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IntVarStrategy | var_str, | ||
Solver::IndexEvaluator2 | value_evaluator | ||
) |
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IntVarStrategy | var_str, | ||
Solver::IndexEvaluator2 | value_evaluator, | ||
Solver::IndexEvaluator1 | tie_breaker | ||
) |
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str | ||
) |
DecisionBuilder * MakePhase | ( | const std::vector< IntVar * > & | vars, |
IntVarStrategy | var_str, | ||
VariableValueComparator | var_val1_val2_comparator | ||
) |
DecisionBuilder * MakePhase | ( | const std::vector< SequenceVar * > & | sequences, |
SequenceStrategy | str | ||
) |
Definition at line 873 of file sched_search.cc.
DecisionBuilder * MakePhase | ( | IntVar *const | v0, |
IntVar *const | v1, | ||
IntVar *const | v2, | ||
IntVar *const | v3, | ||
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str | ||
) |
DecisionBuilder * MakePhase | ( | IntVar *const | v0, |
IntVar *const | v1, | ||
IntVar *const | v2, | ||
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str | ||
) |
DecisionBuilder * MakePhase | ( | IntVar *const | v0, |
IntVar *const | v1, | ||
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str | ||
) |
DecisionBuilder * MakePhase | ( | IntVar *const | v0, |
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str | ||
) |
IntExpr * MakePiecewiseLinearExpr | ( | IntExpr * | expr, |
const PiecewiseLinearFunction & | f | ||
) |
General piecewise-linear function expression, built from f(x) where f is piecewise-linear.
The resulting expression is f(expr). expressions.
Definition at line 7209 of file expressions.cc.
expr ^ n (n > 0)
Definition at line 7023 of file expressions.cc.
ModelVisitor * MakePrintModelVisitor | ( | ) |
Prints the model.
Definition at line 807 of file utilities.cc.
expr * value
Definition at line 6746 of file expressions.cc.
left * right
Definition at line 6836 of file expressions.cc.
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.
Definition at line 191 of file local_search.cc.
LocalSearchOperator * MakeRandomLnsOperator | ( | const std::vector< IntVar * > & | vars, |
int | number_of_variables, | ||
int32 | seed | ||
) |
Definition at line 196 of file local_search.cc.
Decision * MakeRankFirstInterval | ( | SequenceVar *const | sequence, |
int | index | ||
) |
Returns a decision that tries to rank first the ith interval var in the sequence variable.
Definition at line 862 of file sched_search.cc.
Decision * MakeRankLastInterval | ( | SequenceVar *const | sequence, |
int | index | ||
) |
Returns a decision that tries to rank last the ith interval var in the sequence variable.
Definition at line 868 of file sched_search.cc.
LocalSearchFilter * MakeRejectFilter | ( | ) |
Definition at line 2555 of file local_search.cc.
DecisionBuilder * MakeRestoreAssignment | ( | Assignment * | assignment | ) |
Returns a DecisionBuilder which restores an Assignment (calls void Assignment::Restore())
Definition at line 1081 of file constraint_solver/assignment.cc.
scalar product
Definition at line 3547 of file expr_array.cc.
scalar product
Definition at line 3541 of file expr_array.cc.
Constraint * MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefficients, | ||
int64 | cst | ||
) |
Definition at line 3490 of file expr_array.cc.
Constraint * MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefficients, | ||
IntVar *const | target | ||
) |
Definition at line 3504 of file expr_array.cc.
Constraint * MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | coefficients, | ||
int64 | cst | ||
) |
Definition at line 3483 of file expr_array.cc.
Constraint * MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | coefficients, | ||
IntVar *const | target | ||
) |
Definition at line 3497 of file expr_array.cc.
Constraint * MakeScalProdGreaterOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coeffs, | ||
int64 | cst | ||
) |
Definition at line 3519 of file expr_array.cc.
Constraint * MakeScalProdGreaterOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | coeffs, | ||
int64 | cst | ||
) |
Definition at line 3512 of file expr_array.cc.
Constraint * MakeScalProdLessOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefficients, | ||
int64 | cst | ||
) |
Definition at line 3533 of file expr_array.cc.
Constraint * MakeScalProdLessOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64 > & | coefficients, | ||
int64 | cst | ||
) |
Definition at line 3526 of file expr_array.cc.
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.
Definition at line 841 of file sched_search.cc.
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.
Definition at line 834 of file sched_search.cc.
SearchMonitor * MakeSearchLog | ( | int | branch_period | ) |
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
IntVar *const | var | ||
) |
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
IntVar * | var, | ||
std::function< std::string()> | display_callback | ||
) |
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
OptimizeVar *const | opt_var | ||
) |
OptimizeVar Search Logs At each solution, this monitor will also display the 'opt_var' value.
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
OptimizeVar *const | opt_var, | ||
std::function< std::string()> | display_callback | ||
) |
SearchMonitor * MakeSearchLog | ( | int | branch_period, |
std::function< std::string()> | display_callback | ||
) |
SearchMonitor * MakeSearchLog | ( | SearchLogParameters | parameters | ) |
SearchMonitor * MakeSearchTrace | ( | const std::string & | prefix | ) |
Semi continuous Expression (x <= 0 -> f(x) = 0; x > 0 -> f(x) = ax + b) a >= 0 and b >= 0.
Definition at line 7136 of file expressions.cc.
SearchMonitor * MakeSimulatedAnnealing | ( | bool | maximize, |
IntVar *const | v, | ||
int64 | step, | ||
int64 | initial_temperature | ||
) |
RegularLimit * MakeSolutionsLimit | ( | int64 | solutions | ) |
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.
DecisionBuilder * MakeSolveOnce | ( | DecisionBuilder *const | db, |
const std::vector< SearchMonitor * > & | monitors | ||
) |
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 | ||
) |
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:
For more info, please have a look at: https://mpi-inf.mpg.de/~mehlhorn/ftp/Mehlhorn-Thiel.pdf
Definition at line 714 of file alldiff_cst.cc.
expr * expr
Definition at line 7005 of file expressions.cc.
ModelVisitor * MakeStatisticsModelVisitor | ( | ) |
Displays some nice statistics on the model.
Definition at line 811 of file utilities.cc.
DecisionBuilder * MakeStoreAssignment | ( | Assignment * | assignment | ) |
Returns a DecisionBuilder which stores an Assignment (calls void Assignment::Store())
Definition at line 1085 of file constraint_solver/assignment.cc.
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.
Definition at line 2579 of file resource.cc.
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.
Definition at line 642 of file graph_constraints.cc.
sum of all vars.
Definition at line 3230 of file expr_array.cc.
expr + value.
Definition at line 6563 of file expressions.cc.
left + right.
Definition at line 6531 of file expressions.cc.
Constraint * MakeSumEquality | ( | const std::vector< IntVar * > & | vars, |
int64 | cst | ||
) |
Definition at line 3428 of file expr_array.cc.
Constraint * MakeSumEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar *const | var | ||
) |
Definition at line 3458 of file expr_array.cc.
Constraint * MakeSumGreaterOrEqual | ( | const std::vector< IntVar * > & | vars, |
int64 | cst | ||
) |
Definition at line 3418 of file expr_array.cc.
Constraint * MakeSumLessOrEqual | ( | const std::vector< IntVar * > & | vars, |
int64 | cst | ||
) |
Variation on arrays.
Definition at line 3408 of file expr_array.cc.
IntVarLocalSearchFilter * MakeSumObjectiveFilter | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | secondary_vars, | ||
Solver::IndexEvaluator3 | values, | ||
Solver::LocalSearchFilterBound | filter_enum | ||
) |
Definition at line 3531 of file local_search.cc.
IntVarLocalSearchFilter * MakeSumObjectiveFilter | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator2 | values, | ||
Solver::LocalSearchFilterBound | filter_enum | ||
) |
Definition at line 3524 of file local_search.cc.
SearchMonitor * MakeSymmetryManager | ( | const std::vector< SymmetryBreaker * > & | visitors | ) |
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 | ||
) |
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:
Constraint * MakeTemporalDisjunction | ( | IntervalVar *const | t1, |
IntervalVar *const | t2 | ||
) |
This constraint implements a temporal disjunction between two interval vars.
Definition at line 409 of file timetabling.cc.
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).
Definition at line 403 of file timetabling.cc.
RegularLimit * MakeTimeLimit | ( | absl::Duration | time | ) |
|
inline |
Definition at line 2211 of file constraint_solver.h.
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.
Definition at line 1271 of file constraint_solver/table.cc.
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.
Definition at line 1264 of file constraint_solver/table.cc.
Constraint * MakeTrueConstraint | ( | ) |
This constraint always succeeds.
Definition at line 515 of file constraints.cc.
ModelVisitor * MakeVariableDegreeVisitor | ( | absl::flat_hash_map< const IntVar *, int > *const | map | ) |
Compute the number of constraints a variable is attached to.
Definition at line 815 of file utilities.cc.
LocalSearchFilter * MakeVariableDomainFilter | ( | ) |
Definition at line 3233 of file local_search.cc.
OptimizeVar * MakeWeightedMaximize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int > & | weights, | ||
int64 | step | ||
) |
OptimizeVar * MakeWeightedMaximize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int64 > & | weights, | ||
int64 | step | ||
) |
OptimizeVar * MakeWeightedMinimize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int > & | weights, | ||
int64 | step | ||
) |
OptimizeVar * MakeWeightedMinimize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int64 > & | weights, | ||
int64 | step | ||
) |
OptimizeVar * MakeWeightedOptimize | ( | bool | maximize, |
const std::vector< IntVar * > & | sub_objectives, | ||
const std::vector< int > & | weights, | ||
int64 | step | ||
) |
OptimizeVar * MakeWeightedOptimize | ( | bool | maximize, |
const std::vector< IntVar * > & | sub_objectives, | ||
const std::vector< int64 > & | weights, | ||
int64 | step | ||
) |
|
static |
Current memory usage in bytes.
Definition at line 1518 of file constraint_solver.cc.
std::string model_name | ( | ) | const |
Returns the name of the model.
Definition at line 1397 of file constraint_solver.cc.
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.
Definition at line 2267 of file local_search.cc.
bool NameAllVariables | ( | ) | const |
Returns whether all variables should be named.
Definition at line 187 of file constraint_solver.cc.
|
inline |
The number of neighbors created.
Definition at line 1002 of file constraint_solver.h.
void NewSearch | ( | DecisionBuilder *const | db | ) |
Definition at line 1807 of file constraint_solver.cc.
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();
Definition at line 1843 of file constraint_solver.cc.
void NewSearch | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1 | ||
) |
Definition at line 1801 of file constraint_solver.cc.
void NewSearch | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2 | ||
) |
Definition at line 1812 of file constraint_solver.cc.
void NewSearch | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3 | ||
) |
Definition at line 1820 of file constraint_solver.cc.
void NewSearch | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3, | ||
SearchMonitor *const | m4 | ||
) |
Definition at line 1829 of file constraint_solver.cc.
bool NextSolution | ( | ) |
Definition at line 2093 of file constraint_solver.cc.
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.
Definition at line 1524 of file constraint_solver.cc.
|
inline |
The direction of optimization, getter and setter.
Definition at line 1018 of file constraint_solver.h.
|
inline |
Stored Parameters.
Definition at line 768 of file constraint_solver.h.
void PopState | ( | ) |
Definition at line 1561 of file constraint_solver.cc.
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.
Definition at line 1556 of file constraint_solver.cc.
Returns a random value between 0 and 'size' - 1;.
Definition at line 2834 of file constraint_solver.h.
Returns a random value between 0 and 'size' - 1;.
Definition at line 2828 of file constraint_solver.h.
LocalSearchOperator * RandomConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops | ) |
Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor().
Definition at line 2105 of file local_search.cc.
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.
Definition at line 2110 of file local_search.cc.
Adds a new demon and wraps it inside a DemonProfiler if necessary.
Definition at line 450 of file demon_profiler.cc.
IntervalVar * RegisterIntervalVar | ( | IntervalVar *const | var | ) |
Registers a new IntervalVar and wraps it inside a TraceIntervalVar if necessary.
|
inline |
Reseed the solver random generator.
Definition at line 2840 of file constraint_solver.h.
void RestartCurrentSearch | ( | ) |
Definition at line 2431 of file constraint_solver.cc.
void RestartSearch | ( | ) |
Definition at line 1985 of file constraint_solver.cc.
|
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.
|
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.
|
inline |
All-in-one SaveAndAdd_value.
Definition at line 2820 of file constraint_solver.h.
|
inline |
All-in-one SaveAndSetValue.
Definition at line 2811 of file constraint_solver.h.
|
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.
std::string SearchContext | ( | ) | const |
Definition at line 3220 of file constraint_solver.cc.
std::string SearchContext | ( | const Search * | search | ) | const |
Definition at line 3224 of file constraint_solver.cc.
int SearchDepth | ( | ) | const |
Gets the search depth of the current active search.
Returns -1 if there is no active search opened.
Definition at line 1175 of file constraint_solver.cc.
int SearchLeftDepth | ( | ) | const |
Gets the search left depth of the current active search.
Returns -1 if there is no active search opened.
Definition at line 1177 of file constraint_solver.cc.
|
inline |
Internal.
Definition at line 2874 of file constraint_solver.h.
|
inline |
Definition at line 1021 of file constraint_solver.h.
void SetBranchSelector | ( | BranchSelector | bs | ) |
Sets the given branch selector on the current active search.
Definition at line 1152 of file constraint_solver.cc.
void SetSearchContext | ( | Search * | search, |
const std::string & | search_context | ||
) |
Definition at line 3215 of file constraint_solver.cc.
|
inline |
enabled for metaheuristics.
Disables/enables fast local search.
Definition at line 2884 of file constraint_solver.h.
|
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.
int64 solutions | ( | ) | const |
The number of solutions found since the start of the search.
Definition at line 1528 of file constraint_solver.cc.
bool Solve | ( | DecisionBuilder *const | db | ) |
Definition at line 1758 of file constraint_solver.cc.
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:
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:
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. |
Definition at line 1791 of file constraint_solver.cc.
bool Solve | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1 | ||
) |
Definition at line 1752 of file constraint_solver.cc.
bool Solve | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2 | ||
) |
Definition at line 1763 of file constraint_solver.cc.
bool Solve | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3 | ||
) |
Definition at line 1771 of file constraint_solver.cc.
bool Solve | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3, | ||
SearchMonitor *const | m4 | ||
) |
Definition at line 1780 of file constraint_solver.cc.
bool SolveAndCommit | ( | DecisionBuilder *const | db | ) |
Definition at line 2383 of file constraint_solver.cc.
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.
Definition at line 2405 of file constraint_solver.cc.
bool SolveAndCommit | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1 | ||
) |
Definition at line 2376 of file constraint_solver.cc.
bool SolveAndCommit | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2 | ||
) |
Definition at line 2388 of file constraint_solver.cc.
bool SolveAndCommit | ( | DecisionBuilder *const | db, |
SearchMonitor *const | m1, | ||
SearchMonitor *const | m2, | ||
SearchMonitor *const | m3 | ||
) |
Definition at line 2396 of file constraint_solver.cc.
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.
Definition at line 1171 of file constraint_solver.cc.
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.
Definition at line 1643 of file constraint_solver.cc.
|
inline |
State of the solver.
Definition at line 957 of file constraint_solver.h.
void TopPeriodicCheck | ( | ) |
Performs PeriodicCheck on the top-level search; for instance, can be called from a nested solve to check top-level limits.
Definition at line 1542 of file constraint_solver.cc.
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).
Definition at line 1544 of file constraint_solver.cc.
DecisionBuilder * Try | ( | 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.
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.
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 | ||
) |
int64 unchecked_solutions | ( | ) | const |
The number of unchecked solutions found by local search.
Definition at line 1530 of file constraint_solver.cc.
|
inline |
Returns true if fast local search is enabled.
Definition at line 2888 of file constraint_solver.h.
int64 wall_time | ( | ) | const |
DEPRECATED: Use Now() instead.
Time elapsed, in ms since the creation of the solver.
Definition at line 1520 of file constraint_solver.cc.
|
staticconstexpr |
Number of priorities for demons.
Definition at line 270 of file constraint_solver.h.
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.