C++ Reference

C++ Reference: Routing

Detailed Description

Solver Class.

A solver represents the main computation engine. It implements the entire range of Constraint Programming protocols:

  • Reversibility
  • Propagation
  • Search

Usually, Constraint Programming code consists of

  • the creation of the Solver,
  • the creation of the decision variables of the model,
  • the creation of the constraints of the model and their addition to the solver() through the AddConstraint() method,
  • the creation of the main DecisionBuilder class,
  • the launch of the solve() method with the decision builder.

For the time being, Solver is neither MT_SAFE nor MT_HOT.

Definition at line 253 of file constraint_solver.h.

Classes

struct  IntegerCastInfo
 Holds semantic information stating that the 'expression' has been cast into 'variable' using the Var() method, and that 'maintainer' is responsible for maintaining the equality between 'variable' and 'expression'. More...
 
struct  SearchLogParameters
 Creates a search monitor from logging parameters. More...
 

Public Types

enum  IntVarStrategy {
  INT_VAR_DEFAULT , INT_VAR_SIMPLE , CHOOSE_FIRST_UNBOUND , CHOOSE_RANDOM ,
  CHOOSE_MIN_SIZE_LOWEST_MIN , CHOOSE_MIN_SIZE_HIGHEST_MIN , CHOOSE_MIN_SIZE_LOWEST_MAX , CHOOSE_MIN_SIZE_HIGHEST_MAX ,
  CHOOSE_LOWEST_MIN , CHOOSE_HIGHEST_MAX , CHOOSE_MIN_SIZE , CHOOSE_MAX_SIZE ,
  CHOOSE_MAX_REGRET_ON_MIN , CHOOSE_PATH
}
 This enum describes the strategy used to select the next branching variable at each node during the search. More...
 
enum  IntValueStrategy {
  INT_VALUE_DEFAULT , INT_VALUE_SIMPLE , ASSIGN_MIN_VALUE , ASSIGN_MAX_VALUE ,
  ASSIGN_RANDOM_VALUE , ASSIGN_CENTER_VALUE , SPLIT_LOWER_HALF , SPLIT_UPPER_HALF
}
 This enum describes the strategy used to select the next variable value to set. More...
 
enum  EvaluatorStrategy { CHOOSE_STATIC_GLOBAL_BEST , CHOOSE_DYNAMIC_GLOBAL_BEST }
 This enum is used by Solver::MakePhase to specify how to select variables and values during the search. More...
 
enum  SequenceStrategy { SEQUENCE_DEFAULT , SEQUENCE_SIMPLE , CHOOSE_MIN_SLACK_RANK_FORWARD , CHOOSE_RANDOM_RANK_FORWARD }
 Used for scheduling. Not yet implemented. More...
 
enum  IntervalStrategy { INTERVAL_DEFAULT , INTERVAL_SIMPLE , INTERVAL_SET_TIMES_FORWARD , INTERVAL_SET_TIMES_BACKWARD }
 This enum describes the straregy used to select the next interval variable and its value to be fixed. More...
 
enum  LocalSearchOperators {
  TWOOPT , OROPT , RELOCATE , EXCHANGE ,
  CROSS , MAKEACTIVE , MAKEINACTIVE , MAKECHAININACTIVE ,
  SWAPACTIVE , EXTENDEDSWAPACTIVE , PATHLNS , FULLPATHLNS ,
  UNACTIVELNS , INCREMENT , DECREMENT , SIMPLELNS
}
 This enum is used in Solver::MakeOperator to specify the neighborhood to create. More...
 
enum  EvaluatorLocalSearchOperators { LK , TSPOPT , TSPLNS }
 This enum is used in Solver::MakeOperator associated with an evaluator to specify the neighborhood to create. More...
 
enum  LocalSearchFilterBound { GE , LE , EQ }
 This enum is used in Solver::MakeLocalSearchObjectiveFilter. More...
 
enum  DemonPriority { DELAYED_PRIORITY = 0 , VAR_PRIORITY = 1 , NORMAL_PRIORITY = 2 }
 This enum represents the three possible priorities for a demon in the Solver queue. More...
 
enum  BinaryIntervalRelation {
  ENDS_AFTER_END , ENDS_AFTER_START , ENDS_AT_END , ENDS_AT_START ,
  STARTS_AFTER_END , STARTS_AFTER_START , STARTS_AT_END , STARTS_AT_START ,
  STAYS_IN_SYNC
}
 This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between the two intervals t1 and t2. More...
 
enum  UnaryIntervalRelation {
  ENDS_AFTER , ENDS_AT , ENDS_BEFORE , STARTS_AFTER ,
  STARTS_AT , STARTS_BEFORE , CROSS_DATE , AVOID_DATE
}
 This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between an interval t and an integer d. More...
 
enum  DecisionModification {
  NO_CHANGE , KEEP_LEFT , KEEP_RIGHT , KILL_BOTH ,
  SWITCH_BRANCHES
}
 The Solver is responsible for creating the search tree. More...
 
enum  MarkerType { SENTINEL , SIMPLE_MARKER , CHOICE_POINT , REVERSIBLE_ACTION }
 This enum is used internally in private methods Solver::PushState and Solver::PopState to tag states in the search tree. More...
 
enum  SolverState {
  OUTSIDE_SEARCH , IN_ROOT_NODE , IN_SEARCH , AT_SOLUTION ,
  NO_MORE_SOLUTIONS , PROBLEM_INFEASIBLE
}
 This enum represents the state of the solver w.r.t. the search. More...
 
enum  OptimizationDirection { NOT_SET , MAXIMIZATION , MINIMIZATION }
 Optimization directions. More...
 
typedef std::function< int64(int64)> IndexEvaluator1
 Callback typedefs. More...
 
typedef std::function< int64(int64, int64)> IndexEvaluator2
 
typedef std::function< int64(int64, int64, int64)> IndexEvaluator3
 
typedef std::function< bool(int64)> IndexFilter1
 
typedef std::function< IntVar *(int64)> Int64ToIntVar
 
typedef std::function< int64(Solver *solver, const std::vector< IntVar * > &vars, int64 first_unbound, int64 last_unbound)> VariableIndexSelector
 
typedef std::function< int64(const IntVar *v, int64 id)> VariableValueSelector
 
typedef std::function< bool(int64, int64, int64)> VariableValueComparator
 
typedef std::function< DecisionModification()> BranchSelector
 
typedef std::function< void(Solver *)> Action
 
typedef std::function< void()> Closure
 

Public Member Functions

 Solver (const std::string &name)
 Solver API. More...
 
 Solver (const std::string &name, const ConstraintSolverParameters &parameters)
 
 ~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)
 
IntVarMakeIntVar (int64 min, int64 max, const std::string &name)
 MakeIntVar will create the best range based int var for the bounds given. More...
 
IntVarMakeIntVar (const std::vector< int64 > &values, const std::string &name)
 MakeIntVar will create a variable with the given sparse domain. More...
 
IntVarMakeIntVar (const std::vector< int > &values, const std::string &name)
 MakeIntVar will create a variable with the given sparse domain. More...
 
IntVarMakeIntVar (int64 min, int64 max)
 MakeIntVar will create the best range based int var for the bounds given. More...
 
IntVarMakeIntVar (const std::vector< int64 > &values)
 MakeIntVar will create a variable with the given sparse domain. More...
 
IntVarMakeIntVar (const std::vector< int > &values)
 MakeIntVar will create a variable with the given sparse domain. More...
 
IntVarMakeBoolVar (const std::string &name)
 MakeBoolVar will create a variable with a {0, 1} domain. More...
 
IntVarMakeBoolVar ()
 MakeBoolVar will create a variable with a {0, 1} domain. More...
 
IntVarMakeIntConst (int64 val, const std::string &name)
 IntConst will create a constant expression. More...
 
IntVarMakeIntConst (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...
 
IntExprMakeSum (IntExpr *const left, IntExpr *const right)
 left + right. More...
 
IntExprMakeSum (IntExpr *const expr, int64 value)
 expr + value. More...
 
IntExprMakeSum (const std::vector< IntVar * > &vars)
 sum of all vars. More...
 
IntExprMakeScalProd (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefs)
 scalar product More...
 
IntExprMakeScalProd (const std::vector< IntVar * > &vars, const std::vector< int > &coefs)
 scalar product More...
 
IntExprMakeDifference (IntExpr *const left, IntExpr *const right)
 left - right More...
 
IntExprMakeDifference (int64 value, IntExpr *const expr)
 value - expr More...
 
IntExprMakeOpposite (IntExpr *const expr)
 -expr More...
 
IntExprMakeProd (IntExpr *const left, IntExpr *const right)
 left * right More...
 
IntExprMakeProd (IntExpr *const expr, int64 value)
 expr * value More...
 
IntExprMakeDiv (IntExpr *const expr, int64 value)
 expr / value (integer division) More...
 
IntExprMakeDiv (IntExpr *const numerator, IntExpr *const denominator)
 numerator / denominator (integer division). Terms need to be positive. More...
 
IntExprMakeAbs (IntExpr *const expr)
 |expr| More...
 
IntExprMakeSquare (IntExpr *const expr)
 expr * expr More...
 
IntExprMakePower (IntExpr *const expr, int64 n)
 expr ^ n (n > 0) More...
 
IntExprMakeElement (const std::vector< int64 > &values, IntVar *const index)
 values[index] More...
 
IntExprMakeElement (const std::vector< int > &values, IntVar *const index)
 values[index] More...
 
IntExprMakeElement (IndexEvaluator1 values, IntVar *const index)
 Function-based element. More...
 
IntExprMakeMonotonicElement (IndexEvaluator1 values, bool increasing, IntVar *const index)
 Function based element. More...
 
IntExprMakeElement (IndexEvaluator2 values, IntVar *const index1, IntVar *const index2)
 2D version of function-based element expression, values(expr1, expr2). More...
 
IntExprMakeElement (const std::vector< IntVar * > &vars, IntVar *const index)
 vars[expr] More...
 
IntExprMakeElement (Int64ToIntVar vars, int64 range_start, int64 range_end, IntVar *argument)
 vars(argument) More...
 
IntExprMakeIndexExpression (const std::vector< IntVar * > &vars, int64 value)
 Returns the expression expr such that vars[expr] == value. More...
 
ConstraintMakeIfThenElseCt (IntVar *const condition, IntExpr *const then_expr, IntExpr *const else_expr, IntVar *const target_var)
 Special cases with arrays of size two. More...
 
IntExprMakeMin (const std::vector< IntVar * > &vars)
 std::min(vars) More...
 
IntExprMakeMin (IntExpr *const left, IntExpr *const right)
 std::min (left, right) More...
 
IntExprMakeMin (IntExpr *const expr, int64 value)
 std::min(expr, value) More...
 
IntExprMakeMin (IntExpr *const expr, int value)
 std::min(expr, value) More...
 
IntExprMakeMax (const std::vector< IntVar * > &vars)
 std::max(vars) More...
 
IntExprMakeMax (IntExpr *const left, IntExpr *const right)
 std::max(left, right) More...
 
IntExprMakeMax (IntExpr *const expr, int64 value)
 std::max(expr, value) More...
 
IntExprMakeMax (IntExpr *const expr, int value)
 std::max(expr, value) More...
 
IntExprMakeConvexPiecewiseExpr (IntExpr *expr, int64 early_cost, int64 early_date, int64 late_date, int64 late_cost)
 Convex piecewise function. More...
 
IntExprMakeSemiContinuousExpr (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...
 
IntExprMakePiecewiseLinearExpr (IntExpr *expr, const PiecewiseLinearFunction &f)
 General piecewise-linear function expression, built from f(x) where f is piecewise-linear. More...
 
IntExprMakeModulo (IntExpr *const x, int64 mod)
 Modulo expression x % mod (with the python convention for modulo). More...
 
IntExprMakeModulo (IntExpr *const x, IntExpr *const mod)
 Modulo expression x % mod (with the python convention for modulo). More...
 
IntExprMakeConditionalExpression (IntVar *const condition, IntExpr *const expr, int64 unperformed_value)
 Conditional Expr condition ? expr : unperformed_value. More...
 
ConstraintMakeTrueConstraint ()
 This constraint always succeeds. More...
 
ConstraintMakeFalseConstraint ()
 This constraint always fails. More...
 
ConstraintMakeFalseConstraint (const std::string &explanation)
 
ConstraintMakeIsEqualCstCt (IntExpr *const var, int64 value, IntVar *const boolvar)
 boolvar == (var == value) More...
 
IntVarMakeIsEqualCstVar (IntExpr *const var, int64 value)
 status var of (var == value) More...
 
ConstraintMakeIsEqualCt (IntExpr *const v1, IntExpr *v2, IntVar *const b)
 b == (v1 == v2) More...
 
IntVarMakeIsEqualVar (IntExpr *const v1, IntExpr *v2)
 status var of (v1 == v2) More...
 
ConstraintMakeEquality (IntExpr *const left, IntExpr *const right)
 left == right More...
 
ConstraintMakeEquality (IntExpr *const expr, int64 value)
 expr == value More...
 
ConstraintMakeEquality (IntExpr *const expr, int value)
 expr == value More...
 
ConstraintMakeIsDifferentCstCt (IntExpr *const var, int64 value, IntVar *const boolvar)
 boolvar == (var != value) More...
 
IntVarMakeIsDifferentCstVar (IntExpr *const var, int64 value)
 status var of (var != value) More...
 
IntVarMakeIsDifferentVar (IntExpr *const v1, IntExpr *const v2)
 status var of (v1 != v2) More...
 
ConstraintMakeIsDifferentCt (IntExpr *const v1, IntExpr *const v2, IntVar *const b)
 b == (v1 != v2) More...
 
ConstraintMakeNonEquality (IntExpr *const left, IntExpr *const right)
 left != right More...
 
ConstraintMakeNonEquality (IntExpr *const expr, int64 value)
 expr != value More...
 
ConstraintMakeNonEquality (IntExpr *const expr, int value)
 expr != value More...
 
ConstraintMakeIsLessOrEqualCstCt (IntExpr *const var, int64 value, IntVar *const boolvar)
 boolvar == (var <= value) More...
 
IntVarMakeIsLessOrEqualCstVar (IntExpr *const var, int64 value)
 status var of (var <= value) More...
 
IntVarMakeIsLessOrEqualVar (IntExpr *const left, IntExpr *const right)
 status var of (left <= right) More...
 
ConstraintMakeIsLessOrEqualCt (IntExpr *const left, IntExpr *const right, IntVar *const b)
 b == (left <= right) More...
 
ConstraintMakeLessOrEqual (IntExpr *const left, IntExpr *const right)
 left <= right More...
 
ConstraintMakeLessOrEqual (IntExpr *const expr, int64 value)
 expr <= value More...
 
ConstraintMakeLessOrEqual (IntExpr *const expr, int value)
 expr <= value More...
 
ConstraintMakeIsGreaterOrEqualCstCt (IntExpr *const var, int64 value, IntVar *const boolvar)
 boolvar == (var >= value) More...
 
IntVarMakeIsGreaterOrEqualCstVar (IntExpr *const var, int64 value)
 status var of (var >= value) More...
 
IntVarMakeIsGreaterOrEqualVar (IntExpr *const left, IntExpr *const right)
 status var of (left >= right) More...
 
ConstraintMakeIsGreaterOrEqualCt (IntExpr *const left, IntExpr *const right, IntVar *const b)
 b == (left >= right) More...
 
ConstraintMakeGreaterOrEqual (IntExpr *const left, IntExpr *const right)
 left >= right More...
 
ConstraintMakeGreaterOrEqual (IntExpr *const expr, int64 value)
 expr >= value More...
 
ConstraintMakeGreaterOrEqual (IntExpr *const expr, int value)
 expr >= value More...
 
ConstraintMakeIsGreaterCstCt (IntExpr *const v, int64 c, IntVar *const b)
 b == (v > c) More...
 
IntVarMakeIsGreaterCstVar (IntExpr *const var, int64 value)
 status var of (var > value) More...
 
IntVarMakeIsGreaterVar (IntExpr *const left, IntExpr *const right)
 status var of (left > right) More...
 
ConstraintMakeIsGreaterCt (IntExpr *const left, IntExpr *const right, IntVar *const b)
 b == (left > right) More...
 
ConstraintMakeGreater (IntExpr *const left, IntExpr *const right)
 left > right More...
 
ConstraintMakeGreater (IntExpr *const expr, int64 value)
 expr > value More...
 
ConstraintMakeGreater (IntExpr *const expr, int value)
 expr > value More...
 
ConstraintMakeIsLessCstCt (IntExpr *const v, int64 c, IntVar *const b)
 b == (v < c) More...
 
IntVarMakeIsLessCstVar (IntExpr *const var, int64 value)
 status var of (var < value) More...
 
IntVarMakeIsLessVar (IntExpr *const left, IntExpr *const right)
 status var of (left < right) More...
 
ConstraintMakeIsLessCt (IntExpr *const left, IntExpr *const right, IntVar *const b)
 b == (left < right) More...
 
ConstraintMakeLess (IntExpr *const left, IntExpr *const right)
 left < right More...
 
ConstraintMakeLess (IntExpr *const expr, int64 value)
 expr < value More...
 
ConstraintMakeLess (IntExpr *const expr, int value)
 expr < value More...
 
ConstraintMakeSumLessOrEqual (const std::vector< IntVar * > &vars, int64 cst)
 Variation on arrays. More...
 
ConstraintMakeSumGreaterOrEqual (const std::vector< IntVar * > &vars, int64 cst)
 
ConstraintMakeSumEquality (const std::vector< IntVar * > &vars, int64 cst)
 
ConstraintMakeSumEquality (const std::vector< IntVar * > &vars, IntVar *const var)
 
ConstraintMakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefficients, int64 cst)
 
ConstraintMakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64 cst)
 
ConstraintMakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefficients, IntVar *const target)
 
ConstraintMakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, IntVar *const target)
 
ConstraintMakeScalProdGreaterOrEqual (const std::vector< IntVar * > &vars, const std::vector< int64 > &coeffs, int64 cst)
 
ConstraintMakeScalProdGreaterOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coeffs, int64 cst)
 
ConstraintMakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefficients, int64 cst)
 
ConstraintMakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64 cst)
 
ConstraintMakeMinEquality (const std::vector< IntVar * > &vars, IntVar *const min_var)
 
ConstraintMakeMaxEquality (const std::vector< IntVar * > &vars, IntVar *const max_var)
 
ConstraintMakeElementEquality (const std::vector< int64 > &vals, IntVar *const index, IntVar *const target)
 
ConstraintMakeElementEquality (const std::vector< int > &vals, IntVar *const index, IntVar *const target)
 
ConstraintMakeElementEquality (const std::vector< IntVar * > &vars, IntVar *const index, IntVar *const target)
 
ConstraintMakeElementEquality (const std::vector< IntVar * > &vars, IntVar *const index, int64 target)
 
ConstraintMakeAbsEquality (IntVar *const var, IntVar *const abs_var)
 Creates the constraint abs(var) == abs_var. More...
 
