OR-Tools  9.3
Solver

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 245 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_t(int64_t)> IndexEvaluator1
 Callback typedefs. More...
 
typedef std::function< int64_t(int64_t, int64_t)> IndexEvaluator2
 
typedef std::function< int64_t(int64_t, int64_t, int64_t)> IndexEvaluator3
 
typedef std::function< bool(int64_t)> IndexFilter1
 
typedef std::function< IntVar *(int64_t)> Int64ToIntVar
 
typedef std::function< int64_t(Solver *solver, const std::vector< IntVar * > &vars, int64_t first_unbound, int64_t last_unbound)> VariableIndexSelector
 
typedef std::function< int64_t(const IntVar *v, int64_t id)> VariableValueSelector
 
typedef std::function< bool(int64_t, int64_t, int64_t)> 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_t wall_time () const
 DEPRECATED: Use Now() instead. More...
 
int64_t branches () const
 The number of branches explored since the creation of the solver. More...
 
int64_t solutions () const
 The number of solutions found since the start of the search. More...
 
int64_t unchecked_solutions () const
 The number of unchecked solutions found by local search. More...
 
int64_t demon_runs (DemonPriority p) const
 The number of demons executed during search for a given priority. More...
 
int64_t failures () const
 The number of failures encountered since the creation of the solver. More...
 
int64_t neighbors () const
 The number of neighbors created. More...
 
int64_t filtered_neighbors () const
 The number of filtered neighbors (neighbors accepted by filters). More...
 
int64_t accepted_neighbors () const
 The number of accepted neighbors. More...
 
uint64_t stamp () const
 The stamp indicates how many moves in the search tree we have performed. More...
 
uint64_t 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_t min, int64_t max, const std::string &name)
 MakeIntVar will create the best range based int var for the bounds given. More...
 
IntVarMakeIntVar (const std::vector< int64_t > &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_t min, int64_t max)
 MakeIntVar will create the best range based int var for the bounds given. More...
 
IntVarMakeIntVar (const std::vector< int64_t > &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_t val, const std::string &name)
 IntConst will create a constant expression. More...
 
IntVarMakeIntConst (int64_t val)
 IntConst will create a constant expression. More...
 
void MakeIntVarArray (int var_count, int64_t vmin, int64_t 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_t vmin, int64_t 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_t vmin, int64_t 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_t 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_t > &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_t 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_t value)
 expr * value More...
 
IntExprMakeDiv (IntExpr *const expr, int64_t 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_t n)
 expr ^ n (n > 0) More...
 
IntExprMakeElement (const std::vector< int64_t > &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_t range_start, int64_t range_end, IntVar *argument)
 vars(argument) More...
 
IntExprMakeIndexExpression (const std::vector< IntVar * > &vars, int64_t 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_t 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_t value)
 std::max(expr, value) More...
 
IntExprMakeMax (IntExpr *const expr, int value)
 std::max(expr, value) More...
 
IntExprMakeConvexPiecewiseExpr (IntExpr *expr, int64_t early_cost, int64_t early_date, int64_t late_date, int64_t late_cost)
 Convex piecewise function. More...
 
IntExprMakeSemiContinuousExpr (IntExpr *const expr, int64_t fixed_charge, int64_t 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_t 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_t 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_t value, IntVar *const boolvar)
 boolvar == (var == value) More...
 
IntVarMakeIsEqualCstVar (IntExpr *const var, int64_t 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_t value)
 expr == value More...
 
ConstraintMakeEquality (IntExpr *const expr, int value)
 expr == value More...
 
ConstraintMakeIsDifferentCstCt (IntExpr *const var, int64_t value, IntVar *const boolvar)
 boolvar == (var != value) More...
 
IntVarMakeIsDifferentCstVar (IntExpr *const var, int64_t 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_t value)
 expr != value More...
 
ConstraintMakeNonEquality (IntExpr *const expr, int value)
 expr != value More...
 
ConstraintMakeIsLessOrEqualCstCt (IntExpr *const var, int64_t value, IntVar *const boolvar)
 boolvar == (var <= value) More...
 
IntVarMakeIsLessOrEqualCstVar (IntExpr *const var, int64_t 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_t value)
 expr <= value More...
 
ConstraintMakeLessOrEqual (IntExpr *const expr, int value)
 expr <= value More...
 
ConstraintMakeIsGreaterOrEqualCstCt (IntExpr *const var, int64_t value, IntVar *const boolvar)
 boolvar == (var >= value) More...
 
IntVarMakeIsGreaterOrEqualCstVar (IntExpr *const var, int64_t 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_t value)
 expr >= value More...
 
ConstraintMakeGreaterOrEqual (IntExpr *const expr, int value)
 expr >= value More...
 
ConstraintMakeIsGreaterCstCt (IntExpr *const v, int64_t c, IntVar *const b)
 b == (v > c) More...
 
IntVarMakeIsGreaterCstVar (IntExpr *const var, int64_t 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_t value)
 expr > value More...
 
ConstraintMakeGreater (IntExpr *const expr, int value)
 expr > value More...
 
ConstraintMakeIsLessCstCt (IntExpr *const v, int64_t c, IntVar *const b)
 b == (v < c) More...
 
IntVarMakeIsLessCstVar (IntExpr *const var, int64_t 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_t value)
 expr < value More...
 
ConstraintMakeLess (IntExpr *const expr, int value)
 expr < value More...
 
ConstraintMakeSumLessOrEqual (const std::vector< IntVar * > &vars, int64_t cst)
 Variation on arrays. More...
 
ConstraintMakeSumGreaterOrEqual (const std::vector< IntVar * > &vars, int64_t cst)
 
ConstraintMakeSumEquality (const std::vector< IntVar * > &vars, int64_t cst)
 
ConstraintMakeSumEquality (const std::vector< IntVar * > &vars, IntVar *const var)
 
ConstraintMakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int64_t > &coefficients, int64_t cst)
 
ConstraintMakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64_t cst)
 
ConstraintMakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int64_t > &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_t > &coeffs, int64_t cst)
 
ConstraintMakeScalProdGreaterOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coeffs, int64_t cst)
 
ConstraintMakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int64_t > &coefficients, int64_t cst)
 
ConstraintMakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64_t 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_t > &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_t 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_t 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_t l, int64_t u)
 (l <= expr <= u) More...
 
ConstraintMakeNotBetweenCt (IntExpr *const expr, int64_t l, int64_t 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_t l, int64_t u, IntVar *const b)
 b == (l <= expr <= u) More...
 
IntVarMakeIsBetweenVar (IntExpr *const v, int64_t l, int64_t u)
 
ConstraintMakeMemberCt (IntExpr *const expr, const std::vector< int64_t > &values)
 expr in set. More...
 
ConstraintMakeMemberCt (IntExpr *const expr, const std::vector< int > &values)
 
ConstraintMakeNotMemberCt (IntExpr *const expr, const std::vector< int64_t > &values)
 expr not in set. More...
 
ConstraintMakeNotMemberCt (IntExpr *const expr, const std::vector< int > &values)
 
ConstraintMakeNotMemberCt (IntExpr *const expr, std::vector< int64_t > starts, std::vector< int64_t > 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_t > &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_t > &values)
 
IntVarMakeIsMemberVar (IntExpr *const expr, const std::vector< int > &values)
 
ConstraintMakeAtMost (std::vector< IntVar * > vars, int64_t value, int64_t max_count)
 |{i | vars[i] == value}| <= max_count More...
 
ConstraintMakeCount (const std::vector< IntVar * > &vars, int64_t value, int64_t max_count)
 |{i | vars[i] == value}| == max_count More...
 
ConstraintMakeCount (const std::vector< IntVar * > &vars, int64_t value, IntVar *const max_count)
 |{i | vars[i] == value}| == max_count More...
 
ConstraintMakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int64_t > &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_t card_min, int64_t card_max, int64_t card_size)
 Aggregated version of count with bounded cardinalities: forall j in 0 . More...
 
ConstraintMakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int64_t > &card_min, const std::vector< int64_t > &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_t > &values, const std::vector< int64_t > &card_min, const std::vector< int64_t > &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_t 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_t 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_t 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_t > sources, std::vector< int64_t > 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)
 Constraint 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_t initial_state, const std::vector< int64_t > &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_t 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_t > &x_size, const std::vector< int64_t > &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_t > &x_size, const std::vector< int64_t > &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_t start_min, int64_t start_max, int64_t duration, bool optional, const std::string &name)
 Creates an interval var with a fixed duration. More...
 
void MakeFixedDurationIntervalVarArray (int count, int64_t start_min, int64_t start_max, int64_t 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_t duration, const std::string &name)
 Creates a performed interval var with a fixed duration. More...
 
IntervalVarMakeFixedDurationIntervalVar (IntVar *const start_variable, int64_t 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_t 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_t > &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_t > &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_t start, int64_t duration, const std::string &name)
 Creates a fixed and performed interval. More...
 
IntervalVarMakeIntervalVar (int64_t start_min, int64_t start_max, int64_t duration_min, int64_t duration_max, int64_t end_min, int64_t 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_t start_min, int64_t start_max, int64_t duration_min, int64_t duration_max, int64_t end_min, int64_t 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_t duration, int64_t 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_t duration, int64_t 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_t duration, int64_t 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_t duration, int64_t 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_t 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_t 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_t > &demands, int64_t 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_t 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_t > &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_t 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_t step)
 Creates a minimization objective. More...
 
OptimizeVarMakeMaximize (IntVar *const v, int64_t step)
 Creates a maximization objective. More...
 
OptimizeVarMakeOptimize (bool maximize, IntVar *const v, int64_t step)
 Creates a objective with a given sense (true = maximization). More...
 
OptimizeVarMakeWeightedMinimize (const std::vector< IntVar * > &sub_objectives, const std::vector< int64_t > &weights, int64_t step)
 Creates a minimization weighted objective. More...
 
OptimizeVarMakeWeightedMinimize (const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64_t step)
 Creates a minimization weighted objective. More...
 
OptimizeVarMakeWeightedMaximize (const std::vector< IntVar * > &sub_objectives, const std::vector< int64_t > &weights, int64_t step)
 Creates a maximization weigthed objective. More...
 
OptimizeVarMakeWeightedMaximize (const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64_t step)
 Creates a maximization weigthed objective. More...
 
OptimizeVarMakeWeightedOptimize (bool maximize, const std::vector< IntVar * > &sub_objectives, const std::vector< int64_t > &weights, int64_t 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_t step)
 Creates a weighted objective with a given sense (true = maximization). More...
 
SearchMonitorMakeTabuSearch (bool maximize, IntVar *const v, int64_t step, const std::vector< IntVar * > &vars, int64_t keep_tenure, int64_t forbid_tenure, double tabu_factor)
 MetaHeuristics which try to get the search out of local optima. More...
 
SearchMonitorMakeGenericTabuSearch (bool maximize, IntVar *const v, int64_t step, const std::vector< IntVar * > &tabu_vars, int64_t forbid_tenure)
 Creates a Tabu Search based on the vars |vars|. More...
 
SearchMonitorMakeSimulatedAnnealing (bool maximize, IntVar *const v, int64_t step, int64_t initial_temperature)
 Creates a Simulated Annealing monitor. More...
 
SearchMonitorMakeGuidedLocalSearch (bool maximize, IntVar *const objective, IndexEvaluator2 objective_function, int64_t 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_t 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...
 
ABSL_MUST_USE_RESULT RegularLimitMakeTimeLimit (absl::Duration time)
 Creates a search limit that constrains the running time. More...
 
ABSL_MUST_USE_RESULT RegularLimitMakeTimeLimit (int64_t time_in_ms)
 
ABSL_MUST_USE_RESULT RegularLimitMakeBranchesLimit (int64_t branches)
 Creates a search limit that constrains the number of branches explored in the search tree. More...
 
ABSL_MUST_USE_RESULT RegularLimitMakeFailuresLimit (int64_t failures)
 Creates a search limit that constrains the number of failures that can happen when exploring the search tree. More...
 
ABSL_MUST_USE_RESULT RegularLimitMakeSolutionsLimit (int64_t solutions)
 Creates a search limit that constrains the number of solutions found during the search. More...
 
ABSL_MUST_USE_RESULT RegularLimitMakeLimit (absl::Duration time, int64_t branches, int64_t failures, int64_t solutions, bool smart_time_check=false, bool cumulative=false)
 Limits the search with the 'time', 'branches', 'failures' and 'solutions' limits. More...
 
ABSL_MUST_USE_RESULT RegularLimitMakeLimit (const RegularLimitParameters &proto)
 Creates a search limit from its protobuf description. More...
 
ABSL_MUST_USE_RESULT RegularLimitMakeLimit (int64_t time, int64_t branches, int64_t failures, int64_t solutions, bool smart_time_check=false, bool cumulative=false)
 
RegularLimitParameters MakeDefaultRegularLimitParameters () const
 Creates a regular limit proto containing default values. More...
 
ABSL_MUST_USE_RESULT 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...
 
ABSL_MUST_USE_RESULT 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...
 
ABSL_MUST_USE_RESULT 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_t val)
 Decisions. More...
 
DecisionMakeVariableLessOrEqualValue (IntVar *const var, int64_t value)
 
DecisionMakeVariableGreaterOrEqualValue (IntVar *const var, int64_t value)
 
DecisionMakeSplitVariableDomain (IntVar *const var, int64_t val, bool start_with_lower_half)
 
DecisionMakeAssignVariableValueOrFail (IntVar *const var, int64_t value)
 
DecisionMakeAssignVariableValueOrDoNothing (IntVar *const var, int64_t value)
 
DecisionMakeAssignVariablesValues (const std::vector< IntVar * > &vars, const std::vector< int64_t > &values)
 
DecisionMakeAssignVariablesValuesOrDoNothing (const std::vector< IntVar * > &vars, const std::vector< int64_t > &values)
 
DecisionMakeAssignVariablesValuesOrFail (const std::vector< IntVar * > &vars, const std::vector< int64_t > &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_t est, int64_t *const marker)
 Returns a decision that tries to schedule a task at a given time. More...
 
DecisionMakeScheduleOrExpedite (IntervalVar *const var, int64_t est, int64_t *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_t 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_t step, SearchMonitor *const monitor1)
 
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64_t step, SearchMonitor *const monitor1, SearchMonitor *const monitor2)
 
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64_t step, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3)
 
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64_t step, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3, SearchMonitor *const monitor4)
 
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64_t 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_t 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_t > &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_t(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_t 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_t 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...
 
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (IntVar *objective, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder)
 Local Search Phase Parameters. More...
 
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (IntVar *objective, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, RegularLimit *const limit)
 
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (IntVar *objective, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, RegularLimit *const limit, LocalSearchFilterManager *filter_manager)
 
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (IntVar *objective, SolutionPool *const pool, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder)
 
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (IntVar *objective, SolutionPool *const pool, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, RegularLimit *const limit)
 
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (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_t Rand64 (int64_t size)
 Returns a random value between 0 and 'size' - 1;. More...
 
int32_t Rand32 (int32_t size)
 Returns a random value between 0 and 'size' - 1;. More...
 
void ReSeed (int32_t 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...
 
SearchActiveSearch () 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_t *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 ()
 
DecisionBuilderMakeProfiledDecisionBuilderWrapper (DecisionBuilder *db)
 Activates profiling on a decision builder. More...
 
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_t MemoryUsage ()
 Current memory usage in bytes. More...
 

Public Attributes

std::vector< int64_t > 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 754 of file constraint_solver.h.

◆ BranchSelector

typedef std::function<DecisionModification()> BranchSelector

Definition at line 752 of file constraint_solver.h.

◆ Closure

typedef std::function<void()> Closure

Definition at line 755 of file constraint_solver.h.

◆ IndexEvaluator1

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

Callback typedefs.

Definition at line 735 of file constraint_solver.h.

◆ IndexEvaluator2

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

Definition at line 736 of file constraint_solver.h.

◆ IndexEvaluator3

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

Definition at line 737 of file constraint_solver.h.

◆ IndexFilter1

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

Definition at line 739 of file constraint_solver.h.

◆ Int64ToIntVar

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

Definition at line 741 of file constraint_solver.h.

◆ VariableIndexSelector

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

Definition at line 746 of file constraint_solver.h.

◆ VariableValueComparator

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

Definition at line 751 of file constraint_solver.h.

◆ VariableValueSelector

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

Definition at line 749 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 619 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 687 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 605 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 564 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 387 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 411 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 347 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 266 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 592 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 426 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 713 of file constraint_solver.h.

◆ OptimizationDirection

Optimization directions.

Enumerator
NOT_SET 
MAXIMIZATION 
MINIMIZATION 

Definition at line 732 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 402 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 716 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 652 of file constraint_solver.h.

Constructor & Destructor Documentation

◆ Solver() [1/2]

Solver ( const std::string &  name)
explicit

Solver API.

Definition at line 1421 of file constraint_solver.cc.

◆ Solver() [2/2]

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

Definition at line 1410 of file constraint_solver.cc.

◆ ~Solver()

~Solver ( )

Definition at line 1475 of file constraint_solver.cc.

Member Function Documentation

◆ Accept()

void Accept ( ModelVisitor *const  visitor) const

Accepts the given model visitor.

Definition at line 1699 of file constraint_solver.cc.

◆ accepted_neighbors()

int64_t accepted_neighbors ( ) const
inline

The number of accepted neighbors.

Definition at line 1003 of file constraint_solver.h.

◆ ActiveSearch()

Search * ActiveSearch ( ) const

Returns the active search, nullptr outside search.

Definition at line 1131 of file constraint_solver.cc.

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

Definition at line 1595 of file constraint_solver.cc.

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

Definition at line 1687 of file constraint_solver.cc.

◆ 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(...));

Definition at line 1663 of file constraint_solver.cc.

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

Definition at line 3218 of file constraint_solver.cc.

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

Definition at line 3141 of file constraint_solver.cc.

◆ balancing_decision()

Decision * balancing_decision ( ) const
inline

Definition at line 2883 of file constraint_solver.h.

◆ branches()

int64_t branches ( ) const
inline

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

Definition at line 982 of file constraint_solver.h.

◆ Cache()

ModelCache * Cache ( ) const

Returns the cache of the model.

Definition at line 850 of file model_cache.cc.

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

Definition at line 2443 of file constraint_solver.cc.

◆ CheckAssignment()

bool CheckAssignment ( Assignment *const  solution)

Checks whether the given assignment satisfies all relevant constraints.

Definition at line 2299 of file constraint_solver.cc.

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

Definition at line 2378 of file constraint_solver.cc.

◆ CheckFail()

void CheckFail ( )
inline

Definition at line 3000 of file constraint_solver.h.

◆ clear_fail_intercept()

void clear_fail_intercept ( )
inline

Definition at line 2891 of file constraint_solver.h.

◆ ClearLocalSearchState()

void ClearLocalSearchState ( )
inline

Clears the local search state.

Definition at line 2947 of file constraint_solver.h.

◆ Compose() [1/4]

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

Definition at line 586 of file search.cc.

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

Definition at line 556 of file search.cc.

◆ Compose() [3/4]

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

Definition at line 564 of file search.cc.

◆ Compose() [4/4]

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

Definition at line 574 of file search.cc.

◆ 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_t Evaluate(int active_operator, int current_operator) { return kPriorities[current_operator]; }

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

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

Definition at line 2022 of file local_search.cc.

◆ ConcatenateOperators() [2/3]

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

Definition at line 2027 of file local_search.cc.

◆ ConcatenateOperators() [3/3]

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

Definition at line 2039 of file local_search.cc.

◆ constraints()

int constraints ( ) const
inline

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

Definition at line 2878 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.

Definition at line 1752 of file constraint_solver.cc.

◆ DebugString()

std::string DebugString ( ) const

!defined(SWIG)

misc debug string.

Definition at line 1491 of file constraint_solver.cc.

◆ DefaultSolverParameters()

ConstraintSolverParameters DefaultSolverParameters ( )
static

Create a ConstraintSolverParameters proto with all the default values.

Definition at line 122 of file constraint_solver.cc.

◆ demon_profiler()

DemonProfiler * demon_profiler ( ) const
inline

Access to demon profiler.

Definition at line 2893 of file constraint_solver.h.

◆ demon_runs()

int64_t demon_runs ( DemonPriority  p) const
inline

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

Definition at line 991 of file constraint_solver.h.

◆ EndSearch()

void EndSearch ( )

Definition at line 2269 of file constraint_solver.cc.

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

Definition at line 433 of file demon_profiler.cc.

◆ Fail()

void Fail ( )

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

Definition at line 2422 of file constraint_solver.cc.

◆ fail_stamp()

uint64_t fail_stamp ( ) const

The fail_stamp() is incremented after each backtrack.

Definition at line 1651 of file constraint_solver.cc.

◆ failures()

int64_t failures ( ) const
inline

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

Definition at line 994 of file constraint_solver.h.

◆ filtered_neighbors()

int64_t filtered_neighbors ( ) const
inline

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

Definition at line 1000 of file constraint_solver.h.

◆ FinishCurrentSearch()

void FinishCurrentSearch ( )

Tells the solver to kill or restart the current search.

Definition at line 2433 of file constraint_solver.cc.

◆ GetConstraintSolverStatistics()

ConstraintSolverStatistics GetConstraintSolverStatistics ( ) const

Returns detailed cp search statistics.

Definition at line 1552 of file constraint_solver.cc.

◆ GetLocalSearchMonitor()

LocalSearchMonitor * GetLocalSearchMonitor ( ) const

Returns the local search monitor.

Definition at line 3223 of file constraint_solver.cc.

◆ GetLocalSearchStatistics()

LocalSearchStatistics GetLocalSearchStatistics ( ) const

Returns detailed local search statistics.

Definition at line 3940 of file local_search.cc.

◆ GetOrCreateLocalSearchState()

Assignment * GetOrCreateLocalSearchState ( )

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

Definition at line 3240 of file constraint_solver.cc.

◆ GetPropagationMonitor()

PropagationMonitor * GetPropagationMonitor ( ) const

Returns the propagation monitor.

Definition at line 3146 of file constraint_solver.cc.

◆ HasName()

bool HasName ( const PropagationBaseObject object) const

Returns whether the object has been named or not.

Definition at line 2491 of file constraint_solver.cc.

◆ InstrumentsDemons()

bool InstrumentsDemons ( ) const

Returns whether we are instrumenting demons.

Definition at line 173 of file constraint_solver.cc.

◆ InstrumentsVariables()

bool InstrumentsVariables ( ) const

Returns whether we are tracing variables.

Definition at line 187 of file constraint_solver.cc.

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

Definition at line 7476 of file expressions.cc.

◆ IsLocalSearchProfilingEnabled()

bool IsLocalSearchProfilingEnabled ( ) const

Returns whether we are profiling local search.

Definition at line 182 of file constraint_solver.cc.

◆ IsProduct()

bool IsProduct ( IntExpr *const  expr,
IntExpr **  inner_expr,
int64_t *  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.

Definition at line 7494 of file expressions.cc.

◆ IsProfilingEnabled()

bool IsProfilingEnabled ( ) const

Returns whether we are profiling the solver.

Definition at line 177 of file constraint_solver.cc.

◆ LocalSearchProfile()

std::string LocalSearchProfile ( ) const

Returns local search profiling information in a human readable format.

Definition at line 3933 of file local_search.cc.

◆ MakeAbs()

IntExpr * MakeAbs ( IntExpr *const  expr)

|expr|

Definition at line 7017 of file expressions.cc.

◆ MakeAbsEquality()

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

Creates the constraint abs(var) == abs_var.

Definition at line 7010 of file expressions.cc.

◆ MakeAcceptFilter()

LocalSearchFilter * MakeAcceptFilter ( )

Local Search Filters.

Definition at line 2546 of file local_search.cc.

◆ MakeActionDemon()

Demon * MakeActionDemon ( Solver::Action  action)

Creates a demon from a callback.

Definition at line 510 of file constraints.cc.

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

Definition at line 692 of file alldiff_cst.cc.

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

Definition at line 696 of file alldiff_cst.cc.

◆ MakeAllDifferentExcept()

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

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

Definition at line 722 of file alldiff_cst.cc.

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

Definition at line 1261 of file constraint_solver/table.cc.

◆ MakeAllSolutionCollector() [1/2]

SolutionCollector * MakeAllSolutionCollector ( )

Collect all solutions of the search.

The variables will need to be added later.

Definition at line 2774 of file search.cc.

◆ MakeAllSolutionCollector() [2/2]

SolutionCollector * MakeAllSolutionCollector ( const Assignment *const  assignment)

Collect all solutions of the search.

Definition at line 2769 of file search.cc.

◆ MakeApplyBranchSelector()

DecisionBuilder * MakeApplyBranchSelector ( BranchSelector  bs)

Creates a decision builder that will set the branch selector.

Definition at line 1171 of file constraint_solver.cc.

◆ MakeAssignment() [1/2]

Assignment * MakeAssignment ( )

This method creates an empty assignment.

Definition at line 1042 of file constraint_solver/assignment.cc.

◆ MakeAssignment() [2/2]

Assignment * MakeAssignment ( const Assignment *const  a)

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

Definition at line 1044 of file constraint_solver/assignment.cc.

◆ MakeAssignVariablesValues()

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

Definition at line 1796 of file search.cc.

◆ MakeAssignVariablesValuesOrDoNothing()

Decision * MakeAssignVariablesValuesOrDoNothing ( const std::vector< IntVar * > &  vars,
const std::vector< int64_t > &  values 
)

Definition at line 1804 of file search.cc.

◆ MakeAssignVariablesValuesOrFail()

Decision * MakeAssignVariablesValuesOrFail ( const std::vector< IntVar * > &  vars,
const std::vector< int64_t > &  values 
)

Definition at line 1811 of file search.cc.

◆ MakeAssignVariableValue()

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

Decisions.

Definition at line 1566 of file search.cc.

◆ MakeAssignVariableValueOrDoNothing()

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

Definition at line 1633 of file search.cc.

◆ MakeAssignVariableValueOrFail()

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

Definition at line 1604 of file search.cc.

◆ MakeAtMost()

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

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

Definition at line 956 of file count_cst.cc.

◆ MakeAtSolutionCallback()

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

Definition at line 422 of file search.cc.

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

Definition at line 2616 of file search.cc.

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

Definition at line 2611 of file search.cc.

◆ MakeBetweenCt()

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

(l <= expr <= u)

Definition at line 923 of file expr_cst.cc.

◆ MakeBoolVar() [1/2]

IntVar * MakeBoolVar ( )

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

Definition at line 6412 of file expressions.cc.

◆ MakeBoolVar() [2/2]

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

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

Definition at line 6408 of file expressions.cc.

◆ MakeBoolVarArray() [1/3]

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

Same but allocates an array and returns it.

Definition at line 6549 of file expressions.cc.

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

Definition at line 6536 of file expressions.cc.

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

Definition at line 6543 of file expressions.cc.

◆ MakeBranchesLimit()

RegularLimit * MakeBranchesLimit ( int64_t  branches)

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

Definition at line 4180 of file search.cc.

◆ MakeCircuit()

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

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

Definition at line 639 of file graph_constraints.cc.

◆ MakeClosureDemon()

Demon * MakeClosureDemon ( Solver::Closure  closure)

!defined(SWIG)

Creates a demon from a closure.

Definition at line 514 of file constraints.cc.

◆ MakeConditionalExpression()

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

Conditional Expr condition ? expr : unperformed_value.

Definition at line 7249 of file expressions.cc.

◆ MakeConstantRestart()

SearchMonitor * MakeConstantRestart ( int  frequency)

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

Definition at line 4768 of file search.cc.

◆ MakeConstraintAdder()

DecisionBuilder * MakeConstraintAdder ( Constraint *const  ct)

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

Definition at line 2374 of file constraint_solver.cc.

◆ MakeConstraintInitialPropagateCallback()

Demon * MakeConstraintInitialPropagateCallback ( Constraint *const  ct)

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

Definition at line 35 of file constraints.cc.

◆ MakeConvexPiecewiseExpr()

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

Convex piecewise function.

Definition at line 7162 of file expressions.cc.

◆ MakeCount() [1/2]

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

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

Definition at line 32 of file count_cst.cc.

◆ MakeCount() [2/2]

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

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

Definition at line 47 of file count_cst.cc.

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

Definition at line 587 of file sched_constraints.cc.

◆ MakeCumulative() [1/6]

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

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

Intervals and demands should be vectors of equal size.

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

Definition at line 2611 of file resource.cc.

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

Definition at line 2629 of file resource.cc.

◆ MakeCumulative() [3/6]

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

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

Intervals and demands should be vectors of equal size.

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

Definition at line 2597 of file resource.cc.

◆ MakeCumulative() [4/6]

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

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

Intervals and demands should be vectors of equal size.

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

Definition at line 2617 of file resource.cc.

◆ MakeCumulative() [5/6]

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

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

Intervals and demands should be vectors of equal size.

Demands should be positive.

Definition at line 2638 of file resource.cc.

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

Definition at line 2656 of file resource.cc.

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

Definition at line 4462 of file search.cc.

◆ MakeDecision()

Decision * MakeDecision ( Action  apply,
Action  refute 
)

Definition at line 614 of file search.cc.

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

Definition at line 2255 of file search.cc.

◆ MakeDefaultPhase() [1/2]

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

Definition at line 1115 of file default_search.cc.

◆ MakeDefaultPhase() [2/2]

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

Definition at line 1120 of file default_search.cc.

◆ MakeDefaultRegularLimitParameters()

RegularLimitParameters MakeDefaultRegularLimitParameters ( ) const

Creates a regular limit proto containing default values.

Definition at line 4223 of file search.cc.

◆ MakeDefaultSolutionPool()

SolutionPool * MakeDefaultSolutionPool ( )

Solution Pool.

Definition at line 4884 of file local_search.cc.

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

Definition at line 40 of file constraints.cc.

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

Definition at line 1328 of file graph_constraints.cc.

◆ MakeDeviation()

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

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

Definition at line 414 of file deviation.cc.

◆ MakeDifference() [1/2]

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

value - expr

Definition at line 6707 of file expressions.cc.

◆ MakeDifference() [2/2]

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

left - right

Definition at line 6667 of file expressions.cc.

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

Definition at line 2585 of file resource.cc.

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

Definition at line 1053 of file count_cst.cc.

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

Definition at line 1076 of file count_cst.cc.

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

Definition at line 994 of file count_cst.cc.

◆ MakeDistribute() [4/8]

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

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

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

Definition at line 1033 of file count_cst.cc.

◆ MakeDistribute() [5/8]

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

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

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

Definition at line 1059 of file count_cst.cc.

◆ MakeDistribute() [6/8]

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

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

Definition at line 965 of file count_cst.cc.

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

Definition at line 1000 of file count_cst.cc.

◆ MakeDistribute() [8/8]

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

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

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

Definition at line 1014 of file count_cst.cc.

◆ MakeDiv() [1/2]

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

expr / value (integer division)

Definition at line 6989 of file expressions.cc.

◆ MakeDiv() [2/2]

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

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

Definition at line 6951 of file expressions.cc.

◆ MakeElement() [1/6]

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

values[index]

Definition at line 667 of file element.cc.

◆ MakeElement() [2/6]

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

values[index]

Definition at line 657 of file element.cc.

◆ MakeElement() [3/6]

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

vars[expr]

Definition at line 1617 of file element.cc.

◆ MakeElement() [4/6]

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

Function-based element.

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

Definition at line 862 of file element.cc.

◆ MakeElement() [5/6]

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

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

Definition at line 1114 of file element.cc.

◆ MakeElement() [6/6]

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

vars(argument)

Definition at line 1664 of file element.cc.

◆ MakeElementEquality() [1/4]

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

Definition at line 1687 of file element.cc.

◆ MakeElementEquality() [2/4]

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

Definition at line 1681 of file element.cc.

◆ MakeElementEquality() [3/4]

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

Definition at line 1720 of file element.cc.

◆ MakeElementEquality() [4/4]

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

Definition at line 1693 of file element.cc.

◆ MakeEnterSearchCallback()

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

--— Callback-based search monitors --—

Definition at line 442 of file search.cc.

◆ MakeEquality() [1/4]

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

This constraints states that the two interval variables are equal.

Definition at line 597 of file sched_constraints.cc.

◆ MakeEquality() [2/4]

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

expr == value

Definition at line 101 of file expr_cst.cc.

◆ MakeEquality() [3/4]

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

expr == value

Definition at line 86 of file expr_cst.cc.

◆ MakeEquality() [4/4]

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

left == right

Definition at line 512 of file range_cst.cc.

◆ MakeExitSearchCallback()

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

Definition at line 462 of file search.cc.

◆ MakeFailDecision()

Decision * MakeFailDecision ( )

Definition at line 1383 of file constraint_solver.cc.

◆ MakeFailuresLimit()

RegularLimit * MakeFailuresLimit ( int64_t  failures)

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

Definition at line 4187 of file search.cc.

◆ MakeFalseConstraint() [1/2]

Constraint * MakeFalseConstraint ( )

This constraint always fails.

Definition at line 523 of file constraints.cc.

◆ MakeFalseConstraint() [2/2]

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

Definition at line 527 of file constraints.cc.

◆ MakeFirstSolutionCollector() [1/2]

SolutionCollector * MakeFirstSolutionCollector ( )

Collect the first solution of the search.

The variables will need to be added later.

Definition at line 2495 of file search.cc.

◆ MakeFirstSolutionCollector() [2/2]

SolutionCollector * MakeFirstSolutionCollector ( const Assignment *const  assignment)

Collect the first solution of the search.

Definition at line 2490 of file search.cc.

◆ MakeFixedDurationEndSyncedOnEndIntervalVar()

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

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

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

Definition at line 2451 of file interval.cc.

◆ MakeFixedDurationEndSyncedOnStartIntervalVar()

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

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

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

Definition at line 2444 of file interval.cc.

◆ MakeFixedDurationIntervalVar() [1/3]

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

Creates an interval var with a fixed duration.

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

Definition at line 2271 of file interval.cc.

◆ MakeFixedDurationIntervalVar() [2/3]

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

Creates a performed interval var with a fixed duration.

The duration must be greater than 0.

Definition at line 2299 of file interval.cc.

◆ MakeFixedDurationIntervalVar() [3/3]

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

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

The duration must be greater than 0.

Definition at line 2310 of file interval.cc.

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

Definition at line 2359 of file interval.cc.

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

Definition at line 2373 of file interval.cc.

◆ MakeFixedDurationIntervalVarArray() [3/6]

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

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

Definition at line 2345 of file interval.cc.

◆ MakeFixedDurationIntervalVarArray() [4/6]

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

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

Definition at line 2387 of file interval.cc.

◆ MakeFixedDurationIntervalVarArray() [5/6]

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

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

Definition at line 2331 of file interval.cc.

◆ MakeFixedDurationIntervalVarArray() [6/6]

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

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

Definition at line 2286 of file interval.cc.

◆ MakeFixedDurationStartSyncedOnEndIntervalVar()

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

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

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

Definition at line 2437 of file interval.cc.

◆ MakeFixedDurationStartSyncedOnStartIntervalVar()

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

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

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

Definition at line 2430 of file interval.cc.

◆ MakeFixedInterval()

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

Creates a fixed and performed interval.

Definition at line 2266 of file interval.cc.

◆ MakeGenericTabuSearch()

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

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

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

Definition at line 3320 of file search.cc.

◆ MakeGreater() [1/3]

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

expr > value

Definition at line 203 of file expr_cst.cc.

◆ MakeGreater() [2/3]

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

expr > value

Definition at line 192 of file expr_cst.cc.

◆ MakeGreater() [3/3]

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

left > right

Definition at line 560 of file range_cst.cc.

◆ MakeGreaterOrEqual() [1/3]

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

expr >= value

Definition at line 181 of file expr_cst.cc.

◆ MakeGreaterOrEqual() [2/3]

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

expr >= value

Definition at line 170 of file expr_cst.cc.

◆ MakeGreaterOrEqual() [3/3]

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

left >= right

Definition at line 542 of file range_cst.cc.

◆ MakeGuidedLocalSearch() [1/2]

SearchMonitor * MakeGuidedLocalSearch ( bool  maximize,
IntVar *const  objective,
Solver::IndexEvaluator2  objective_function,
int64_t  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

Definition at line 3976 of file search.cc.

◆ MakeGuidedLocalSearch() [2/2]

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

Definition at line 3985 of file search.cc.

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

Definition at line 1609 of file element.cc.

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

Definition at line 4351 of file search.cc.

◆ MakeIndexExpression()

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

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

It assumes that vars are all different.

Definition at line 1759 of file element.cc.

◆ MakeIndexOfConstraint()

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

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

Definition at line 1744 of file element.cc.

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

Definition at line 558 of file constraints.cc.

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

Definition at line 563 of file constraints.cc.

◆ MakeIntConst() [1/2]

IntVar * MakeIntConst ( int64_t  val)

IntConst will create a constant expression.

Definition at line 6491 of file expressions.cc.

◆ MakeIntConst() [2/2]

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

IntConst will create a constant expression.

Definition at line 6480 of file expressions.cc.

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

Definition at line 2241 of file interval.cc.

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

Definition at line 2250 of file interval.cc.

◆ MakeIntervalVar()

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

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

Definition at line 2403 of file interval.cc.

◆ MakeIntervalVarArray()

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

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

Definition at line 2412 of file interval.cc.

◆ MakeIntervalVarRelation() [1/2]

Constraint * MakeIntervalVarRelation ( IntervalVar *const  t,
Solver::UnaryIntervalRelation  r,
int64_t  d 
)

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

Definition at line 114 of file timetabling.cc.

◆ MakeIntervalVarRelation() [2/2]

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

This method creates a relation between two interval vars.

Definition at line 233 of file timetabling.cc.

◆ MakeIntervalVarRelationWithDelay()

Constraint * MakeIntervalVarRelationWithDelay ( IntervalVar *const  t1,
Solver::BinaryIntervalRelation  r,
IntervalVar *const  t2,
int64_t  delay 
)

This method creates a relation between two interval vars.

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

Definition at line 239 of file timetabling.cc.

◆ MakeIntVar() [1/6]

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

MakeIntVar will create a variable with the given sparse domain.

Definition at line 6476 of file expressions.cc.

◆ MakeIntVar() [2/6]

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

MakeIntVar will create a variable with the given sparse domain.

Definition at line 6471 of file expressions.cc.

◆ MakeIntVar() [3/6]

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

MakeIntVar will create a variable with the given sparse domain.

Definition at line 6467 of file expressions.cc.

◆ MakeIntVar() [4/6]

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

MakeIntVar will create a variable with the given sparse domain.

Definition at line 6416 of file expressions.cc.

◆ MakeIntVar() [5/6]

IntVar * MakeIntVar ( int64_t  min,
int64_t  max 
)

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

Definition at line 6404 of file expressions.cc.

◆ MakeIntVar() [6/6]

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

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

Definition at line 6388 of file expressions.cc.

◆ MakeIntVarArray() [1/3]

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

Same but allocates an array and returns it.

Definition at line 6527 of file expressions.cc.

◆ MakeIntVarArray() [2/3]

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

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

Definition at line 6512 of file expressions.cc.

◆ MakeIntVarArray() [3/3]

void MakeIntVarArray ( int  var_count,
int64_t  vmin,
int64_t  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.

Definition at line 6520 of file expressions.cc.

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

Definition at line 553 of file constraints.cc.

◆ MakeIsBetweenCt()

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

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

Definition at line 1051 of file expr_cst.cc.

◆ MakeIsBetweenVar()

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

Definition at line 1087 of file expr_cst.cc.

◆ MakeIsDifferentCstCt()

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

boolvar == (var != value)

Definition at line 589 of file expr_cst.cc.

◆ MakeIsDifferentCstVar()

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

status var of (var != value)

Definition at line 580 of file expr_cst.cc.

◆ MakeIsDifferentCt()

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

b == (v1 != v2)

Definition at line 686 of file range_cst.cc.

◆ MakeIsDifferentVar()

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

status var of (v1 != v2)

Definition at line 641 of file range_cst.cc.

◆ MakeIsEqualCstCt()

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

boolvar == (var == value)

Definition at line 487 of file expr_cst.cc.

◆ MakeIsEqualCstVar()

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

status var of (var == value)

Definition at line 462 of file expr_cst.cc.

◆ MakeIsEqualCt()

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

b == (v1 == v2)

Definition at line 622 of file range_cst.cc.

◆ MakeIsEqualVar()

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

status var of (v1 == v2)

Definition at line 577 of file range_cst.cc.

◆ MakeIsGreaterCstCt()

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

b == (v > c)

Definition at line 716 of file expr_cst.cc.

◆ MakeIsGreaterCstVar()

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

status var of (var > value)

Definition at line 696 of file expr_cst.cc.

◆ MakeIsGreaterCt()

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

b == (left > right)

Definition at line 800 of file range_cst.cc.

◆ MakeIsGreaterOrEqualCstCt()

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

boolvar == (var >= value)

Definition at line 700 of file expr_cst.cc.

◆ MakeIsGreaterOrEqualCstVar()

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

status var of (var >= value)

Definition at line 679 of file expr_cst.cc.

◆ MakeIsGreaterOrEqualCt()

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

b == (left >= right)

Definition at line 790 of file range_cst.cc.

◆ MakeIsGreaterOrEqualVar()

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

status var of (left >= right)

Definition at line 785 of file range_cst.cc.

◆ MakeIsGreaterVar()

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

status var of (left > right)

Definition at line 796 of file range_cst.cc.

◆ MakeIsLessCstCt()

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

b == (v < c)

Definition at line 816 of file expr_cst.cc.

◆ MakeIsLessCstVar()

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

status var of (var < value)

Definition at line 796 of file expr_cst.cc.

◆ MakeIsLessCt()

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

b == (left < right)

Definition at line 773 of file range_cst.cc.

◆ MakeIsLessOrEqualCstCt()

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

boolvar == (var <= value)

Definition at line 800 of file expr_cst.cc.

◆ MakeIsLessOrEqualCstVar()

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

status var of (var <= value)

Definition at line 779 of file expr_cst.cc.

◆ MakeIsLessOrEqualCt()

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

b == (left <= right)

Definition at line 730 of file range_cst.cc.

◆ MakeIsLessOrEqualVar()

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

status var of (left <= right)

Definition at line 698 of file range_cst.cc.

◆ MakeIsLessVar()

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

status var of (left < right)

Definition at line 742 of file range_cst.cc.

◆ MakeIsMemberCt() [1/2]

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

Definition at line 1489 of file expr_cst.cc.

◆ MakeIsMemberCt() [2/2]

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

boolvar == (expr in set)

Definition at line 1483 of file expr_cst.cc.

◆ MakeIsMemberVar() [1/2]

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

Definition at line 1502 of file expr_cst.cc.

◆ MakeIsMemberVar() [2/2]

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

Definition at line 1495 of file expr_cst.cc.

◆ MakeLastSolutionCollector() [1/2]

SolutionCollector * MakeLastSolutionCollector ( )

Collect the last solution of the search.

The variables will need to be added later.

Definition at line 2541 of file search.cc.

◆ MakeLastSolutionCollector() [2/2]

SolutionCollector * MakeLastSolutionCollector ( const Assignment *const  assignment)

Collect the last solution of the search.

Definition at line 2536 of file search.cc.

◆ MakeLess() [1/3]

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

expr < value

Definition at line 300 of file expr_cst.cc.

◆ MakeLess() [2/3]

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

expr < value

Definition at line 289 of file expr_cst.cc.

◆ MakeLess() [3/3]

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

left < right

Definition at line 546 of file range_cst.cc.

◆ MakeLessOrEqual() [1/3]

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

expr <= value

Definition at line 278 of file expr_cst.cc.

◆ MakeLessOrEqual() [2/3]

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

expr <= value

Definition at line 267 of file expr_cst.cc.

◆ MakeLessOrEqual() [3/3]

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

left <= right

Definition at line 526 of file range_cst.cc.

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

Definition at line 543 of file constraints.cc.

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

Definition at line 548 of file constraints.cc.

◆ MakeLimit() [1/4]

RegularLimit * MakeLimit ( absl::Duration  time,
int64_t  branches,
int64_t  failures,
int64_t  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

Definition at line 4208 of file search.cc.

◆ MakeLimit() [2/4]

RegularLimit * MakeLimit ( const RegularLimitParameters &  proto)

Creates a search limit from its protobuf description.

Definition at line 4215 of file search.cc.

◆ MakeLimit() [3/4]

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

Definition at line 4201 of file search.cc.

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

Definition at line 4423 of file search.cc.

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

Definition at line 4888 of file local_search.cc.

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

Definition at line 4906 of file local_search.cc.

◆ MakeLocalSearchPhase() [3/4]

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

Definition at line 4896 of file local_search.cc.

◆ MakeLocalSearchPhase() [4/4]

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

Definition at line 4917 of file local_search.cc.

◆ MakeLocalSearchPhaseParameters() [1/6]

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

Local Search Phase Parameters.

Definition at line 4465 of file local_search.cc.

◆ MakeLocalSearchPhaseParameters() [2/6]

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

Definition at line 4473 of file local_search.cc.

◆ MakeLocalSearchPhaseParameters() [3/6]

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

Definition at line 4481 of file local_search.cc.

◆ MakeLocalSearchPhaseParameters() [4/6]

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

Definition at line 4490 of file local_search.cc.

◆ MakeLocalSearchPhaseParameters() [5/6]

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

Definition at line 4498 of file local_search.cc.

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

Definition at line 4506 of file local_search.cc.

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

Definition at line 4735 of file search.cc.

◆ 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);

Definition at line 538 of file constraints.cc.

◆ MakeMax() [1/4]

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

std::max(vars)

Definition at line 3344 of file expr_array.cc.

◆ MakeMax() [2/4]

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

std::max(expr, value)

Definition at line 7158 of file expressions.cc.

◆ MakeMax() [3/4]

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

std::max(expr, value)

Definition at line 7144 of file expressions.cc.

◆ MakeMax() [4/4]

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

std::max(left, right)

Definition at line 7126 of file expressions.cc.

◆ MakeMaxEquality()

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

Definition at line 3409 of file expr_array.cc.

◆ MakeMaximize()

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

Creates a maximization objective.

Definition at line 2918 of file search.cc.

◆ MakeMemberCt() [1/2]

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

Definition at line 1228 of file expr_cst.cc.

◆ MakeMemberCt() [2/2]

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

expr in set.

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

Definition at line 1163 of file expr_cst.cc.

◆ MakeMin() [1/4]

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

std::min(vars)

Definition at line 3301 of file expr_array.cc.

◆ MakeMin() [2/4]

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

std::min(expr, value)

Definition at line 7122 of file expressions.cc.

◆ MakeMin() [3/4]

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

std::min(expr, value)

Definition at line 7108 of file expressions.cc.

◆ MakeMin() [4/4]

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

std::min (left, right)

Definition at line 7090 of file expressions.cc.

◆ MakeMinEquality()

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

Definition at line 3387 of file expr_array.cc.

◆ MakeMinimize()

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

Creates a minimization objective.

Definition at line 2914 of file search.cc.

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

Definition at line 2236 of file interval.cc.

◆ MakeModulo() [1/2]

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

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

Definition at line 7273 of file expressions.cc.

◆ MakeModulo() [2/2]

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

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

Definition at line 7284 of file expressions.cc.

◆ MakeMonotonicElement()

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

Function based element.

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

Definition at line 869 of file element.cc.

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

Definition at line 271 of file local_search.cc.

◆ MakeMoveTowardTargetOperator() [2/2]

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

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

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

Definition at line 287 of file local_search.cc.

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

Definition at line 2715 of file search.cc.

◆ MakeNBestValueSolutionCollector() [2/2]

SolutionCollector * MakeNBestValueSolutionCollector ( int  solution_count,
bool  maximize 
)

Definition at line 2724 of file search.cc.

◆ MakeNeighborhoodLimit()

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

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

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

Definition at line 1889 of file local_search.cc.

◆ MakeNestedOptimize() [1/6]

DecisionBuilder * MakeNestedOptimize ( DecisionBuilder *const  db,
Assignment *const  solution,
bool  maximize,
int64_t  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.

Definition at line 4624 of file search.cc.

◆ MakeNestedOptimize() [2/6]

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

Definition at line 4675 of file search.cc.

◆ MakeNestedOptimize() [3/6]

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

Definition at line 4630 of file search.cc.

◆ MakeNestedOptimize() [4/6]

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

Definition at line 4639 of file search.cc.

◆ MakeNestedOptimize() [5/6]

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

Definition at line 4650 of file search.cc.

◆ MakeNestedOptimize() [6/6]

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

Definition at line 4663 of file search.cc.

◆ MakeNoCycle() [1/2]

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

Definition at line 620 of file graph_constraints.cc.

◆ MakeNoCycle() [2/2]

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

Prevent cycles.

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

Definition at line 632 of file graph_constraints.cc.

◆ MakeNonEquality() [1/3]

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

expr != value

Definition at line 394 of file expr_cst.cc.

◆ MakeNonEquality() [2/3]

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

expr != value

Definition at line 379 of file expr_cst.cc.

◆ MakeNonEquality() [3/3]

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

left != right

Definition at line 564 of file range_cst.cc.

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

Definition at line 317 of file constraint_solver/diffn.cc.

◆ MakeNonOverlappingBoxesConstraint() [2/3]

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

Definition at line 305 of file constraint_solver/diffn.cc.

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

Definition at line 299 of file constraint_solver/diffn.cc.

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

Definition at line 347 of file constraint_solver/diffn.cc.

◆ MakeNonOverlappingNonStrictBoxesConstraint() [2/3]

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

Definition at line 335 of file constraint_solver/diffn.cc.

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

Definition at line 329 of file constraint_solver/diffn.cc.

◆ MakeNotBetweenCt()

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

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

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

Definition at line 956 of file expr_cst.cc.

◆ MakeNotMemberCt() [1/5]

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

Definition at line 1297 of file expr_cst.cc.

◆ MakeNotMemberCt() [2/5]

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

expr not in set.

Definition at line 1233 of file expr_cst.cc.

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

Definition at line 1583 of file expr_cst.cc.

◆ MakeNotMemberCt() [4/5]

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

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

Definition at line 1576 of file expr_cst.cc.

◆ MakeNotMemberCt() [5/5]

Constraint * MakeNotMemberCt ( IntExpr expr,
SortedDisjointIntervalList  intervals 
)

expr should not be in the list of forbidden intervals.

Definition at line 1590 of file expr_cst.cc.

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

Definition at line 735 of file alldiff_cst.cc.

◆ MakeNullIntersectExcept()

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

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

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

Definition at line 740 of file alldiff_cst.cc.

◆ MakeOperator() [1/4]

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

Definition at line 2438 of file local_search.cc.

◆ MakeOperator() [2/4]

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

Definition at line 2324 of file local_search.cc.

◆ MakeOperator() [3/4]

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

Definition at line 2432 of file local_search.cc.

◆ MakeOperator() [4/4]

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

Local Search Operators.

Definition at line 2319 of file local_search.cc.

◆ MakeOpposite()

IntExpr * MakeOpposite ( IntExpr *const  expr)

-expr

Definition at line 6761 of file expressions.cc.

◆ MakeOptimize()

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

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

Definition at line 2922 of file search.cc.

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

Definition at line 1612 of file pack.cc.

◆ MakePathConnected()

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

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

Check whether more propagation is needed.

Definition at line 1438 of file graph_constraints.cc.

◆ 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,
Solver::IndexEvaluator2  transit_evaluator 
)

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

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

Definition at line 1318 of file graph_constraints.cc.

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

Definition at line 1300 of file graph_constraints.cc.

◆ MakePathCumul() [3/3]

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

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

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

Definition at line 1309 of file graph_constraints.cc.

◆ MakePathPrecedenceConstraint() [1/2]

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

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

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

Definition at line 1623 of file graph_constraints.cc.

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

Definition at line 1629 of file graph_constraints.cc.

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

Definition at line 1646 of file graph_constraints.cc.

◆ MakePhase() [1/15]

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

Scheduling phases.

Definition at line 853 of file sched_search.cc.

◆ MakePhase() [2/15]

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

Definition at line 2131 of file search.cc.

◆ MakePhase() [3/15]

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

Definition at line 2169 of file search.cc.

◆ MakePhase() [4/15]

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

Definition at line 2080 of file search.cc.

◆ MakePhase() [5/15]

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

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

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

Definition at line 2191 of file search.cc.

◆ MakePhase() [6/15]

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

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

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

Definition at line 2197 of file search.cc.

◆ MakePhase() [7/15]

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

Definition at line 2098 of file search.cc.

◆ MakePhase() [8/15]

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

Definition at line 2152 of file search.cc.

◆ MakePhase() [9/15]

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

Phases on IntVar arrays.

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

Definition at line 2068 of file search.cc.

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

Definition at line 2115 of file search.cc.

◆ MakePhase() [11/15]

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

Definition at line 878 of file sched_search.cc.

◆ MakePhase() [12/15]

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

Definition at line 2046 of file search.cc.

◆ MakePhase() [13/15]

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

Definition at line 2035 of file search.cc.

◆ MakePhase() [14/15]

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

Definition at line 2026 of file search.cc.

◆ MakePhase() [15/15]

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

Shortcuts for small arrays.

Definition at line 2018 of file search.cc.

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

Definition at line 7242 of file expressions.cc.

◆ MakePower()

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

expr ^ n (n > 0)

Definition at line 7056 of file expressions.cc.

◆ MakePrintModelVisitor()

ModelVisitor * MakePrintModelVisitor ( )

Prints the model.

Definition at line 813 of file utilities.cc.

◆ MakeProd() [1/2]

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

expr * value

Definition at line 6779 of file expressions.cc.

◆ MakeProd() [2/2]

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

left * right

Definition at line 6869 of file expressions.cc.

◆ MakeProfiledDecisionBuilderWrapper()

DecisionBuilder * MakeProfiledDecisionBuilderWrapper ( DecisionBuilder db)

Activates profiling on a decision builder.

Definition at line 3908 of file local_search.cc.

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

Definition at line 193 of file local_search.cc.

◆ MakeRandomLnsOperator() [2/2]

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

Definition at line 198 of file local_search.cc.

◆ MakeRankFirstInterval()

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

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

Definition at line 867 of file sched_search.cc.

◆ MakeRankLastInterval()

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

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

Definition at line 873 of file sched_search.cc.

◆ MakeRejectFilter()

LocalSearchFilter * MakeRejectFilter ( )

Definition at line 2564 of file local_search.cc.

◆ MakeRestoreAssignment()

DecisionBuilder * MakeRestoreAssignment ( Assignment assignment)

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

Definition at line 1086 of file constraint_solver/assignment.cc.

◆ MakeScalProd() [1/2]

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

scalar product

Definition at line 3570 of file expr_array.cc.

◆ MakeScalProd() [2/2]

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

scalar product

Definition at line 3564 of file expr_array.cc.

◆ MakeScalProdEquality() [1/4]

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

Definition at line 3513 of file expr_array.cc.

◆ MakeScalProdEquality() [2/4]

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

Definition at line 3527 of file expr_array.cc.

◆ MakeScalProdEquality() [3/4]

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

Definition at line 3506 of file expr_array.cc.

◆ MakeScalProdEquality() [4/4]

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

Definition at line 3520 of file expr_array.cc.

◆ MakeScalProdGreaterOrEqual() [1/2]

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

Definition at line 3542 of file expr_array.cc.

◆ MakeScalProdGreaterOrEqual() [2/2]

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

Definition at line 3535 of file expr_array.cc.

◆ MakeScalProdLessOrEqual() [1/2]

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

Definition at line 3556 of file expr_array.cc.

◆ MakeScalProdLessOrEqual() [2/2]

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

Definition at line 3549 of file expr_array.cc.

◆ MakeScheduleOrExpedite()

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

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

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

Definition at line 846 of file sched_search.cc.

◆ MakeScheduleOrPostpone()

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

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

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

Definition at line 839 of file sched_search.cc.

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

Definition at line 288 of file search.cc.

◆ MakeSearchLog() [2/7]

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

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

Definition at line 292 of file search.cc.

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

Definition at line 302 of file search.cc.

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

Definition at line 310 of file search.cc.

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

Definition at line 315 of file search.cc.

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

Definition at line 296 of file search.cc.

◆ MakeSearchLog() [7/7]

SearchMonitor * MakeSearchLog ( SearchLogParameters  parameters)

Definition at line 323 of file search.cc.

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

Definition at line 398 of file search.cc.

◆ MakeSemiContinuousExpr()

IntExpr * MakeSemiContinuousExpr ( IntExpr *const  expr,
int64_t  fixed_charge,
int64_t  step 
)

Semi continuous Expression (x <= 0 -> f(x) = 0; x > 0 -> f(x) = ax + b) a >= 0 and b >= 0.

Definition at line 7169 of file expressions.cc.

◆ MakeSimulatedAnnealing()

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

Creates a Simulated Annealing monitor.

Definition at line 3425 of file search.cc.

◆ MakeSolutionsLimit()

RegularLimit * MakeSolutionsLimit ( int64_t  solutions)

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

Definition at line 4194 of file search.cc.

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

Definition at line 4505 of file search.cc.

◆ MakeSolveOnce() [2/6]

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

Definition at line 4549 of file search.cc.

◆ MakeSolveOnce() [3/6]

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

Definition at line 4509 of file search.cc.

◆ MakeSolveOnce() [4/6]

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

Definition at line 4516 of file search.cc.

◆ MakeSolveOnce() [5/6]

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

Definition at line 4525 of file search.cc.

◆ MakeSolveOnce() [6/6]

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

Definition at line 4536 of file search.cc.

◆ 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

Definition at line 716 of file alldiff_cst.cc.

◆ MakeSplitVariableDomain()

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

Definition at line 1687 of file search.cc.

◆ MakeSquare()

IntExpr * MakeSquare ( IntExpr *const  expr)

expr * expr

Definition at line 7038 of file expressions.cc.

◆ MakeStatisticsModelVisitor()

ModelVisitor * MakeStatisticsModelVisitor ( )

Displays some nice statistics on the model.

Definition at line 817 of file utilities.cc.

◆ MakeStoreAssignment()

DecisionBuilder * MakeStoreAssignment ( Assignment assignment)

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

Definition at line 1090 of file constraint_solver/assignment.cc.

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

Definition at line 2590 of file resource.cc.

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

Definition at line 643 of file graph_constraints.cc.

◆ MakeSum() [1/3]

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

sum of all vars.

Definition at line 3252 of file expr_array.cc.

◆ MakeSum() [2/3]

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

expr + value.

Definition at line 6596 of file expressions.cc.

◆ MakeSum() [3/3]

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

left + right.

Definition at line 6564 of file expressions.cc.

◆ MakeSumEquality() [1/2]

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

Definition at line 3451 of file expr_array.cc.

◆ MakeSumEquality() [2/2]

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

Definition at line 3481 of file expr_array.cc.

◆ MakeSumGreaterOrEqual()

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

Definition at line 3441 of file expr_array.cc.

◆ MakeSumLessOrEqual()

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

Variation on arrays.

Definition at line 3431 of file expr_array.cc.

◆ MakeSumObjectiveFilter() [1/2]

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

Definition at line 3593 of file local_search.cc.

◆ MakeSumObjectiveFilter() [2/2]

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

Definition at line 3586 of file local_search.cc.

◆ MakeSymmetryManager() [1/5]

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

Symmetry Breaking.

Definition at line 4907 of file search.cc.

◆ MakeSymmetryManager() [2/5]

SearchMonitor * MakeSymmetryManager ( SymmetryBreaker *const  v1)

Definition at line 4912 of file search.cc.

◆ MakeSymmetryManager() [3/5]

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

Definition at line 4918 of file search.cc.

◆ MakeSymmetryManager() [4/5]

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

Definition at line 4926 of file search.cc.

◆ MakeSymmetryManager() [5/5]

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

Definition at line 4936 of file search.cc.

◆ MakeTabuSearch()

SearchMonitor * MakeTabuSearch ( bool  maximize,
IntVar *const  v,
int64_t  step,
const std::vector< IntVar * > &  vars,
int64_t  keep_tenure,
int64_t  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.

Definition at line 3310 of file search.cc.

◆ MakeTemporalDisjunction() [1/2]

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

This constraint implements a temporal disjunction between two interval vars.

Definition at line 410 of file timetabling.cc.

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

Definition at line 404 of file timetabling.cc.

◆ MakeTimeLimit() [1/2]

RegularLimit * MakeTimeLimit ( absl::Duration  time)

Creates a search limit that constrains the running time.

Definition at line 4173 of file search.cc.

◆ MakeTimeLimit() [2/2]

ABSL_MUST_USE_RESULT RegularLimit * MakeTimeLimit ( int64_t  time_in_ms)
inline

Definition at line 2209 of file constraint_solver.h.

◆ MakeTransitionConstraint() [1/2]

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

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

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

Definition at line 1281 of file constraint_solver/table.cc.

◆ MakeTransitionConstraint() [2/2]

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

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

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

Definition at line 1274 of file constraint_solver/table.cc.

◆ MakeTrueConstraint()

Constraint * MakeTrueConstraint ( )

This constraint always succeeds.

Definition at line 518 of file constraints.cc.

◆ MakeVariableDegreeVisitor()

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

Compute the number of constraints a variable is attached to.

Definition at line 821 of file utilities.cc.

◆ MakeVariableDomainFilter()

LocalSearchFilter * MakeVariableDomainFilter ( )

Definition at line 3294 of file local_search.cc.

◆ MakeVariableGreaterOrEqualValue()

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

Definition at line 1697 of file search.cc.

◆ MakeVariableLessOrEqualValue()

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

Definition at line 1692 of file search.cc.

◆ MakeWeightedMaximize() [1/2]

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

Creates a maximization weigthed objective.

Definition at line 2996 of file search.cc.

◆ MakeWeightedMaximize() [2/2]

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

Creates a maximization weigthed objective.

Definition at line 2976 of file search.cc.

◆ MakeWeightedMinimize() [1/2]

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

Creates a minimization weighted objective.

The actual objective is scalar_prod(sub_objectives, weights).

Definition at line 2990 of file search.cc.

◆ MakeWeightedMinimize() [2/2]

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

Creates a minimization weighted objective.

The actual objective is scalar_prod(sub_objectives, weights).

Definition at line 2969 of file search.cc.

◆ MakeWeightedOptimize() [1/2]

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

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

Definition at line 2983 of file search.cc.

◆ MakeWeightedOptimize() [2/2]

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

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

Definition at line 2962 of file search.cc.

◆ MemoryUsage()

int64_t MemoryUsage ( )
static

Current memory usage in bytes.

Definition at line 1522 of file constraint_solver.cc.

◆ model_name()

std::string model_name ( ) const

Returns the name of the model.

Definition at line 1401 of file constraint_solver.cc.

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

Definition at line 2276 of file local_search.cc.

◆ NameAllVariables()

bool NameAllVariables ( ) const

Returns whether all variables should be named.

Definition at line 191 of file constraint_solver.cc.

◆ neighbors()

int64_t neighbors ( ) const
inline

The number of neighbors created.

Definition at line 997 of file constraint_solver.h.

◆ NewSearch() [1/6]

void NewSearch ( DecisionBuilder *const  db)

Definition at line 1813 of file constraint_solver.cc.

◆ 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();

Definition at line 1849 of file constraint_solver.cc.

◆ NewSearch() [3/6]

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

Definition at line 1807 of file constraint_solver.cc.

◆ NewSearch() [4/6]

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

Definition at line 1818 of file constraint_solver.cc.

◆ NewSearch() [5/6]

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

Definition at line 1826 of file constraint_solver.cc.

◆ NewSearch() [6/6]

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

Definition at line 1835 of file constraint_solver.cc.

◆ NextSolution()

bool NextSolution ( )

Definition at line 2099 of file constraint_solver.cc.

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

Definition at line 1528 of file constraint_solver.cc.

◆ optimization_direction()

OptimizationDirection optimization_direction ( ) const
inline

The direction of optimization, getter and setter.

Definition at line 1013 of file constraint_solver.h.

◆ parameters()

ConstraintSolverParameters parameters ( ) const
inline

Stored Parameters.

Definition at line 763 of file constraint_solver.h.

◆ PopState()

void PopState ( )

Definition at line 1567 of file constraint_solver.cc.

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

Definition at line 1562 of file constraint_solver.cc.

◆ Rand32()

int32_t Rand32 ( int32_t  size)
inline

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

Definition at line 2847 of file constraint_solver.h.

◆ Rand64()

int64_t Rand64 ( int64_t  size)
inline

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

Definition at line 2841 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().

Definition at line 2112 of file local_search.cc.

◆ RandomConcatenateOperators() [2/2]

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

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

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

Definition at line 2117 of file local_search.cc.

◆ RegisterDemon()

Demon * RegisterDemon ( Demon *const  demon)

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

Definition at line 453 of file demon_profiler.cc.

◆ RegisterIntervalVar()

IntervalVar * RegisterIntervalVar ( IntervalVar *const  var)

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

Definition at line 870 of file trace.cc.

◆ RegisterIntExpr()

IntExpr * RegisterIntExpr ( IntExpr *const  expr)

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

Definition at line 849 of file trace.cc.

◆ RegisterIntVar()

IntVar * RegisterIntVar ( IntVar *const  var)

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

Definition at line 861 of file trace.cc.

◆ ReSeed()

void ReSeed ( int32_t  seed)
inline

Reseed the solver random generator.

Definition at line 2853 of file constraint_solver.h.

◆ RestartCurrentSearch()

void RestartCurrentSearch ( )

Definition at line 2437 of file constraint_solver.cc.

◆ RestartSearch()

void RestartSearch ( )

Definition at line 1991 of file constraint_solver.cc.

◆ 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 791 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_t, uint64_t, bool, BaseObject*, IntVar*, IntExpr*, and Constraint*.

Definition at line 802 of file constraint_solver.h.

◆ SaveAndAdd()

void SaveAndAdd ( T *  adr,
val 
)
inline

All-in-one SaveAndAdd_value.

Definition at line 2833 of file constraint_solver.h.

◆ SaveAndSetValue()

void SaveAndSetValue ( T *  adr,
val 
)
inline

All-in-one SaveAndSetValue.

Definition at line 2824 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 774 of file constraint_solver.h.

◆ SearchContext() [1/2]

std::string SearchContext ( ) const

Definition at line 3232 of file constraint_solver.cc.

◆ SearchContext() [2/2]

std::string SearchContext ( const Search search) const

Definition at line 3236 of file constraint_solver.cc.

◆ SearchDepth()

int SearchDepth ( ) const

Gets the search depth of the current active search.

Returns -1 if there is no active search opened.

Definition at line 1179 of file constraint_solver.cc.

◆ SearchLeftDepth()

int SearchLeftDepth ( ) const

Gets the search left depth of the current active search.

Returns -1 if there is no active search opened.

Definition at line 1181 of file constraint_solver.cc.

◆ set_fail_intercept()

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

Internal.

Definition at line 2887 of file constraint_solver.h.

◆ set_optimization_direction()

void set_optimization_direction ( OptimizationDirection  direction)
inline

Definition at line 1016 of file constraint_solver.h.

◆ SetBranchSelector()

void SetBranchSelector ( BranchSelector  bs)

Sets the given branch selector on the current active search.

Definition at line 1156 of file constraint_solver.cc.

◆ SetSearchContext()

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

Definition at line 3227 of file constraint_solver.cc.

◆ SetUseFastLocalSearch()

void SetUseFastLocalSearch ( bool  use_fast_local_search)
inline

enabled for metaheuristics.

Disables/enables fast local search.

Definition at line 2897 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 2999 of file constraint_solver.h.

◆ solutions()

int64_t solutions ( ) const

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

Definition at line 1532 of file constraint_solver.cc.

◆ Solve() [1/6]

bool Solve ( DecisionBuilder *const  db)

Definition at line 1764 of file constraint_solver.cc.

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

Definition at line 1797 of file constraint_solver.cc.

◆ Solve() [3/6]

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

Definition at line 1758 of file constraint_solver.cc.

◆ Solve() [4/6]

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

Definition at line 1769 of file constraint_solver.cc.

◆ Solve() [5/6]

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

Definition at line 1777 of file constraint_solver.cc.

◆ Solve() [6/6]

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

Definition at line 1786 of file constraint_solver.cc.

◆ SolveAndCommit() [1/5]

bool SolveAndCommit ( DecisionBuilder *const  db)

Definition at line 2389 of file constraint_solver.cc.

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

Definition at line 2411 of file constraint_solver.cc.

◆ SolveAndCommit() [3/5]

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

Definition at line 2382 of file constraint_solver.cc.

◆ SolveAndCommit() [4/5]

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

Definition at line 2394 of file constraint_solver.cc.

◆ SolveAndCommit() [5/5]

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

Definition at line 2402 of file constraint_solver.cc.

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

Definition at line 1175 of file constraint_solver.cc.

◆ stamp()

uint64_t stamp ( ) const

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

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

Definition at line 1649 of file constraint_solver.cc.

◆ state()

SolverState state ( ) const
inline

State of the solver.

Definition at line 952 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.

Definition at line 1548 of file constraint_solver.cc.

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

Definition at line 1550 of file constraint_solver.cc.

◆ Try() [1/4]

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

Definition at line 734 of file search.cc.

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

Definition at line 704 of file search.cc.

◆ Try() [3/4]

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

Definition at line 712 of file search.cc.

◆ Try() [4/4]

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

Definition at line 722 of file search.cc.

◆ unchecked_solutions()

int64_t unchecked_solutions ( ) const

The number of unchecked solutions found by local search.

Definition at line 1536 of file constraint_solver.cc.

◆ UseFastLocalSearch()

bool UseFastLocalSearch ( ) const
inline

Returns true if fast local search is enabled.

Definition at line 2901 of file constraint_solver.h.

◆ wall_time()

int64_t wall_time ( ) const

DEPRECATED: Use Now() instead.

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

Definition at line 1524 of file constraint_solver.cc.

Member Data Documentation

◆ kNumPriorities

constexpr int kNumPriorities = 3
staticconstexpr

Number of priorities for demons.

Definition at line 262 of file constraint_solver.h.

◆ tmp_vector_

std::vector<int64_t> 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 2953 of file constraint_solver.h.


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