ConstraintMakeIndexOfConstraint (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...
 
DemonMakeConstraintInitialPropagateCallback (Constraint *const ct)
 This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct'. More...
 
DemonMakeDelayedConstraintInitialPropagateCallback (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...
 
DemonMakeActionDemon (Action action)
 Creates a demon from a callback. More...
 
DemonMakeClosureDemon (Closure closure)
 !defined(SWIG) More...
 
ConstraintMakeBetweenCt (IntExpr *const expr, int64 l, int64 u)
 (l <= expr <= u) More...
 
ConstraintMakeNotBetweenCt (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...
 
ConstraintMakeIsBetweenCt (IntExpr *const expr, int64 l, int64 u, IntVar *const b)
 b == (l <= expr <= u) More...
 
IntVarMakeIsBetweenVar (IntExpr *const v, int64 l, int64 u)
 
ConstraintMakeMemberCt (IntExpr *const expr, const std::vector< int64 > &values)
 expr in set. More...
 
ConstraintMakeMemberCt (IntExpr *const expr, const std::vector< int > &values)
 
ConstraintMakeNotMemberCt (IntExpr *const expr, const std::vector< int64 > &values)
 expr not in set. More...
 
ConstraintMakeNotMemberCt (IntExpr *const expr, const std::vector< int > &values)
 
ConstraintMakeNotMemberCt (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...
 
ConstraintMakeNotMemberCt (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...
 
ConstraintMakeNotMemberCt (IntExpr *expr, SortedDisjointIntervalList intervals)
 expr should not be in the list of forbidden intervals. More...
 
ConstraintMakeIsMemberCt (IntExpr *const expr, const std::vector< int64 > &values, IntVar *const boolvar)
 boolvar == (expr in set) More...
 
ConstraintMakeIsMemberCt (IntExpr *const expr, const std::vector< int > &values, IntVar *const boolvar)
 
IntVarMakeIsMemberVar (IntExpr *const expr, const std::vector< int64 > &values)
 
IntVarMakeIsMemberVar (IntExpr *const expr, const std::vector< int > &values)
 
ConstraintMakeAtMost (std::vector< IntVar * > vars, int64 value, int64 max_count)
 |{i | vars[i] == value}| <= max_count More...
 
ConstraintMakeCount (const std::vector< IntVar * > &vars, int64 value, int64 max_count)
 |{i | vars[i] == value}| == max_count More...
 
ConstraintMakeCount (const std::vector< IntVar * > &vars, int64 value, IntVar *const max_count)
 |{i | vars[i] == value}| == max_count More...
 
ConstraintMakeDistribute (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...
 
ConstraintMakeDistribute (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...
 
ConstraintMakeDistribute (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &cards)
 Aggregated version of count: |{i | v[i] == j}| == cards[j]. More...
 
ConstraintMakeDistribute (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...
 
ConstraintMakeDistribute (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...
 
ConstraintMakeDistribute (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...
 
ConstraintMakeDistribute (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...
 
ConstraintMakeDistribute (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...
 
ConstraintMakeDeviation (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...
 
ConstraintMakeAllDifferent (const std::vector< IntVar * > &vars)
 All variables are pairwise different. More...
 
ConstraintMakeAllDifferent (const std::vector< IntVar * > &vars, bool stronger_propagation)
 All variables are pairwise different. More...
 
ConstraintMakeAllDifferentExcept (const std::vector< IntVar * > &vars, int64 escape_value)
 All variables are pairwise different, unless they are assigned to the escape value. More...
 
ConstraintMakeSortingConstraint (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...
 
ConstraintMakeLexicalLess (const std::vector< IntVar * > &left, const std::vector< IntVar * > &right)
 Creates a constraint that enforces that left is lexicographically less than right. More...
 
ConstraintMakeLexicalLessOrEqual (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...
 
ConstraintMakeInversePermutationConstraint (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...
 
ConstraintMakeIndexOfFirstMaxValueConstraint (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...
 
ConstraintMakeIndexOfFirstMinValueConstraint (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...
 
ConstraintMakeNullIntersect (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...
 
ConstraintMakeNullIntersectExcept (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...
 
ConstraintMakeNoCycle (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, IndexFilter1 sink_handler=nullptr)
 Prevent cycles. More...
 
ConstraintMakeNoCycle (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, IndexFilter1 sink_handler, bool assume_paths)
 
ConstraintMakeCircuit (const std::vector< IntVar * > &nexts)
 Force the "nexts" variable to create a complete Hamiltonian path. More...
 
ConstraintMakeSubCircuit (const std::vector< IntVar * > &nexts)
 Force the "nexts" variable to create a complete Hamiltonian path for those that do not loop upon themselves. More...
 
ConstraintMakePathCumul (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...
 
ConstraintMakeDelayedPathCumul (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...
 
ConstraintMakePathCumul (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...
 
ConstraintMakePathCumul (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...
 
ConstraintMakePathConnected (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...
 
ConstraintMakePathPrecedenceConstraint (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...
 
ConstraintMakePathPrecedenceConstraint (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...
 
ConstraintMakePathTransitPrecedenceConstraint (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...
 
ConstraintMakeMapDomain (IntVar *const var, const std::vector< IntVar * > &actives)
 This constraint maps the domain of 'var' onto the array of variables 'actives'. More...
 
ConstraintMakeAllowedAssignments (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...
 
ConstraintMakeTransitionConstraint (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...
 
ConstraintMakeTransitionConstraint (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...
 
ConstraintMakeNonOverlappingBoxesConstraint (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...
 
ConstraintMakeNonOverlappingBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< int64 > &x_size, const std::vector< int64 > &y_size)
 
ConstraintMakeNonOverlappingBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< int > &x_size, const std::vector< int > &y_size)
 
ConstraintMakeNonOverlappingNonStrictBoxesConstraint (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...
 
ConstraintMakeNonOverlappingNonStrictBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< int64 > &x_size, const std::vector< int64 > &y_size)
 
ConstraintMakeNonOverlappingNonStrictBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< int > &x_size, const std::vector< int > &y_size)
 
PackMakePack (const std::vector< IntVar * > &vars, int number_of_bins)
 This constraint packs all variables onto 'number_of_bins' variables. More...
 
IntervalVarMakeFixedDurationIntervalVar (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...
 
IntervalVarMakeFixedDurationIntervalVar (IntVar *const start_variable, int64 duration, const std::string &name)
 Creates a performed interval var with a fixed duration. More...
 
IntervalVarMakeFixedDurationIntervalVar (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...
 
IntervalVarMakeFixedInterval (int64 start, int64 duration, const std::string &name)
 Creates a fixed and performed interval. More...
 
IntervalVarMakeIntervalVar (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...
 
IntervalVarMakeMirrorInterval (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...
 
IntervalVarMakeFixedDurationStartSyncedOnStartIntervalVar (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...
 
IntervalVarMakeFixedDurationStartSyncedOnEndIntervalVar (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...
 
IntervalVarMakeFixedDurationEndSyncedOnStartIntervalVar (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...
 
IntervalVarMakeFixedDurationEndSyncedOnEndIntervalVar (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...
 
IntervalVarMakeIntervalRelaxedMin (IntervalVar *const interval_var)
 Creates and returns an interval variable that wraps around the given one, relaxing the min start and end. More...
 
IntervalVarMakeIntervalRelaxedMax (IntervalVar *const interval_var)
 Creates and returns an interval variable that wraps around the given one, relaxing the max start and end. More...
 
ConstraintMakeIntervalVarRelation (IntervalVar *const t, UnaryIntervalRelation r, int64 d)
 This method creates a relation between an interval var and a date. More...
 
ConstraintMakeIntervalVarRelation (IntervalVar *const t1, BinaryIntervalRelation r, IntervalVar *const t2)
 This method creates a relation between two interval vars. More...
 
ConstraintMakeIntervalVarRelationWithDelay (IntervalVar *const t1, BinaryIntervalRelation r, IntervalVar *const t2, int64 delay)
 This method creates a relation between two interval vars. More...
 
ConstraintMakeTemporalDisjunction (IntervalVar *const t1, IntervalVar *const t2, IntVar *const alt)
 This constraint implements a temporal disjunction between two interval vars t1 and t2. More...
 
ConstraintMakeTemporalDisjunction (IntervalVar *const t1, IntervalVar *const t2)
 This constraint implements a temporal disjunction between two interval vars. More...
 
DisjunctiveConstraintMakeDisjunctiveConstraint (const std::vector< IntervalVar * > &intervals, const std::string &name)
 This constraint forces all interval vars into an non-overlapping sequence. More...
 
DisjunctiveConstraintMakeStrictDisjunctiveConstraint (const std::vector< IntervalVar * > &intervals, const std::string &name)
 This constraint forces all interval vars into an non-overlapping sequence. More...
 
ConstraintMakeCumulative (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...
 
ConstraintMakeCumulative (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...
 
ConstraintMakeCumulative (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...
 
ConstraintMakeCumulative (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...
 
ConstraintMakeCumulative (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...
 
ConstraintMakeCumulative (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...
 
ConstraintMakeCover (const std::vector< IntervalVar * > &vars, IntervalVar *const target_var)
 This constraint states that the target_var is the convex hull of the intervals. More...
 
ConstraintMakeEquality (IntervalVar *const var1, IntervalVar *const var2)
 This constraints states that the two interval variables are equal. More...
 
AssignmentMakeAssignment ()
 This method creates an empty assignment. More...
 
AssignmentMakeAssignment (const Assignment *const a)
 This method creates an assignment which is a copy of 'a'. More...
 
SolutionCollectorMakeFirstSolutionCollector (const Assignment *const assignment)
 Collect the first solution of the search. More...
 
SolutionCollectorMakeFirstSolutionCollector ()
 Collect the first solution of the search. More...
 
SolutionCollectorMakeLastSolutionCollector (const Assignment *const assignment)
 Collect the last solution of the search. More...
 
SolutionCollectorMakeLastSolutionCollector ()
 Collect the last solution of the search. More...
 
SolutionCollectorMakeBestValueSolutionCollector (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...
 
SolutionCollectorMakeBestValueSolutionCollector (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...
 
SolutionCollectorMakeNBestValueSolutionCollector (const Assignment *const assignment, int solution_count, bool maximize)
 Same as MakeBestValueSolutionCollector but collects the best solution_count solutions. More...
 
SolutionCollectorMakeNBestValueSolutionCollector (int solution_count, bool maximize)
 
SolutionCollectorMakeAllSolutionCollector (const Assignment *const assignment)
 Collect all solutions of the search. More...
 
SolutionCollectorMakeAllSolutionCollector ()
 Collect all solutions of the search. More...
 
OptimizeVarMakeMinimize (IntVar *const v, int64 step)
 Creates a minimization objective. More...
 
OptimizeVarMakeMaximize (IntVar *const v, int64 step)
 Creates a maximization objective. More...
 
OptimizeVarMakeOptimize (bool maximize, IntVar *const v, int64 step)
 Creates a objective with a given sense (true = maximization). More...
 
OptimizeVarMakeWeightedMinimize (const std::vector< IntVar * > &sub_objectives, const std::vector< int64 > &weights, int64 step)
 Creates a minimization weighted objective. More...
 
OptimizeVarMakeWeightedMinimize (const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64 step)
 Creates a minimization weighted objective. More...
 
OptimizeVarMakeWeightedMaximize (const std::vector< IntVar * > &sub_objectives, const std::vector< int64 > &weights, int64 step)
 Creates a maximization weigthed objective. More...
 
OptimizeVarMakeWeightedMaximize (const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64 step)
 Creates a maximization weigthed objective. More...
 
OptimizeVarMakeWeightedOptimize (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...
 
OptimizeVarMakeWeightedOptimize (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...
 
SearchMonitorMakeTabuSearch (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...
 
SearchMonitorMakeGenericTabuSearch (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...
 
SearchMonitorMakeSimulatedAnnealing (bool maximize, IntVar *const v, int64 step, int64 initial_temperature)
 Creates a Simulated Annealing monitor. More...
 
SearchMonitorMakeGuidedLocalSearch (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...
 
SearchMonitorMakeGuidedLocalSearch (bool maximize, IntVar *const objective, IndexEvaluator3 objective_function, int64 step, const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, double penalty_factor)
 
SearchMonitorMakeLubyRestart (int scale_factor)
 This search monitor will restart the search periodically. More...
 
SearchMonitorMakeConstantRestart (int frequency)
 This search monitor will restart the search periodically after 'frequency' failures. More...
 
RegularLimitMakeTimeLimit (absl::Duration time)
 Creates a search limit that constrains the running time. More...
 
RegularLimitMakeTimeLimit (int64 time_in_ms)
 
RegularLimitMakeBranchesLimit (int64 branches)
 Creates a search limit that constrains the number of branches explored in the search tree. More...
 
RegularLimitMakeFailuresLimit (int64 failures)
 Creates a search limit that constrains the number of failures that can happen when exploring the search tree. More...
 
RegularLimitMakeSolutionsLimit (int64 solutions)
 Creates a search limit that constrains the number of solutions found during the search. More...
 
RegularLimitMakeLimit (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...
 
RegularLimitMakeLimit (const RegularLimitParameters &proto)
 Creates a search limit from its protobuf description. More...
 
RegularLimitMakeLimit (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...
 
SearchLimitMakeLimit (SearchLimit *const limit_1, SearchLimit *const limit_2)
 Creates a search limit that is reached when either of the underlying limit is reached. More...
 
ImprovementSearchLimitMakeImprovementLimit (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...
 
SearchLimitMakeCustomLimit (std::function< bool()> limiter)
 Callback-based search limit. More...
 
SearchMonitorMakeSearchLog (int branch_period)
 The SearchMonitors below will display a periodic search log on LOG(INFO) every branch_period branches explored. More...
 
SearchMonitorMakeSearchLog (int branch_period, IntVar *const var)
 At each solution, this monitor also display the var value. More...
 
SearchMonitorMakeSearchLog (int branch_period, std::function< std::string()> display_callback)
 At each solution, this monitor will also display result of display_callback. More...
 
SearchMonitorMakeSearchLog (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...
 
SearchMonitorMakeSearchLog (int branch_period, OptimizeVar *const opt_var)
 OptimizeVar Search Logs At each solution, this monitor will also display the 'opt_var' value. More...
 
SearchMonitorMakeSearchLog (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...
 
SearchMonitorMakeSearchLog (SearchLogParameters parameters)
 
SearchMonitorMakeSearchTrace (const std::string &prefix)
 Creates a search monitor that will trace precisely the behavior of the search. More...
 
SearchMonitorMakeEnterSearchCallback (std::function< void()> callback)
 --— Callback-based search monitors --— More...
 
SearchMonitorMakeExitSearchCallback (std::function< void()> callback)
 
SearchMonitorMakeAtSolutionCallback (std::function< void()> callback)
 
ModelVisitorMakePrintModelVisitor ()
 Prints the model. More...
 
ModelVisitorMakeStatisticsModelVisitor ()
 Displays some nice statistics on the model. More...
 
ModelVisitorMakeVariableDegreeVisitor (absl::flat_hash_map< const IntVar *, int > *const map)
 Compute the number of constraints a variable is attached to. More...
 
SearchMonitorMakeSymmetryManager (const std::vector< SymmetryBreaker * > &visitors)
 Symmetry Breaking. More...
 
SearchMonitorMakeSymmetryManager (SymmetryBreaker *const v1)
 
SearchMonitorMakeSymmetryManager (SymmetryBreaker *const v1, SymmetryBreaker *const v2)
 
SearchMonitorMakeSymmetryManager (SymmetryBreaker *const v1, SymmetryBreaker *const v2, SymmetryBreaker *const v3)
 
SearchMonitorMakeSymmetryManager (SymmetryBreaker *const v1, SymmetryBreaker *const v2, SymmetryBreaker *const v3, SymmetryBreaker *const v4)
 
DecisionMakeAssignVariableValue (IntVar *const var, int64 val)
 Decisions. More...
 
DecisionMakeVariableLessOrEqualValue (IntVar *const var, int64 value)
 
DecisionMakeVariableGreaterOrEqualValue (IntVar *const var, int64 value)
 
DecisionMakeSplitVariableDomain (IntVar *const var, int64 val, bool start_with_lower_half)
 
DecisionMakeAssignVariableValueOrFail (IntVar *const var, int64 value)
 
DecisionMakeAssignVariableValueOrDoNothing (IntVar *const var, int64 value)
 
DecisionMakeAssignVariablesValues (const std::vector< IntVar * > &vars, const std::vector< int64 > &values)
 
DecisionMakeFailDecision ()
 
DecisionMakeDecision (Action apply, Action refute)
 
DecisionBuilderCompose (DecisionBuilder *const db1, DecisionBuilder *const db2)
 Creates a decision builder which sequentially composes decision builders. More...
 
DecisionBuilderCompose (DecisionBuilder *const db1, DecisionBuilder *const db2, DecisionBuilder *const db3)
 
DecisionBuilderCompose (DecisionBuilder *const db1, DecisionBuilder *const db2, DecisionBuilder *const db3, DecisionBuilder *const db4)
 
DecisionBuilderCompose (const std::vector< DecisionBuilder * > &dbs)
 
DecisionBuilderTry (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...
 
DecisionBuilderTry (DecisionBuilder *const db1, DecisionBuilder *const db2, DecisionBuilder *const db3)
 
DecisionBuilderTry (DecisionBuilder *const db1, DecisionBuilder *const db2, DecisionBuilder *const db3, DecisionBuilder *const db4)
 
DecisionBuilderTry (const std::vector< DecisionBuilder * > &dbs)
 
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IntValueStrategy val_str)
 Phases on IntVar arrays. More...
 
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 var_evaluator, IntValueStrategy val_str)
 
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IndexEvaluator2 value_evaluator)
 
DecisionBuilderMakePhase (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...
 
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 var_evaluator, IndexEvaluator2 value_evaluator)
 
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IndexEvaluator2 value_evaluator, IndexEvaluator1 tie_breaker)
 
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 var_evaluator, IndexEvaluator2 value_evaluator, IndexEvaluator1 tie_breaker)
 
DecisionBuilderMakeDefaultPhase (const std::vector< IntVar * > &vars)
 
DecisionBuilderMakeDefaultPhase (const std::vector< IntVar * > &vars, const DefaultPhaseParameters &parameters)
 
DecisionBuilderMakePhase (IntVar *const v0, IntVarStrategy var_str, IntValueStrategy val_str)
 Shortcuts for small arrays. More...
 
DecisionBuilderMakePhase (IntVar *const v0, IntVar *const v1, IntVarStrategy var_str, IntValueStrategy val_str)
 
DecisionBuilderMakePhase (IntVar *const v0, IntVar *const v1, IntVar *const v2, IntVarStrategy var_str, IntValueStrategy val_str)
 
DecisionBuilderMakePhase (IntVar *const v0, IntVar *const v1, IntVar *const v2, IntVar *const v3, IntVarStrategy var_str, IntValueStrategy val_str)
 
DecisionMakeScheduleOrPostpone (IntervalVar *const var, int64 est, int64 *const marker)
 Returns a decision that tries to schedule a task at a given time. More...
 
DecisionMakeScheduleOrExpedite (IntervalVar *const var, int64 est, int64 *const marker)
 Returns a decision that tries to schedule a task at a given time. More...
 
DecisionMakeRankFirstInterval (SequenceVar *const sequence, int index)
 Returns a decision that tries to rank first the ith interval var in the sequence variable. More...
 
DecisionMakeRankLastInterval (SequenceVar *const sequence, int index)
 Returns a decision that tries to rank last the ith interval var in the sequence variable. More...
 
DecisionBuilderMakePhase (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...
 
DecisionBuilderMakePhase (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...
 
DecisionBuilderMakePhase (const std::vector< IntervalVar * > &intervals, IntervalStrategy str)
 Scheduling phases. More...
 
DecisionBuilderMakePhase (const std::vector< SequenceVar * > &sequences, SequenceStrategy str)
 
DecisionBuilderMakeDecisionBuilderFromAssignment (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...
 
DecisionBuilderMakeConstraintAdder (Constraint *const ct)
 Returns a decision builder that will add the given constraint to the model. More...
 
DecisionBuilderMakeSolveOnce (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...
 
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1)
 
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1, SearchMonitor *const monitor2)
 
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3)
 
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3, SearchMonitor *const monitor4)
 
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, const std::vector< SearchMonitor * > &monitors)
 
DecisionBuilderMakeNestedOptimize (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...
 
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1)
 
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1, SearchMonitor *const monitor2)
 
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3)
 
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3, SearchMonitor *const monitor4)
 
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, const std::vector< SearchMonitor * > &monitors)
 
DecisionBuilderMakeRestoreAssignment (Assignment *assignment)
 Returns a DecisionBuilder which restores an Assignment (calls void Assignment::Restore()) More...
 
DecisionBuilderMakeStoreAssignment (Assignment *assignment)
 Returns a DecisionBuilder which stores an Assignment (calls void Assignment::Store()) More...
 
LocalSearchOperatorMakeOperator (const std::vector< IntVar * > &vars, LocalSearchOperators op)
 Local Search Operators. More...
 
LocalSearchOperatorMakeOperator (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, LocalSearchOperators op)
 
LocalSearchOperatorMakeOperator (const std::vector< IntVar * > &vars, IndexEvaluator3 evaluator, EvaluatorLocalSearchOperators op)
 
LocalSearchOperatorMakeOperator (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, IndexEvaluator3 evaluator, EvaluatorLocalSearchOperators op)
 
LocalSearchOperatorMakeRandomLnsOperator (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...
 
LocalSearchOperatorMakeRandomLnsOperator (const std::vector< IntVar * > &vars, int number_of_variables, int32 seed)
 
LocalSearchOperatorMakeMoveTowardTargetOperator (const Assignment &target)
 Creates a local search operator that tries to move the assignment of some variables toward a target. More...
 
LocalSearchOperatorMakeMoveTowardTargetOperator (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...
 
LocalSearchOperatorConcatenateOperators (const std::vector< LocalSearchOperator * > &ops)
 Creates a local search operator which concatenates a vector of operators. More...
 
LocalSearchOperatorConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, bool restart)
 
LocalSearchOperatorConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, std::function< int64(int, int)> evaluator)
 
LocalSearchOperatorRandomConcatenateOperators (const std::vector< LocalSearchOperator * > &ops)
 Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor(). More...
 
LocalSearchOperatorRandomConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, int32 seed)
 Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor(). More...
 
LocalSearchOperatorMultiArmedBanditConcatenateOperators (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...
 
LocalSearchOperatorMakeNeighborhoodLimit (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...
 
DecisionBuilderMakeLocalSearchPhase (Assignment *const assignment, LocalSearchPhaseParameters *const parameters)
 Local Search decision builders factories. More...
 
DecisionBuilderMakeLocalSearchPhase (const std::vector< IntVar * > &vars, DecisionBuilder *const first_solution, LocalSearchPhaseParameters *const parameters)
 
DecisionBuilderMakeLocalSearchPhase (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...
 
DecisionBuilderMakeLocalSearchPhase (const std::vector< SequenceVar * > &vars, DecisionBuilder *const first_solution, LocalSearchPhaseParameters *const parameters)
 
SolutionPoolMakeDefaultSolutionPool ()
 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)
 
LocalSearchFilterMakeAcceptFilter ()
 Local Search Filters. More...
 
LocalSearchFilterMakeRejectFilter ()
 
LocalSearchFilterMakeVariableDomainFilter ()
 
IntVarLocalSearchFilterMakeSumObjectiveFilter (const std::vector< IntVar * > &vars, IndexEvaluator2 values, Solver::LocalSearchFilterBound filter_enum)
 
IntVarLocalSearchFilterMakeSumObjectiveFilter (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...
 
DecisionBuilderMakeApplyBranchSelector (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...
 
Decisionbalancing_decision () const
 
void set_fail_intercept (std::function< void()> fail_intercept)
 Internal. More...
 
void clear_fail_intercept ()
 
DemonProfilerdemon_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...
 
DemonRegisterDemon (Demon *const demon)
 Adds a new demon and wraps it inside a DemonProfiler if necessary. More...
 
IntExprRegisterIntExpr (IntExpr *const expr)
 Registers a new IntExpr and wraps it inside a TraceIntExpr if necessary. More...
 
IntVarRegisterIntVar (IntVar *const var)
 Registers a new IntVar and wraps it inside a TraceIntVar if necessary. More...
 
IntervalVarRegisterIntervalVar (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...
 
ModelCacheCache () 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...
 
PropagationMonitorGetPropagationMonitor () const
 Returns the propagation monitor. More...
 
void AddPropagationMonitor (PropagationMonitor *const monitor)
 Adds the propagation monitor to the solver. More...
 
LocalSearchMonitorGetLocalSearchMonitor () 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
 
AssignmentGetOrCreateLocalSearchState ()
 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...
 
IntExprCastExpression (const IntVar *const var) const
 !defined(SWIG) More...
 
void FinishCurrentSearch ()
 Tells the solver to kill or restart the current search. More...
 
void RestartCurrentSearch ()
 
void ShouldFail ()
 These methods are only useful for the SWIG wrappers, which need a way to externally cause the Solver to fail. More...
 
void CheckFail ()
 
bool Solve (DecisionBuilder *const db, const std::vector< SearchMonitor * > &monitors)
 
bool Solve (DecisionBuilder *const db)
 
bool Solve (DecisionBuilder *const db, SearchMonitor *const m1)
 
bool Solve (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2)
 
bool Solve (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3)
 
bool Solve (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3, SearchMonitor *const m4)
 
void NewSearch (DecisionBuilder *const db, const std::vector< SearchMonitor * > &monitors)
 
void NewSearch (DecisionBuilder *const db)
 
void NewSearch (DecisionBuilder *const db, SearchMonitor *const m1)
 
void NewSearch (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2)
 
void NewSearch (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3)
 
void NewSearch (DecisionBuilder *const db, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3, SearchMonitor *const m4)
 
bool NextSolution ()
 
void RestartSearch ()
 
void EndSearch ()
 

Static Public Member Functions

static ConstraintSolverParameters DefaultSolverParameters ()
 Create a ConstraintSolverParameters proto with all the default values. More...
 
static int64 MemoryUsage ()
 Current memory usage in bytes. More...
 

Public Attributes

std::vector< int64 > tmp_vector_
 Unsafe temporary vector. More...
 

Static Public Attributes

static constexpr int kNumPriorities = 3
 Number of priorities for demons. More...
 

Member Typedef Documentation

◆ Action

typedef std::function<void(Solver*)> Action

Definition at line 759 of file constraint_solver.h.

◆ BranchSelector

typedef std::function<DecisionModification()> BranchSelector

Definition at line 757 of file constraint_solver.h.

◆ Closure

typedef std::function<void()> Closure

Definition at line 760 of file constraint_solver.h.

◆ IndexEvaluator1

typedef std::function<int64(int64)> IndexEvaluator1

Callback typedefs.

Definition at line 743 of file constraint_solver.h.

◆ IndexEvaluator2

typedef std::function<int64(int64, int64)> IndexEvaluator2

Definition at line 744 of file constraint_solver.h.

◆ IndexEvaluator3

typedef std::function<int64(int64, int64, int64)> IndexEvaluator3

Definition at line 745 of file constraint_solver.h.

◆ IndexFilter1

typedef std::function<bool(int64)> IndexFilter1

Definition at line 747 of file constraint_solver.h.

◆ Int64ToIntVar

typedef std::function<IntVar*(int64)> Int64ToIntVar

Definition at line 749 of file constraint_solver.h.

◆ VariableIndexSelector

typedef std::function<int64(Solver* solver, const std::vector<IntVar*>& vars, int64 first_unbound, int64 last_unbound)> VariableIndexSelector

Definition at line 753 of file constraint_solver.h.

◆ VariableValueComparator

typedef std::function<bool(int64, int64, int64)> VariableValueComparator

Definition at line 756 of file constraint_solver.h.

◆ VariableValueSelector

typedef std::function<int64(const IntVar* v, int64 id)> VariableValueSelector

Definition at line 755 of file constraint_solver.h.

Member Enumeration Documentation

◆ BinaryIntervalRelation

This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between the two intervals t1 and t2.

Enumerator
ENDS_AFTER_END 

t1 ends after t2 end, i.e. End(t1) >= End(t2) + delay.

ENDS_AFTER_START 

t1 ends after t2 start, i.e. End(t1) >= Start(t2) + delay.

ENDS_AT_END 

t1 ends at t2 end, i.e. End(t1) == End(t2) + delay.

ENDS_AT_START 

t1 ends at t2 start, i.e. End(t1) == Start(t2) + delay.

STARTS_AFTER_END 

t1 starts after t2 end, i.e. Start(t1) >= End(t2) + delay.

STARTS_AFTER_START 

t1 starts after t2 start, i.e. Start(t1) >= Start(t2) + delay.

STARTS_AT_END 

t1 starts at t2 end, i.e. Start(t1) == End(t2) + delay.

STARTS_AT_START 

t1 starts at t2 start, i.e. Start(t1) == Start(t2) + delay.

STAYS_IN_SYNC 

STARTS_AT_START and ENDS_AT_END at the same time.

t1 starts at t2 start, i.e. Start(t1) == Start(t2) + delay. t1 ends at t2 end, i.e. End(t1) == End(t2).

Definition at line 627 of file constraint_solver.h.

◆ 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.

Enumerator
NO_CHANGE 

Keeps the default behavior, i.e.

apply left branch first, and then right branch in case of backtracking.

KEEP_LEFT 

Right branches are ignored.

This is used to make the code faster when backtrack makes no sense or is not useful. This is faster as there is no need to create one new node per decision.

KEEP_RIGHT 

Left branches are ignored.

This is used to make the code faster when backtrack makes no sense or is not useful. This is faster as there is no need to create one new node per decision.

KILL_BOTH 

Backtracks to the previous decisions, i.e.

left and right branches are not applied.

SWITCH_BRANCHES 

Applies right branch first.

Left branch will be applied in case of backtracking.

Definition at line 695 of file constraint_solver.h.

◆ DemonPriority

This enum represents the three possible priorities for a demon in the Solver queue.

Note: this is for advanced users only.

Enumerator
DELAYED_PRIORITY 

DELAYED_PRIORITY is the lowest priority: Demons will be processed after VAR_PRIORITY and NORMAL_PRIORITY demons.

VAR_PRIORITY 

VAR_PRIORITY is between DELAYED_PRIORITY and NORMAL_PRIORITY.

NORMAL_PRIORITY 

NORMAL_PRIORITY is the highest priority: Demons will be processed first.

Definition at line 613 of file constraint_solver.h.

◆ EvaluatorLocalSearchOperators

This enum is used in Solver::MakeOperator associated with an evaluator to specify the neighborhood to create.

Enumerator
LK 

Lin-Kernighan local search.

While the accumulated local gain is positive, perform a 2opt or a 3opt move followed by a series of 2opt moves. Return a neighbor for which the global gain is positive.

TSPOPT 

Sliding TSP operator.

Uses an exact dynamic programming algorithm to solve the TSP corresponding to path sub-chains. For a subchain 1 -> 2 -> 3 -> 4 -> 5 -> 6, solves the TSP on nodes A, 2, 3, 4, 5, where A is a merger of nodes 1 and 6 such that cost(A,i) = cost(1,i) and cost(i,A) = cost(i,6).

TSPLNS 

TSP-base LNS.

Randomly merge consecutive nodes until n "meta"-nodes remain and solve the corresponding TSP. This is an "unlimited" neighborhood which must be stopped by search limits. To force diversification, the operator iteratively forces each node to serve as base of a meta-node.

Definition at line 572 of file constraint_solver.h.

◆ 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.

Enumerator
CHOOSE_STATIC_GLOBAL_BEST 

Pairs are compared at the first call of the selector, and results are cached.

Next calls to the selector use the previous computation, and so are not up-to-date, e.g. some <variable, value> pairs may not be possible anymore due to propagation since the first to call.

CHOOSE_DYNAMIC_GLOBAL_BEST 

Pairs are compared each time a variable is selected.

That way all pairs are relevant and evaluation is accurate. This strategy runs in O(number-of-pairs) at each variable selection, versus O(1) in the static version.

Definition at line 395 of file constraint_solver.h.

◆ IntervalStrategy

This enum describes the straregy used to select the next interval variable and its value to be fixed.

Enumerator
INTERVAL_DEFAULT 

The default is INTERVAL_SET_TIMES_FORWARD.

INTERVAL_SIMPLE 

The simple is INTERVAL_SET_TIMES_FORWARD.

INTERVAL_SET_TIMES_FORWARD 

Selects the variable with the lowest starting time of all variables, and fixes its starting time to this lowest value.

INTERVAL_SET_TIMES_BACKWARD 

Selects the variable with the highest ending time of all variables, and fixes the ending time to this highest values.

Definition at line 419 of file constraint_solver.h.

◆ IntValueStrategy

This enum describes the strategy used to select the next variable value to set.

Enumerator
INT_VALUE_DEFAULT 

The default behavior is ASSIGN_MIN_VALUE.

INT_VALUE_SIMPLE 

The simple selection is ASSIGN_MIN_VALUE.

ASSIGN_MIN_VALUE 

Selects the min value of the selected variable.

ASSIGN_MAX_VALUE 

Selects the max value of the selected variable.

ASSIGN_RANDOM_VALUE 

Selects randomly one of the possible values of the selected variable.

ASSIGN_CENTER_VALUE 

Selects the first possible value which is the closest to the center of the domain of the selected variable.

The center is defined as (min + max) / 2.

SPLIT_LOWER_HALF 

Split the domain in two around the center, and choose the lower part first.

SPLIT_UPPER_HALF 

Split the domain in two around the center, and choose the lower part first.

Definition at line 355 of file constraint_solver.h.

◆ IntVarStrategy

This enum describes the strategy used to select the next branching variable at each node during the search.

Enumerator
INT_VAR_DEFAULT 

The default behavior is CHOOSE_FIRST_UNBOUND.

INT_VAR_SIMPLE 

The simple selection is CHOOSE_FIRST_UNBOUND.

CHOOSE_FIRST_UNBOUND 

Select the first unbound variable.

Variables are considered in the order of the vector of IntVars used to create the selector.

CHOOSE_RANDOM 

Randomly select one of the remaining unbound variables.

CHOOSE_MIN_SIZE_LOWEST_MIN 

Among unbound variables, select the variable with the smallest size, i.e., the smallest number of possible values.

In case of a tie, the selected variables is the one with the lowest min value. In case of a tie, the first one is selected, first being defined by the order in the vector of IntVars used to create the selector.

CHOOSE_MIN_SIZE_HIGHEST_MIN 

Among unbound variables, select the variable with the smallest size, i.e., the smallest number of possible values.

In case of a tie, the selected variable is the one with the highest min value. In case of a tie, the first one is selected, first being defined by the order in the vector of IntVars used to create the selector.

CHOOSE_MIN_SIZE_LOWEST_MAX 

Among unbound variables, select the variable with the smallest size, i.e., the smallest number of possible values.

In case of a tie, the selected variables is the one with the lowest max value. In case of a tie, the first one is selected, first being defined by the order in the vector of IntVars used to create the selector.

CHOOSE_MIN_SIZE_HIGHEST_MAX 

Among unbound variables, select the variable with the smallest size, i.e., the smallest number of possible values.

In case of a tie, the selected variable is the one with the highest max value. In case of a tie, the first one is selected, first being defined by the order in the vector of IntVars used to create the selector.

CHOOSE_LOWEST_MIN 

Among unbound variables, select the variable with the smallest minimal value.

In case of a tie, the first one is selected, "first" defined by the order in the vector of IntVars used to create the selector.

CHOOSE_HIGHEST_MAX 

Among unbound variables, select the variable with the highest maximal value.

In case of a tie, the first one is selected, first being defined by the order in the vector of IntVars used to create the selector.

CHOOSE_MIN_SIZE 

Among unbound variables, select the variable with the smallest size.

In case of a tie, the first one is selected, first being defined by the order in the vector of IntVars used to create the selector.

CHOOSE_MAX_SIZE 

Among unbound variables, select the variable with the highest size.

In case of a tie, the first one is selected, first being defined by the order in the vector of IntVars used to create the selector.

CHOOSE_MAX_REGRET_ON_MIN 

Among unbound variables, select the variable with the largest gap between the first and the second values of the domain.

CHOOSE_PATH 

Selects the next unbound variable on a path, the path being defined by the variables: var[i] corresponds to the index of the next of i.

Definition at line 274 of file constraint_solver.h.

◆ LocalSearchFilterBound

This enum is used in Solver::MakeLocalSearchObjectiveFilter.

It specifies the behavior of the objective filter to create. The goal is to define under which condition a move is accepted based on the current objective value.

Enumerator
GE 

Move is accepted when the current objective value >= objective.Min.

LE 

Move is accepted when the current objective value <= objective.Max.

EQ 

Move is accepted when the current objective value is in the interval objective.Min .

. objective.Max.

Definition at line 600 of file constraint_solver.h.

◆ 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.

◆ MarkerType

enum MarkerType

This enum is used internally in private methods Solver::PushState and Solver::PopState to tag states in the search tree.

Enumerator
SENTINEL 
SIMPLE_MARKER 
CHOICE_POINT 
REVERSIBLE_ACTION 

Definition at line 721 of file constraint_solver.h.

◆ OptimizationDirection

Optimization directions.

Enumerator
NOT_SET 
MAXIMIZATION 
MINIMIZATION 

Definition at line 740 of file constraint_solver.h.

◆ SequenceStrategy

Used for scheduling. Not yet implemented.

Enumerator
SEQUENCE_DEFAULT 
SEQUENCE_SIMPLE 
CHOOSE_MIN_SLACK_RANK_FORWARD 
CHOOSE_RANDOM_RANK_FORWARD 

Definition at line 410 of file constraint_solver.h.

◆ SolverState

This enum represents the state of the solver w.r.t. the search.

Enumerator
OUTSIDE_SEARCH 

Before search, after search.

IN_ROOT_NODE 

Executing the root node.

IN_SEARCH 

Executing the search code.

AT_SOLUTION 

After successful NextSolution and before EndSearch.

NO_MORE_SOLUTIONS 

After failed NextSolution and before EndSearch.

PROBLEM_INFEASIBLE 

After search, the model is infeasible.

Definition at line 724 of file constraint_solver.h.

◆ UnaryIntervalRelation

This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between an interval t and an integer d.

Enumerator
ENDS_AFTER 

t ends after d, i.e. End(t) >= d.

ENDS_AT 

t ends at d, i.e. End(t) == d.

ENDS_BEFORE 

t ends before d, i.e. End(t) <= d.

STARTS_AFTER 

t starts after d, i.e. Start(t) >= d.

STARTS_AT 

t starts at d, i.e. Start(t) == d.

STARTS_BEFORE 

t starts before d, i.e. Start(t) <= d.

CROSS_DATE 

STARTS_BEFORE and ENDS_AFTER at the same time, i.e.

d is in t. t starts before d, i.e. Start(t) <= d. t ends after d, i.e. End(t) >= d.

AVOID_DATE 

STARTS_AFTER or ENDS_BEFORE, i.e.

d is not in t. t starts after d, i.e. Start(t) >= d. t ends before d, i.e. End(t) <= d.

Definition at line 660 of file constraint_solver.h.

Constructor & Destructor Documentation

◆ Solver() [1/2]

Solver ( const std::string &  name)
explicit

Solver API.

◆ Solver() [2/2]

Solver ( const std::string &  name,
const ConstraintSolverParameters &  parameters 
)

◆ ~Solver()

~Solver ( )

Member Function Documentation

◆ Accept()

void Accept ( ModelVisitor *const  visitor) const

Accepts the given model visitor.

◆ accepted_neighbors()

int64 accepted_neighbors ( ) const
inline

The number of accepted neighbors.

Definition at line 1008 of file constraint_solver.h.

◆ ActiveSearch()

Search* ActiveSearch ( ) const

Returns the active search, nullptr outside search.

◆ AddBacktrackAction()

void AddBacktrackAction ( Action  a,
bool  fast 
)

When SaveValue() is not the best way to go, one can create a reversible action that will be called upon backtrack.

The "fast" parameter indicates whether we need restore all values saved through SaveValue() before calling this method.

◆ AddCastConstraint()

void AddCastConstraint ( CastConstraint *const  constraint,
IntVar *const  target_var,
IntExpr *const  expr 
)

Adds 'constraint' to the solver and marks it as a cast constraint, that is, a constraint created calling Var() on an expression.

This is used internally.

◆ AddConstraint()

void AddConstraint ( Constraint *const  c)

Adds the constraint 'c' to the model.

After calling this method, and until there is a backtrack that undoes the addition, any assignment of variables to values must satisfy the given constraint in order to be considered feasible. There are two fairly different use cases:

  • the most common use case is modeling: the given constraint is really part of the problem that the user is trying to solve. In this use case, AddConstraint is called outside of search (i.e., with state() == OUTSIDE_SEARCH). Most users should only use AddConstraint in this way. In this case, the constraint will belong to the model forever: it cannot not be removed by backtracking.
  • a rarer use case is that 'c' is not a real constraint of the model. It may be a constraint generated by a branching decision (a constraint whose goal is to restrict the search space), a symmetry breaking constraint (a constraint that does restrict the search space, but in a way that cannot have an impact on the quality of the solutions in the subtree), or an inferred constraint that, while having no semantic value to the model (it does not restrict the set of solutions), is worth having because we believe it may strengthen the propagation. In these cases, it happens that the constraint is added during the search (i.e., with state() == IN_SEARCH or state() == IN_ROOT_NODE). When a constraint is added during a search, it applies only to the subtree of the search tree rooted at the current node, and will be automatically removed by backtracking.

This method does not take ownership of the constraint. If the constraint has been created by any factory method (Solver::MakeXXX), it will automatically be deleted. However, power users who implement their own constraints should do: solver.AddConstraint(solver.RevAlloc(new MyConstraint(...));

◆ AddLocalSearchMonitor()

void AddLocalSearchMonitor ( LocalSearchMonitor monitor)

Adds the local search monitor to the solver.

This is called internally when a propagation monitor is passed to the Solve() or NewSearch() method.

◆ AddPropagationMonitor()

void AddPropagationMonitor ( PropagationMonitor *const  monitor)

Adds the propagation monitor to the solver.

This is called internally when a propagation monitor is passed to the Solve() or NewSearch() method.

◆ balancing_decision()

Decision* balancing_decision ( ) const
inline

Definition at line 2870 of file constraint_solver.h.

◆ branches()

int64 branches ( ) const
inline

The number of branches explored since the creation of the solver.

Definition at line 987 of file constraint_solver.h.

◆ Cache()

ModelCache* Cache ( ) const

Returns the cache of the model.

◆ CastExpression()

IntExpr* CastExpression ( const IntVar *const  var) const

!defined(SWIG)

Internal. If the variables is the result of expr->Var(), this method returns expr, nullptr otherwise.

◆ CheckAssignment()

bool CheckAssignment ( Assignment *const  solution)

Checks whether the given assignment satisfies all relevant constraints.

◆ CheckConstraint()

bool CheckConstraint ( Constraint *const  ct)

Checks whether adding this constraint will lead to an immediate failure.

It will return false if the model is already inconsistent, or if adding the constraint makes it inconsistent.

◆ CheckFail()

void CheckFail ( )
inline

Definition at line 2986 of file constraint_solver.h.

◆ clear_fail_intercept()

void clear_fail_intercept ( )
inline

Definition at line 2878 of file constraint_solver.h.

◆ ClearLocalSearchState()

void ClearLocalSearchState ( )
inline

Clears the local search state.

Definition at line 2934 of file constraint_solver.h.

◆ Compose() [1/4]

DecisionBuilder* Compose ( const std::vector< DecisionBuilder * > &  dbs)

◆ Compose() [2/4]

DecisionBuilder* Compose ( DecisionBuilder *const  db1,
DecisionBuilder *const  db2 
)

Creates a decision builder which sequentially composes decision builders.

At each leaf of a decision builder, the next decision builder is therefore called. For instance, Compose(db1, db2) will result in the following tree: d1 tree | / | \ | db1 leaves | / | \ | db2 tree db2 tree db2 tree |

◆ Compose() [3/4]

DecisionBuilder* Compose ( DecisionBuilder *const  db1,
DecisionBuilder *const  db2,
DecisionBuilder *const  db3 
)

◆ Compose() [4/4]

DecisionBuilder* Compose ( DecisionBuilder *const  db1,
DecisionBuilder *const  db2,
DecisionBuilder *const  db3,
DecisionBuilder *const  db4 
)

◆ ConcatenateOperators() [1/3]

LocalSearchOperator* ConcatenateOperators ( const std::vector< LocalSearchOperator * > &  ops)

Creates a local search operator which concatenates a vector of operators.

Each operator from the vector is called sequentially. By default, when a neighbor is found the neighborhood exploration restarts from the last active operator (the one which produced the neighbor). This can be overridden by setting restart to true to force the exploration to start from the first operator in the vector.

The default behavior can also be overridden using an evaluation callback to set the order in which the operators are explored (the callback is called in LocalSearchOperator::Start()). The first argument of the callback is the index of the operator which produced the last move, the second argument is the index of the operator to be evaluated. Ownership of the callback is taken by ConcatenateOperators.

Example:

const int kPriorities = {10, 100, 10, 0}; int64 Evaluate(int active_operator, int current_operator) { return kPriorities[current_operator]; }

LocalSearchOperator* concat = solver.ConcatenateOperators(operators, NewPermanentCallback(&Evaluate));

The elements of the vector operators will be sorted by increasing priority and explored in that order (tie-breaks are handled by keeping the relative operator order in the vector). This would result in the following order: operators[3], operators[0], operators[2], operators[1].

◆ ConcatenateOperators() [2/3]

LocalSearchOperator* ConcatenateOperators ( const std::vector< LocalSearchOperator * > &  ops,
bool  restart 
)

◆ ConcatenateOperators() [3/3]

LocalSearchOperator* ConcatenateOperators ( const std::vector< LocalSearchOperator * > &  ops,
std::function< int64(int, int)>  evaluator 
)

◆ constraints()

int constraints ( ) const
inline

Counts the number of constraints that have been added to the solver before the search.

Definition at line 2865 of file constraint_solver.h.

◆ CurrentlyInSolve()

bool CurrentlyInSolve ( ) const

Returns true whether the current search has been created using a Solve() call instead of a NewSearch one.

It returns false if the solver is not in search at all.

◆ DebugString()

std::string DebugString ( ) const

!defined(SWIG)

misc debug string.

◆ DefaultSolverParameters()

static ConstraintSolverParameters DefaultSolverParameters ( )
static

Create a ConstraintSolverParameters proto with all the default values.

◆ demon_profiler()

DemonProfiler* demon_profiler ( ) const
inline

Access to demon profiler.

Definition at line 2880 of file constraint_solver.h.

◆ demon_runs()

int64 demon_runs ( DemonPriority  p) const
inline

The number of demons executed during search for a given priority.

Definition at line 996 of file constraint_solver.h.

◆ EndSearch()

void EndSearch ( )

◆ ExportProfilingOverview()

void ExportProfilingOverview ( const std::string &  filename)

Exports the profiling information in a human readable overview.

The parameter profile_level used to create the solver must be set to true.

◆ Fail()

void Fail ( )

Abandon the current branch in the search tree. A backtrack will follow.

◆ fail_stamp()

uint64 fail_stamp ( ) const

The fail_stamp() is incremented after each backtrack.

◆ failures()

int64 failures ( ) const
inline

The number of failures encountered since the creation of the solver.

Definition at line 999 of file constraint_solver.h.

◆ filtered_neighbors()

int64 filtered_neighbors ( ) const
inline

The number of filtered neighbors (neighbors accepted by filters).

Definition at line 1005 of file constraint_solver.h.

◆ FinishCurrentSearch()

void FinishCurrentSearch ( )

Tells the solver to kill or restart the current search.

◆ GetConstraintSolverStatistics()

ConstraintSolverStatistics GetConstraintSolverStatistics ( ) const

Returns detailed cp search statistics.

◆ GetLocalSearchMonitor()

LocalSearchMonitor* GetLocalSearchMonitor ( ) const

Returns the local search monitor.

◆ GetLocalSearchStatistics()

LocalSearchStatistics GetLocalSearchStatistics ( ) const

Returns detailed local search statistics.

◆ GetOrCreateLocalSearchState()

Assignment* GetOrCreateLocalSearchState ( )

Returns (or creates) an assignment representing the state of local search.

◆ GetPropagationMonitor()

PropagationMonitor* GetPropagationMonitor ( ) const

Returns the propagation monitor.

◆ HasName()

bool HasName ( const PropagationBaseObject object) const

Returns whether the object has been named or not.

◆ InstrumentsDemons()

bool InstrumentsDemons ( ) const

Returns whether we are instrumenting demons.

◆ InstrumentsVariables()

bool InstrumentsVariables ( ) const

Returns whether we are tracing variables.

◆ IsBooleanVar()

bool IsBooleanVar ( IntExpr *const  expr,
IntVar **  inner_var,
bool *  is_negated 
) const

Returns true if expr represents either boolean_var or 1 - boolean_var.

In that case, it fills inner_var and is_negated to be true if the expression is 1 - boolean_var – equivalent to not(boolean_var).

◆ IsLocalSearchProfilingEnabled()

bool IsLocalSearchProfilingEnabled ( ) const

Returns whether we are profiling local search.

◆ IsProduct()

bool IsProduct ( IntExpr *const  expr,
IntExpr **  inner_expr,
int64 *  coefficient 
)

Returns true if expr represents a product of a expr and a constant.

In that case, it fills inner_expr and coefficient with these, and returns true. In the other case, it fills inner_expr with expr, coefficient with 1, and returns false.

◆ IsProfilingEnabled()

bool IsProfilingEnabled ( ) const

Returns whether we are profiling the solver.

◆ LocalSearchProfile()

std::string LocalSearchProfile ( ) const

Returns local search profiling information in a human readable format.

◆ MakeAbs()

IntExpr* MakeAbs ( IntExpr *const  expr)

|expr|

◆ MakeAbsEquality()

Constraint* MakeAbsEquality ( IntVar *const  var,
IntVar *const  abs_var 
)

Creates the constraint abs(var) == abs_var.

◆ MakeAcceptFilter()

LocalSearchFilter* MakeAcceptFilter ( )

Local Search Filters.

◆ MakeActionDemon()

Demon* MakeActionDemon ( Action  action)

Creates a demon from a callback.

◆ MakeAllDifferent() [1/2]

Constraint* MakeAllDifferent ( const std::vector< IntVar * > &  vars)

All variables are pairwise different.

This corresponds to the stronger version of the propagation algorithm.

◆ MakeAllDifferent() [2/2]

Constraint* MakeAllDifferent ( const std::vector< IntVar * > &  vars,
bool  stronger_propagation 
)

All variables are pairwise different.

If 'stronger_propagation' is true, stronger, and potentially slower propagation will occur. This API will be deprecated in the future.

◆ MakeAllDifferentExcept()

Constraint* MakeAllDifferentExcept ( const std::vector< IntVar * > &  vars,
int64  escape_value 
)

All variables are pairwise different, unless they are assigned to the escape value.

◆ MakeAllowedAssignments()

Constraint* MakeAllowedAssignments ( const std::vector< IntVar * > &  vars,
const IntTupleSet &  tuples 
)

This method creates a constraint where the graph of the relation between the variables is given in extension.

There are 'arity' variables involved in the relation and the graph is given by a integer tuple set.

◆ MakeAllSolutionCollector() [1/2]

SolutionCollector* MakeAllSolutionCollector ( )

Collect all solutions of the search.

The variables will need to be added later.

◆ MakeAllSolutionCollector() [2/2]

SolutionCollector* MakeAllSolutionCollector ( const Assignment *const  assignment)

Collect all solutions of the search.

◆ MakeApplyBranchSelector()

DecisionBuilder* MakeApplyBranchSelector ( BranchSelector  bs)

Creates a decision builder that will set the branch selector.

◆ MakeAssignment() [1/2]

Assignment* MakeAssignment ( )

This method creates an empty assignment.

◆ MakeAssignment() [2/2]

Assignment* MakeAssignment ( const Assignment *const  a)

This method creates an assignment which is a copy of 'a'.

◆ MakeAssignVariablesValues()

Decision* MakeAssignVariablesValues ( const std::vector< IntVar * > &  vars,
const std::vector< int64 > &  values 
)

◆ MakeAssignVariableValue()

Decision* MakeAssignVariableValue ( IntVar *const  var,
int64  val 
)

Decisions.

◆ MakeAssignVariableValueOrDoNothing()

Decision* MakeAssignVariableValueOrDoNothing ( IntVar *const  var,
int64  value 
)

◆ MakeAssignVariableValueOrFail()

Decision* MakeAssignVariableValueOrFail ( IntVar *const  var,
int64  value 
)

◆ MakeAtMost()

Constraint* MakeAtMost ( std::vector< IntVar * >  vars,
int64  value,
int64  max_count 
)

|{i | vars[i] == value}| <= max_count

◆ MakeAtSolutionCallback()

SearchMonitor* MakeAtSolutionCallback ( std::function< void()>  callback)

◆ MakeBestValueSolutionCollector() [1/2]

SolutionCollector* MakeBestValueSolutionCollector ( bool  maximize)

Collect the solution corresponding to the optimal value of the objective of 'assignment'; if 'assignment' does not have an objective no solution is collected.

This collector only collects one solution corresponding to the best objective value (the first one found). The variables will need to be added later.

◆ MakeBestValueSolutionCollector() [2/2]

SolutionCollector* MakeBestValueSolutionCollector ( const Assignment *const  assignment,
bool  maximize 
)

Collect the solution corresponding to the optimal value of the objective of 'assignment'; if 'assignment' does not have an objective no solution is collected.

This collector only collects one solution corresponding to the best objective value (the first one found).

◆ MakeBetweenCt()

Constraint* MakeBetweenCt ( IntExpr *const  expr,
int64  l,
int64  u 
)

(l <= expr <= u)

◆ MakeBoolVar() [1/2]

IntVar* MakeBoolVar ( )

MakeBoolVar will create a variable with a {0, 1} domain.

◆ MakeBoolVar() [2/2]

IntVar* MakeBoolVar ( const std::string &  name)

MakeBoolVar will create a variable with a {0, 1} domain.

◆ MakeBoolVarArray() [1/3]

IntVar** MakeBoolVarArray ( int  var_count,
const std::string &  name 
)

Same but allocates an array and returns it.

◆ MakeBoolVarArray() [2/3]

void MakeBoolVarArray ( int  var_count,
const std::string &  name,
std::vector< IntVar * > *  vars 
)

This method will append the vector vars with 'var_count' boolean variables having name "name<i>" where is the index of the variable.

◆ MakeBoolVarArray() [3/3]

void MakeBoolVarArray ( int  var_count,
std::vector< IntVar * > *  vars 
)

This method will append the vector vars with 'var_count' boolean variables having no names.

◆ MakeBranchesLimit()

RegularLimit* MakeBranchesLimit ( int64  branches)

Creates a search limit that constrains the number of branches explored in the search tree.

◆ MakeCircuit()

Constraint* MakeCircuit ( const std::vector< IntVar * > &  nexts)

Force the "nexts" variable to create a complete Hamiltonian path.

◆ MakeClosureDemon()

Demon* MakeClosureDemon ( Closure  closure)

!defined(SWIG)

Creates a demon from a closure.

◆ MakeConditionalExpression()

IntExpr* MakeConditionalExpression ( IntVar *const  condition,
IntExpr *const  expr,
int64  unperformed_value 
)

Conditional Expr condition ? expr : unperformed_value.

◆ MakeConstantRestart()

SearchMonitor* MakeConstantRestart ( int  frequency)

This search monitor will restart the search periodically after 'frequency' failures.

◆ MakeConstraintAdder()

DecisionBuilder* MakeConstraintAdder ( Constraint *const  ct)

Returns a decision builder that will add the given constraint to the model.

◆ MakeConstraintInitialPropagateCallback()

Demon* MakeConstraintInitialPropagateCallback ( Constraint *const  ct)

This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct'.

◆ MakeConvexPiecewiseExpr()

IntExpr* MakeConvexPiecewiseExpr ( IntExpr expr,
int64  early_cost,
int64  early_date,
int64  late_date,
int64  late_cost 
)

Convex piecewise function.

◆ MakeCount() [1/2]

Constraint* MakeCount ( const std::vector< IntVar * > &  vars,
int64  value,
int64  max_count 
)

|{i | vars[i] == value}| == max_count

◆ MakeCount() [2/2]

Constraint* MakeCount ( const std::vector< IntVar * > &  vars,
int64  value,
IntVar *const  max_count 
)

|{i | vars[i] == value}| == max_count

◆ MakeCover()

Constraint* MakeCover ( const std::vector< IntervalVar * > &  vars,
IntervalVar *const  target_var 
)

This constraint states that the target_var is the convex hull of the intervals.

If none of the interval variables is performed, then the target var is unperformed too. Also, if the target variable is unperformed, then all the intervals variables are unperformed too.

◆ MakeCumulative() [1/6]

Constraint* MakeCumulative ( const std::vector< IntervalVar * > &  intervals,
const std::vector< int > &  demands,
int64  capacity,
const std::string &  name 
)

This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity.

Intervals and demands should be vectors of equal size.

Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.

◆ MakeCumulative() [2/6]

Constraint* MakeCumulative ( const std::vector< IntervalVar * > &  intervals,
const std::vector< int > &  demands,
IntVar *const  capacity,
const std::string &  name 
)

This constraint enforces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity.

Intervals and demands should be vectors of equal size.

Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.

◆ MakeCumulative() [3/6]

Constraint* MakeCumulative ( const std::vector< IntervalVar * > &  intervals,
const std::vector< int64 > &  demands,
int64  capacity,
const std::string &  name 
)

This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity.

Intervals and demands should be vectors of equal size.

Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.

◆ MakeCumulative() [4/6]

Constraint* MakeCumulative ( const std::vector< IntervalVar * > &  intervals,
const std::vector< int64 > &  demands,
IntVar *const  capacity,
const std::string &  name 
)

This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity.

Intervals and demands should be vectors of equal size.

Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.

◆ MakeCumulative() [5/6]

Constraint* MakeCumulative ( const std::vector< IntervalVar * > &  intervals,
const std::vector< IntVar * > &  demands,
int64  capacity,
const std::string &  name 
)

This constraint enforces that, for any integer t, the sum of demands corresponding to an interval containing t does not exceed the given capacity.

Intervals and demands should be vectors of equal size.

Demands should be positive.

◆ MakeCumulative() [6/6]

Constraint* MakeCumulative ( const std::vector< IntervalVar * > &  intervals,
const std::vector< IntVar * > &  demands,
IntVar *const  capacity,
const std::string &  name 
)

This constraint enforces that, for any integer t, the sum of demands corresponding to an interval containing t does not exceed the given capacity.

Intervals and demands should be vectors of equal size.

Demands should be positive.

◆ MakeCustomLimit()

SearchLimit* MakeCustomLimit ( std::function< bool()>  limiter)

Callback-based search limit.

Search stops when limiter returns true; if this happens at a leaf the corresponding solution will be rejected.

◆ MakeDecision()

Decision* MakeDecision ( Action  apply,
Action  refute 
)

◆ MakeDecisionBuilderFromAssignment()

DecisionBuilder* MakeDecisionBuilderFromAssignment ( Assignment *const  assignment,
DecisionBuilder *const  db,
const std::vector< IntVar * > &  vars 
)

Returns a decision builder for which the left-most leaf corresponds to assignment, the rest of the tree being explored using 'db'.

◆ MakeDefaultPhase() [1/2]

DecisionBuilder* MakeDefaultPhase ( const std::vector< IntVar * > &  vars)

◆ MakeDefaultPhase() [2/2]

DecisionBuilder* MakeDefaultPhase ( const std::vector< IntVar * > &  vars,
const DefaultPhaseParameters parameters 
)

◆ MakeDefaultRegularLimitParameters()

RegularLimitParameters MakeDefaultRegularLimitParameters ( ) const

Creates a regular limit proto containing default values.

◆ MakeDefaultSolutionPool()

SolutionPool* MakeDefaultSolutionPool ( )

Solution Pool.

◆ MakeDelayedConstraintInitialPropagateCallback()

Demon* MakeDelayedConstraintInitialPropagateCallback ( Constraint *const  ct)

This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct' with low priority.

◆ MakeDelayedPathCumul()

Constraint* MakeDelayedPathCumul ( const std::vector< IntVar * > &  nexts,
const std::vector< IntVar * > &  active,
const std::vector< IntVar * > &  cumuls,
const std::vector< IntVar * > &  transits 
)

Delayed version of the same constraint: propagation on the nexts variables is delayed until all constraints have propagated.

◆ MakeDeviation()

Constraint* MakeDeviation ( const std::vector< IntVar * > &  vars,
IntVar *const  deviation_var,
int64  total_sum 
)

Deviation constraint: sum_i |n * vars[i] - total_sum| <= deviation_var and sum_i vars[i] == total_sum n = #vars.

◆ MakeDifference() [1/2]

IntExpr* MakeDifference ( int64  value,
IntExpr *const  expr 
)

value - expr

◆ MakeDifference() [2/2]

IntExpr* MakeDifference ( IntExpr *const  left,
IntExpr *const  right 
)

left - right

◆ MakeDisjunctiveConstraint()

DisjunctiveConstraint* MakeDisjunctiveConstraint ( const std::vector< IntervalVar * > &  intervals,
const std::string &  name 
)

This constraint forces all interval vars into an non-overlapping sequence.

Intervals with zero duration can be scheduled anywhere.

◆ MakeDistribute() [1/8]

Constraint* MakeDistribute ( const std::vector< IntVar * > &  vars,
const std::vector< int > &  card_min,
const std::vector< int > &  card_max 
)

Aggregated version of count with bounded cardinalities: forall j in 0 .

. card_size - 1: card_min[j] <= |{i | v[i] == j}| <= card_max[j]

◆ MakeDistribute() [2/8]

Constraint* MakeDistribute ( const std::vector< IntVar * > &  vars,
const std::vector< int > &  values,
const std::vector< int > &  card_min,
const std::vector< int > &  card_max 
)

Aggregated version of count with bounded cardinalities: forall j in 0 .

. card_size - 1: card_min[j] <= |{i | v[i] == values[j]}| <= card_max[j]

◆ MakeDistribute() [3/8]

Constraint* MakeDistribute ( const std::vector< IntVar * > &  vars,
const std::vector< int > &  values,
const std::vector< IntVar * > &  cards 
)

Aggregated version of count: |{i | v[i] == values[j]}| == cards[j].

◆ MakeDistribute() [4/8]

Constraint* MakeDistribute ( const std::vector< IntVar * > &  vars,
const std::vector< int64 > &  card_min,
const std::vector< int64 > &  card_max 
)

Aggregated version of count with bounded cardinalities: forall j in 0 .

. card_size - 1: card_min[j] <= |{i | v[i] == j}| <= card_max[j]

◆ MakeDistribute() [5/8]

Constraint* MakeDistribute ( const std::vector< IntVar * > &  vars,
const std::vector< int64 > &  values,
const std::vector< int64 > &  card_min,
const std::vector< int64 > &  card_max 
)

Aggregated version of count with bounded cardinalities: forall j in 0 .

. card_size - 1: card_min[j] <= |{i | v[i] == values[j]}| <= card_max[j]

◆ MakeDistribute() [6/8]

Constraint* MakeDistribute ( const std::vector< IntVar * > &  vars,
const std::vector< int64 > &  values,
const std::vector< IntVar * > &  cards 
)

Aggregated version of count: |{i | v[i] == values[j]}| == cards[j].

◆ MakeDistribute() [7/8]

Constraint* MakeDistribute ( const std::vector< IntVar * > &  vars,
const std::vector< IntVar * > &  cards 
)

Aggregated version of count: |{i | v[i] == j}| == cards[j].

◆ MakeDistribute() [8/8]

Constraint* MakeDistribute ( const std::vector< IntVar * > &  vars,
int64  card_min,
int64  card_max,
int64  card_size 
)

Aggregated version of count with bounded cardinalities: forall j in 0 .

. card_size - 1: card_min <= |{i | v[i] == j}| <= card_max

◆ MakeDiv() [1/2]

IntExpr* MakeDiv ( IntExpr *const  expr,
int64  value 
)

expr / value (integer division)

◆ MakeDiv() [2/2]

IntExpr* MakeDiv ( IntExpr *const  numerator,
IntExpr *const  denominator 
)

numerator / denominator (integer division). Terms need to be positive.

◆ MakeElement() [1/6]

IntExpr* MakeElement ( const std::vector< int > &  values,
IntVar *const  index 
)

values[index]

◆ MakeElement() [2/6]

IntExpr* MakeElement ( const std::vector< int64 > &  values,
IntVar *const  index 
)

values[index]

◆ MakeElement() [3/6]

IntExpr* MakeElement ( const std::vector< IntVar * > &  vars,
IntVar *const  index 
)

vars[expr]

◆ MakeElement() [4/6]

IntExpr* MakeElement ( IndexEvaluator1  values,
IntVar *const  index 
)

Function-based element.

The constraint takes ownership of the callback. The callback must be able to cope with any possible value in the domain of 'index' (potentially negative ones too).

◆ MakeElement() [5/6]

IntExpr* MakeElement ( IndexEvaluator2  values,
IntVar *const  index1,
IntVar *const  index2 
)

2D version of function-based element expression, values(expr1, expr2).

◆ MakeElement() [6/6]

IntExpr* MakeElement ( Int64ToIntVar  vars,
int64  range_start,
int64  range_end,
IntVar argument 
)

vars(argument)

◆ MakeElementEquality() [1/4]

Constraint* MakeElementEquality ( const std::vector< int > &  vals,
IntVar *const  index,
IntVar *const  target 
)

◆ MakeElementEquality() [2/4]

Constraint* MakeElementEquality ( const std::vector< int64 > &  vals,
IntVar *const  index,
IntVar *const  target 
)

◆ MakeElementEquality() [3/4]

Constraint* MakeElementEquality ( const std::vector< IntVar * > &  vars,
IntVar *const  index,
int64  target 
)

◆ MakeElementEquality() [4/4]

Constraint* MakeElementEquality ( const std::vector< IntVar * > &  vars,
IntVar *const  index,
IntVar *const  target 
)

◆ MakeEnterSearchCallback()

SearchMonitor* MakeEnterSearchCallback ( std::function< void()>  callback)

--— Callback-based search monitors --—

◆ MakeEquality() [1/4]

Constraint* MakeEquality ( IntervalVar *const  var1,
IntervalVar *const  var2 
)

This constraints states that the two interval variables are equal.

◆ MakeEquality() [2/4]

Constraint* MakeEquality ( IntExpr *const  expr,
int  value 
)

expr == value

◆ MakeEquality() [3/4]

Constraint* MakeEquality ( IntExpr *const  expr,
int64  value 
)

expr == value

◆ MakeEquality() [4/4]

Constraint* MakeEquality ( IntExpr *const  left,
IntExpr *const  right 
)

left == right

◆ MakeExitSearchCallback()

SearchMonitor* MakeExitSearchCallback ( std::function< void()>  callback)

◆ MakeFailDecision()

Decision* MakeFailDecision ( )

◆ MakeFailuresLimit()

RegularLimit* MakeFailuresLimit ( int64  failures)

Creates a search limit that constrains the number of failures that can happen when exploring the search tree.

◆ MakeFalseConstraint() [1/2]

Constraint* MakeFalseConstraint ( )

This constraint always fails.

◆ MakeFalseConstraint() [2/2]

Constraint* MakeFalseConstraint ( const std::string &  explanation)

◆ MakeFirstSolutionCollector() [1/2]

SolutionCollector* MakeFirstSolutionCollector ( )

Collect the first solution of the search.

The variables will need to be added later.

◆ MakeFirstSolutionCollector() [2/2]

SolutionCollector* MakeFirstSolutionCollector ( const Assignment *const  assignment)

Collect the first solution of the search.

◆ MakeFixedDurationEndSyncedOnEndIntervalVar()

IntervalVar* MakeFixedDurationEndSyncedOnEndIntervalVar ( IntervalVar *const  interval_var,
int64  duration,
int64  offset 
)

Creates an interval var with a fixed duration whose end is synchronized with the end of another interval, with a given offset.

The performed status is also in sync with the performed status of the given interval variable.

◆ MakeFixedDurationEndSyncedOnStartIntervalVar()

IntervalVar* MakeFixedDurationEndSyncedOnStartIntervalVar ( IntervalVar *const  interval_var,
int64  duration,
int64  offset 
)

Creates an interval var with a fixed duration whose end is synchronized with the start of another interval, with a given offset.

The performed status is also in sync with the performed status of the given interval variable.

◆ MakeFixedDurationIntervalVar() [1/3]

IntervalVar* MakeFixedDurationIntervalVar ( int64  start_min,
int64  start_max,
int64  duration,
bool  optional,
const std::string &  name 
)

Creates an interval var with a fixed duration.

The duration must be greater than 0. If optional is true, then the interval can be performed or unperformed. If optional is false, then the interval is always performed.

◆ MakeFixedDurationIntervalVar() [2/3]

IntervalVar* MakeFixedDurationIntervalVar ( IntVar *const  start_variable,
int64  duration,
const std::string &  name 
)

Creates a performed interval var with a fixed duration.

The duration must be greater than 0.

◆ MakeFixedDurationIntervalVar() [3/3]

IntervalVar* MakeFixedDurationIntervalVar ( IntVar *const  start_variable,
int64  duration,
IntVar *const  performed_variable,
const std::string &  name 
)

Creates an interval var with a fixed duration, and performed_variable.

The duration must be greater than 0.

◆ MakeFixedDurationIntervalVarArray() [1/6]

void MakeFixedDurationIntervalVarArray ( const std::vector< IntVar * > &  start_variables,
const std::vector< int > &  durations,
const std::string &  name,
std::vector< IntervalVar * > *const  array 
)

This method fills the vector with interval variables built with the corresponding start variables.

◆ MakeFixedDurationIntervalVarArray() [2/6]

void MakeFixedDurationIntervalVarArray ( const std::vector< IntVar * > &  start_variables,
const std::vector< int > &  durations,
const std::vector< IntVar * > &  performed_variables,
const std::string &  name,
std::vector< IntervalVar * > *const  array 
)

This method fills the vector with interval variables built with the corresponding start and performed variables.

◆ MakeFixedDurationIntervalVarArray() [3/6]

void MakeFixedDurationIntervalVarArray ( const std::vector< IntVar * > &  start_variables,
const std::vector< int64 > &  durations,
const std::string &  name,
std::vector< IntervalVar * > *const  array 
)

This method fills the vector with interval variables built with the corresponding start variables.

◆ MakeFixedDurationIntervalVarArray() [4/6]

void MakeFixedDurationIntervalVarArray ( const std::vector< IntVar * > &  start_variables,
const std::vector< int64 > &  durations,
const std::vector< IntVar * > &  performed_variables,
const std::string &  name,
std::vector< IntervalVar * > *const  array 
)

This method fills the vector with interval variables built with the corresponding start and performed variables.

◆ MakeFixedDurationIntervalVarArray() [5/6]

void MakeFixedDurationIntervalVarArray ( const std::vector< IntVar * > &  start_variables,
int64  duration,
const std::string &  name,
std::vector< IntervalVar * > *const  array 
)

This method fills the vector with 'count' interval var built with the corresponding start variables.

◆ MakeFixedDurationIntervalVarArray() [6/6]

void MakeFixedDurationIntervalVarArray ( int  count,
int64  start_min,
int64  start_max,
int64  duration,
bool  optional,
const std::string &  name,
std::vector< IntervalVar * > *const  array 
)

This method fills the vector with 'count' interval variables built with the corresponding parameters.

◆ MakeFixedDurationStartSyncedOnEndIntervalVar()

IntervalVar* MakeFixedDurationStartSyncedOnEndIntervalVar ( IntervalVar *const  interval_var,
int64  duration,
int64  offset 
)

Creates an interval var with a fixed duration whose start is synchronized with the end of another interval, with a given offset.

The performed status is also in sync with the performed status of the given interval variable.

◆ MakeFixedDurationStartSyncedOnStartIntervalVar()

IntervalVar* MakeFixedDurationStartSyncedOnStartIntervalVar ( IntervalVar *const  interval_var,
int64  duration,
int64  offset 
)

Creates an interval var with a fixed duration whose start is synchronized with the start of another interval, with a given offset.

The performed status is also in sync with the performed status of the given interval variable.

◆ MakeFixedInterval()

IntervalVar* MakeFixedInterval ( int64  start,
int64  duration,
const std::string &  name 
)

Creates a fixed and performed interval.

◆ MakeGenericTabuSearch()

SearchMonitor* MakeGenericTabuSearch ( bool  maximize,
IntVar *const  v,
int64  step,
const std::vector< IntVar * > &  tabu_vars,
int64  forbid_tenure 
)

Creates a Tabu Search based on the vars |vars|.

A solution is "tabu" if all the vars in |vars| keep their value.

◆ MakeGreater() [1/3]

Constraint* MakeGreater ( IntExpr *const  expr,
int  value 
)

expr > value

◆ MakeGreater() [2/3]

Constraint* MakeGreater ( IntExpr *const  expr,
int64  value 
)

expr > value

◆ MakeGreater() [3/3]

Constraint* MakeGreater ( IntExpr *const  left,
IntExpr *const  right 
)

left > right

◆ MakeGreaterOrEqual() [1/3]

Constraint* MakeGreaterOrEqual ( IntExpr *const  expr,
int  value 
)

expr >= value

◆ MakeGreaterOrEqual() [2/3]

Constraint* MakeGreaterOrEqual ( IntExpr *const  expr,
int64  value 
)

expr >= value

◆ MakeGreaterOrEqual() [3/3]

Constraint* MakeGreaterOrEqual ( IntExpr *const  left,
IntExpr *const  right 
)

left >= right

◆ MakeGuidedLocalSearch() [1/2]

SearchMonitor* MakeGuidedLocalSearch ( bool  maximize,
IntVar *const  objective,
IndexEvaluator2  objective_function,
int64  step,
const std::vector< IntVar * > &  vars,
double  penalty_factor 
)

Creates a Guided Local Search monitor.

Description here: http://en.wikipedia.org/wiki/Guided_Local_Search

◆ MakeGuidedLocalSearch() [2/2]

SearchMonitor* MakeGuidedLocalSearch ( bool  maximize,
IntVar *const  objective,
IndexEvaluator3  objective_function,
int64  step,
const std::vector< IntVar * > &  vars,
const std::vector< IntVar * > &  secondary_vars,
double  penalty_factor 
)

◆ MakeIfThenElseCt()

Constraint* MakeIfThenElseCt ( IntVar *const  condition,
IntExpr *const  then_expr,
IntExpr *const  else_expr,
IntVar *const  target_var 
)

Special cases with arrays of size two.

◆ MakeImprovementLimit()

ImprovementSearchLimit* MakeImprovementLimit ( IntVar objective_var,
bool  maximize,
double  objective_scaling_factor,
double  objective_offset,
double  improvement_rate_coefficient,
int  improvement_rate_solutions_distance 
)

Limits the search based on the improvements of 'objective_var'.

Stops the search when the improvement rate gets lower than a threshold value. This threshold value is computed based on the improvement rate during the first phase of the search.

◆ MakeIndexExpression()

IntExpr* MakeIndexExpression ( const std::vector< IntVar * > &  vars,
int64  value 
)

Returns the expression expr such that vars[expr] == value.

It assumes that vars are all different.

◆ MakeIndexOfConstraint()

Constraint* MakeIndexOfConstraint ( const std::vector< IntVar * > &  vars,
IntVar *const  index,
int64  target 
)

This constraint is a special case of the element constraint with an array of integer variables, where the variables are all different and the index variable is constrained such that vars[index] == target.

◆ MakeIndexOfFirstMaxValueConstraint()

Constraint* MakeIndexOfFirstMaxValueConstraint ( IntVar index,
const std::vector< IntVar * > &  vars 
)

Creates a constraint that binds the index variable to the index of the first variable with the maximum value.

◆ MakeIndexOfFirstMinValueConstraint()

Constraint* MakeIndexOfFirstMinValueConstraint ( IntVar index,
const std::vector< IntVar * > &  vars 
)

Creates a constraint that binds the index variable to the index of the first variable with the minimum value.

◆ MakeIntConst() [1/2]

IntVar* MakeIntConst ( int64  val)

IntConst will create a constant expression.

◆ MakeIntConst() [2/2]

IntVar* MakeIntConst ( int64  val,
const std::string &  name 
)

IntConst will create a constant expression.

◆ MakeIntervalRelaxedMax()

IntervalVar* MakeIntervalRelaxedMax ( IntervalVar *const  interval_var)

Creates and returns an interval variable that wraps around the given one, relaxing the max start and end.

Relaxing means making unbounded when optional. If the variable is non optional, this method returns interval_var.

More precisely, such an interval variable behaves as follows:

  • When the underlying must be performed, the returned interval variable behaves exactly as the underlying;
  • When the underlying may or may not be performed, the returned interval variable behaves like the underlying, except that it is unbounded on the max side;
  • When the underlying cannot be performed, the returned interval variable is of duration 0 and must be performed in an interval unbounded on both sides.

This is very useful for implementing propagators that may only modify the start min or end min.

◆ MakeIntervalRelaxedMin()

IntervalVar* MakeIntervalRelaxedMin ( IntervalVar *const  interval_var)

Creates and returns an interval variable that wraps around the given one, relaxing the min start and end.

Relaxing means making unbounded when optional. If the variable is non-optional, this method returns interval_var.

More precisely, such an interval variable behaves as follows:

  • When the underlying must be performed, the returned interval variable behaves exactly as the underlying;
  • When the underlying may or may not be performed, the returned interval variable behaves like the underlying, except that it is unbounded on the min side;
  • When the underlying cannot be performed, the returned interval variable is of duration 0 and must be performed in an interval unbounded on both sides.

This is very useful to implement propagators that may only modify the start max or end max.

◆ MakeIntervalVar()

IntervalVar* MakeIntervalVar ( int64  start_min,
int64  start_max,
int64  duration_min,
int64  duration_max,
int64  end_min,
int64  end_max,
bool  optional,
const std::string &  name 
)

Creates an interval var by specifying the bounds on start, duration, and end.

◆ MakeIntervalVarArray()

void MakeIntervalVarArray ( int  count,
int64  start_min,
int64  start_max,
int64  duration_min,
int64  duration_max,
int64  end_min,
int64  end_max,
bool  optional,
const std::string &  name,
std::vector< IntervalVar * > *const  array 
)

This method fills the vector with 'count' interval var built with the corresponding parameters.

◆ MakeIntervalVarRelation() [1/2]

Constraint* MakeIntervalVarRelation ( IntervalVar *const  t,
UnaryIntervalRelation  r,
int64  d 
)

This method creates a relation between an interval var and a date.

◆ MakeIntervalVarRelation() [2/2]

Constraint* MakeIntervalVarRelation ( IntervalVar *const  t1,
BinaryIntervalRelation  r,
IntervalVar *const  t2 
)

This method creates a relation between two interval vars.

◆ MakeIntervalVarRelationWithDelay()

Constraint* MakeIntervalVarRelationWithDelay ( IntervalVar *const  t1,
BinaryIntervalRelation  r,
IntervalVar *const  t2,
int64  delay 
)

This method creates a relation between two interval vars.

The given delay is added to the second interval. i.e.: t1 STARTS_AFTER_END of t2 with a delay of 2 means t1 will start at least two units of time after the end of t2.

◆ MakeIntVar() [1/6]

IntVar* MakeIntVar ( const std::vector< int > &  values)

MakeIntVar will create a variable with the given sparse domain.

◆ MakeIntVar() [2/6]

IntVar* MakeIntVar ( const std::vector< int > &  values,
const std::string &  name 
)

MakeIntVar will create a variable with the given sparse domain.

◆ MakeIntVar() [3/6]

IntVar* MakeIntVar ( const std::vector< int64 > &  values)

MakeIntVar will create a variable with the given sparse domain.

◆ MakeIntVar() [4/6]

IntVar* MakeIntVar ( const std::vector< int64 > &  values,
const std::string &  name 
)

MakeIntVar will create a variable with the given sparse domain.

◆ MakeIntVar() [5/6]

IntVar* MakeIntVar ( int64  min,
int64  max 
)

MakeIntVar will create the best range based int var for the bounds given.

◆ MakeIntVar() [6/6]

IntVar* MakeIntVar ( int64  min,
int64  max,
const std::string &  name 
)

MakeIntVar will create the best range based int var for the bounds given.

◆ MakeIntVarArray() [1/3]

IntVar** MakeIntVarArray ( int  var_count,
int64  vmin,
int64  vmax,
const std::string &  name 
)

Same but allocates an array and returns it.

◆ MakeIntVarArray() [2/3]

void MakeIntVarArray ( int  var_count,
int64  vmin,
int64  vmax,
const std::string &  name,
std::vector< IntVar * > *  vars 
)

This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having name "name<i>" where is the index of the variable.

◆ MakeIntVarArray() [3/3]

void MakeIntVarArray ( int  var_count,
int64  vmin,
int64  vmax,
std::vector< IntVar * > *  vars 
)

This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having no names.

◆ MakeInversePermutationConstraint()

Constraint* MakeInversePermutationConstraint ( const std::vector< IntVar * > &  left,
const std::vector< IntVar * > &  right 
)

Creates a constraint that enforces that 'left' and 'right' both represent permutations of [0..left.size()-1], and that 'right' is the inverse permutation of 'left', i.e.

for all i in [0..left.size()-1], right[left[i]] = i.

◆ MakeIsBetweenCt()

Constraint* MakeIsBetweenCt ( IntExpr *const  expr,
int64  l,
int64  u,
IntVar *const  b 
)

b == (l <= expr <= u)

◆ MakeIsBetweenVar()

IntVar* MakeIsBetweenVar ( IntExpr *const  v,
int64  l,
int64  u 
)

◆ MakeIsDifferentCstCt()

Constraint* MakeIsDifferentCstCt ( IntExpr *const  var,
int64  value,
IntVar *const  boolvar 
)

boolvar == (var != value)

◆ MakeIsDifferentCstVar()

IntVar* MakeIsDifferentCstVar ( IntExpr *const  var,
int64  value 
)

status var of (var != value)

◆ MakeIsDifferentCt()

Constraint* MakeIsDifferentCt ( IntExpr *const  v1,
IntExpr *const  v2,
IntVar *const  b 
)

b == (v1 != v2)

◆ MakeIsDifferentVar()

IntVar* MakeIsDifferentVar ( IntExpr *const  v1,
IntExpr *const  v2 
)

status var of (v1 != v2)

◆ MakeIsEqualCstCt()

Constraint* MakeIsEqualCstCt ( IntExpr *const  var,
int64  value,
IntVar *const  boolvar 
)

boolvar == (var == value)

◆ MakeIsEqualCstVar()

IntVar* MakeIsEqualCstVar ( IntExpr *const  var,
int64  value 
)

status var of (var == value)

◆ MakeIsEqualCt()

Constraint* MakeIsEqualCt ( IntExpr *const  v1,
IntExpr v2,
IntVar *const  b 
)

b == (v1 == v2)

◆ MakeIsEqualVar()

IntVar* MakeIsEqualVar ( IntExpr *const  v1,
IntExpr v2 
)

status var of (v1 == v2)

◆ MakeIsGreaterCstCt()

Constraint* MakeIsGreaterCstCt ( IntExpr *const  v,
int64  c,
IntVar *const  b 
)

b == (v > c)

◆ MakeIsGreaterCstVar()

IntVar* MakeIsGreaterCstVar ( IntExpr *const  var,
int64  value 
)

status var of (var > value)

◆ MakeIsGreaterCt()

Constraint* MakeIsGreaterCt ( IntExpr *const  left,
IntExpr *const  right,
IntVar *const  b 
)

b == (left > right)

◆ MakeIsGreaterOrEqualCstCt()

Constraint* MakeIsGreaterOrEqualCstCt ( IntExpr *const  var,
int64  value,
IntVar *const  boolvar 
)

boolvar == (var >= value)

◆ MakeIsGreaterOrEqualCstVar()

IntVar* MakeIsGreaterOrEqualCstVar ( IntExpr *const  var,
int64  value 
)

status var of (var >= value)

◆ MakeIsGreaterOrEqualCt()

Constraint* MakeIsGreaterOrEqualCt ( IntExpr *const  left,
IntExpr *const  right,
IntVar *const  b 
)

b == (left >= right)

◆ MakeIsGreaterOrEqualVar()

IntVar* MakeIsGreaterOrEqualVar ( IntExpr *const  left,
IntExpr *const  right 
)

status var of (left >= right)

◆ MakeIsGreaterVar()

IntVar* MakeIsGreaterVar ( IntExpr *const  left,
IntExpr *const  right 
)

status var of (left > right)

◆ MakeIsLessCstCt()

Constraint* MakeIsLessCstCt ( IntExpr *const  v,
int64  c,
IntVar *const  b 
)

b == (v < c)

◆ MakeIsLessCstVar()

IntVar* MakeIsLessCstVar ( IntExpr *const  var,
int64  value 
)

status var of (var < value)

◆ MakeIsLessCt()

Constraint* MakeIsLessCt ( IntExpr *const  left,
IntExpr *const  right,
IntVar *const  b 
)

b == (left < right)

◆ MakeIsLessOrEqualCstCt()

Constraint* MakeIsLessOrEqualCstCt ( IntExpr *const  var,
int64  value,
IntVar *const  boolvar 
)

boolvar == (var <= value)

◆ MakeIsLessOrEqualCstVar()

IntVar* MakeIsLessOrEqualCstVar ( IntExpr *const  var,
int64  value 
)

status var of (var <= value)

◆ MakeIsLessOrEqualCt()

Constraint* MakeIsLessOrEqualCt ( IntExpr *const  left,
IntExpr *const  right,
IntVar *const  b 
)

b == (left <= right)

◆ MakeIsLessOrEqualVar()

IntVar* MakeIsLessOrEqualVar ( IntExpr *const  left,
IntExpr *const  right 
)

status var of (left <= right)

◆ MakeIsLessVar()

IntVar* MakeIsLessVar ( IntExpr *const  left,
IntExpr *const  right 
)

status var of (left < right)

◆ MakeIsMemberCt() [1/2]

Constraint* MakeIsMemberCt ( IntExpr *const  expr,
const std::vector< int > &  values,
IntVar *const  boolvar 
)

◆ MakeIsMemberCt() [2/2]

Constraint* MakeIsMemberCt ( IntExpr *const  expr,
const std::vector< int64 > &  values,
IntVar *const  boolvar 
)

boolvar == (expr in set)

◆ MakeIsMemberVar() [1/2]

IntVar* MakeIsMemberVar ( IntExpr *const  expr,
const std::vector< int > &  values 
)

◆ MakeIsMemberVar() [2/2]

IntVar* MakeIsMemberVar ( IntExpr *const  expr,
const std::vector< int64 > &  values 
)

◆ MakeLastSolutionCollector() [1/2]

SolutionCollector* MakeLastSolutionCollector ( )

Collect the last solution of the search.

The variables will need to be added later.

◆ MakeLastSolutionCollector() [2/2]

SolutionCollector* MakeLastSolutionCollector ( const Assignment *const  assignment)

Collect the last solution of the search.

◆ MakeLess() [1/3]

Constraint* MakeLess ( IntExpr *const  expr,
int  value 
)

expr < value

◆ MakeLess() [2/3]

Constraint* MakeLess ( IntExpr *const  expr,
int64  value 
)

expr < value

◆ MakeLess() [3/3]

Constraint* MakeLess ( IntExpr *const  left,
IntExpr *const  right 
)

left < right

◆ MakeLessOrEqual() [1/3]

Constraint* MakeLessOrEqual ( IntExpr *const  expr,
int  value 
)

expr <= value

◆ MakeLessOrEqual() [2/3]

Constraint* MakeLessOrEqual ( IntExpr *const  expr,
int64  value 
)

expr <= value

◆ MakeLessOrEqual() [3/3]

Constraint* MakeLessOrEqual ( IntExpr *const  left,
IntExpr *const  right 
)

left <= right

◆ MakeLexicalLess()

Constraint* MakeLexicalLess ( const std::vector< IntVar * > &  left,
const std::vector< IntVar * > &  right 
)

Creates a constraint that enforces that left is lexicographically less than right.

◆ MakeLexicalLessOrEqual()

Constraint* MakeLexicalLessOrEqual ( const std::vector< IntVar * > &  left,
const std::vector< IntVar * > &  right 
)

Creates a constraint that enforces that left is lexicographically less than or equal to right.

◆ MakeLimit() [1/4]

RegularLimit* MakeLimit ( absl::Duration  time,
int64  branches,
int64  failures,
int64  solutions,
bool  smart_time_check = false,
bool  cumulative = false 
)

Limits the search with the 'time', 'branches', 'failures' and 'solutions' limits.

'smart_time_check' reduces the calls to the wall

◆ MakeLimit() [2/4]

RegularLimit* MakeLimit ( const RegularLimitParameters &  proto)

Creates a search limit from its protobuf description.

◆ MakeLimit() [3/4]

RegularLimit* MakeLimit ( int64  time,
int64  branches,
int64  failures,
int64  solutions,
bool  smart_time_check = false,
bool  cumulative = false 
)

◆ MakeLimit() [4/4]

SearchLimit* MakeLimit ( SearchLimit *const  limit_1,
SearchLimit *const  limit_2 
)

Creates a search limit that is reached when either of the underlying limit is reached.

That is, the returned limit is more stringent than both argument limits.

◆ MakeLocalSearchPhase() [1/4]

DecisionBuilder* MakeLocalSearchPhase ( Assignment *const  assignment,
LocalSearchPhaseParameters *const  parameters 
)

Local Search decision builders factories.

Local search is used to improve a given solution. This initial solution can be specified either by an Assignment or by a DecisionBulder, and the corresponding variables, the initial solution being the first solution found by the DecisionBuilder. The LocalSearchPhaseParameters parameter holds the actual definition of the local search phase:

  • a local search operator used to explore the neighborhood of the current solution,
  • a decision builder to instantiate unbound variables once a neighbor has been defined; in the case of LNS-based operators instantiates fragment variables; search monitors can be added to this sub-search by wrapping the decision builder with MakeSolveOnce.
  • a search limit specifying how long local search looks for neighbors before accepting one; the last neighbor is always taken and in the case of a greedy search, this corresponds to the best local neighbor; first-accept (which is the default behavior) can be modeled using a solution found limit of 1,
  • a vector of local search filters used to speed up the search by pruning unfeasible neighbors. Metaheuristics can be added by defining specialized search monitors; currently down/up-hill climbing is available through OptimizeVar, as well as Guided Local Search, Tabu Search and Simulated Annealing.

◆ MakeLocalSearchPhase() [2/4]

DecisionBuilder* MakeLocalSearchPhase ( const std::vector< IntVar * > &  vars,
DecisionBuilder *const  first_solution,
DecisionBuilder *const  first_solution_sub_decision_builder,
LocalSearchPhaseParameters *const  parameters 
)

Variant with a sub_decison_builder specific to the first solution.

◆ MakeLocalSearchPhase() [3/4]

DecisionBuilder* MakeLocalSearchPhase ( const std::vector< IntVar * > &  vars,
DecisionBuilder *const  first_solution,
LocalSearchPhaseParameters *const  parameters 
)

◆ MakeLocalSearchPhase() [4/4]

DecisionBuilder* MakeLocalSearchPhase ( const std::vector< SequenceVar * > &  vars,
DecisionBuilder *const  first_solution,
LocalSearchPhaseParameters *const  parameters 
)

◆ MakeLocalSearchPhaseParameters() [1/6]

LocalSearchPhaseParameters* MakeLocalSearchPhaseParameters ( IntVar objective,
LocalSearchOperator *const  ls_operator,
DecisionBuilder *const  sub_decision_builder 
)

Local Search Phase Parameters.

◆ MakeLocalSearchPhaseParameters() [2/6]

LocalSearchPhaseParameters* MakeLocalSearchPhaseParameters ( IntVar objective,
LocalSearchOperator *const  ls_operator,
DecisionBuilder *const  sub_decision_builder,
RegularLimit *const  limit 
)

◆ MakeLocalSearchPhaseParameters() [3/6]

LocalSearchPhaseParameters* MakeLocalSearchPhaseParameters ( IntVar objective,
LocalSearchOperator *const  ls_operator,
DecisionBuilder *const  sub_decision_builder,
RegularLimit *const  limit,
LocalSearchFilterManager filter_manager 
)

◆ MakeLocalSearchPhaseParameters() [4/6]

LocalSearchPhaseParameters* MakeLocalSearchPhaseParameters ( IntVar objective,
SolutionPool *const  pool,
LocalSearchOperator *const  ls_operator,
DecisionBuilder *const  sub_decision_builder 
)

◆ MakeLocalSearchPhaseParameters() [5/6]

LocalSearchPhaseParameters* MakeLocalSearchPhaseParameters ( IntVar objective,
SolutionPool *const  pool,
LocalSearchOperator *const  ls_operator,
DecisionBuilder *const  sub_decision_builder,
RegularLimit *const  limit 
)

◆ MakeLocalSearchPhaseParameters() [6/6]

LocalSearchPhaseParameters* MakeLocalSearchPhaseParameters ( IntVar objective,
SolutionPool *const  pool,
LocalSearchOperator *const  ls_operator,
DecisionBuilder *const  sub_decision_builder,
RegularLimit *const  limit,
LocalSearchFilterManager filter_manager 
)

◆ MakeLubyRestart()

SearchMonitor* MakeLubyRestart ( int  scale_factor)

This search monitor will restart the search periodically.

At the iteration n, it will restart after scale_factor * Luby(n) failures where Luby is the Luby Strategy (i.e. 1 1 2 1 1 2 4 1 1 2 1 1 2 4 8...).

◆ MakeMapDomain()

Constraint* MakeMapDomain ( IntVar *const  var,
const std::vector< IntVar * > &  actives 
)

This constraint maps the domain of 'var' onto the array of variables 'actives'.

That is for all i in [0 .. size - 1]: actives[i] == 1 <=> var->Contains(i);

◆ MakeMax() [1/4]

IntExpr* MakeMax ( const std::vector< IntVar * > &  vars)

std::max(vars)

◆ MakeMax() [2/4]

IntExpr* MakeMax ( IntExpr *const  expr,
int  value 
)

std::max(expr, value)

◆ MakeMax() [3/4]

IntExpr* MakeMax ( IntExpr *const  expr,
int64  value 
)

std::max(expr, value)

◆ MakeMax() [4/4]

IntExpr* MakeMax ( IntExpr *const  left,
IntExpr *const  right 
)

std::max(left, right)

◆ MakeMaxEquality()

Constraint* MakeMaxEquality ( const std::vector< IntVar * > &  vars,
IntVar *const  max_var 
)

◆ MakeMaximize()

OptimizeVar* MakeMaximize ( IntVar *const  v,
int64  step 
)

Creates a maximization objective.

◆ MakeMemberCt() [1/2]

Constraint* MakeMemberCt ( IntExpr *const  expr,
const std::vector< int > &  values 
)

◆ MakeMemberCt() [2/2]

Constraint* MakeMemberCt ( IntExpr *const  expr,
const std::vector< int64 > &  values 
)

expr in set.

Propagation is lazy, i.e. this constraint does not creates holes in the domain of the variable.

◆ MakeMin() [1/4]

IntExpr* MakeMin ( const std::vector< IntVar * > &  vars)

std::min(vars)

◆ MakeMin() [2/4]

IntExpr* MakeMin ( IntExpr *const  expr,
int  value 
)

std::min(expr, value)

◆ MakeMin() [3/4]

IntExpr* MakeMin ( IntExpr *const  expr,
int64  value 
)

std::min(expr, value)

◆ MakeMin() [4/4]

IntExpr* MakeMin ( IntExpr *const  left,
IntExpr *const  right 
)

std::min (left, right)

◆ MakeMinEquality()

Constraint* MakeMinEquality ( const std::vector< IntVar * > &  vars,
IntVar *const  min_var 
)

◆ MakeMinimize()

OptimizeVar* MakeMinimize ( IntVar *const  v,
int64  step 
)

Creates a minimization objective.

◆ MakeMirrorInterval()

IntervalVar* MakeMirrorInterval ( IntervalVar *const  interval_var)

Creates an interval var that is the mirror image of the given one, that is, the interval var obtained by reversing the axis.

◆ MakeModulo() [1/2]

IntExpr* MakeModulo ( IntExpr *const  x,
int64  mod 
)

Modulo expression x % mod (with the python convention for modulo).

◆ MakeModulo() [2/2]

IntExpr* MakeModulo ( IntExpr *const  x,
IntExpr *const  mod 
)

Modulo expression x % mod (with the python convention for modulo).

◆ MakeMonotonicElement()

IntExpr* MakeMonotonicElement ( IndexEvaluator1  values,
bool  increasing,
IntVar *const  index 
)

Function based element.

The constraint takes ownership of the callback. The callback must be monotonic. It must be able to cope with any possible value in the domain of 'index' (potentially negative ones too). Furtermore, monotonicity is not checked. Thus giving a non-monotonic function, or specifying an incorrect increasing parameter will result in undefined behavior.

◆ MakeMoveTowardTargetOperator() [1/2]

LocalSearchOperator* MakeMoveTowardTargetOperator ( const Assignment target)

Creates a local search operator that tries to move the assignment of some variables toward a target.

The target is given as an Assignment. This operator generates neighbors in which the only difference compared to the current state is that one variable that belongs to the target assignment is set to its target value.

◆ MakeMoveTowardTargetOperator() [2/2]

LocalSearchOperator* MakeMoveTowardTargetOperator ( const std::vector< IntVar * > &  variables,
const std::vector< int64 > &  target_values 
)

Creates a local search operator that tries to move the assignment of some variables toward a target.

The target is given either as two vectors: a vector of variables and a vector of associated target values. The two vectors should be of the same length. This operator generates neighbors in which the only difference compared to the current state is that one variable that belongs to the given vector is set to its target value.

◆ MakeNBestValueSolutionCollector() [1/2]

SolutionCollector* MakeNBestValueSolutionCollector ( const Assignment *const  assignment,
int  solution_count,
bool  maximize 
)

Same as MakeBestValueSolutionCollector but collects the best solution_count solutions.

Collected solutions are sorted in increasing optimality order (the best solution is the last one).

◆ MakeNBestValueSolutionCollector() [2/2]

SolutionCollector* MakeNBestValueSolutionCollector ( int  solution_count,
bool  maximize 
)

◆ MakeNeighborhoodLimit()

LocalSearchOperator* MakeNeighborhoodLimit ( LocalSearchOperator *const  op,
int64  limit 
)

Creates a local search operator that wraps another local search operator and limits the number of neighbors explored (i.e., calls to MakeNextNeighbor from the current solution (between two calls to Start()).

When this limit is reached, MakeNextNeighbor() returns false. The counter is cleared when Start() is called.

◆ MakeNestedOptimize() [1/6]

DecisionBuilder* MakeNestedOptimize ( DecisionBuilder *const  db,
Assignment *const  solution,
bool  maximize,
int64  step 
)

NestedOptimize will collapse a search tree described by a decision builder 'db' and a set of monitors and wrap it into a single point.

If there are no solutions to this nested tree, then NestedOptimize will fail. If there are solutions, it will find the best as described by the mandatory objective in the solution as well as the optimization direction, instantiate all variables to this solution, and return nullptr.

◆ MakeNestedOptimize() [2/6]

DecisionBuilder* MakeNestedOptimize ( DecisionBuilder *const  db,
Assignment *const  solution,
bool  maximize,
int64  step,
const std::vector< SearchMonitor * > &  monitors 
)

◆ MakeNestedOptimize() [3/6]

DecisionBuilder* MakeNestedOptimize ( DecisionBuilder *const  db,
Assignment *const  solution,
bool  maximize,
int64  step,
SearchMonitor *const  monitor1 
)

◆ MakeNestedOptimize() [4/6]

DecisionBuilder* MakeNestedOptimize ( DecisionBuilder *const  db,
Assignment *const  solution,
bool  maximize,
int64  step,
SearchMonitor *const  monitor1,
SearchMonitor *const  monitor2 
)

◆ MakeNestedOptimize() [5/6]

DecisionBuilder* MakeNestedOptimize ( DecisionBuilder *const  db,
Assignment *const  solution,
bool  maximize,
int64  step,
SearchMonitor *const  monitor1,
SearchMonitor *const  monitor2,
SearchMonitor *const  monitor3 
)

◆ MakeNestedOptimize() [6/6]

DecisionBuilder* MakeNestedOptimize ( DecisionBuilder *const  db,
Assignment *const  solution,
bool  maximize,
int64  step,
SearchMonitor *const  monitor1,
SearchMonitor *const  monitor2,
SearchMonitor *const  monitor3,
SearchMonitor *const  monitor4 
)

◆ MakeNoCycle() [1/2]

Constraint* MakeNoCycle ( const std::vector< IntVar * > &  nexts,
const std::vector< IntVar * > &  active,
IndexFilter1  sink_handler,
bool  assume_paths 
)

◆ MakeNoCycle() [2/2]

Constraint* MakeNoCycle ( const std::vector< IntVar * > &  nexts,
const std::vector< IntVar * > &  active,
IndexFilter1  sink_handler = nullptr 
)

Prevent cycles.

The "nexts" variables represent the next in the chain. "active" variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem. A callback can be added to specify sink values (by default sink values are values >= vars.size()). Ownership of the callback is passed to the constraint. If assume_paths is either not specified or true, the constraint assumes the "nexts" variables represent paths (and performs a faster propagation); otherwise the constraint assumes they represent a forest.

◆ MakeNonEquality() [1/3]

Constraint* MakeNonEquality ( IntExpr *const  expr,
int  value 
)

expr != value

◆ MakeNonEquality() [2/3]

Constraint* MakeNonEquality ( IntExpr *const  expr,
int64  value 
)

expr != value

◆ MakeNonEquality() [3/3]

Constraint* MakeNonEquality ( IntExpr *const  left,
IntExpr *const  right 
)

left != right

◆ MakeNonOverlappingBoxesConstraint() [1/3]

Constraint* MakeNonOverlappingBoxesConstraint ( const std::vector< IntVar * > &  x_vars,
const std::vector< IntVar * > &  y_vars,
const std::vector< int > &  x_size,
const std::vector< int > &  y_size 
)

◆ MakeNonOverlappingBoxesConstraint() [2/3]

Constraint* MakeNonOverlappingBoxesConstraint ( const std::vector< IntVar * > &  x_vars,
const std::vector< IntVar * > &  y_vars,
const std::vector< int64 > &  x_size,
const std::vector< int64 > &  y_size 
)

◆ MakeNonOverlappingBoxesConstraint() [3/3]

Constraint* MakeNonOverlappingBoxesConstraint ( const std::vector< IntVar * > &  x_vars,
const std::vector< IntVar * > &  y_vars,
const std::vector< IntVar * > &  x_size,
const std::vector< IntVar * > &  y_size 
)

This constraint states that all the boxes must not overlap.

The coordinates of box i are: (x_vars[i], y_vars[i]), (x_vars[i], y_vars[i] + y_size[i]), (x_vars[i] + x_size[i], y_vars[i]), (x_vars[i] + x_size[i], y_vars[i] + y_size[i]). The sizes must be non-negative. Boxes with a zero dimension can be pushed like any box.

◆ MakeNonOverlappingNonStrictBoxesConstraint() [1/3]

Constraint* MakeNonOverlappingNonStrictBoxesConstraint ( const std::vector< IntVar * > &  x_vars,
const std::vector< IntVar * > &  y_vars,
const std::vector< int > &  x_size,
const std::vector< int > &  y_size 
)

◆ MakeNonOverlappingNonStrictBoxesConstraint() [2/3]

Constraint* MakeNonOverlappingNonStrictBoxesConstraint ( const std::vector< IntVar * > &  x_vars,
const std::vector< IntVar * > &  y_vars,
const std::vector< int64 > &  x_size,
const std::vector< int64 > &  y_size 
)

◆ MakeNonOverlappingNonStrictBoxesConstraint() [3/3]

Constraint* MakeNonOverlappingNonStrictBoxesConstraint ( const std::vector< IntVar * > &  x_vars,
const std::vector< IntVar * > &  y_vars,
const std::vector< IntVar * > &  x_size,
const std::vector< IntVar * > &  y_size 
)

This constraint states that all the boxes must not overlap.

The coordinates of box i are: (x_vars[i], y_vars[i]), (x_vars[i], y_vars[i] + y_size[i]), (x_vars[i] + x_size[i], y_vars[i]), (x_vars[i] + x_size[i], y_vars[i] + y_size[i]). The sizes must be positive. Boxes with a zero dimension can be placed anywhere.

◆ MakeNotBetweenCt()

Constraint* MakeNotBetweenCt ( IntExpr *const  expr,
int64  l,
int64  u 
)

(expr < l || expr > u) This constraint is lazy as it will not make holes in the domain of variables.

It will propagate only when expr->Min() >= l or expr->Max() <= u.

◆ MakeNotMemberCt() [1/5]

Constraint* MakeNotMemberCt ( IntExpr *const  expr,
const std::vector< int > &  values 
)

◆ MakeNotMemberCt() [2/5]

Constraint* MakeNotMemberCt ( IntExpr *const  expr,
const std::vector< int64 > &  values 
)

expr not in set.

◆ MakeNotMemberCt() [3/5]

Constraint* MakeNotMemberCt ( IntExpr *const  expr,
std::vector< int >  starts,
std::vector< int >  ends 
)

expr should not be in the list of forbidden intervals [start[i]..end[i]].

◆ MakeNotMemberCt() [4/5]

Constraint* MakeNotMemberCt ( IntExpr *const  expr,
std::vector< int64 >  starts,
std::vector< int64 >  ends 
)

expr should not be in the list of forbidden intervals [start[i]..end[i]].

◆ MakeNotMemberCt() [5/5]

Constraint* MakeNotMemberCt ( IntExpr expr,
SortedDisjointIntervalList  intervals 
)

expr should not be in the list of forbidden intervals.

◆ MakeNullIntersect()

Constraint* MakeNullIntersect ( const std::vector< IntVar * > &  first_vars,
const std::vector< IntVar * > &  second_vars 
)

Creates a constraint that states that all variables in the first vector are different from all variables in the second group.

Thus the set of values in the first vector does not intersect with the set of values in the second vector.

◆ MakeNullIntersectExcept()

Constraint* MakeNullIntersectExcept ( const std::vector< IntVar * > &  first_vars,
const std::vector< IntVar * > &  second_vars,
int64  escape_value 
)

Creates a constraint that states that all variables in the first vector are different from all variables from the second group, unless they are assigned to the escape value.

Thus the set of values in the first vector minus the escape value does not intersect with the set of values in the second vector.

◆ MakeOperator() [1/4]

LocalSearchOperator* MakeOperator ( const std::vector< IntVar * > &  vars,
const std::vector< IntVar * > &  secondary_vars,
IndexEvaluator3  evaluator,
EvaluatorLocalSearchOperators  op 
)

◆ MakeOperator() [2/4]

LocalSearchOperator* MakeOperator ( const std::vector< IntVar * > &  vars,
const std::vector< IntVar * > &  secondary_vars,
LocalSearchOperators  op 
)

◆ MakeOperator() [3/4]

LocalSearchOperator* MakeOperator ( const std::vector< IntVar * > &  vars,
IndexEvaluator3  evaluator,
EvaluatorLocalSearchOperators  op 
)

◆ MakeOperator() [4/4]

LocalSearchOperator* MakeOperator ( const std::vector< IntVar * > &  vars,
LocalSearchOperators  op 
)

Local Search Operators.

◆ MakeOpposite()

IntExpr* MakeOpposite ( IntExpr *const  expr)

-expr

◆ MakeOptimize()

OptimizeVar* MakeOptimize ( bool  maximize,
IntVar *const  v,
int64  step 
)

Creates a objective with a given sense (true = maximization).

◆ MakePack()

Pack* MakePack ( const std::vector< IntVar * > &  vars,
int  number_of_bins 
)

This constraint packs all variables onto 'number_of_bins' variables.

For any given variable, a value of 'number_of_bins' indicates that the variable is not assigned to any bin. Dimensions, i.e., cumulative constraints on this packing, can be added directly from the pack class.

◆ MakePathConnected()

Constraint* MakePathConnected ( std::vector< IntVar * >  nexts,
std::vector< int64 >  sources,
std::vector< int64 >  sinks,
std::vector< IntVar * >  status 
)

Constraint enforcing that status[i] is true iff there's a path defined on next variables from sources[i] to sinks[i].

Check whether more propagation is needed.

◆ MakePathCumul() [1/3]

Constraint* MakePathCumul ( const std::vector< IntVar * > &  nexts,
const std::vector< IntVar * > &  active,
const std::vector< IntVar * > &  cumuls,
const std::vector< IntVar * > &  slacks,
IndexEvaluator2  transit_evaluator 
)

Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transit_evaluator(i, next[i]) + slacks[i].

Active variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem. Ownership of transit_evaluator is taken and it must be a repeatable callback.

◆ MakePathCumul() [2/3]

Constraint* MakePathCumul ( const std::vector< IntVar * > &  nexts,
const std::vector< IntVar * > &  active,
const std::vector< IntVar * > &  cumuls,
const std::vector< IntVar * > &  transits 
)

Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transits[i].

Active variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem.

◆ MakePathCumul() [3/3]

Constraint* MakePathCumul ( const std::vector< IntVar * > &  nexts,
const std::vector< IntVar * > &  active,
const std::vector< IntVar * > &  cumuls,
IndexEvaluator2  transit_evaluator 
)

Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transit_evaluator(i, next[i]).

Active variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem. Ownership of transit_evaluator is taken and it must be a repeatable callback.

◆ MakePathPrecedenceConstraint() [1/2]

Constraint* MakePathPrecedenceConstraint ( std::vector< IntVar * >  nexts,
const std::vector< std::pair< int, int >> &  precedences 
)

Contraint enforcing, for each pair (i,j) in precedences, i to be before j in paths defined by next variables.

the implementation can easily be modified to do that; evaluate the impact on models solved with local search.

◆ MakePathPrecedenceConstraint() [2/2]

Constraint* MakePathPrecedenceConstraint ( std::vector< IntVar * >  nexts,
const std::vector< std::pair< int, int >> &  precedences,
const std::vector< int > &  lifo_path_starts,
const std::vector< int > &  fifo_path_starts 
)

Same as MakePathPrecedenceConstraint but ensures precedence pairs on some paths follow a LIFO or FIFO order.

LIFO order: given 2 pairs (a,b) and (c,d), if a is before c on the path then d must be before b or b must be before c. FIFO order: given 2 pairs (a,b) and (c,d), if a is before c on the path then b must be before d. LIFO (resp. FIFO) orders are enforced only on paths starting by indices in lifo_path_starts (resp. fifo_path_start).

◆ MakePathTransitPrecedenceConstraint()

Constraint* MakePathTransitPrecedenceConstraint ( std::vector< IntVar * >  nexts,
std::vector< IntVar * >  transits,
const std::vector< std::pair< int, int >> &  precedences 
)

Same as MakePathPrecedenceConstraint but will force i to be before j if the sum of transits on the path from i to j is strictly positive.

◆ MakePhase() [1/15]

DecisionBuilder* MakePhase ( const std::vector< IntervalVar * > &  intervals,
IntervalStrategy  str 
)

Scheduling phases.

◆ MakePhase() [2/15]

DecisionBuilder* MakePhase ( const std::vector< IntVar * > &  vars,
IndexEvaluator1  var_evaluator,
IndexEvaluator2  value_evaluator 
)

◆ MakePhase() [3/15]

DecisionBuilder* MakePhase ( const std::vector< IntVar * > &  vars,
IndexEvaluator1  var_evaluator,
IndexEvaluator2  value_evaluator,
IndexEvaluator1  tie_breaker 
)

◆ MakePhase() [4/15]

DecisionBuilder* MakePhase ( const std::vector< IntVar * > &  vars,
IndexEvaluator1  var_evaluator,
IntValueStrategy  val_str 
)

◆ MakePhase() [5/15]

DecisionBuilder* MakePhase ( const std::vector< IntVar * > &  vars,
IndexEvaluator2  eval,
EvaluatorStrategy  str 
)

Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator.

The arguments passed to the evaluator callback are the indices of the variables in vars and the values of these variables. Ownership of the callback is passed to the decision builder.

◆ MakePhase() [6/15]

DecisionBuilder* MakePhase ( const std::vector< IntVar * > &  vars,
IndexEvaluator2  eval,
IndexEvaluator1  tie_breaker,
EvaluatorStrategy  str 
)

Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator.

In case of tie breaks, the second callback is used to choose the best index in the array of equivalent pairs with equivalent evaluations. The arguments passed to the evaluator callback are the indices of the variables in vars and the values of these variables. Ownership of the callback is passed to the decision builder.

◆ MakePhase() [7/15]

DecisionBuilder* MakePhase ( const std::vector< IntVar * > &  vars,
IntVarStrategy  var_str,
IndexEvaluator2  value_evaluator 
)

◆ MakePhase() [8/15]

DecisionBuilder* MakePhase ( const std::vector< IntVar * > &  vars,
IntVarStrategy  var_str,
IndexEvaluator2  value_evaluator,
IndexEvaluator1  tie_breaker 
)

◆ MakePhase() [9/15]

DecisionBuilder* MakePhase ( const std::vector< IntVar * > &  vars,
IntVarStrategy  var_str,
IntValueStrategy  val_str 
)

Phases on IntVar arrays.

for all other functions that have several homonyms in this .h).

◆ MakePhase() [10/15]

DecisionBuilder* MakePhase ( const std::vector< IntVar * > &  vars,
IntVarStrategy  var_str,
VariableValueComparator  var_val1_val2_comparator 
)

var_val1_val2_comparator(var, val1, val2) is true iff assigning value "val1" to variable "var" is better than assigning value "val2".

◆ MakePhase() [11/15]

DecisionBuilder* MakePhase ( const std::vector< SequenceVar * > &  sequences,
SequenceStrategy  str 
)

◆ MakePhase() [12/15]

DecisionBuilder* MakePhase ( IntVar *const  v0,
IntVar *const  v1,
IntVar *const  v2,
IntVar *const  v3,
IntVarStrategy  var_str,
IntValueStrategy  val_str 
)

◆ MakePhase() [13/15]

DecisionBuilder* MakePhase ( IntVar *const  v0,
IntVar *const  v1,
IntVar *const  v2,
IntVarStrategy  var_str,
IntValueStrategy  val_str 
)

◆ MakePhase() [14/15]

DecisionBuilder* MakePhase ( IntVar *const  v0,
IntVar *const  v1,
IntVarStrategy  var_str,
IntValueStrategy  val_str 
)

◆ MakePhase() [15/15]

DecisionBuilder* MakePhase ( IntVar *const  v0,
IntVarStrategy  var_str,
IntValueStrategy  val_str 
)

Shortcuts for small arrays.

◆ MakePiecewiseLinearExpr()

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.

◆ MakePower()

IntExpr* MakePower ( IntExpr *const  expr,
int64  n 
)

expr ^ n (n > 0)

◆ MakePrintModelVisitor()

ModelVisitor* MakePrintModelVisitor ( )

Prints the model.

◆ MakeProd() [1/2]

IntExpr* MakeProd ( IntExpr *const  expr,
int64  value 
)

expr * value

◆ MakeProd() [2/2]

IntExpr* MakeProd ( IntExpr *const  left,
IntExpr *const  right 
)

left * right

◆ MakeRandomLnsOperator() [1/2]

LocalSearchOperator* MakeRandomLnsOperator ( const std::vector< IntVar * > &  vars,
int  number_of_variables 
)

Creates a large neighborhood search operator which creates fragments (set of relaxed variables) with up to number_of_variables random variables (sampling with replacement is performed meaning that at most number_of_variables variables are selected).

Warning: this operator will always return neighbors; using it without a search limit will result in a non-ending search. Optionally a random seed can be specified.

◆ MakeRandomLnsOperator() [2/2]

LocalSearchOperator* MakeRandomLnsOperator ( const std::vector< IntVar * > &  vars,
int  number_of_variables,
int32  seed 
)

◆ MakeRankFirstInterval()

Decision* MakeRankFirstInterval ( SequenceVar *const  sequence,
int  index 
)

Returns a decision that tries to rank first the ith interval var in the sequence variable.

◆ MakeRankLastInterval()

Decision* MakeRankLastInterval ( SequenceVar *const  sequence,
int  index 
)

Returns a decision that tries to rank last the ith interval var in the sequence variable.

◆ MakeRejectFilter()

LocalSearchFilter* MakeRejectFilter ( )

◆ MakeRestoreAssignment()

DecisionBuilder* MakeRestoreAssignment ( Assignment assignment)

Returns a DecisionBuilder which restores an Assignment (calls void Assignment::Restore())

◆ MakeScalProd() [1/2]

IntExpr* MakeScalProd ( const std::vector< IntVar * > &  vars,
const std::vector< int > &  coefs 
)

scalar product

◆ MakeScalProd() [2/2]

IntExpr* MakeScalProd ( const std::vector< IntVar * > &  vars,
const std::vector< int64 > &  coefs 
)

scalar product

◆ MakeScalProdEquality() [1/4]

Constraint* MakeScalProdEquality ( const std::vector< IntVar * > &  vars,
const std::vector< int > &  coefficients,
int64  cst 
)

◆ MakeScalProdEquality() [2/4]

Constraint* MakeScalProdEquality ( const std::vector< IntVar * > &  vars,
const std::vector< int > &  coefficients,
IntVar *const  target 
)

◆ MakeScalProdEquality() [3/4]

Constraint* MakeScalProdEquality ( const std::vector< IntVar * > &  vars,
const std::vector< int64 > &  coefficients,
int64  cst 
)

◆ MakeScalProdEquality() [4/4]

Constraint* MakeScalProdEquality ( const std::vector< IntVar * > &  vars,
const std::vector< int64 > &  coefficients,
IntVar *const  target 
)

◆ MakeScalProdGreaterOrEqual() [1/2]

Constraint* MakeScalProdGreaterOrEqual ( const std::vector< IntVar * > &  vars,
const std::vector< int > &  coeffs,
int64  cst 
)

◆ MakeScalProdGreaterOrEqual() [2/2]

Constraint* MakeScalProdGreaterOrEqual ( const std::vector< IntVar * > &  vars,
const std::vector< int64 > &  coeffs,
int64  cst 
)

◆ MakeScalProdLessOrEqual() [1/2]

Constraint* MakeScalProdLessOrEqual ( const std::vector< IntVar * > &  vars,
const std::vector< int > &  coefficients,
int64  cst 
)

◆ MakeScalProdLessOrEqual() [2/2]

Constraint* MakeScalProdLessOrEqual ( const std::vector< IntVar * > &  vars,
const std::vector< int64 > &  coefficients,
int64  cst 
)

◆ MakeScheduleOrExpedite()

Decision* MakeScheduleOrExpedite ( IntervalVar *const  var,
int64  est,
int64 *const  marker 
)

Returns a decision that tries to schedule a task at a given time.

On the Apply branch, it will set that interval var as performed and set its end to 'est'. On the Refute branch, it will just update the 'marker' to 'est' - 1. This decision is used in the INTERVAL_SET_TIMES_BACKWARD strategy.

◆ MakeScheduleOrPostpone()

Decision* MakeScheduleOrPostpone ( IntervalVar *const  var,
int64  est,
int64 *const  marker 
)

Returns a decision that tries to schedule a task at a given time.

On the Apply branch, it will set that interval var as performed and set its start to 'est'. On the Refute branch, it will just update the 'marker' to 'est' + 1. This decision is used in the INTERVAL_SET_TIMES_FORWARD strategy.

◆ MakeSearchLog() [1/7]

SearchMonitor* MakeSearchLog ( int  branch_period)

The SearchMonitors below will display a periodic search log on LOG(INFO) every branch_period branches explored.

◆ MakeSearchLog() [2/7]

SearchMonitor* MakeSearchLog ( int  branch_period,
IntVar *const  var 
)

At each solution, this monitor also display the var value.

◆ MakeSearchLog() [3/7]

SearchMonitor* MakeSearchLog ( int  branch_period,
IntVar var,
std::function< std::string()>  display_callback 
)

At each solution, this monitor will display the 'var' value and the result of display_callback.

◆ MakeSearchLog() [4/7]

SearchMonitor* MakeSearchLog ( int  branch_period,
OptimizeVar *const  opt_var 
)

OptimizeVar Search Logs At each solution, this monitor will also display the 'opt_var' value.

◆ MakeSearchLog() [5/7]

SearchMonitor* MakeSearchLog ( int  branch_period,
OptimizeVar *const  opt_var,
std::function< std::string()>  display_callback 
)

Creates a search monitor that will also print the result of the display callback.

◆ MakeSearchLog() [6/7]

SearchMonitor* MakeSearchLog ( int  branch_period,
std::function< std::string()>  display_callback 
)

At each solution, this monitor will also display result of display_callback.

◆ MakeSearchLog() [7/7]

SearchMonitor* MakeSearchLog ( SearchLogParameters  parameters)

◆ MakeSearchTrace()

SearchMonitor* MakeSearchTrace ( const std::string &  prefix)

Creates a search monitor that will trace precisely the behavior of the search.

Use this only for low level debugging.

◆ MakeSemiContinuousExpr()

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.

◆ MakeSimulatedAnnealing()

SearchMonitor* MakeSimulatedAnnealing ( bool  maximize,
IntVar *const  v,
int64  step,
int64  initial_temperature 
)

Creates a Simulated Annealing monitor.

◆ MakeSolutionsLimit()

RegularLimit* MakeSolutionsLimit ( int64  solutions)

Creates a search limit that constrains the number of solutions found during the search.

◆ MakeSolveOnce() [1/6]

DecisionBuilder* MakeSolveOnce ( DecisionBuilder *const  db)

SolveOnce will collapse a search tree described by a decision builder 'db' and a set of monitors and wrap it into a single point.

If there are no solutions to this nested tree, then SolveOnce will fail. If there is a solution, it will find it and returns nullptr.

◆ MakeSolveOnce() [2/6]

DecisionBuilder* MakeSolveOnce ( DecisionBuilder *const  db,
const std::vector< SearchMonitor * > &  monitors 
)

◆ MakeSolveOnce() [3/6]

DecisionBuilder* MakeSolveOnce ( DecisionBuilder *const  db,
SearchMonitor *const  monitor1 
)

◆ MakeSolveOnce() [4/6]

DecisionBuilder* MakeSolveOnce ( DecisionBuilder *const  db,
SearchMonitor *const  monitor1,
SearchMonitor *const  monitor2 
)

◆ MakeSolveOnce() [5/6]

DecisionBuilder* MakeSolveOnce ( DecisionBuilder *const  db,
SearchMonitor *const  monitor1,
SearchMonitor *const  monitor2,
SearchMonitor *const  monitor3 
)

◆ MakeSolveOnce() [6/6]

DecisionBuilder* MakeSolveOnce ( DecisionBuilder *const  db,
SearchMonitor *const  monitor1,
SearchMonitor *const  monitor2,
SearchMonitor *const  monitor3,
SearchMonitor *const  monitor4 
)

◆ MakeSortingConstraint()

Constraint* MakeSortingConstraint ( const std::vector< IntVar * > &  vars,
const std::vector< IntVar * > &  sorted 
)

Creates a constraint binding the arrays of variables "vars" and "sorted_vars": sorted_vars[0] must be equal to the minimum of all variables in vars, and so on: the value of sorted_vars[i] must be equal to the i-th value of variables invars.

This constraint propagates in both directions: from "vars" to "sorted_vars" and vice-versa.

Behind the scenes, this constraint maintains that:

  • sorted is always increasing.
  • whatever the values of vars, there exists a permutation that injects its values into the sorted variables.

For more info, please have a look at: https://mpi-inf.mpg.de/~mehlhorn/ftp/Mehlhorn-Thiel.pdf

◆ MakeSplitVariableDomain()

Decision* MakeSplitVariableDomain ( IntVar *const  var,
int64  val,
bool  start_with_lower_half 
)

◆ MakeSquare()

IntExpr* MakeSquare ( IntExpr *const  expr)

expr * expr

◆ MakeStatisticsModelVisitor()

ModelVisitor* MakeStatisticsModelVisitor ( )

Displays some nice statistics on the model.

◆ MakeStoreAssignment()

DecisionBuilder* MakeStoreAssignment ( Assignment assignment)

Returns a DecisionBuilder which stores an Assignment (calls void Assignment::Store())

◆ MakeStrictDisjunctiveConstraint()

DisjunctiveConstraint* MakeStrictDisjunctiveConstraint ( const std::vector< IntervalVar * > &  intervals,
const std::string &  name 
)

This constraint forces all interval vars into an non-overlapping sequence.

Intervals with zero durations cannot overlap with over intervals.

◆ MakeSubCircuit()

Constraint* MakeSubCircuit ( const std::vector< IntVar * > &  nexts)

Force the "nexts" variable to create a complete Hamiltonian path for those that do not loop upon themselves.

◆ MakeSum() [1/3]

IntExpr* MakeSum ( const std::vector< IntVar * > &  vars)

sum of all vars.

◆ MakeSum() [2/3]

IntExpr* MakeSum ( IntExpr *const  expr,
int64  value 
)

expr + value.

◆ MakeSum() [3/3]

IntExpr* MakeSum ( IntExpr *const  left,
IntExpr *const  right 
)

left + right.

◆ MakeSumEquality() [1/2]

Constraint* MakeSumEquality ( const std::vector< IntVar * > &  vars,
int64  cst 
)

◆ MakeSumEquality() [2/2]

Constraint* MakeSumEquality ( const std::vector< IntVar * > &  vars,
IntVar *const  var 
)

◆ MakeSumGreaterOrEqual()

Constraint* MakeSumGreaterOrEqual ( const std::vector< IntVar * > &  vars,
int64  cst 
)

◆ MakeSumLessOrEqual()

Constraint* MakeSumLessOrEqual ( const std::vector< IntVar * > &  vars,
int64  cst 
)

Variation on arrays.

◆ MakeSumObjectiveFilter() [1/2]

IntVarLocalSearchFilter* MakeSumObjectiveFilter ( const std::vector< IntVar * > &  vars,
const std::vector< IntVar * > &  secondary_vars,
IndexEvaluator3  values,
Solver::LocalSearchFilterBound  filter_enum 
)

◆ MakeSumObjectiveFilter() [2/2]

IntVarLocalSearchFilter* MakeSumObjectiveFilter ( const std::vector< IntVar * > &  vars,
IndexEvaluator2  values,
Solver::LocalSearchFilterBound  filter_enum 
)

◆ MakeSymmetryManager() [1/5]

SearchMonitor* MakeSymmetryManager ( const std::vector< SymmetryBreaker * > &  visitors)

Symmetry Breaking.

◆ MakeSymmetryManager() [2/5]

SearchMonitor* MakeSymmetryManager ( SymmetryBreaker *const  v1)

◆ MakeSymmetryManager() [3/5]

SearchMonitor* MakeSymmetryManager ( SymmetryBreaker *const  v1,
SymmetryBreaker *const  v2 
)

◆ MakeSymmetryManager() [4/5]

SearchMonitor* MakeSymmetryManager ( SymmetryBreaker *const  v1,
SymmetryBreaker *const  v2,
SymmetryBreaker *const  v3 
)

◆ MakeSymmetryManager() [5/5]

SearchMonitor* MakeSymmetryManager ( SymmetryBreaker *const  v1,
SymmetryBreaker *const  v2,
SymmetryBreaker *const  v3,
SymmetryBreaker *const  v4 
)

◆ MakeTabuSearch()

SearchMonitor* MakeTabuSearch ( bool  maximize,
IntVar *const  v,
int64  step,
const std::vector< IntVar * > &  vars,
int64  keep_tenure,
int64  forbid_tenure,
double  tabu_factor 
)

MetaHeuristics which try to get the search out of local optima.

Creates a Tabu Search monitor. In the context of local search the behavior is similar to MakeOptimize(), creating an objective in a given sense. The behavior differs once a local optimum is reached: thereafter solutions which degrade the value of the objective are allowed if they are not "tabu". A solution is "tabu" if it doesn't respect the following rules:

  • improving the best solution found so far
  • variables in the "keep" list must keep their value, variables in the "forbid" list must not take the value they have in the list. Variables with new values enter the tabu lists after each new solution found and leave the lists after a given number of iterations (called tenure). Only the variables passed to the method can enter the lists. The tabu criterion is softened by the tabu factor which gives the number of "tabu" violations which is tolerated; a factor of 1 means no violations allowed; a factor of 0 means all violations are allowed.

◆ MakeTemporalDisjunction() [1/2]

Constraint* MakeTemporalDisjunction ( IntervalVar *const  t1,
IntervalVar *const  t2 
)

This constraint implements a temporal disjunction between two interval vars.

◆ MakeTemporalDisjunction() [2/2]

Constraint* MakeTemporalDisjunction ( IntervalVar *const  t1,
IntervalVar *const  t2,
IntVar *const  alt 
)

This constraint implements a temporal disjunction between two interval vars t1 and t2.

'alt' indicates which alternative was chosen (alt == 0 is equivalent to t1 before t2).

◆ MakeTimeLimit() [1/2]

RegularLimit* MakeTimeLimit ( absl::Duration  time)

Creates a search limit that constrains the running time.

◆ MakeTimeLimit() [2/2]

RegularLimit* MakeTimeLimit ( int64  time_in_ms)
inline

Definition at line 2211 of file constraint_solver.h.

◆ MakeTransitionConstraint() [1/2]

Constraint* MakeTransitionConstraint ( const std::vector< IntVar * > &  vars,
const IntTupleSet &  transition_table,
int64  initial_state,
const std::vector< int > &  final_states 
)

This constraint create a finite automaton that will check the sequence of variables vars.

It uses a transition table called 'transition_table'. Each transition is a triple (current_state, variable_value, new_state). The initial state is given, and the set of accepted states is decribed by 'final_states'. These states are hidden inside the constraint. Only the transitions (i.e. the variables) are visible.

◆ MakeTransitionConstraint() [2/2]

Constraint* MakeTransitionConstraint ( const std::vector< IntVar * > &  vars,
const IntTupleSet &  transition_table,
int64  initial_state,
const std::vector< int64 > &  final_states 
)

This constraint create a finite automaton that will check the sequence of variables vars.

It uses a transition table called 'transition_table'. Each transition is a triple (current_state, variable_value, new_state). The initial state is given, and the set of accepted states is decribed by 'final_states'. These states are hidden inside the constraint. Only the transitions (i.e. the variables) are visible.

◆ MakeTrueConstraint()

Constraint* MakeTrueConstraint ( )

This constraint always succeeds.

◆ MakeVariableDegreeVisitor()

ModelVisitor* MakeVariableDegreeVisitor ( absl::flat_hash_map< const IntVar *, int > *const  map)

Compute the number of constraints a variable is attached to.

◆ MakeVariableDomainFilter()

LocalSearchFilter* MakeVariableDomainFilter ( )

◆ MakeVariableGreaterOrEqualValue()

Decision* MakeVariableGreaterOrEqualValue ( IntVar *const  var,
int64  value 
)

◆ MakeVariableLessOrEqualValue()

Decision* MakeVariableLessOrEqualValue ( IntVar *const  var,
int64  value 
)

◆ MakeWeightedMaximize() [1/2]

OptimizeVar* MakeWeightedMaximize ( const std::vector< IntVar * > &  sub_objectives,
const std::vector< int > &  weights,
int64  step 
)

Creates a maximization weigthed objective.

◆ MakeWeightedMaximize() [2/2]

OptimizeVar* MakeWeightedMaximize ( const std::vector< IntVar * > &  sub_objectives,
const std::vector< int64 > &  weights,
int64  step 
)

Creates a maximization weigthed objective.

◆ MakeWeightedMinimize() [1/2]

OptimizeVar* MakeWeightedMinimize ( const std::vector< IntVar * > &  sub_objectives,
const std::vector< int > &  weights,
int64  step 
)

Creates a minimization weighted objective.

The actual objective is scalar_prod(sub_objectives, weights).

◆ MakeWeightedMinimize() [2/2]

OptimizeVar* MakeWeightedMinimize ( const std::vector< IntVar * > &  sub_objectives,
const std::vector< int64 > &  weights,
int64  step 
)

Creates a minimization weighted objective.

The actual objective is scalar_prod(sub_objectives, weights).

◆ MakeWeightedOptimize() [1/2]

OptimizeVar* MakeWeightedOptimize ( bool  maximize,
const std::vector< IntVar * > &  sub_objectives,
const std::vector< int > &  weights,
int64  step 
)

Creates a weighted objective with a given sense (true = maximization).

◆ MakeWeightedOptimize() [2/2]

OptimizeVar* MakeWeightedOptimize ( bool  maximize,
const std::vector< IntVar * > &  sub_objectives,
const std::vector< int64 > &  weights,
int64  step 
)

Creates a weighted objective with a given sense (true = maximization).

◆ MemoryUsage()

static int64 MemoryUsage ( )
static

Current memory usage in bytes.

◆ model_name()

std::string model_name ( ) const

Returns the name of the model.

◆ MultiArmedBanditConcatenateOperators()

LocalSearchOperator* MultiArmedBanditConcatenateOperators ( const std::vector< LocalSearchOperator * > &  ops,
double  memory_coefficient,
double  exploration_coefficient,
bool  maximize 
)

Creates a local search operator which concatenates a vector of operators.

Uses Multi-Armed Bandit approach for choosing the next operator to use. Sorts operators based on Upper Confidence Bound Algorithm which evaluates each operator as sum of average improvement and exploration function.

Updates the order of operators when accepts a neighbor with objective improvement.

◆ NameAllVariables()

bool NameAllVariables ( ) const

Returns whether all variables should be named.

◆ neighbors()

int64 neighbors ( ) const
inline

The number of neighbors created.

Definition at line 1002 of file constraint_solver.h.

◆ NewSearch() [1/6]

void NewSearch ( DecisionBuilder *const  db)

◆ NewSearch() [2/6]

void NewSearch ( DecisionBuilder *const  db,
const std::vector< SearchMonitor * > &  monitors 
)

Decomposed search. The code for a top level search should look like solver->NewSearch(db); while (solver->NextSolution()) { //.. use the current solution } solver()->EndSearch();

◆ NewSearch() [3/6]

void NewSearch ( DecisionBuilder *const  db,
SearchMonitor *const  m1 
)

◆ NewSearch() [4/6]

void NewSearch ( DecisionBuilder *const  db,
SearchMonitor *const  m1,
SearchMonitor *const  m2 
)

◆ NewSearch() [5/6]

void NewSearch ( DecisionBuilder *const  db,
SearchMonitor *const  m1,
SearchMonitor *const  m2,
SearchMonitor *const  m3 
)

◆ NewSearch() [6/6]

void NewSearch ( DecisionBuilder *const  db,
SearchMonitor *const  m1,
SearchMonitor *const  m2,
SearchMonitor *const  m3,
SearchMonitor *const  m4 
)

◆ NextSolution()

bool NextSolution ( )

◆ Now()

absl::Time Now ( ) const

The 'absolute time' as seen by the solver.

Unless a user-provided clock was injected via SetClock() (eg. for unit tests), this is a real walltime, shifted so that it was 0 at construction. All so-called "walltime" limits are relative to this time.

◆ optimization_direction()

OptimizationDirection optimization_direction ( ) const
inline

The direction of optimization, getter and setter.

Definition at line 1018 of file constraint_solver.h.

◆ parameters()

ConstraintSolverParameters parameters ( ) const
inline

Stored Parameters.

Definition at line 768 of file constraint_solver.h.

◆ PopState()

void PopState ( )

◆ PushState()

void PushState ( )

The PushState and PopState methods manipulates the states of the reversible objects.

They are visible only because they are useful to write unitary tests.

◆ Rand32()

int32 Rand32 ( int32  size)
inline

Returns a random value between 0 and 'size' - 1;.

Definition at line 2834 of file constraint_solver.h.

◆ Rand64()

int64 Rand64 ( int64  size)
inline

Returns a random value between 0 and 'size' - 1;.

Definition at line 2828 of file constraint_solver.h.

◆ RandomConcatenateOperators() [1/2]

LocalSearchOperator* RandomConcatenateOperators ( const std::vector< LocalSearchOperator * > &  ops)

Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor().

◆ RandomConcatenateOperators() [2/2]

LocalSearchOperator* RandomConcatenateOperators ( const std::vector< LocalSearchOperator * > &  ops,
int32  seed 
)

Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor().

The provided seed is used to initialize the random number generator.

◆ RegisterDemon()

Demon* RegisterDemon ( Demon *const  demon)

Adds a new demon and wraps it inside a DemonProfiler if necessary.

◆ RegisterIntervalVar()

IntervalVar* RegisterIntervalVar ( IntervalVar *const  var)

Registers a new IntervalVar and wraps it inside a TraceIntervalVar if necessary.

◆ RegisterIntExpr()

IntExpr* RegisterIntExpr ( IntExpr *const  expr)

Registers a new IntExpr and wraps it inside a TraceIntExpr if necessary.

◆ RegisterIntVar()

IntVar* RegisterIntVar ( IntVar *const  var)

Registers a new IntVar and wraps it inside a TraceIntVar if necessary.

◆ ReSeed()

void ReSeed ( int32  seed)
inline

Reseed the solver random generator.

Definition at line 2840 of file constraint_solver.h.

◆ RestartCurrentSearch()

void RestartCurrentSearch ( )

◆ RestartSearch()

void RestartSearch ( )

◆ RevAlloc()

T* RevAlloc ( T *  object)
inline

Registers the given object as being reversible.

By calling this method, the caller gives ownership of the object to the solver, which will delete it when there is a backtrack out of the current state.

Returns the argument for convenience: this way, the caller may directly invoke a constructor in the argument, without having to store the pointer first.

This function is only for users that define their own subclasses of BaseObject: for all subclasses predefined in the library, the corresponding factory methods (e.g., MakeIntVar(...), MakeAllDifferent(...) already take care of the registration.

Definition at line 796 of file constraint_solver.h.

◆ RevAllocArray()

T* RevAllocArray ( T *  object)
inline

Like RevAlloc() above, but for an array of objects: the array must have been allocated with the new[] operator.

The entire array will be deleted when backtracking out of the current state.

This method is valid for arrays of int, int64, uint64, bool, BaseObject*, IntVar*, IntExpr*, and Constraint*.

Definition at line 807 of file constraint_solver.h.

◆ SaveAndAdd()

void SaveAndAdd ( T *  adr,
val 
)
inline

All-in-one SaveAndAdd_value.

Definition at line 2820 of file constraint_solver.h.

◆ SaveAndSetValue()

void SaveAndSetValue ( T *  adr,
val 
)
inline

All-in-one SaveAndSetValue.

Definition at line 2811 of file constraint_solver.h.

◆ SaveValue()

void SaveValue ( T *  o)
inline

reversibility

SaveValue() saves the value of the corresponding object. It must be called before modifying the object. The value will be restored upon backtrack.

Definition at line 779 of file constraint_solver.h.

◆ SearchContext() [1/2]

std::string SearchContext ( ) const

◆ SearchContext() [2/2]

std::string SearchContext ( const Search *  search) const

◆ SearchDepth()

int SearchDepth ( ) const

Gets the search depth of the current active search.

Returns -1 if there is no active search opened.

◆ SearchLeftDepth()

int SearchLeftDepth ( ) const

Gets the search left depth of the current active search.

Returns -1 if there is no active search opened.

◆ set_fail_intercept()

void set_fail_intercept ( std::function< void()>  fail_intercept)
inline

Internal.

Definition at line 2874 of file constraint_solver.h.

◆ set_optimization_direction()

void set_optimization_direction ( OptimizationDirection  direction)
inline

Definition at line 1021 of file constraint_solver.h.

◆ SetBranchSelector()

void SetBranchSelector ( BranchSelector  bs)

Sets the given branch selector on the current active search.

◆ SetSearchContext()

void SetSearchContext ( Search *  search,
const std::string &  search_context 
)

◆ SetUseFastLocalSearch()

void SetUseFastLocalSearch ( bool  use_fast_local_search)
inline

enabled for metaheuristics.

Disables/enables fast local search.

Definition at line 2884 of file constraint_solver.h.

◆ ShouldFail()

void ShouldFail ( )
inline

These methods are only useful for the SWIG wrappers, which need a way to externally cause the Solver to fail.

Definition at line 2985 of file constraint_solver.h.

◆ solutions()

int64 solutions ( ) const

The number of solutions found since the start of the search.

◆ Solve() [1/6]

bool Solve ( DecisionBuilder *const  db)

◆ Solve() [2/6]

bool Solve ( DecisionBuilder *const  db,
const std::vector< SearchMonitor * > &  monitors 
)

Solves the problem using the given DecisionBuilder and returns true if a solution was found and accepted.

These methods are the ones most users should use to search for a solution. Note that the definition of 'solution' is subtle. A solution here is defined as a leaf of the search tree with respect to the given decision builder for which there is no failure. What this means is that, contrary to intuition, a solution may not have all variables of the model bound. It is the responsibility of the decision builder to keep returning decisions until all variables are indeed bound. The most extreme counterexample is calling Solve with a trivial decision builder whose Next() method always returns nullptr. In this case, Solve immediately returns 'true', since not assigning any variable to any value is a solution, unless the root node propagation discovers that the model is infeasible.

This function must be called either from outside of search, or from within the Next() method of a decision builder.

Solve will terminate whenever any of the following event arise:

  • A search monitor asks the solver to terminate the search by calling solver()->FinishCurrentSearch().
  • A solution is found that is accepted by all search monitors, and none of the search monitors decides to search for another one.

Upon search termination, there will be a series of backtracks all the way to the top level. This means that a user cannot expect to inspect the solution by querying variables after a call to Solve(): all the information will be lost. In order to do something with the solution, the user must either:

  • Use a search monitor that can process such a leaf. See, in particular, the SolutionCollector class.
  • Do not use Solve. Instead, use the more fine-grained approach using methods NewSearch(...), NextSolution(), and EndSearch().
Parameters
dbThe decision builder that will generate the search tree.
monitorsA vector of search monitors that will be notified of various events during the search. In their reaction to these events, such monitors may influence the search.

◆ Solve() [3/6]

bool Solve ( DecisionBuilder *const  db,
SearchMonitor *const  m1 
)

◆ Solve() [4/6]

bool Solve ( DecisionBuilder *const  db,
SearchMonitor *const  m1,
SearchMonitor *const  m2 
)

◆ Solve() [5/6]

bool Solve ( DecisionBuilder *const  db,
SearchMonitor *const  m1,
SearchMonitor *const  m2,
SearchMonitor *const  m3 
)

◆ Solve() [6/6]

bool Solve ( DecisionBuilder *const  db,
SearchMonitor *const  m1,
SearchMonitor *const  m2,
SearchMonitor *const  m3,
SearchMonitor *const  m4 
)

◆ SolveAndCommit() [1/5]

bool SolveAndCommit ( DecisionBuilder *const  db)

◆ SolveAndCommit() [2/5]

bool SolveAndCommit ( DecisionBuilder *const  db,
const std::vector< SearchMonitor * > &  monitors 
)

SolveAndCommit using a decision builder and up to three search monitors, usually one for the objective, one for the limits and one to collect solutions.

The difference between a SolveAndCommit() and a Solve() method call is the fact that SolveAndCommit will not backtrack all modifications at the end of the search. This method is only usable during the Next() method of a decision builder.

◆ SolveAndCommit() [3/5]

bool SolveAndCommit ( DecisionBuilder *const  db,
SearchMonitor *const  m1 
)

◆ SolveAndCommit() [4/5]

bool SolveAndCommit ( DecisionBuilder *const  db,
SearchMonitor *const  m1,
SearchMonitor *const  m2 
)

◆ SolveAndCommit() [5/5]

bool SolveAndCommit ( DecisionBuilder *const  db,
SearchMonitor *const  m1,
SearchMonitor *const  m2,
SearchMonitor *const  m3 
)

◆ SolveDepth()

int SolveDepth ( ) const

Gets the number of nested searches.

It returns 0 outside search, 1 during the top level search, 2 or more in case of nested searches.

◆ stamp()

uint64 stamp ( ) const

The stamp indicates how many moves in the search tree we have performed.

It is useful to detect if we need to update same lazy structures.

◆ state()

SolverState state ( ) const
inline

State of the solver.

Definition at line 957 of file constraint_solver.h.

◆ TopPeriodicCheck()

void TopPeriodicCheck ( )

Performs PeriodicCheck on the top-level search; for instance, can be called from a nested solve to check top-level limits.

◆ TopProgressPercent()

int TopProgressPercent ( )

Returns a percentage representing the propress of the search before reaching the limits of the top-level search (can be called from a nested solve).

◆ Try() [1/4]

DecisionBuilder* Try ( const std::vector< DecisionBuilder * > &  dbs)

◆ Try() [2/4]

DecisionBuilder* Try ( DecisionBuilder *const  db1,
DecisionBuilder *const  db2 
)

Creates a decision builder which will create a search tree where each decision builder is called from the top of the search tree.

For instance the decision builder Try(db1, db2) will entirely explore the search tree of db1 then the one of db2, resulting in the following search tree: Tree root | / \ | db1 tree db2 tree |

This is very handy to try a decision builder which partially explores the search space and if it fails to try another decision builder. "Try"-builders "recursively". For instance, Try(a,b,c,d) will give a tree unbalanced to the right, whereas Try(Try(a,b), Try(b,c)) will give a balanced tree. Investigate if we should only provide the binary version and/or if we should balance automatically.

◆ Try() [3/4]

DecisionBuilder* Try ( DecisionBuilder *const  db1,
DecisionBuilder *const  db2,
DecisionBuilder *const  db3 
)

◆ Try() [4/4]

DecisionBuilder* Try ( DecisionBuilder *const  db1,
DecisionBuilder *const  db2,
DecisionBuilder *const  db3,
DecisionBuilder *const  db4 
)

◆ unchecked_solutions()

int64 unchecked_solutions ( ) const

The number of unchecked solutions found by local search.

◆ UseFastLocalSearch()

bool UseFastLocalSearch ( ) const
inline

Returns true if fast local search is enabled.

Definition at line 2888 of file constraint_solver.h.

◆ wall_time()

int64 wall_time ( ) const

DEPRECATED: Use Now() instead.

Time elapsed, in ms since the creation of the solver.

Member Data Documentation

◆ kNumPriorities

constexpr int kNumPriorities = 3
staticconstexpr

Number of priorities for demons.

Definition at line 270 of file constraint_solver.h.

◆ tmp_vector_

std::vector<int64> tmp_vector_

Unsafe temporary vector.

It is used to avoid leaks in operations that need storage and that may fail. See IntVar::SetValues() for instance. It is not locked; do not use in a multi-threaded or reentrant setup.

Definition at line 2940 of file constraint_solver.h.


The documentation for this class was generated from the following file: