Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ constraint_solver/

operations_research::Solver Class Reference

Solver Class. More...

#include <constraint_solver.h>

List of all members.

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_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
}
 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 }
 Used for scheduling. Not yet implemented. More...
enum  LocalSearchOperators {
  TWOOPT, OROPT, RELOCATE, EXCHANGE,
  CROSS, MAKEACTIVE, MAKEINACTIVE, SWAPACTIVE,
  EXTENDEDSWAPACTIVE, PATHLNS, 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  LocalSearchOperation { SUM, PROD, MAX, MIN }
 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...
typedef ResultCallback1< int64,
int64 > 
IndexEvaluator1
 Callback typedefs.
typedef ResultCallback2< int64,
int64, int64 > 
IndexEvaluator2
typedef ResultCallback3< int64,
int64, int64, int64 > 
IndexEvaluator3
typedef ResultCallback2
< IntExpr *, CPModelLoader
*, const
CPIntegerExpressionProto & > 
IntegerExpressionBuilder
typedef ResultCallback2
< Constraint *, CPModelLoader
*, const CPConstraintProto & > 
ConstraintBuilder
typedef ResultCallback2
< IntervalVar *, CPModelLoader
*, const
CPIntervalVariableProto & > 
IntervalVariableBuilder
typedef ResultCallback2
< SequenceVar *, CPModelLoader
*, const
CPSequenceVariableProto & > 
SequenceVariableBuilder

Public Member Functions

 Solver (const string &modelname)
 Solver (const string &modelname, const SolverParameters &parameters)
 ~Solver ()
const SolverParametersparameters () const
 Read-only Parameters.
template<class T>
void SaveValue (T *o)
 reversibility
template<typename T>
T * RevAlloc (T *object)
 Registers the given object as being reversible.
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.
void AddConstraint (Constraint *const c)
 propagation
void AddCastConstraint (CastConstraint *const c, IntVar *const target_var, IntExpr *const casted_expression)
 Adds the constraint 'c' to the solver and marks it as a cast constraint, that is, a constraint created calling Var() on an expression.
bool NestedSolve (DecisionBuilder *const db, bool restore, const std::vector< SearchMonitor * > &monitors)
 Nested solve using a decision builder and up to three search monitors, usually one for the objective, one for the limits and one to collect solutions.
bool NestedSolve (DecisionBuilder *const db, bool restore, SearchMonitor *const *monitors, int size)
bool NestedSolve (DecisionBuilder *const db, bool restore)
bool NestedSolve (DecisionBuilder *const db, bool restore, SearchMonitor *const m1)
bool NestedSolve (DecisionBuilder *const db, bool restore, SearchMonitor *const m1, SearchMonitor *const m2)
bool NestedSolve (DecisionBuilder *const db, bool restore, SearchMonitor *const m1, SearchMonitor *const m2, SearchMonitor *const m3)
bool CheckAssignment (Assignment *const assignment)
 Checks whether the given assignment satisfies all the relevant constraints.
bool CheckConstraint (Constraint *const constraint)
 Checks whether adding this constraint will lead to an immediate failure.
SolverState state () const
 State of the solver.
void Fail ()
 Abandon the current branch in the search tree. A backtrack will follow.
void ExportModel (CPModelProto *const proto) const
 Exports the model to protobuf.
void ExportModel (const std::vector< SearchMonitor * > &monitors, CPModelProto *const proto) const
 Exports the model to protobuf.
bool LoadModel (const CPModelProto &proto)
 Loads the model into the solver, and returns true upon success.
bool LoadModel (const CPModelProto &proto, std::vector< SearchMonitor * > *monitors)
 Loads the model into the solver, appends search monitors to monitors, and returns true upon success.
bool CollectDecisionVariables (std::vector< IntVar * > *const primary_integer_variables, std::vector< IntVar * > *const secondary_integer_variables, std::vector< SequenceVar * > *const sequence_variables, std::vector< IntervalVar * > *const interval_variables)
 Collects decision variables.
void RegisterBuilder (const string &tag, ConstraintBuilder *const builder)
 Registers a constraint builder. Ownership is passed to the solver.
void RegisterBuilder (const string &tag, IntegerExpressionBuilder *const builder)
 Registers an integer expression builder. Ownership is passed to the solver.
void RegisterBuilder (const string &tag, IntervalVariableBuilder *const builder)
 Registers an interval variable builder. Ownership is passed to the solver.
void RegisterBuilder (const string &tag, SequenceVariableBuilder *const builder)
 Registers a sequence variable builder. Ownership is passed to the solver.
ConstraintBuilderGetConstraintBuilder (const string &tag) const
IntegerExpressionBuilderGetIntegerExpressionBuilder (const string &tag) const
IntervalVariableBuilderGetIntervalVariableBuilder (const string &tag) const
SequenceVariableBuilderGetSequenceVariableBuilder (const string &tag) const
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.
string DebugString () const
 misc debug string.
int64 wall_time () const
 wall_time() in ms since the creation of the solver.
int64 branches () const
 number of branches explored since the creation of the solver.
int64 solutions () const
 number of solutions found since the start of the search.
int64 demon_runs (DemonPriority p) const
 number of demons executed during search for a given priority.
int64 failures () const
 number of failures encountered since the creation of the solver.
int64 neighbors () const
 number of neighbors created
int64 filtered_neighbors () const
 number of filtered neighbors (neighbors accepted by filters)
int64 accepted_neighbors () const
 number of accepted neighbors
uint64 stamp () const
 The stamp indicates how many moves in the search tree we have performed.
uint64 fail_stamp () const
 The fail_stamp() is incremented after each backtrack.
IntVarMakeIntVar (int64 vmin, int64 vmax, const string &name)
 Make Factory.
IntVarMakeIntVar (const std::vector< int64 > &values, const string &name)
 MakeIntVar will create a variable with the given sparse domain.
IntVarMakeIntVar (const std::vector< int > &values, const string &name)
 MakeIntVar will create a variable with the given sparse domain.
IntVarMakeIntVar (int64 vmin, int64 vmax)
 MakeIntVar will create the best range based int var for the bounds given.
IntVarMakeIntVar (const std::vector< int64 > &values)
 MakeIntVar will create a variable with the given sparse domain.
IntVarMakeIntVar (const std::vector< int > &values)
 MakeIntVar will create a variable with the given sparse domain.
IntVarMakeBoolVar (const string &name)
 MakeBoolVar will create a variable with a {0, 1} domain.
IntVarMakeBoolVar ()
 MakeBoolVar will create a variable with a {0, 1} domain.
IntVarMakeIntConst (int64 val, const string &name)
 IntConst will create a constant expression.
IntVarMakeIntConst (int64 val)
 IntConst will create a constant expression.
void MakeIntVarArray (int var_count, int64 vmin, int64 vmax, const 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.
void MakeIntVarArray (int var_count, int64 vmin, int64 vmax, std::vector< IntVar * > *vars)
 This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having no names.
IntVar ** MakeIntVarArray (int var_count, int64 vmin, int64 vmax, const string &name)
 Same but allocates an array and returns it.
void MakeBoolVarArray (int var_count, const 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.
void MakeBoolVarArray (int var_count, std::vector< IntVar * > *vars)
 This method will append the vector vars with 'var_count' boolean variables having no names.
IntVar ** MakeBoolVarArray (int var_count, const string &name)
 Same but allocates an array and returns it.
IntExprMakeSum (IntExpr *const left, IntExpr *const right)
 Integer Expressions.
IntExprMakeSum (IntExpr *const expr, int64 value)
 expr + value.
IntExprMakeSum (IntVar *const *vars, int size)
 sum of all vars.
IntExprMakeSum (const std::vector< IntVar * > &vars)
 sum of all vars.
IntExprMakeScalProd (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefs)
 scalar product
IntExprMakeScalProd (IntVar *const *vars, const int64 *const coefs, int size)
 scalar product
IntExprMakeScalProd (const std::vector< IntVar * > &vars, const std::vector< int > &coefs)
 scalar product
IntExprMakeScalProd (IntVar *const *vars, const int *const coefs, int size)
 scalar product
IntExprMakeDifference (IntExpr *const left, IntExpr *const right)
 left - right
IntExprMakeDifference (int64 value, IntExpr *const expr)
 value - expr
IntExprMakeOpposite (IntExpr *const expr)
 -expr
IntExprMakeProd (IntExpr *const left, IntExpr *const right)
 left * right
IntExprMakeProd (IntExpr *const expr, int64 value)
 expr * value
IntExprMakeDiv (IntExpr *const expr, int64 value)
 expr / value (integer division)
IntExprMakeDiv (IntExpr *const numerator, IntExpr *const denominator)
 numerator / denominator (integer division). Terms need to be positive.
IntExprMakeAbs (IntExpr *const expr)
 |expr|
IntExprMakeSquare (IntExpr *const expr)
 expr * expr
IntExprMakeElement (const int64 *const vals, int size, IntVar *const index)
 vals[expr]
IntExprMakeElement (const std::vector< int64 > &vals, IntVar *const index)
 vals[expr]
IntExprMakeElement (const int *const vals, int size, IntVar *const index)
 vals[expr]
IntExprMakeElement (const std::vector< int > &vals, IntVar *const index)
 vals[expr]
IntExprMakeElement (IndexEvaluator1 *values, IntVar *const index)
 Function-based element.
IntExprMakeMonotonicElement (IndexEvaluator1 *values, bool increasing, IntVar *const index)
 Function based element.
IntExprMakeElement (IndexEvaluator2 *values, IntVar *const index1, IntVar *const index2)
 2D version of function-based element expression, values(expr1, expr2).
IntExprMakeElement (const IntVar *const *vars, int size, IntVar *const index)
 vars[expr]
IntExprMakeElement (const std::vector< IntVar * > &vars, IntVar *const index)
 vars[expr]
IntExprMakeMin (const std::vector< IntVar * > &vars)
 min(vars)
IntExprMakeMin (IntVar *const *vars, int size)
 min(vars)
IntExprMakeMin (IntExpr *const left, IntExpr *const right)
 min (left, right)
IntExprMakeMin (IntExpr *const expr, int64 val)
 min(expr, val)
IntExprMakeMin (IntExpr *const expr, int val)
 min(expr, val)
IntExprMakeMax (const std::vector< IntVar * > &vars)
 max(vars)
IntExprMakeMax (IntVar *const *vars, int size)
 max(vars)
IntExprMakeMax (IntExpr *const left, IntExpr *const right)
 max(left, right)
IntExprMakeMax (IntExpr *const expr, int64 val)
 max(expr, val)
IntExprMakeMax (IntExpr *const expr, int val)
 max(expr, val)
IntExprMakeConvexPiecewiseExpr (IntVar *e, int64 early_cost, int64 early_date, int64 late_date, int64 late_cost)
 convex piecewise function.
IntExprMakeSemiContinuousExpr (IntExpr *const e, int64 fixed_charge, int64 step)
 Semi continuous Expression (x <= 0 -> f(x) = 0; x > 0 -> f(x) = ax + b) a >= 0 and b >= 0.
ConstraintMakeTrueConstraint ()
 Constraints This constraint always succeeds.
ConstraintMakeFalseConstraint ()
 This constraint always fails.
ConstraintMakeFalseConstraint (const string &explanation)
ConstraintMakeIsEqualCstCt (IntVar *const v, int64 c, IntVar *const b)
 b == (v == c)
IntVarMakeIsEqualCstVar (IntVar *const var, int64 value)
 status var of (v == c)
ConstraintMakeIsEqualCt (IntExpr *const v1, IntExpr *v2, IntVar *const b)
 b == (v1 == v2)
IntVarMakeIsEqualVar (IntExpr *const var, IntExpr *v2)
 status var of (v1 == v2)
ConstraintMakeEquality (IntVar *const left, IntVar *const right)
 left == right
ConstraintMakeEquality (IntExpr *const expr, int64 value)
 expr == value
ConstraintMakeEquality (IntExpr *const expr, int value)
 expr == value
ConstraintMakeIsDifferentCstCt (IntVar *const v, int64 c, IntVar *const b)
 b == (v != c)
IntVarMakeIsDifferentCstVar (IntVar *const v, int64 c)
 status var of (v != c)
IntVarMakeIsDifferentVar (IntExpr *const v1, IntExpr *const v2)
 status var of (v1 != v2)
ConstraintMakeIsDifferentCt (IntExpr *const v1, IntExpr *const v2, IntVar *const b)
 b == (v1 != v2)
ConstraintMakeNonEquality (IntVar *const left, IntVar *const right)
 left != right
ConstraintMakeNonEquality (IntVar *const expr, int64 value)
 expr != value
ConstraintMakeNonEquality (IntVar *const expr, int value)
 expr != value
ConstraintMakeIsLessOrEqualCstCt (IntVar *const v, int64 c, IntVar *const b)
 b == (v <= c)
IntVarMakeIsLessOrEqualCstVar (IntVar *const v, int64 c)
 status var of (v <= c)
IntVarMakeIsLessOrEqualVar (IntExpr *const left, IntExpr *const right)
 status var of (left <= right)
ConstraintMakeIsLessOrEqualCt (IntExpr *const left, IntExpr *const right, IntVar *const b)
 b == (left <= right)
ConstraintMakeLessOrEqual (IntVar *const left, IntVar *const right)
 left <= right
ConstraintMakeLessOrEqual (IntExpr *const expr, int64 value)
 expr <= value
ConstraintMakeLessOrEqual (IntExpr *const expr, int value)
 expr <= value
ConstraintMakeIsGreaterOrEqualCstCt (IntVar *const v, int64 c, IntVar *const b)
 b == (v >= c)
IntVarMakeIsGreaterOrEqualCstVar (IntVar *const v, int64 c)
 status var of (v >= c)
IntVarMakeIsGreaterOrEqualVar (IntExpr *const left, IntExpr *const right)
 status var of (left >= right)
ConstraintMakeIsGreaterOrEqualCt (IntExpr *const left, IntExpr *const right, IntVar *const b)
 b == (left >= right)
ConstraintMakeGreaterOrEqual (IntVar *const left, IntVar *const right)
 left >= right
ConstraintMakeGreaterOrEqual (IntExpr *const expr, int64 value)
 expr >= value
ConstraintMakeGreaterOrEqual (IntExpr *const expr, int value)
 expr >= value
ConstraintMakeIsGreaterCstCt (IntVar *const v, int64 c, IntVar *const b)
 b == (v > c)
IntVarMakeIsGreaterCstVar (IntVar *const v, int64 c)
 status var of (v > c)
IntVarMakeIsGreaterVar (IntExpr *const left, IntExpr *const right)
 status var of (left > right)
ConstraintMakeIsGreaterCt (IntExpr *const left, IntExpr *const right, IntVar *const b)
 b == (left > right)
ConstraintMakeGreater (IntVar *const left, IntVar *const right)
 left > right
ConstraintMakeGreater (IntExpr *const expr, int64 value)
 expr > value
ConstraintMakeGreater (IntExpr *const expr, int value)
 expr > value
ConstraintMakeIsLessCstCt (IntVar *const v, int64 c, IntVar *const b)
 b == (v < c)
IntVarMakeIsLessCstVar (IntVar *const v, int64 c)
 status var of (v < c)
IntVarMakeIsLessVar (IntExpr *const left, IntExpr *const right)
 status var of (left < right)
ConstraintMakeIsLessCt (IntExpr *const left, IntExpr *const right, IntVar *const b)
 b == (left < right)
ConstraintMakeLess (IntVar *const left, IntVar *const right)
 left < right
ConstraintMakeLess (IntExpr *const expr, int64 value)
 expr < value
ConstraintMakeLess (IntExpr *const expr, int value)
 expr < value
ConstraintMakeSumLessOrEqual (const std::vector< IntVar * > &vars, int64 cst)
 Variation on arrays.
ConstraintMakeSumLessOrEqual (IntVar *const *vars, int size, int64 cst)
ConstraintMakeSumGreaterOrEqual (const std::vector< IntVar * > &vars, int64 cst)
ConstraintMakeSumGreaterOrEqual (IntVar *const *vars, int size, int64 cst)
ConstraintMakeSumEquality (const std::vector< IntVar * > &vars, int64 cst)
ConstraintMakeSumEquality (IntVar *const *vars, int size, int64 cst)
ConstraintMakeSumEquality (const std::vector< IntVar * > &vars, IntVar *const var)
ConstraintMakeSumEquality (IntVar *const *vars, int size, IntVar *const var)
ConstraintMakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefficients, int64 cst)
ConstraintMakeScalProdEquality (IntVar *const *vars, int size, int64 const *coefficients, int64 cst)
 namespace
ConstraintMakeScalProdEquality (IntVar *const *vars, int size, int const *coefficients, int64 cst)
ConstraintMakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64 cst)
ConstraintMakeScalProdGreaterOrEqual (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefficients, int64 cst)
ConstraintMakeScalProdGreaterOrEqual (IntVar *const *vars, int size, int64 const *coefficients, int64 cst)
 namespace
ConstraintMakeScalProdGreaterOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64 cst)
ConstraintMakeScalProdGreaterOrEqual (IntVar *const *vars, int size, int const *coefficients, int64 cst)
ConstraintMakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int64 > &coefficients, int64 cst)
ConstraintMakeScalProdLessOrEqual (IntVar *const *vars, int size, int64 const *coefficients, int64 cst)
 namespace
ConstraintMakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64 cst)
ConstraintMakeScalProdLessOrEqual (IntVar *const *vars, int size, int const *coefficients, int64 cst)
DemonMakeConstraintInitialPropagateCallback (Constraint *const ct)
 This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct'.
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.
DemonMakeCallbackDemon (Callback1< Solver * > *const callback)
 Creates a demon from a callback.
DemonMakeCallbackDemon (Closure *const closure)
 Creates a demon from a closure.
ConstraintMakeBetweenCt (IntVar *const v, int64 l, int64 u)
 (l <= b <= u)
ConstraintMakeIsBetweenCt (IntVar *const v, int64 l, int64 u, IntVar *const b)
 b == (l <= v <= u)
ConstraintMakeIsMemberCt (IntVar *const v, const int64 *const values, int size, IntVar *const b)
 b == (v in set)
ConstraintMakeIsMemberCt (IntVar *const v, const std::vector< int64 > &values, IntVar *const b)
ConstraintMakeIsMemberCt (IntVar *const v, const int *const values, int size, IntVar *const b)
ConstraintMakeIsMemberCt (IntVar *const v, const std::vector< int > &values, IntVar *const b)
IntVarMakeIsMemberVar (IntVar *const v, const int64 *const values, int size)
IntVarMakeIsMemberVar (IntVar *const v, const std::vector< int64 > &values)
IntVarMakeIsMemberVar (IntVar *const v, const int *const values, int size)
IntVarMakeIsMemberVar (IntVar *const v, const std::vector< int > &values)
ConstraintMakeMemberCt (IntVar *const v, const int64 *const values, int size)
 v in set.
ConstraintMakeMemberCt (IntVar *const v, const std::vector< int64 > &values)
ConstraintMakeMemberCt (IntVar *const v, const int *const values, int size)
ConstraintMakeMemberCt (IntVar *const v, const std::vector< int > &values)
ConstraintMakeCount (const std::vector< IntVar * > &v, int64 value, int64 count)
 |{i | v[i] == value}| == count
ConstraintMakeCount (const std::vector< IntVar * > &v, int64 value, IntVar *const count)
 |{i | v[i] == value}| == count
ConstraintMakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int64 > &values, const std::vector< IntVar * > &cards)
 Aggregated version of count: |{i | v[i] == values[j]}| == cards[j].
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].
ConstraintMakeDistribute (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &cards)
 Aggregated version of count: |{i | v[i] == j}| == cards[j].
ConstraintMakeDistribute (const std::vector< IntVar * > &vars, int64 card_min, int64 card_max, int64 card_size)
 Aggregated version of count with bounded cardinalities: forall j in 0 .
ConstraintMakeDeviation (const std::vector< IntVar * > &vars, IntVar *const deviation_var, int64 total_sum)
 Deviation constraint: sum_i |n * vars[i] - total_sum| <= deviation_var and sum_i vars[i] == total_sum n = vars.
ConstraintMakeAllDifferent (const std::vector< IntVar * > &vars)
 All variables are pairwise different.
ConstraintMakeAllDifferent (const std::vector< IntVar * > &vars, bool stronger_propagation)
 All variables are pairwise different.
ConstraintMakeAllDifferent (const IntVar *const *vars, int size, bool stronger_propagation)
 All variables are pairwise different.
ConstraintMakeNoCycle (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, ResultCallback1< bool, int64 > *sink_handler=NULL)
 Prevent cycles, nexts variables representing the next in the chain.
ConstraintMakeNoCycle (const IntVar *const *nexts, const IntVar *const *active, int size, ResultCallback1< bool, int64 > *sink_handler=NULL)
ConstraintMakeNoCycle (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, ResultCallback1< bool, int64 > *sink_handler, bool assume_paths)
 namespace
ConstraintMakeNoCycle (const IntVar *const *nexts, const IntVar *const *active, int size, ResultCallback1< bool, int64 > *sink_handler, bool assume_paths)
ConstraintMakePathCumul (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, const std::vector< IntVar * > &cumuls, const std::vector< IntVar * > &transits)
 Accumulate values along a path such that: cumuls[next[i]] = cumuls[i] + transits[i].
ConstraintMakePathCumul (const IntVar *const *nexts, const IntVar *const *active, const IntVar *const *cumuls, const IntVar *const *transits, int next_size, int cumul_size)
ConstraintMakeMapDomain (IntVar *const var, IntVar *const *vars, int size)
 This constraint maps the domain of 'var' onto the array of variables 'vars'.
ConstraintMakeMapDomain (IntVar *const var, const std::vector< IntVar * > &vars)
 This constraint maps the domain of 'var' onto the array of variables 'vars'.
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.
ConstraintMakeTransitionConstraint (const std::vector< IntVar * > &vars, const IntTupleSet &transitions, int64 initial_state, const std::vector< int64 > &final_states)
 This constraint create a finite automaton that will check the sequence of variables vars.
ConstraintMakeTransitionConstraint (const std::vector< IntVar * > &vars, const IntTupleSet &transitions, int64 initial_state, const std::vector< int > &final_states)
 This constraint create a finite automaton that will check the sequence of variables vars.
PackMakePack (const std::vector< IntVar * > &vars, int number_of_bins)
 Packing constraint.
IntervalVarMakeFixedDurationIntervalVar (int64 start_min, int64 start_max, int64 duration, bool optional, const string &name)
 scheduling objects
void MakeFixedDurationIntervalVarArray (int count, int64 start_min, int64 start_max, int64 duration, bool optional, const string &name, std::vector< IntervalVar * > *array)
 This method fills the vector with 'count' interval var built with the corresponding parameters.
IntervalVarMakeFixedInterval (int64 start, int64 duration, const string &name)
 Creates an fixed and performed interval.
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.
IntervalVarMakeIntervalRelaxedMin (IntervalVar *const interval_var)
 Creates and returns an interval variable that wraps around the given one, relaxing the min start and end.
IntervalVarMakeIntervalRelaxedMax (IntervalVar *const interval_var)
 Creates and returns an interval variable that wraps around the given one, relaxing the max start and end.
ConstraintMakeIntervalVarRelation (IntervalVar *const t, UnaryIntervalRelation r, int64 d)
 scheduling constraints
ConstraintMakeIntervalVarRelation (IntervalVar *const t1, BinaryIntervalRelation r, IntervalVar *const t2)
 This method creates a relation between two an interval vars.
ConstraintMakeTemporalDisjunction (IntervalVar *const t1, IntervalVar *const t2, IntVar *const alt)
 This constraint implements a temporal disjunction between two interval vars t1 and t2.
ConstraintMakeTemporalDisjunction (IntervalVar *const t1, IntervalVar *const t2)
 This constraint implements a temporal disjunction between two interval vars.
ConstraintMakeDisjunctiveConstraint (const std::vector< IntervalVar * > &intervals)
 This constraint forces all interval vars into an non overlapping sequence.
SequenceVarMakeSequenceVar (const std::vector< IntervalVar * > &intervals, const string &name)
 The sequence variable is used to rank disjoint intervals.
ConstraintMakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int64 > &demands, int64 capacity, const 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.
ConstraintMakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int > &demands, int64 capacity, const 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.
AssignmentMakeAssignment ()
 Assignments.
AssignmentMakeAssignment (const Assignment *const a)
 This method creates an assignnment which is a copy of 'a'.
SolutionCollectorMakeFirstSolutionCollector (const Assignment *const assignment)
 Solution Collectors.
SolutionCollectorMakeFirstSolutionCollector ()
 Collect the first solution of the search.
SolutionCollectorMakeLastSolutionCollector (const Assignment *const assignment)
 Collect the last solution of the search.
SolutionCollectorMakeLastSolutionCollector ()
 Collect the last solution of the search.
SolutionCollectorMakeBestValueSolutionCollector (const Assignment *const assignment, bool maximize)
 Collect the solution corresponding to the optimal value of the objective of 'a'; if 'a' does not have an objective no solution is collected.
SolutionCollectorMakeBestValueSolutionCollector (bool maximize)
 Collect the solution corresponding to the optimal value of the objective of 'a'; if 'a' does not have an objective no solution is collected.
SolutionCollectorMakeAllSolutionCollector (const Assignment *const assignment)
 Collect all solutions of the search.
SolutionCollectorMakeAllSolutionCollector ()
 Collect all solutions of the search.
OptimizeVarMakeMinimize (IntVar *const v, int64 step)
 Objective.
OptimizeVarMakeMaximize (IntVar *const v, int64 step)
 Creates a maximization objective.
OptimizeVarMakeOptimize (bool maximize, IntVar *const v, int64 step)
 Creates a objective with a given sense (true = maximization).
OptimizeVarMakeWeightedMinimize (const std::vector< IntVar * > &vars, const std::vector< int64 > &weights, int64 step)
 Creates a minimization weighted objective.
OptimizeVarMakeWeightedMinimize (const std::vector< IntVar * > &vars, const std::vector< int > &weights, int64 step)
 Creates a minimization weighted objective.
OptimizeVarMakeWeightedMaximize (const std::vector< IntVar * > &vars, const std::vector< int64 > &weights, int64 step)
 Creates a maximization weigthed objective.
OptimizeVarMakeWeightedMaximize (const std::vector< IntVar * > &vars, const std::vector< int > &weights, int64 step)
 Creates a maximization weigthed objective.
OptimizeVarMakeWeightedOptimize (bool maximize, const std::vector< IntVar * > &vars, const std::vector< int64 > &weights, int64 step)
 Creates a weighted objective with a given sense (true = maximization).
OptimizeVarMakeWeightedOptimize (bool maximize, const std::vector< IntVar * > &vars, const std::vector< int > &weights, int64 step)
 Creates a weighted objective with a given sense (true = maximization).
SearchMonitorMakeTabuSearch (bool maximize, IntVar *const v, int64 step, const std::vector< IntVar * > &vars, int64 keep_tenure, int64 forbid_tenure, double tabu_factor)
 Meta-heuristics Search monitors which try to get the search out of local optima.
SearchMonitorMakeTabuSearch (bool maximize, IntVar *const v, int64 step, const IntVar *const *vars, int size, int64 keep_tenure, int64 forbid_tenure, double tabu_factor)
SearchMonitorMakeSimulatedAnnealing (bool maximize, IntVar *const v, int64 step, int64 initial_temperature)
 Creates a Simulated Annealing monitor.
SearchMonitorMakeGuidedLocalSearch (bool maximize, IntVar *const objective, IndexEvaluator2 *objective_function, int64 step, const std::vector< IntVar * > &vars, double penalty_factor)
 Creates a Guided Local Search monitor.
SearchMonitorMakeGuidedLocalSearch (bool maximize, IntVar *const objective, IndexEvaluator2 *objective_function, int64 step, const IntVar *const *vars, int size, double penalty_factor)
SearchMonitorMakeGuidedLocalSearch (bool maximize, IntVar *const objective, IndexEvaluator3 *objective_function, int64 step, const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, double penalty_factor)
SearchMonitorMakeGuidedLocalSearch (bool maximize, IntVar *const objective, IndexEvaluator3 *objective_function, int64 step, const IntVar *const *vars, const IntVar *const *secondary_vars, int size, double penalty_factor)
SearchMonitorMakeLubyRestart (int scale_factor)
 Restart Search.
SearchMonitorMakeConstantRestart (int frequency)
 This search monitor will restart the search periodically after 'frequency' failures.
SearchLimitMakeTimeLimit (int64 time_in_ms)
 Search Limit.
SearchLimitMakeBranchesLimit (int64 branches)
 Creates a search limit that constrains the number of branches explored in the search tree.
SearchLimitMakeFailuresLimit (int64 failures)
 Creates a search limit that constrains the number of failures that can happen when exploring the search tree.
SearchLimitMakeSolutionsLimit (int64 solutions)
 Creates a search limit that constrains the number of solutions found during the search.
SearchLimitMakeLimit (int64 time, int64 branches, int64 failures, int64 solutions)
 Limits the search with the 'time', 'branches', 'failures' and 'solutions' limits.
SearchLimitMakeLimit (int64 time, int64 branches, int64 failures, int64 solutions, bool smart_time_check)
 Version reducing calls to wall timer by estimating number of remaining calls.
SearchLimitMakeLimit (int64 time, int64 branches, int64 failures, int64 solutions, bool smart_time_check, bool cumulative)
 Creates a search limit which can either apply cumulatively or search-by-search.
SearchLimitMakeLimit (const SearchLimitProto &proto)
 Creates a search limit from its protobuf description.
SearchLimitMakeLimit (SearchLimit *const limit_1, SearchLimit *const limit_2)
 Creates a search limit that is reached when either of the underlying limit is reached.
void UpdateLimits (int64 time, int64 branches, int64 failures, int64 solutions, SearchLimit *limit)
int64 GetTime (SearchLimit *limit)
 Returns 'time' limit of search limit.
SearchLimitMakeCustomLimit (ResultCallback< bool > *limiter)
 Callback-based search limit.
NoGoodManagerMakeNoGoodManager ()
 No Goods.
SearchMonitorMakeTreeMonitor (const IntVar *const *vars, int size, const string &file_tree, const string &file_visualization)
 Tree Monitor Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.
SearchMonitorMakeTreeMonitor (const std::vector< IntVar * > &vars, const string &file_tree, const string &file_visualization)
 Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.
SearchMonitorMakeTreeMonitor (const IntVar *const *vars, int size, const string &file_config, const string &file_tree, const string &file_visualization)
 Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.
SearchMonitorMakeTreeMonitor (const std::vector< IntVar * > &vars, const string &file_config, const string &file_tree, const string &file_visualization)
 Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.
SearchMonitorMakeTreeMonitor (const IntVar *const *vars, int size, string *const tree_xml, string *const visualization_xml)
 Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.
SearchMonitorMakeTreeMonitor (const std::vector< IntVar * > &vars, string *const tree_xml, string *const visualization_xml)
 Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.
SearchMonitorMakeTreeMonitor (const IntVar *const *vars, int size, string *const config_xml, string *const tree_xml, string *const visualization_xml)
 Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.
SearchMonitorMakeTreeMonitor (const std::vector< IntVar * > &vars, string *const config_xml, string *const tree_xml, string *const visualization_xml)
 Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.
SearchMonitorMakeSearchLog (int branch_count)
 Search Log The SearchMonitors below will display a periodic search log on LOG(INFO) every branch_count branches explored.
SearchMonitorMakeSearchLog (int branch_count, IntVar *const objective)
 At each solution, this monitor also display the objective value.
SearchMonitorMakeSearchLog (int branch_count, ResultCallback< string > *display_callback)
 At each solution, this monitor will also display result of display_callback.
SearchMonitorMakeSearchLog (int branch_count, IntVar *objective, ResultCallback< string > *display_callback)
 At each solution, this monitor will display the objective value and the result of display_callback.
SearchMonitorMakeSearchLog (int branch_count, OptimizeVar *const objective)
 OptimizeVar Search Logs At each solution, this monitor will also display the objective->Print().
SearchMonitorMakeSearchLog (int branch_count, OptimizeVar *const objective, ResultCallback< string > *display_callback)
 Creates a search monitor that will also print the result of the display callback.
SearchMonitorMakeSearchTrace (const string &prefix)
 Search Trace.
ModelVisitorMakePrintModelVisitor ()
 ModelVisitor.
ModelVisitorMakeStatisticsModelVisitor ()
 Displays some nice statistics on the model.
SearchMonitorMakeSymmetryManager (const std::vector< SymmetryBreaker * > &visitors)
 Symmetry Breaking.
SearchMonitorMakeSymmetryManager (SymmetryBreaker *const *visitors, int size)
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)
SearchMonitorMakeSimplexConnection (Callback1< MPSolver * > *const builder, Callback1< MPSolver * > *const modifier, Callback1< MPSolver * > *const runner, int simplex_frequency)
 Simplex Connection.
SearchMonitorMakeSimplexConstraint (int simplex_frequency)
 Linear Relaxation Constraint.
DecisionMakeAssignVariableValue (IntVar *const var, int64 value)
 Search Decicions and Decision Builders.
DecisionMakeVariableLessOrEqualValue (IntVar *const var, int64 value)
DecisionMakeVariableGreaterOrEqualValue (IntVar *const var, int64 value)
DecisionMakeSplitVariableDomain (IntVar *const var, int64 value, bool start_with_lower_half)
 namespace
DecisionMakeAssignVariableValueOrFail (IntVar *const var, int64 value)
 namespace
DecisionMakeAssignVariablesValues (const IntVar *const *vars, int size, const int64 *const values)
 namespace
DecisionMakeAssignVariablesValues (const std::vector< IntVar * > &vars, const std::vector< int64 > &values)
DecisionMakeFailDecision ()
 namespace
DecisionBuilderCompose (DecisionBuilder *const db1, DecisionBuilder *const db2)
 Creates a decision builder which sequentially composes decision builders.
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.
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.
DecisionBuilderMakePhase (const IntVar *const *vars, int size, IntVarStrategy var_str, IntValueStrategy val_str)
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 *var_evaluator, IntValueStrategy val_str)
DecisionBuilderMakePhase (const IntVar *const *vars, int size, IndexEvaluator1 *var_evaluator, IntValueStrategy val_str)
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IndexEvaluator2 *val_eval)
DecisionBuilderMakePhase (const IntVar *const *vars, int size, IntVarStrategy var_str, IndexEvaluator2 *val_eval)
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 *var_evaluator, IndexEvaluator2 *val_eval)
DecisionBuilderMakePhase (const IntVar *const *vars, int size, IndexEvaluator1 *var_evaluator, IndexEvaluator2 *val_eval)
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IndexEvaluator2 *val_eval, IndexEvaluator1 *tie_breaker)
DecisionBuilderMakePhase (const IntVar *const *vars, int size, IntVarStrategy var_str, IndexEvaluator2 *val_eval, IndexEvaluator1 *tie_breaker)
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 *var_evaluator, IndexEvaluator2 *val_eval, IndexEvaluator1 *tie_breaker)
DecisionBuilderMakePhase (const IntVar *const *vars, int size, IndexEvaluator1 *var_evaluator, IndexEvaluator2 *val_eval, IndexEvaluator1 *tie_breaker)
DecisionBuilderMakeDefaultPhase (const IntVar *const *vars, int size)
DecisionBuilderMakeDefaultPhase (const std::vector< IntVar * > &vars)
 namespace
DecisionBuilderMakeDefaultPhase (const IntVar *const *vars, int size, const DefaultPhaseParameters &parameters)
DecisionBuilderMakeDefaultPhase (const std::vector< IntVar * > &vars, const DefaultPhaseParameters &parameters)
DecisionBuilderMakePhase (IntVar *const v0, IntVarStrategy var_str, IntValueStrategy val_str)
 shortcuts for small arrays.
DecisionBuilderMakePhase (IntVar *const v0, IntVar *const v1, IntVarStrategy var_str, IntValueStrategy val_str)
DecisionBuilderMakePhase (IntVar *const v0, IntVar *const v1, IntVar *const v2, IntVarStrategy var_str, IntValueStrategy val_str)
DecisionBuilderMakePhase (IntVar *const v0, IntVar *const v1, IntVar *const v2, IntVar *const v3, IntVarStrategy var_str, IntValueStrategy val_str)
DecisionMakeScheduleOrPostpone (IntervalVar *const var, int64 est, int64 *const marker)
 Scheduling Decisions.
DecisionMakeRankFirstInterval (SequenceVar *const sequence, int index)
 Returns a decision that tries to rank first the ith interval var in the sequence variable.
DecisionMakeRankLastInterval (SequenceVar *const sequence, int index)
 Returns a decision that tries to rank last the ith interval var in the sequence variable.
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IndexEvaluator2 *evaluator, EvaluatorStrategy str)
 Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator.
DecisionBuilderMakePhase (const IntVar *const *vars, int size, IndexEvaluator2 *evaluator, EvaluatorStrategy str)
DecisionBuilderMakePhase (const std::vector< IntVar * > &vars, IndexEvaluator2 *evaluator, IndexEvaluator1 *tie_breaker, EvaluatorStrategy str)
 Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator.
DecisionBuilderMakePhase (const IntVar *const *vars, int size, IndexEvaluator2 *evaluator, IndexEvaluator1 *tie_breaker, EvaluatorStrategy str)
DecisionBuilderMakePhase (const std::vector< IntervalVar * > &intervals, IntervalStrategy str)
 Scheduling phases.
DecisionBuilderMakePhase (const std::vector< SequenceVar * > &sequences, SequenceStrategy str)
DecisionBuilderMakeDecisionBuilderFromAssignment (Assignment *const assignment, DecisionBuilder *const db, const IntVar *const *vars, int size)
 Returns a decision builder for which the left-most leaf corresponds to assignment, the rest of the tree being explored using 'db'.
DecisionBuilderMakeConstraintAdder (Constraint *const ct)
 Returns a decision builder that will add the given constraint to the model.
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.
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1)
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1, SearchMonitor *const monitor2)
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3)
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3, SearchMonitor *const monitor4)
DecisionBuilderMakeSolveOnce (DecisionBuilder *const db, const std::vector< SearchMonitor * > &monitors)
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step)
 NestedOptimize will collapse a search tree described by a decision builder 'db' and a set of monitors and wrap it into a single point.
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1)
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1, SearchMonitor *const monitor2)
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3)
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, SearchMonitor *const monitor1, SearchMonitor *const monitor2, SearchMonitor *const monitor3, SearchMonitor *const monitor4)
DecisionBuilderMakeNestedOptimize (DecisionBuilder *const db, Assignment *const solution, bool maximize, int64 step, const std::vector< SearchMonitor * > &monitors)
DecisionBuilderMakeRestoreAssignment (Assignment *assignment)
 Returns a DecisionBuilder which restores an Assignment (calls void Assignment::Restore()).
DecisionBuilderMakeStoreAssignment (Assignment *assignment)
 Returns a DecisionBuilder which stores an Assignment (calls void Assignment::Store()).
LocalSearchOperatorMakeOperator (const std::vector< IntVar * > &vars, LocalSearchOperators op)
 Local Search Operators.
LocalSearchOperatorMakeOperator (const IntVar *const *vars, int size, LocalSearchOperators op)
LocalSearchOperatorMakeOperator (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, LocalSearchOperators op)
LocalSearchOperatorMakeOperator (const IntVar *const *vars, const IntVar *const *secondary_vars, int size, LocalSearchOperators op)
LocalSearchOperatorMakeOperator (const std::vector< IntVar * > &vars, IndexEvaluator3 *const evaluator, EvaluatorLocalSearchOperators op)
LocalSearchOperatorMakeOperator (const IntVar *const *vars, int size, IndexEvaluator3 *const evaluator, EvaluatorLocalSearchOperators op)
LocalSearchOperatorMakeOperator (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, IndexEvaluator3 *const evaluator, EvaluatorLocalSearchOperators op)
LocalSearchOperatorMakeOperator (const IntVar *const *vars, const IntVar *const *secondary_vars, int size, IndexEvaluator3 *const 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).
LocalSearchOperatorMakeRandomLNSOperator (const std::vector< IntVar * > &vars, int number_of_variables, int32 seed)
LocalSearchOperatorMakeRandomLNSOperator (const IntVar *const *vars, int size, int number_of_variables)
LocalSearchOperatorMakeRandomLNSOperator (const IntVar *const *vars, int size, int number_of_variables, int32 seed)
LocalSearchOperatorMakeMoveTowardTargetOperator (const Assignment &target)
 Creates a local search operator that tries to move the assignment of some variables toward a target.
LocalSearchOperatorMakeMoveTowardTargetOperator (const std::vector< IntVar * > &variables, const std::vector< int64 > &target_values)
 Creates a local search operator that tries to move the assignment of some variables toward a target.
LocalSearchOperatorConcatenateOperators (const std::vector< LocalSearchOperator * > &ops)
 Creates a local search operator which concatenates a vector of operators.
LocalSearchOperatorConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, bool restart)
LocalSearchOperatorConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, ResultCallback2< int64, int, int > *const evaluator)
LocalSearchOperatorRandomConcatenateOperators (const std::vector< LocalSearchOperator * > &ops)
 Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor().
LocalSearchOperatorMakeNeighborhoodLimit (LocalSearchOperator *const op, int64 limit)
 Creates a local search operator that wraps another local search operator and limits the number of neighbors explored (i.e.
DecisionBuilderMakeLocalSearchPhase (Assignment *const assignment, LocalSearchPhaseParameters *const parameters)
 Local Search decision builders factories.
DecisionBuilderMakeLocalSearchPhase (const std::vector< IntVar * > &vars, DecisionBuilder *const first_solution, LocalSearchPhaseParameters *const parameters)
DecisionBuilderMakeLocalSearchPhase (IntVar *const *vars, int size, DecisionBuilder *const first_solution, LocalSearchPhaseParameters *const parameters)
SolutionPoolMakeDefaultSolutionPool ()
 Solution Pool.
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder)
 Local Search Phase Parameters.
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, SearchLimit *const limit)
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, SearchLimit *const limit, const std::vector< LocalSearchFilter * > &filters)
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (SolutionPool *const pool, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder)
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (SolutionPool *const pool, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, SearchLimit *const limit)
LocalSearchPhaseParametersMakeLocalSearchPhaseParameters (SolutionPool *const pool, LocalSearchOperator *const ls_operator, DecisionBuilder *const sub_decision_builder, SearchLimit *const limit, const std::vector< LocalSearchFilter * > &filters)
LocalSearchFilterMakeVariableDomainFilter ()
 Local Search Filters.
LocalSearchFilterMakeLocalSearchObjectiveFilter (const IntVar *const *vars, int size, IndexEvaluator2 *const values, const IntVar *const objective, Solver::LocalSearchFilterBound filter_enum, Solver::LocalSearchOperation op_enum)
 namespace
LocalSearchFilterMakeLocalSearchObjectiveFilter (const std::vector< IntVar * > &vars, IndexEvaluator2 *const values, const IntVar *const objective, Solver::LocalSearchFilterBound filter_enum, Solver::LocalSearchOperation op_enum)
LocalSearchFilterMakeLocalSearchObjectiveFilter (const IntVar *const *vars, const IntVar *const *secondary_vars, int size, ResultCallback3< int64, int64, int64, int64 > *const values, const IntVar *const objective, Solver::LocalSearchFilterBound filter_enum, Solver::LocalSearchOperation op_enum)
void TopPeriodicCheck ()
 Performs PeriodicCheck on the top-level search; can be called from a nested solve to check top-level limits for instance.
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).
void PushState ()
 The PushState and PopState methods manipulates the states of the reversible objects.
void PopState ()
int SearchDepth () const
 Gets the search depth of the current active search.
int SearchLeftDepth () const
 Gets the search left depth of the current active search.
int SolveDepth () const
 Gets the number of nested searches.
void SetBranchSelector (ResultCallback1< Solver::DecisionModification, Solver * > *const bs)
 Sets the given branch selector on the current active search.
DecisionBuilderMakeApplyBranchSelector (ResultCallback1< Solver::DecisionModification, Solver * > *const bs)
 Creates a decision builder that will set the branch selector.
template<class T>
void SaveAndSetValue (T *adr, T val)
 All-in-one SaveAndSetValue.
template<class T>
void SaveAndAdd (T *adr, T val)
 All-in-one SaveAndAdd_value.
int64 Rand64 (int64 size)
 Returns a random value between 0 and 'size' - 1;.
int32 Rand32 (int32 size)
 Returns a random value between 0 and 'size' - 1;.
void ReSeed (int32 seed)
 Reseed the solver random generator.
void AddFailHook (Action *a)
 Adds a fail hook, that is an action that will be called after each failure.
void ExportProfilingOverview (const string &filename)
 Exports the profiling information in a human readable overview.
bool CurrentlyInSolve () const
 Returns true whether the current search has been created using a Solve() call instead of a NewSearch 0ne.
int constraints () const
 Counts the number of constraints that have been added to the solver before the search,.
void Accept (ModelVisitor *const visitor) const
 Accepts the given model visitor.
void Accept (ModelVisitor *const visitor, const std::vector< SearchMonitor * > &monitors) const
 Accepts the given model visitor.
Decisionbalancing_decision () const
void set_fail_intercept (Closure *const c)
 Internal set_fail_intercept does not take ownership of the closure.
void clear_fail_intercept ()
DemonProfilerdemon_profiler () const
 Access to demon profiler.
bool HasName (const PropagationBaseObject *object) const
 Returns whether the object has been named or not.
DemonRegisterDemon (Demon *const d)
 Adds a new demon and wraps it inside a DemonProfiler if necessary.
IntExprRegisterIntExpr (IntExpr *const expr)
 Registers a new IntExpr and wraps it inside a TraceIntExpr if necessary.
IntVarRegisterIntVar (IntVar *const var)
 Registers a new IntVar and wraps it inside a TraceIntVar if necessary.
IntervalVarRegisterIntervalVar (IntervalVar *const var)
 Registers a new IntervalVar and wraps it inside a TraceIntervalVar if necessary.
SearchActiveSearch () const
 Returns the active search, NULL outside search.
ModelCacheCache () const
 Returns the cache of the model.
bool InstrumentsDemons () const
 Returns whether we are instrumenting demons.
bool IsProfilingEnabled () const
 Returns whether we are profiling the solver.
bool InstrumentsVariables () const
 Returns whether we are tracing variables.
bool NameAllVariables () const
 Returns whether all variables should be named.
string model_name () const
 Returns the name of the model.
DependencyGraphGraph () const
 Returns the dependency graph of the solver.
PropagationMonitorGetPropagationMonitor () const
 Returns the propagation monitor.
void AddPropagationMonitor (PropagationMonitor *const monitor)
 Adds the propagation monitor to the solver.
bool Solve (DecisionBuilder *const db, const std::vector< SearchMonitor * > &monitors)
bool Solve (DecisionBuilder *const db, SearchMonitor *const *monitors, int size)
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, SearchMonitor *const *monitors, int size)
 Opens a new top level search.
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 ()
 namespace
void RestartSearch ()
void EndSearch ()

Static Public Member Functions

static bool UpgradeModel (CPModelProto *const proto)
 Upgrades the model to the latest version.
static int64 MemoryUsage ()
 Current memory usage in bytes.

Static Public Attributes

static const int kNumPriorities = 3
 Number of priorities for demons.

Friends

class BaseIntExpr
class Constraint
class DemonProfiler
class FindOneNeighbor
class IntVar
class PropagationBaseObject
class Queue
class SearchMonitor
class SimpleRevFIFO
class RevImmutableMultiMap
void InternalSaveBooleanVarValue (Solver *const, IntVar *const)
void SetQueueCleanerOnFail (Solver *const, IntVar *const)

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


Detailed Description

Solver Class.

A solver represent the main computation engine. It implements the whole range of Constraint Programming protocol:

Usually, a Constraint Programming code consists of

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

Definition at line 342 of file constraint_solver.h.


Member Typedef Documentation

typedef ResultCallback1<int64, int64> operations_research::Solver::IndexEvaluator1

Callback typedefs.

Definition at line 345 of file constraint_solver.h.

typedef ResultCallback2<int64, int64, int64> operations_research::Solver::IndexEvaluator2

Definition at line 346 of file constraint_solver.h.

typedef ResultCallback3<int64, int64, int64, int64> operations_research::Solver::IndexEvaluator3

Definition at line 347 of file constraint_solver.h.

typedef ResultCallback2<IntExpr*, CPModelLoader*, const CPIntegerExpressionProto&> operations_research::Solver::IntegerExpressionBuilder

Definition at line 351 of file constraint_solver.h.

typedef ResultCallback2<Constraint*, CPModelLoader*, const CPConstraintProto&> operations_research::Solver::ConstraintBuilder

Definition at line 354 of file constraint_solver.h.

typedef ResultCallback2<IntervalVar*, CPModelLoader*, const CPIntervalVariableProto&> operations_research::Solver::IntervalVariableBuilder

Definition at line 358 of file constraint_solver.h.

typedef ResultCallback2<SequenceVar*, CPModelLoader*, const CPSequenceVariableProto&> operations_research::Solver::SequenceVariableBuilder

Definition at line 362 of file constraint_solver.h.


Member Enumeration Documentation

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 tie, the selected variables is the one with the lowest min value. In case of 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 tie, the selected variables is the one with the highest min value. In case of 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 tie, the selected variables is the one with the lowest max value. In case of 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 tie, the selected variables is the one with the highest max value. In case of tie, the first one is selected, first being defined by the order in the vector of IntVars used to create the selector.

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 382 of file constraint_solver.h.

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.

Definition at line 436 of file constraint_solver.h.

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 468 of file constraint_solver.h.

Used for scheduling. Not yet implemented.

Enumerator:
SEQUENCE_DEFAULT 
SEQUENCE_SIMPLE 
CHOOSE_MIN_SLACK_RANK_FORWARD 
CHOOSE_RANDOM_RANK_FORWARD 

Definition at line 483 of file constraint_solver.h.

Used for scheduling. Not yet implemented.

Enumerator:
INTERVAL_DEFAULT 
INTERVAL_SIMPLE 
INTERVAL_SET_TIMES_FORWARD 

Definition at line 491 of file constraint_solver.h.

This enum is used in Solver::MakeOperator to specify the neighborhood to create.

Enumerator:
TWOOPT  Operator which reverves 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

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

UNACTIVELNS  Operator which relaxes all inactive nodes and one sub-chain of six consecutive arcs.

That way the path can be improve by inserting inactive nodes or swaping 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 1 by 1 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 499 of file constraint_solver.h.

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 624 of file constraint_solver.h.

This enum is used in Solver::MakeLocalSearchObjectiveFilter.

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

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 652 of file constraint_solver.h.

This enum is used in Solver::MakeLocalSearchObjectiveFilter.

It specifies the operation used in the objective to build the corresponding filter.

Enumerator:
SUM  The objective is the sum of the variables defined in Solver::MakeLocalSearchObjectiveFilter.

PROD  The objective is the product of the variables defined in Solver::MakeLocalSearchObjectiveFilter.

MAX  The objective is the max of the variables defined in Solver::MakeLocalSearchObjectiveFilter.

MIN  The objective is the min of the variables defined in Solver::MakeLocalSearchObjectiveFilter.

Definition at line 664 of file constraint_solver.h.

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 685 of file constraint_solver.h.

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).
ENDS_AFTER_START  t1 ends after t2 start, i.e. End(t1) >= Start(t2).
ENDS_AT_END  t1 ends at t2 end, i.e. End(t1) == End(t2).
ENDS_AT_START  t1 ends at t2 start, i.e. End(t1) == Start(t2).
STARTS_AFTER_END  t1 starts after t2 end, i.e. Start(t1) >= End(t2).
STARTS_AFTER_START  t1 starts after t2 start, i.e. Start(t1) >= Start(t2).
STARTS_AT_END  t1 starts at t2 end, i.e. Start(t1) == End(t2).
STARTS_AT_START  t1 starts at t2 start, i.e. Start(t1) == Start(t2).
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). t1 ends at t2 end, i.e. End(t1) == End(t2).

Definition at line 699 of file constraint_solver.h.

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

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 732 of file constraint_solver.h.

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 767 of file constraint_solver.h.

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 793 of file constraint_solver.h.

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 801 of file constraint_solver.h.


Constructor & Destructor Documentation

operations_research::Solver::Solver ( const string &  modelname  )  [explicit]

Definition at line 1407 of file constraint_solver.cc.

operations_research::Solver::Solver ( const string &  modelname,
const SolverParameters parameters 
)

Definition at line 1373 of file constraint_solver.cc.

operations_research::Solver::~Solver (  ) 

Definition at line 1457 of file constraint_solver.cc.


Member Function Documentation

const SolverParameters& operations_research::Solver::parameters (  )  const [inline]

Read-only Parameters.

Definition at line 815 of file constraint_solver.h.

template<class T>
void operations_research::Solver::SaveValue ( T *  o  )  [inline]

reversibility

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

Definition at line 822 of file constraint_solver.h.

template<typename T>
T* operations_research::Solver::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 838 of file constraint_solver.h.

template<typename T>
T* operations_research::Solver::RevAllocArray ( T *  object  )  [inline]

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

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

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

Definition at line 848 of file constraint_solver.h.

void operations_research::Solver::AddConstraint ( Constraint *const   c  ) 

propagation

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

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 1659 of file constraint_solver.cc.

void operations_research::Solver::AddCastConstraint ( CastConstraint *const   c,
IntVar *const   target_var,
IntExpr *const   casted_expression 
)

Adds the constraint 'c' 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 1679 of file constraint_solver.cc.

bool operations_research::Solver::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 NULL. 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.

These function must be called from outside of search, meaning that state() == OUTSIDE_SEARCH.

Solve will terminate whenever any of the following event arise: A search monitor asks the solver to terminate the search by calling SearchMonitor::FinishCurrentSearch(). A solution is found that is accepted by all search monitors, and none of the search monitors decides to search for another one.

Upon search termination, there will be a series of backtracks all the way to the top level. This means that a user cannot expect to inspect the solution by querying variables after a call to Solve(): all the information will be lost. In order to do something with the solution, the user must either: Use a search monitor that can process such a leaf. See, in particular, the SolutionCollector class. Do not use Solve. Instead, use the more fine-grained approach using methods NewSearch(...), NextSolution(), and EndSearch().

Parameters:
db The decision builder that will generate the search tree.
monitors A vector of search monitors that will be notified of various events during the search. In their reaction to these events, such monitors may influence the search.

Definition at line 1782 of file constraint_solver.cc.

bool operations_research::Solver::Solve ( DecisionBuilder *const   db,
SearchMonitor *const *  monitors,
int  size 
)

Definition at line 1830 of file constraint_solver.cc.

bool operations_research::Solver::Solve ( DecisionBuilder *const   db  ) 

Definition at line 1793 of file constraint_solver.cc.

bool operations_research::Solver::Solve ( DecisionBuilder *const   db,
SearchMonitor *const   m1 
)

Definition at line 1787 of file constraint_solver.cc.

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

Definition at line 1797 of file constraint_solver.cc.

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

Definition at line 1806 of file constraint_solver.cc.

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

Definition at line 1817 of file constraint_solver.cc.

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

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

Definition at line 1841 of file constraint_solver.cc.

void operations_research::Solver::NewSearch ( DecisionBuilder *const   db,
SearchMonitor *const *  monitors,
int  size 
)

Opens a new top level search.

Definition at line 1892 of file constraint_solver.cc.

void operations_research::Solver::NewSearch ( DecisionBuilder *const   db  ) 

Definition at line 1852 of file constraint_solver.cc.

void operations_research::Solver::NewSearch ( DecisionBuilder *const   db,
SearchMonitor *const   m1 
)

Definition at line 1846 of file constraint_solver.cc.

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

Definition at line 1856 of file constraint_solver.cc.

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

Definition at line 1865 of file constraint_solver.cc.

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

Definition at line 1876 of file constraint_solver.cc.

bool operations_research::Solver::NextSolution (  ) 

namespace

Search for the next solution in the search tree.

Definition at line 2126 of file constraint_solver.cc.

void operations_research::Solver::RestartSearch (  ) 

Definition at line 2013 of file constraint_solver.cc.

void operations_research::Solver::EndSearch (  ) 

Definition at line 2292 of file constraint_solver.cc.

bool operations_research::Solver::NestedSolve ( DecisionBuilder *const   db,
bool  restore,
const std::vector< SearchMonitor * > &  monitors 
)

Nested solve 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 restore parameter indicates if the search should backtrack completely after completion, even in case of success.

Definition at line 2385 of file constraint_solver.cc.

bool operations_research::Solver::NestedSolve ( DecisionBuilder *const   db,
bool  restore,
SearchMonitor *const *  monitors,
int  size 
)

Definition at line 2425 of file constraint_solver.cc.

bool operations_research::Solver::NestedSolve ( DecisionBuilder *const   db,
bool  restore 
)

Definition at line 2399 of file constraint_solver.cc.

bool operations_research::Solver::NestedSolve ( DecisionBuilder *const   db,
bool  restore,
SearchMonitor *const   m1 
)

Definition at line 2391 of file constraint_solver.cc.

bool operations_research::Solver::NestedSolve ( DecisionBuilder *const   db,
bool  restore,
SearchMonitor *const   m1,
SearchMonitor *const   m2 
)

Definition at line 2403 of file constraint_solver.cc.

bool operations_research::Solver::NestedSolve ( DecisionBuilder *const   db,
bool  restore,
SearchMonitor *const   m1,
SearchMonitor *const   m2,
SearchMonitor *const   m3 
)

Definition at line 2413 of file constraint_solver.cc.

bool operations_research::Solver::CheckAssignment ( Assignment *const   assignment  ) 

Checks whether the given assignment satisfies all the relevant constraints.

Definition at line 2305 of file constraint_solver.cc.

bool operations_research::Solver::CheckConstraint ( Constraint *const   constraint  ) 

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

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

Definition at line 2381 of file constraint_solver.cc.

SolverState operations_research::Solver::state (  )  const [inline]

State of the solver.

Definition at line 1020 of file constraint_solver.h.

void operations_research::Solver::Fail (  ) 

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

Definition at line 2474 of file constraint_solver.cc.

void operations_research::Solver::ExportModel ( CPModelProto *const   proto  )  const

Exports the model to protobuf.

This code will be called from inside the solver during the start of the search.

Definition at line 2418 of file io.cc.

void operations_research::Solver::ExportModel ( const std::vector< SearchMonitor * > &  monitors,
CPModelProto *const   proto 
) const

Exports the model to protobuf.

Solver API.

Search monitors are useful to pass the objective and limits to the protobuf.

Definition at line 2403 of file io.cc.

bool operations_research::Solver::LoadModel ( const CPModelProto &  proto  ) 

Loads the model into the solver, and returns true upon success.

Definition at line 2426 of file io.cc.

bool operations_research::Solver::LoadModel ( const CPModelProto &  proto,
std::vector< SearchMonitor * > *  monitors 
)

Loads the model into the solver, appends search monitors to monitors, and returns true upon success.

Definition at line 2430 of file io.cc.

bool operations_research::Solver::UpgradeModel ( CPModelProto *const   proto  )  [static]

Upgrades the model to the latest version.

Definition at line 2495 of file io.cc.

bool operations_research::Solver::CollectDecisionVariables ( std::vector< IntVar * > *const   primary_integer_variables,
std::vector< IntVar * > *const   secondary_integer_variables,
std::vector< SequenceVar * > *const   sequence_variables,
std::vector< IntervalVar * > *const   interval_variables 
)

Collects decision variables.

namespace

All decision variables will be collected in 4 groups:

  • Main integer decision variables.
  • Secondary integer variables (that are derived integer variables that should be fixed like times of tasks after the order has been fixed).
  • Sequence variables.
  • Interval variables.

From these 4 groups, one could write a decision builder: solver.Compose( solver.MakeDefaultPhase(primary_integer_variables), solver.MakePhase(sequence_variables, Solver::SEQUENCE_DEFAULT), solver.MakePhase(interval_variables, Solver::INTERVAL_DEFAULT), solver.MakePhase(secondary_integer_variables, Solver::INT_VAR_DEFAULT); SWIG

Definition at line 201 of file collect_variables.cc.

void operations_research::Solver::RegisterBuilder ( const string &  tag,
ConstraintBuilder *const   builder 
)

Registers a constraint builder. Ownership is passed to the solver.

Definition at line 2502 of file io.cc.

void operations_research::Solver::RegisterBuilder ( const string &  tag,
IntegerExpressionBuilder *const   builder 
)

Registers an integer expression builder. Ownership is passed to the solver.

Definition at line 2507 of file io.cc.

void operations_research::Solver::RegisterBuilder ( const string &  tag,
IntervalVariableBuilder *const   builder 
)

Registers an interval variable builder. Ownership is passed to the solver.

Definition at line 2512 of file io.cc.

void operations_research::Solver::RegisterBuilder ( const string &  tag,
SequenceVariableBuilder *const   builder 
)

Registers a sequence variable builder. Ownership is passed to the solver.

Definition at line 2517 of file io.cc.

Solver::ConstraintBuilder * operations_research::Solver::GetConstraintBuilder ( const string &  tag  )  const

Definition at line 2523 of file io.cc.

Solver::IntegerExpressionBuilder * operations_research::Solver::GetIntegerExpressionBuilder ( const string &  tag  )  const

Definition at line 2528 of file io.cc.

Solver::IntervalVariableBuilder * operations_research::Solver::GetIntervalVariableBuilder ( const string &  tag  )  const

Definition at line 2533 of file io.cc.

Solver::SequenceVariableBuilder * operations_research::Solver::GetSequenceVariableBuilder ( const string &  tag  )  const

Definition at line 2540 of file io.cc.

void operations_research::Solver::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 1571 of file constraint_solver.cc.

string operations_research::Solver::DebugString (  )  const

misc debug string.

Definition at line 1484 of file constraint_solver.cc.

int64 operations_research::Solver::MemoryUsage (  )  [static]

Current memory usage in bytes.

Definition at line 1519 of file constraint_solver.cc.

int64 operations_research::Solver::wall_time (  )  const

wall_time() in ms since the creation of the solver.

Definition at line 1524 of file constraint_solver.cc.

int64 operations_research::Solver::branches (  )  const [inline]

number of branches explored since the creation of the solver.

Definition at line 1099 of file constraint_solver.h.

int64 operations_research::Solver::solutions (  )  const

number of solutions found since the start of the search.

Definition at line 1528 of file constraint_solver.cc.

int64 operations_research::Solver::demon_runs ( DemonPriority  p  )  const [inline]

number of demons executed during search for a given priority.

Definition at line 1105 of file constraint_solver.h.

int64 operations_research::Solver::failures (  )  const [inline]

number of failures encountered since the creation of the solver.

Definition at line 1108 of file constraint_solver.h.

int64 operations_research::Solver::neighbors (  )  const [inline]

number of neighbors created

Definition at line 1111 of file constraint_solver.h.

int64 operations_research::Solver::filtered_neighbors (  )  const [inline]

number of filtered neighbors (neighbors accepted by filters)

Definition at line 1114 of file constraint_solver.h.

int64 operations_research::Solver::accepted_neighbors (  )  const [inline]

number of accepted neighbors

Definition at line 1117 of file constraint_solver.h.

uint64 operations_research::Solver::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 1639 of file constraint_solver.cc.

uint64 operations_research::Solver::fail_stamp (  )  const

The fail_stamp() is incremented after each backtrack.

Definition at line 1643 of file constraint_solver.cc.

IntVar * operations_research::Solver::MakeIntVar ( int64  vmin,
int64  vmax,
const string &  name 
)

Make Factory.

API.

All factories (MakeXXX methods) encapsulate creation of objects through RevAlloc(). Hence, the Solver used for allocating the returned object will retain ownership of the allocated memory. Destructors are called upon backtrack, or when the Solver is itself destructed. Int Variables and Constants MakeIntVar will create the best range based int var for the bounds given.

Definition at line 4307 of file expressions.cc.

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

MakeIntVar will create a variable with the given sparse domain.

Definition at line 4330 of file expressions.cc.

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

MakeIntVar will create a variable with the given sparse domain.

Definition at line 4345 of file expressions.cc.

IntVar * operations_research::Solver::MakeIntVar ( int64  vmin,
int64  vmax 
)

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

Definition at line 4318 of file expressions.cc.

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

MakeIntVar will create a variable with the given sparse domain.

Definition at line 4341 of file expressions.cc.

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

MakeIntVar will create a variable with the given sparse domain.

Definition at line 4356 of file expressions.cc.

IntVar * operations_research::Solver::MakeBoolVar ( const string &  name  ) 

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

Definition at line 4322 of file expressions.cc.

IntVar * operations_research::Solver::MakeBoolVar (  ) 

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

Definition at line 4326 of file expressions.cc.

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

IntConst will create a constant expression.

Definition at line 4360 of file expressions.cc.

IntVar * operations_research::Solver::MakeIntConst ( int64  val  ) 

IntConst will create a constant expression.

Definition at line 4372 of file expressions.cc.

void operations_research::Solver::MakeIntVarArray ( int  var_count,
int64  vmin,
int64  vmax,
const 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.

namespace

Definition at line 4391 of file expressions.cc.

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

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

Definition at line 4401 of file expressions.cc.

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

Same but allocates an array and returns it.

Definition at line 4410 of file expressions.cc.

void operations_research::Solver::MakeBoolVarArray ( int  var_count,
const 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 4421 of file expressions.cc.

void operations_research::Solver::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 4429 of file expressions.cc.

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

Same but allocates an array and returns it.

Definition at line 4435 of file expressions.cc.

IntExpr * operations_research::Solver::MakeSum ( IntExpr *const   left,
IntExpr *const   right 
)

Integer Expressions.

left + right.

Definition at line 4450 of file expressions.cc.

IntExpr * operations_research::Solver::MakeSum ( IntExpr *const   expr,
int64  value 
)

expr + value.

Definition at line 4465 of file expressions.cc.

IntExpr * operations_research::Solver::MakeSum ( IntVar *const *  vars,
int  size 
)

sum of all vars.

Definition at line 1390 of file expr_array.cc.

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

sum of all vars.

namespace

Definition at line 1386 of file expr_array.cc.

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

scalar product

Definition at line 2818 of file expr_array.cc.

IntExpr * operations_research::Solver::MakeScalProd ( IntVar *const *  vars,
const int64 *const   coefs,
int  size 
)

scalar product

namespace

Definition at line 2901 of file expr_array.cc.

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

scalar product

Definition at line 2824 of file expr_array.cc.

IntExpr * operations_research::Solver::MakeScalProd ( IntVar *const *  vars,
const int *const   coefs,
int  size 
)

scalar product

Definition at line 2907 of file expr_array.cc.

IntExpr * operations_research::Solver::MakeDifference ( IntExpr *const   left,
IntExpr *const   right 
)

left - right

Definition at line 4475 of file expressions.cc.

IntExpr * operations_research::Solver::MakeDifference ( int64  value,
IntExpr *const   expr 
)

value - expr

warning: this is 'v - e'.

Definition at line 4704 of file expressions.cc.

IntExpr * operations_research::Solver::MakeOpposite ( IntExpr *const   expr  ) 

-expr

Definition at line 4715 of file expressions.cc.

IntExpr * operations_research::Solver::MakeProd ( IntExpr *const   left,
IntExpr *const   right 
)

left * right

Definition at line 4749 of file expressions.cc.

IntExpr * operations_research::Solver::MakeProd ( IntExpr *const   expr,
int64  value 
)

expr * value

Definition at line 4727 of file expressions.cc.

IntExpr * operations_research::Solver::MakeDiv ( IntExpr *const   expr,
int64  value 
)

expr / value (integer division)

Definition at line 4807 of file expressions.cc.

IntExpr * operations_research::Solver::MakeDiv ( IntExpr *const   numerator,
IntExpr *const   denominator 
)

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

Definition at line 4790 of file expressions.cc.

IntExpr * operations_research::Solver::MakeAbs ( IntExpr *const   expr  ) 

|expr|

Definition at line 4828 of file expressions.cc.

IntExpr * operations_research::Solver::MakeSquare ( IntExpr *const   expr  ) 

expr * expr

Definition at line 4838 of file expressions.cc.

IntExpr * operations_research::Solver::MakeElement ( const int64 *const   vals,
int  size,
IntVar *const   index 
)

vals[expr]

Definition at line 540 of file element.cc.

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

vals[expr]

Definition at line 536 of file element.cc.

IntExpr * operations_research::Solver::MakeElement ( const int *const   vals,
int  size,
IntVar *const   index 
)

vals[expr]

namespace

Definition at line 525 of file element.cc.

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

vals[expr]

Definition at line 551 of file element.cc.

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

Function-based element.

namespace

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

Definition at line 731 of file element.cc.

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

Function based element.

namespace

The constraint takes ownership of 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 757 of file element.cc.

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

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

namespace

Definition at line 1005 of file element.cc.

IntExpr * operations_research::Solver::MakeElement ( const IntVar *const *  vars,
int  size,
IntVar *const   index 
)

vars[expr]

namespace

Definition at line 1371 of file element.cc.

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

vars[expr]

Definition at line 1379 of file element.cc.

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

min(vars)

Definition at line 1410 of file expr_array.cc.

IntExpr * operations_research::Solver::MakeMin ( IntVar *const *  vars,
int  size 
)

min(vars)

Definition at line 1414 of file expr_array.cc.

IntExpr * operations_research::Solver::MakeMin ( IntExpr *const   left,
IntExpr *const   right 
)

min (left, right)

Definition at line 4850 of file expressions.cc.

IntExpr * operations_research::Solver::MakeMin ( IntExpr *const   expr,
int64  val 
)

min(expr, val)

Definition at line 4868 of file expressions.cc.

IntExpr * operations_research::Solver::MakeMin ( IntExpr *const   expr,
int  val 
)

min(expr, val)

Definition at line 4882 of file expressions.cc.

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

max(vars)

Definition at line 1418 of file expr_array.cc.

IntExpr * operations_research::Solver::MakeMax ( IntVar *const *  vars,
int  size 
)

max(vars)

Definition at line 1422 of file expr_array.cc.

IntExpr * operations_research::Solver::MakeMax ( IntExpr *const   left,
IntExpr *const   right 
)

max(left, right)

Definition at line 4886 of file expressions.cc.

IntExpr * operations_research::Solver::MakeMax ( IntExpr *const   expr,
int64  val 
)

max(expr, val)

Definition at line 4904 of file expressions.cc.

IntExpr * operations_research::Solver::MakeMax ( IntExpr *const   expr,
int  val 
)

max(expr, val)

Definition at line 4918 of file expressions.cc.

IntExpr * operations_research::Solver::MakeConvexPiecewiseExpr ( IntVar e,
int64  early_cost,
int64  early_date,
int64  late_date,
int64  late_cost 
)

convex piecewise function.

Definition at line 4922 of file expressions.cc.

IntExpr * operations_research::Solver::MakeSemiContinuousExpr ( IntExpr *const   e,
int64  fixed_charge,
int64  step 
)

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

Definition at line 4931 of file expressions.cc.

Constraint * operations_research::Solver::MakeTrueConstraint (  ) 

Constraints This constraint always succeeds.

namespace

Definition at line 105 of file constraints.cc.

Constraint * operations_research::Solver::MakeFalseConstraint (  ) 

This constraint always fails.

namespace

Definition at line 134 of file constraints.cc.

Constraint * operations_research::Solver::MakeFalseConstraint ( const string &  explanation  ) 

Definition at line 138 of file constraints.cc.

Constraint * operations_research::Solver::MakeIsEqualCstCt ( IntVar *const   v,
int64  c,
IntVar *const   b 
)

b == (v == c)

Definition at line 391 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsEqualCstVar ( IntVar *const   var,
int64  value 
)

status var of (v == c)

namespace

Definition at line 352 of file expr_cst.cc.

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

b == (v1 == v2)

Definition at line 4522 of file expressions.cc.

IntVar * operations_research::Solver::MakeIsEqualVar ( IntExpr *const   var,
IntExpr v2 
)

status var of (v1 == v2)

Definition at line 4487 of file expressions.cc.

Constraint * operations_research::Solver::MakeEquality ( IntVar *const   left,
IntVar *const   right 
)

left == right

namespace

Definition at line 70 of file range_cst.cc.

Constraint * operations_research::Solver::MakeEquality ( IntExpr *const   expr,
int64  value 
)

expr == value

namespace

Definition at line 82 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeEquality ( IntExpr *const   expr,
int  value 
)

expr == value

Definition at line 87 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsDifferentCstCt ( IntVar *const   v,
int64  c,
IntVar *const   b 
)

b == (v != c)

Definition at line 507 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsDifferentCstVar ( IntVar *const   v,
int64  c 
)

status var of (v != c)

namespace

Definition at line 468 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsDifferentVar ( IntExpr *const   v1,
IntExpr *const   v2 
)

status var of (v1 != v2)

Definition at line 4535 of file expressions.cc.

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

b == (v1 != v2)

Definition at line 4571 of file expressions.cc.

Constraint * operations_research::Solver::MakeNonEquality ( IntVar *const   left,
IntVar *const   right 
)

left != right

namespace

Definition at line 350 of file range_cst.cc.

Constraint * operations_research::Solver::MakeNonEquality ( IntVar *const   expr,
int64  value 
)

expr != value

namespace

Definition at line 290 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeNonEquality ( IntVar *const   expr,
int  value 
)

expr != value

Definition at line 295 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsLessOrEqualCstCt ( IntVar *const   v,
int64  c,
IntVar *const   b 
)

b == (v <= c)

Definition at line 729 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsLessOrEqualCstVar ( IntVar *const   v,
int64  c 
)

status var of (v <= c)

namespace

Definition at line 692 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsLessOrEqualVar ( IntExpr *const   left,
IntExpr *const   right 
)

status var of (left <= right)

Definition at line 4584 of file expressions.cc.

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

b == (left <= right)

Definition at line 4621 of file expressions.cc.

Constraint * operations_research::Solver::MakeLessOrEqual ( IntVar *const   left,
IntVar *const   right 
)

left <= right

namespace

Definition at line 125 of file range_cst.cc.

Constraint * operations_research::Solver::MakeLessOrEqual ( IntExpr *const   expr,
int64  value 
)

expr <= value

namespace

Definition at line 206 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeLessOrEqual ( IntExpr *const   expr,
int  value 
)

expr <= value

Definition at line 211 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsGreaterOrEqualCstCt ( IntVar *const   v,
int64  c,
IntVar *const   b 
)

b == (v >= c)

Definition at line 617 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsGreaterOrEqualCstVar ( IntVar *const   v,
int64  c 
)

status var of (v >= c)

namespace

Definition at line 580 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsGreaterOrEqualVar ( IntExpr *const   left,
IntExpr *const   right 
)

status var of (left >= right)

Definition at line 4682 of file expressions.cc.

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

b == (left >= right)

Definition at line 4687 of file expressions.cc.

Constraint * operations_research::Solver::MakeGreaterOrEqual ( IntVar *const   left,
IntVar *const   right 
)

left >= right

namespace

Definition at line 180 of file range_cst.cc.

Constraint * operations_research::Solver::MakeGreaterOrEqual ( IntExpr *const   expr,
int64  value 
)

expr >= value

namespace

Definition at line 140 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeGreaterOrEqual ( IntExpr *const   expr,
int  value 
)

expr >= value

Definition at line 145 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsGreaterCstCt ( IntVar *const   v,
int64  c,
IntVar *const   b 
)

b == (v > c)

Definition at line 630 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsGreaterCstVar ( IntVar *const   v,
int64  c 
)

status var of (v > c)

Definition at line 613 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsGreaterVar ( IntExpr *const   left,
IntExpr *const   right 
)

status var of (left > right)

Definition at line 4693 of file expressions.cc.

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

b == (left > right)

Definition at line 4698 of file expressions.cc.

Constraint * operations_research::Solver::MakeGreater ( IntVar *const   left,
IntVar *const   right 
)

left > right

namespace

Definition at line 288 of file range_cst.cc.

Constraint * operations_research::Solver::MakeGreater ( IntExpr *const   expr,
int64  value 
)

expr > value

Definition at line 150 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeGreater ( IntExpr *const   expr,
int  value 
)

expr > value

Definition at line 155 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsLessCstCt ( IntVar *const   v,
int64  c,
IntVar *const   b 
)

b == (v < c)

Definition at line 742 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsLessCstVar ( IntVar *const   v,
int64  c 
)

status var of (v < c)

Definition at line 725 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsLessVar ( IntExpr *const   left,
IntExpr *const   right 
)

status var of (left < right)

Definition at line 4633 of file expressions.cc.

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

b == (left < right)

Definition at line 4670 of file expressions.cc.

Constraint * operations_research::Solver::MakeLess ( IntVar *const   left,
IntVar *const   right 
)

left < right

namespace

Definition at line 234 of file range_cst.cc.

Constraint * operations_research::Solver::MakeLess ( IntExpr *const   expr,
int64  value 
)

expr < value

Definition at line 216 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeLess ( IntExpr *const   expr,
int  value 
)

expr < value

Definition at line 221 of file expr_cst.cc.

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

Variation on arrays.

namespace

Definition at line 2567 of file expr_array.cc.

Constraint * operations_research::Solver::MakeSumLessOrEqual ( IntVar *const *  vars,
int  size,
int64  cst 
)

Definition at line 2571 of file expr_array.cc.

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

Definition at line 2581 of file expr_array.cc.

Constraint * operations_research::Solver::MakeSumGreaterOrEqual ( IntVar *const *  vars,
int  size,
int64  cst 
)

Definition at line 2586 of file expr_array.cc.

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

Definition at line 2596 of file expr_array.cc.

Constraint * operations_research::Solver::MakeSumEquality ( IntVar *const *  vars,
int  size,
int64  cst 
)

Definition at line 2600 of file expr_array.cc.

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

Definition at line 2619 of file expr_array.cc.

Constraint * operations_research::Solver::MakeSumEquality ( IntVar *const *  vars,
int  size,
IntVar *const   var 
)

Definition at line 2624 of file expr_array.cc.

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

Definition at line 2634 of file expr_array.cc.

Constraint * operations_research::Solver::MakeScalProdEquality ( IntVar *const *  vars,
int  size,
int64 const *  coefficients,
int64  cst 
)

namespace

Definition at line 2680 of file expr_array.cc.

Constraint * operations_research::Solver::MakeScalProdEquality ( IntVar *const *  vars,
int  size,
int const *  coefficients,
int64  cst 
)

Definition at line 2687 of file expr_array.cc.

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

Definition at line 2644 of file expr_array.cc.

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

Definition at line 2694 of file expr_array.cc.

Constraint * operations_research::Solver::MakeScalProdGreaterOrEqual ( IntVar *const *  vars,
int  size,
int64 const *  coefficients,
int64  cst 
)

namespace

Definition at line 2733 of file expr_array.cc.

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

Definition at line 2704 of file expr_array.cc.

Constraint * operations_research::Solver::MakeScalProdGreaterOrEqual ( IntVar *const *  vars,
int  size,
int const *  coefficients,
int64  cst 
)

Definition at line 2741 of file expr_array.cc.

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

Definition at line 2749 of file expr_array.cc.

Constraint * operations_research::Solver::MakeScalProdLessOrEqual ( IntVar *const *  vars,
int  size,
int64 const *  coefficients,
int64  cst 
)

namespace

Definition at line 2804 of file expr_array.cc.

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

Definition at line 2759 of file expr_array.cc.

Constraint * operations_research::Solver::MakeScalProdLessOrEqual ( IntVar *const *  vars,
int  size,
int const *  coefficients,
int64  cst 
)

Definition at line 2811 of file expr_array.cc.

Demon * operations_research::Solver::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 28 of file constraints.cc.

Demon * operations_research::Solver::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 35 of file constraints.cc.

Demon * operations_research::Solver::MakeCallbackDemon ( Callback1< Solver * > *const   callback  ) 

Creates a demon from a callback.

namespace

Definition at line 78 of file constraints.cc.

Demon * operations_research::Solver::MakeCallbackDemon ( Closure *const   closure  ) 

Creates a demon from a closure.

Definition at line 82 of file constraints.cc.

Constraint * operations_research::Solver::MakeBetweenCt ( IntVar *const   v,
int64  l,
int64  u 
)

(l <= b <= u)

namespace

Definition at line 782 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsBetweenCt ( IntVar *const   v,
int64  l,
int64  u,
IntVar *const   b 
)

b == (l <= v <= u)

namespace

Definition at line 847 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsMemberCt ( IntVar *const   v,
const int64 *const   values,
int  size,
IntVar *const   b 
)

b == (v in set)

namespace

Definition at line 1014 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsMemberCt ( IntVar *const   v,
const std::vector< int64 > &  values,
IntVar *const   b 
)

Definition at line 1026 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsMemberCt ( IntVar *const   v,
const int *const   values,
int  size,
IntVar *const   b 
)

Definition at line 1032 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeIsMemberCt ( IntVar *const   v,
const std::vector< int > &  values,
IntVar *const   b 
)

Definition at line 1044 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsMemberVar ( IntVar *const   v,
const int64 *const   values,
int  size 
)

Definition at line 1050 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsMemberVar ( IntVar *const   v,
const std::vector< int64 > &  values 
)

Definition at line 1058 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsMemberVar ( IntVar *const   v,
const int *const   values,
int  size 
)

Definition at line 1063 of file expr_cst.cc.

IntVar * operations_research::Solver::MakeIsMemberVar ( IntVar *const   v,
const std::vector< int > &  values 
)

Definition at line 1071 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeMemberCt ( IntVar *const   v,
const int64 *const   values,
int  size 
)

v in set.

namespace

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

Definition at line 899 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeMemberCt ( IntVar *const   v,
const std::vector< int64 > &  values 
)

Definition at line 907 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeMemberCt ( IntVar *const   v,
const int *const   values,
int  size 
)

Definition at line 912 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeMemberCt ( IntVar *const   v,
const std::vector< int > &  values 
)

Definition at line 920 of file expr_cst.cc.

Constraint * operations_research::Solver::MakeCount ( const std::vector< IntVar * > &  v,
int64  value,
int64  count 
)

|{i | v[i] == value}| == count

namespace

Definition at line 195 of file count_cst.cc.

Constraint * operations_research::Solver::MakeCount ( const std::vector< IntVar * > &  v,
int64  value,
IntVar *const  count 
)

|{i | v[i] == value}| == count

namespace

Definition at line 387 of file count_cst.cc.

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

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

namespace

Factory

Definition at line 1107 of file count_cst.cc.

Constraint * operations_research::Solver::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 1138 of file count_cst.cc.

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

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

Definition at line 1169 of file count_cst.cc.

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

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

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

Definition at line 1184 of file count_cst.cc.

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

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

namespace

Definition at line 427 of file deviation.cc.

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

All variables are pairwise different.

namespace

This corresponds to the stronger version of the propagation algorithm.

Definition at line 426 of file alldiff_cst.cc.

Constraint * operations_research::Solver::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 430 of file alldiff_cst.cc.

Constraint * operations_research::Solver::MakeAllDifferent ( const IntVar *const *  vars,
int  size,
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 435 of file alldiff_cst.cc.

Constraint * operations_research::Solver::MakeNoCycle ( const std::vector< IntVar * > &  nexts,
const std::vector< IntVar * > &  active,
ResultCallback1< bool, int64 > *  sink_handler = NULL 
)

Prevent cycles, nexts variables representing 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 'next' variables represent paths (and performs a faster propagation); otherwise the constraint assumes the 'next' variables represent a forest.

Definition at line 574 of file constraints.cc.

Constraint * operations_research::Solver::MakeNoCycle ( const IntVar *const *  nexts,
const IntVar *const *  active,
int  size,
ResultCallback1< bool, int64 > *  sink_handler = NULL 
)

Definition at line 580 of file constraints.cc.

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

namespace

Definition at line 544 of file constraints.cc.

Constraint * operations_research::Solver::MakeNoCycle ( const IntVar *const *  nexts,
const IntVar *const *  active,
int  size,
ResultCallback1< bool, int64 > *  sink_handler,
bool  assume_paths 
)

Definition at line 556 of file constraints.cc.

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

Accumulate values along a path such that: cumuls[next[i]] = cumuls[i] + transits[i].

namespace

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 814 of file constraints.cc.

Constraint * operations_research::Solver::MakePathCumul ( const IntVar *const *  nexts,
const IntVar *const *  active,
const IntVar *const *  cumuls,
const IntVar *const *  transits,
int  next_size,
int  cumul_size 
)

Definition at line 827 of file constraints.cc.

Constraint * operations_research::Solver::MakeMapDomain ( IntVar *const   var,
IntVar *const *  vars,
int  size 
)

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

namespace

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

Definition at line 273 of file constraints.cc.

Constraint * operations_research::Solver::MakeMapDomain ( IntVar *const   var,
const std::vector< IntVar * > &  vars 
)

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

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

Definition at line 278 of file constraints.cc.

Constraint * operations_research::Solver::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.

namespace

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

Definition at line 824 of file table.cc.

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

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

namespace

It uses a transition table called 'transitions'. 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 948 of file table.cc.

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

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

It uses a transition table called 'transitions'. 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 960 of file table.cc.

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

Packing constraint.

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 1345 of file pack.cc.

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

scheduling objects

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 1468 of file interval.cc.

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

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

Definition at line 1488 of file interval.cc.

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

Creates an fixed and performed interval.

Definition at line 1462 of file interval.cc.

IntervalVar * operations_research::Solver::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.

namespace

Definition at line 93 of file interval.cc.

IntervalVar * operations_research::Solver::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 methods 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 280 of file interval.cc.

IntervalVar * operations_research::Solver::MakeIntervalRelaxedMax ( IntervalVar *const   interval_var  ) 

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

namespace

Relaxing means making unbounded when optional. If the variable is non optional, this methods 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 to implement propagators that may only modify the start min or end min.

Definition at line 271 of file interval.cc.

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

scheduling constraints

namespace

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

Definition at line 128 of file timetabling.cc.

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

This method creates a relation between two an interval vars.

namespace

Definition at line 260 of file timetabling.cc.

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

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

namespace

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

Definition at line 433 of file timetabling.cc.

Constraint * operations_research::Solver::MakeTemporalDisjunction ( IntervalVar *const   t1,
IntervalVar *const   t2 
)

This constraint implements a temporal disjunction between two interval vars.

Definition at line 439 of file timetabling.cc.

Constraint * operations_research::Solver::MakeDisjunctiveConstraint ( const std::vector< IntervalVar * > &  intervals  ) 

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

namespace

Sequence Constraint

Definition at line 1727 of file resource.cc.

SequenceVar * operations_research::Solver::MakeSequenceVar ( const std::vector< IntervalVar * > &  intervals,
const string &  name 
)

The sequence variable is used to rank disjoint intervals.

Factory methods.

It will post a SequenceConstraint upon creation.

Definition at line 2153 of file resource.cc.

Constraint * operations_research::Solver::MakeCumulative ( const std::vector< IntervalVar * > &  intervals,
const std::vector< int64 > &  demands,
int64  capacity,
const 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 2161 of file resource.cc.

Constraint * operations_research::Solver::MakeCumulative ( const std::vector< IntervalVar * > &  intervals,
const std::vector< int > &  demands,
int64  capacity,
const 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 2177 of file resource.cc.

Assignment * operations_research::Solver::MakeAssignment (  ) 

Assignments.

This method creates an empty assignment.

Definition at line 1097 of file assignment.cc.

Assignment * operations_research::Solver::MakeAssignment ( const Assignment *const   a  ) 

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

Definition at line 1101 of file assignment.cc.

SolutionCollector * operations_research::Solver::MakeFirstSolutionCollector ( const Assignment *const   assignment  ) 

Solution Collectors.

namespace

Collect the first solution of the search.

Definition at line 2241 of file search.cc.

SolutionCollector * operations_research::Solver::MakeFirstSolutionCollector (  ) 

Collect the first solution of the search.

The variables will need to be added later.

Definition at line 2246 of file search.cc.

SolutionCollector * operations_research::Solver::MakeLastSolutionCollector ( const Assignment *const   assignment  ) 

Collect the last solution of the search.

namespace

Definition at line 2288 of file search.cc.

SolutionCollector * operations_research::Solver::MakeLastSolutionCollector (  ) 

Collect the last solution of the search.

The variables will need to be added later.

Definition at line 2293 of file search.cc.

SolutionCollector * operations_research::Solver::MakeBestValueSolutionCollector ( const Assignment *const   assignment,
bool  maximize 
)

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

namespace

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

Definition at line 2361 of file search.cc.

SolutionCollector * operations_research::Solver::MakeBestValueSolutionCollector ( bool  maximize  ) 

Collect the solution corresponding to the optimal value of the objective of 'a'; if 'a' 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 2366 of file search.cc.

SolutionCollector * operations_research::Solver::MakeAllSolutionCollector ( const Assignment *const   assignment  ) 

Collect all solutions of the search.

namespace

Definition at line 2406 of file search.cc.

SolutionCollector * operations_research::Solver::MakeAllSolutionCollector (  ) 

Collect all solutions of the search.

The variables will need to be added later.

Definition at line 2410 of file search.cc.

OptimizeVar * operations_research::Solver::MakeMinimize ( IntVar *const   v,
int64  step 
)

Objective.

Creates a minimization objective.

Definition at line 2505 of file search.cc.

OptimizeVar * operations_research::Solver::MakeMaximize ( IntVar *const   v,
int64  step 
)

Creates a maximization objective.

Definition at line 2509 of file search.cc.

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

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

Definition at line 2513 of file search.cc.

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

Creates a minimization weighted objective.

The actual objective is scalar_prod(vars, weights).

Definition at line 2593 of file search.cc.

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

Creates a minimization weighted objective.

The actual objective is scalar_prod(vars, weights).

Definition at line 2621 of file search.cc.

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

Creates a maximization weigthed objective.

Definition at line 2602 of file search.cc.

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

Creates a maximization weigthed objective.

Definition at line 2630 of file search.cc.

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

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

namespace

Definition at line 2583 of file search.cc.

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

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

Definition at line 2611 of file search.cc.

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

Meta-heuristics Search monitors which try to get the search out of local optima.

namespace

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

Definition at line 2904 of file search.cc.

SearchMonitor * operations_research::Solver::MakeTabuSearch ( bool  maximize,
IntVar *const   v,
int64  step,
const IntVar *const *  vars,
int  size,
int64  keep_tenure,
int64  forbid_tenure,
double  tabu_factor 
)

Definition at line 2922 of file search.cc.

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

Creates a Simulated Annealing monitor.

namespace

Todo:
TODO(user): document behavior

Definition at line 3023 of file search.cc.

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

Creates a Guided Local Search monitor.

namespace

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

Definition at line 3626 of file search.cc.

SearchMonitor * operations_research::Solver::MakeGuidedLocalSearch ( bool  maximize,
IntVar *const   objective,
IndexEvaluator2 objective_function,
int64  step,
const IntVar *const *  vars,
int  size,
double  penalty_factor 
)

Definition at line 3642 of file search.cc.

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

Definition at line 3660 of file search.cc.

SearchMonitor * operations_research::Solver::MakeGuidedLocalSearch ( bool  maximize,
IntVar *const   objective,
IndexEvaluator3 objective_function,
int64  step,
const IntVar *const *  vars,
const IntVar *const *  secondary_vars,
int  size,
double  penalty_factor 
)

Definition at line 3678 of file search.cc.

SearchMonitor * operations_research::Solver::MakeLubyRestart ( int  scale_factor  ) 

Restart Search.

namespace

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 4409 of file search.cc.

SearchMonitor * operations_research::Solver::MakeConstantRestart ( int  frequency  ) 

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

namespace

Definition at line 4442 of file search.cc.

SearchLimit * operations_research::Solver::MakeTimeLimit ( int64  time_in_ms  ) 

Search Limit.

namespace

Creates a search limit that constrains the running time given in milliseconds.

Definition at line 3931 of file search.cc.

SearchLimit * operations_research::Solver::MakeBranchesLimit ( int64  branches  ) 

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

Definition at line 3935 of file search.cc.

SearchLimit * operations_research::Solver::MakeFailuresLimit ( int64  failures  ) 

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

Definition at line 3939 of file search.cc.

SearchLimit * operations_research::Solver::MakeSolutionsLimit ( int64  solutions  ) 

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

Definition at line 3943 of file search.cc.

SearchLimit * operations_research::Solver::MakeLimit ( int64  time,
int64  branches,
int64  failures,
int64  solutions 
)

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

Definition at line 3947 of file search.cc.

SearchLimit * operations_research::Solver::MakeLimit ( int64  time,
int64  branches,
int64  failures,
int64  solutions,
bool  smart_time_check 
)

Version reducing calls to wall timer by estimating number of remaining calls.

Definition at line 3954 of file search.cc.

SearchLimit * operations_research::Solver::MakeLimit ( int64  time,
int64  branches,
int64  failures,
int64  solutions,
bool  smart_time_check,
bool  cumulative 
)

Creates a search limit which can either apply cumulatively or search-by-search.

Definition at line 3963 of file search.cc.

SearchLimit * operations_research::Solver::MakeLimit ( const SearchLimitProto &  proto  ) 

Creates a search limit from its protobuf description.

Definition at line 3978 of file search.cc.

SearchLimit * operations_research::Solver::MakeLimit ( SearchLimit *const   limit_1,
SearchLimit *const   limit_2 
)

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

namespace

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

Definition at line 4054 of file search.cc.

void operations_research::Solver::UpdateLimits ( int64  time,
int64  branches,
int64  failures,
int64  solutions,
SearchLimit limit 
)

Definition at line 4059 of file search.cc.

int64 operations_research::Solver::GetTime ( SearchLimit limit  ) 

Returns 'time' limit of search limit.

Definition at line 4070 of file search.cc.

SearchLimit * operations_research::Solver::MakeCustomLimit ( ResultCallback< bool > *  limiter  ) 

Callback-based search limit.

namespace

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

Definition at line 4120 of file search.cc.

NoGoodManager * operations_research::Solver::MakeNoGoodManager (  ) 

No Goods.

namespace

Creates a non-reversible nogood manager to store and use nogoods during search. Nogoods are defined by the NoGood class. It can be used during search with restart to avoid revisiting the same portion of the search tree.

API

Definition at line 208 of file nogoods.cc.

SearchMonitor * operations_research::Solver::MakeTreeMonitor ( const IntVar *const *  vars,
int  size,
const string &  file_tree,
const string &  file_visualization 
)

Tree Monitor Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.

API.

The XML data is written to files file_tree and file_visualization as the search finishes.

Definition at line 795 of file tree_monitor.cc.

SearchMonitor * operations_research::Solver::MakeTreeMonitor ( const std::vector< IntVar * > &  vars,
const string &  file_tree,
const string &  file_visualization 
)

Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.

The XML data is written to files file_tree and file_visualization as the search finishes.

Definition at line 802 of file tree_monitor.cc.

SearchMonitor * operations_research::Solver::MakeTreeMonitor ( const IntVar *const *  vars,
int  size,
const string &  file_config,
const string &  file_tree,
const string &  file_visualization 
)

Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.

The XML data is written to files file_config, file_tree and file_visualization as the search finishes.

Definition at line 809 of file tree_monitor.cc.

SearchMonitor * operations_research::Solver::MakeTreeMonitor ( const std::vector< IntVar * > &  vars,
const string &  file_config,
const string &  file_tree,
const string &  file_visualization 
)

Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.

The XML data is written to files file_config, file_tree and file_visualization as the search finishes.

Definition at line 817 of file tree_monitor.cc.

SearchMonitor * operations_research::Solver::MakeTreeMonitor ( const IntVar *const *  vars,
int  size,
string *const   tree_xml,
string *const   visualization_xml 
)

Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.

The XML data is copied to tree_xml and visualization_xml as the search finishes. The tree monitor does not take ownership of either string.

Definition at line 825 of file tree_monitor.cc.

SearchMonitor * operations_research::Solver::MakeTreeMonitor ( const std::vector< IntVar * > &  vars,
string *const   tree_xml,
string *const   visualization_xml 
)

Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.

The XML data is copied to tree_xml and visualization_xml as the search finishes. The tree monitor does not take ownership of either string.

Definition at line 832 of file tree_monitor.cc.

SearchMonitor * operations_research::Solver::MakeTreeMonitor ( const IntVar *const *  vars,
int  size,
string *const   config_xml,
string *const   tree_xml,
string *const   visualization_xml 
)

Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.

The XML data is copied to config_xml, tree_xml and visualization_xml as the search finishes. The tree monitor does not take ownership of these strings.

Definition at line 839 of file tree_monitor.cc.

SearchMonitor * operations_research::Solver::MakeTreeMonitor ( const std::vector< IntVar * > &  vars,
string *const   config_xml,
string *const   tree_xml,
string *const   visualization_xml 
)

Creates a tree monitor that outputs a detailed overview of the decision phase in cpviz format.

The XML data is copied to config_xml, tree_xml and visualization_xml as the search finishes. The tree monitor does not take ownership of these strings. if !defined(SWIG)

Definition at line 847 of file tree_monitor.cc.

SearchMonitor * operations_research::Solver::MakeSearchLog ( int  branch_count  ) 

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

Todo:
TODO(user): DEPRECATE API of MakeSearchLog(.., IntVar* var,..).

Definition at line 271 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSearchLog ( int  branch_count,
IntVar *const   objective 
)

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

Definition at line 275 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSearchLog ( int  branch_count,
ResultCallback< string > *  display_callback 
)

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

Definition at line 279 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSearchLog ( int  branch_count,
IntVar objective,
ResultCallback< string > *  display_callback 
)

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

Definition at line 284 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSearchLog ( int  branch_count,
OptimizeVar *const   objective 
)

OptimizeVar Search Logs At each solution, this monitor will also display the objective->Print().

Definition at line 289 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSearchLog ( int  branch_count,
OptimizeVar *const   objective,
ResultCallback< string > *  display_callback 
)

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

Definition at line 293 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSearchTrace ( const string &  prefix  ) 

Search Trace.

namespace

Creates a search monitor that will trace precisely the behavior of the search. Use this only for low level debugging.

Definition at line 364 of file search.cc.

ModelVisitor * operations_research::Solver::MakePrintModelVisitor (  ) 

ModelVisitor.

namespace

Prints the model.

Definition at line 464 of file utilities.cc.

ModelVisitor * operations_research::Solver::MakeStatisticsModelVisitor (  ) 

Displays some nice statistics on the model.

namespace

Definition at line 678 of file utilities.cc.

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

Symmetry Breaking.

API.

Definition at line 4583 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSymmetryManager ( SymmetryBreaker *const *  visitors,
int  size 
)

Definition at line 4588 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSymmetryManager ( SymmetryBreaker *const   v1  ) 

Definition at line 4593 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSymmetryManager ( SymmetryBreaker *const   v1,
SymmetryBreaker *const   v2 
)

Definition at line 4599 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSymmetryManager ( SymmetryBreaker *const   v1,
SymmetryBreaker *const   v2,
SymmetryBreaker *const   v3 
)

Definition at line 4607 of file search.cc.

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

Definition at line 4617 of file search.cc.

SearchMonitor * operations_research::Solver::MakeSimplexConnection ( Callback1< MPSolver * > *const   builder,
Callback1< MPSolver * > *const   modifier,
Callback1< MPSolver * > *const   runner,
int  frequency 
)

Simplex Connection.

namespace

if !defined(SWIG)

API

Definition at line 645 of file hybrid.cc.

SearchMonitor * operations_research::Solver::MakeSimplexConstraint ( int  simplex_frequency  ) 

Linear Relaxation Constraint.

Creates a search monitor that will maintain a linear relaxation of the problem. Every 'simplex_frequency' nodes explored in the search tree, this linear relaxation will be called and the resulting optimal solution found by the simplex will be used to prune the objective of the constraint programming model.

Definition at line 657 of file hybrid.cc.

Decision * operations_research::Solver::MakeAssignVariableValue ( IntVar *const   var,
int64  value 
)

Search Decicions and Decision Builders.

namespace

Decisions

Definition at line 1426 of file search.cc.

Decision * operations_research::Solver::MakeVariableLessOrEqualValue ( IntVar *const   var,
int64  value 
)

Definition at line 1531 of file search.cc.

Decision * operations_research::Solver::MakeVariableGreaterOrEqualValue ( IntVar *const   var,
int64  value 
)

Definition at line 1535 of file search.cc.

Decision * operations_research::Solver::MakeSplitVariableDomain ( IntVar *const   var,
int64  value,
bool  start_with_lower_half 
)

namespace

Definition at line 1525 of file search.cc.

Decision * operations_research::Solver::MakeAssignVariableValueOrFail ( IntVar *const   var,
int64  value 
)

namespace

Definition at line 1468 of file search.cc.

Decision * operations_research::Solver::MakeAssignVariablesValues ( const IntVar *const *  vars,
int  size,
const int64 *const   values 
)

namespace

Definition at line 1611 of file search.cc.

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

Definition at line 1616 of file search.cc.

Decision * operations_research::Solver::MakeFailDecision (  ) 

namespace

Definition at line 1349 of file constraint_solver.cc.

DecisionBuilder * operations_research::Solver::Compose ( DecisionBuilder *const   db1,
DecisionBuilder *const   db2 
)

Creates a decision builder which sequentially composes decision builders.

namespace

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 464 of file search.cc.

DecisionBuilder * operations_research::Solver::Compose ( DecisionBuilder *const   db1,
DecisionBuilder *const   db2,
DecisionBuilder *const   db3 
)

Definition at line 472 of file search.cc.

DecisionBuilder * operations_research::Solver::Compose ( DecisionBuilder *const   db1,
DecisionBuilder *const   db2,
DecisionBuilder *const   db3,
DecisionBuilder *const   db4 
)

Definition at line 482 of file search.cc.

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

Definition at line 494 of file search.cc.

DecisionBuilder * operations_research::Solver::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.

namespace

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.

Todo:
TODO(user): The search tree can be balanced by using binary "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 587 of file search.cc.

DecisionBuilder * operations_research::Solver::Try ( DecisionBuilder *const   db1,
DecisionBuilder *const   db2,
DecisionBuilder *const   db3 
)

Definition at line 595 of file search.cc.

DecisionBuilder * operations_research::Solver::Try ( DecisionBuilder *const   db1,
DecisionBuilder *const   db2,
DecisionBuilder *const   db3,
DecisionBuilder *const   db4 
)

Definition at line 605 of file search.cc.

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

Definition at line 617 of file search.cc.

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

Phases on IntVar arrays.

Definition at line 1779 of file search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const IntVar *const *  vars,
int  size,
Solver::IntVarStrategy  var_str,
Solver::IntValueStrategy  val_str 
)

Definition at line 1785 of file search.cc.

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

Definition at line 1803 of file search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const IntVar *const *  vars,
int  size,
IndexEvaluator1 var_evaluator,
Solver::IntValueStrategy  val_str 
)

Definition at line 1809 of file search.cc.

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

Definition at line 1825 of file search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const IntVar *const *  vars,
int  size,
Solver::IntVarStrategy  var_str,
IndexEvaluator2 val_eval 
)

Definition at line 1832 of file search.cc.

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

Definition at line 1852 of file search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const IntVar *const *  vars,
int  size,
IndexEvaluator1 var_evaluator,
IndexEvaluator2 val_eval 
)

Definition at line 1859 of file search.cc.

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

Definition at line 1877 of file search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const IntVar *const *  vars,
int  size,
Solver::IntVarStrategy  var_str,
IndexEvaluator2 val_eval,
IndexEvaluator1 tie_breaker 
)

Definition at line 1886 of file search.cc.

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

Definition at line 1907 of file search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const IntVar *const *  vars,
int  size,
IndexEvaluator1 var_evaluator,
IndexEvaluator2 val_eval,
IndexEvaluator1 tie_breaker 
)

Definition at line 1916 of file search.cc.

DecisionBuilder * operations_research::Solver::MakeDefaultPhase ( const IntVar *const *  vars,
int  size 
)

Definition at line 1146 of file default_search.cc.

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

namespace

API

Definition at line 1125 of file default_search.cc.

DecisionBuilder * operations_research::Solver::MakeDefaultPhase ( const IntVar *const *  vars,
int  size,
const DefaultPhaseParameters parameters 
)

Definition at line 1136 of file default_search.cc.

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

Definition at line 1130 of file default_search.cc.

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

shortcuts for small arrays.

namespace

Definition at line 1735 of file search.cc.

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

Definition at line 1743 of file search.cc.

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

Definition at line 1753 of file search.cc.

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

Definition at line 1765 of file search.cc.

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

Scheduling Decisions.

namespace

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 406 of file sched_search.cc.

Decision * operations_research::Solver::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 419 of file sched_search.cc.

Decision * operations_research::Solver::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 425 of file sched_search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const std::vector< IntVar * > &  vars,
IndexEvaluator2 evaluator,
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 1935 of file search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const IntVar *const *  vars,
int  size,
IndexEvaluator2 evaluator,
Solver::EvaluatorStrategy  str 
)

Definition at line 1941 of file search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const std::vector< IntVar * > &  vars,
IndexEvaluator2 evaluator,
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 1948 of file search.cc.

DecisionBuilder * operations_research::Solver::MakePhase ( const IntVar *const *  vars,
int  size,
IndexEvaluator2 evaluator,
IndexEvaluator1 tie_breaker,
Solver::EvaluatorStrategy  str 
)

Definition at line 1955 of file search.cc.

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

Scheduling phases.

Definition at line 414 of file sched_search.cc.

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

Definition at line 430 of file sched_search.cc.

DecisionBuilder * operations_research::Solver::MakeDecisionBuilderFromAssignment ( Assignment *const   assignment,
DecisionBuilder *const   db,
const IntVar *const *  vars,
int  size 
)

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

namespace

Definition at line 2029 of file search.cc.

DecisionBuilder * operations_research::Solver::MakeConstraintAdder ( Constraint *const   ct  ) 

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

namespace

Definition at line 2377 of file constraint_solver.cc.

DecisionBuilder * operations_research::Solver::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.

namespace

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

Definition at line 4162 of file search.cc.

DecisionBuilder * operations_research::Solver::MakeSolveOnce ( DecisionBuilder *const   db,
SearchMonitor *const   monitor1 
)

Definition at line 4166 of file search.cc.

DecisionBuilder * operations_research::Solver::MakeSolveOnce ( DecisionBuilder *const   db,
SearchMonitor *const   monitor1,
SearchMonitor *const   monitor2 
)

Definition at line 4173 of file search.cc.

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

Definition at line 4182 of file search.cc.

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

Definition at line 4193 of file search.cc.

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

Definition at line 4206 of file search.cc.

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

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

namespace

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 returns NULL.

Definition at line 4287 of file search.cc.

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

Definition at line 4294 of file search.cc.

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

Definition at line 4304 of file search.cc.

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

Definition at line 4316 of file search.cc.

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

Definition at line 4330 of file search.cc.

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

Definition at line 4346 of file search.cc.

DecisionBuilder * operations_research::Solver::MakeRestoreAssignment ( Assignment assignment  ) 

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

namespace

Definition at line 1147 of file assignment.cc.

DecisionBuilder * operations_research::Solver::MakeStoreAssignment ( Assignment assignment  ) 

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

Definition at line 1151 of file assignment.cc.

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

Local Search Operators.

Operator factory.

Definition at line 2037 of file local_search.cc.

LocalSearchOperator * operations_research::Solver::MakeOperator ( const IntVar *const *  vars,
int  size,
Solver::LocalSearchOperators  op 
)

Definition at line 2042 of file local_search.cc.

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

Definition at line 2048 of file local_search.cc.

LocalSearchOperator * operations_research::Solver::MakeOperator ( const IntVar *const *  vars,
const IntVar *const *  secondary_vars,
int  size,
Solver::LocalSearchOperators  op 
)

Definition at line 2054 of file local_search.cc.

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

Todo:
TODO(user): Make the callback an IndexEvaluator2 when there are no secondary variables.

Definition at line 2145 of file local_search.cc.

LocalSearchOperator * operations_research::Solver::MakeOperator ( const IntVar *const *  vars,
int  size,
Solver::IndexEvaluator3 *const  evaluator,
Solver::EvaluatorLocalSearchOperators  op 
)

Definition at line 2152 of file local_search.cc.

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

Definition at line 2160 of file local_search.cc.

LocalSearchOperator * operations_research::Solver::MakeOperator ( const IntVar *const *  vars,
const IntVar *const *  secondary_vars,
int  size,
Solver::IndexEvaluator3 *const  evaluator,
Solver::EvaluatorLocalSearchOperators  op 
)

Definition at line 2172 of file local_search.cc.

LocalSearchOperator * operations_research::Solver::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).

namespace

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 472 of file local_search.cc.

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

Definition at line 477 of file local_search.cc.

LocalSearchOperator * operations_research::Solver::MakeRandomLNSOperator ( const IntVar *const *  vars,
int  size,
int  number_of_variables 
)

Definition at line 486 of file local_search.cc.

LocalSearchOperator * operations_research::Solver::MakeRandomLNSOperator ( const IntVar *const *  vars,
int  size,
int  number_of_variables,
int32  seed 
)

Definition at line 495 of file local_search.cc.

LocalSearchOperator * operations_research::Solver::MakeMoveTowardTargetOperator ( const Assignment target  ) 

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

namespace

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 568 of file local_search.cc.

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

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

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

Definition at line 584 of file local_search.cc.

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

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

namespace

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 overriden by setting restart to true to force the exploration to start from the first operator in the vector. The default behavior can also be overriden using an evaluation callback to set the order in which the operators are explored (the callback is called in LocalSearchOperator::Start()). The first argument of the callback is the index of the operator which produced the last move, the second argument is the index of the operator to be evaluated. Ownership of the callback is taken by ConcatenateOperators.

Example:

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

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

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

Definition at line 1960 of file local_search.cc.

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

Definition at line 1965 of file local_search.cc.

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

Definition at line 1980 of file local_search.cc.

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

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

namespace

Definition at line 2030 of file local_search.cc.

LocalSearchOperator * operations_research::Solver::MakeNeighborhoodLimit ( LocalSearchOperator *const   op,
int64  limit 
)

Creates a local search operator that wraps another local search operator and limits the number of neighbors explored (i.e.

namespace

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 1841 of file local_search.cc.

DecisionBuilder * operations_research::Solver::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.

Todo:
TODO(user): Make a variant which runs a local search after each solution found in a dfs

Definition at line 3318 of file local_search.cc.

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

Definition at line 3329 of file local_search.cc.

DecisionBuilder * operations_research::Solver::MakeLocalSearchPhase ( IntVar *const *  vars,
int  size,
DecisionBuilder *const  first_solution,
LocalSearchPhaseParameters *const  parameters 
)

Definition at line 3339 of file local_search.cc.

SolutionPool * operations_research::Solver::MakeDefaultSolutionPool (  ) 

Solution Pool.

namespace

Definition at line 3314 of file local_search.cc.

LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters ( LocalSearchOperator *const   ls_operator,
DecisionBuilder *const   sub_decision_builder 
)

Local Search Phase Parameters.

Definition at line 2940 of file local_search.cc.

LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters ( LocalSearchOperator *const   ls_operator,
DecisionBuilder *const   sub_decision_builder,
SearchLimit *const   limit 
)

Definition at line 2950 of file local_search.cc.

LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters ( LocalSearchOperator *const   ls_operator,
DecisionBuilder *const   sub_decision_builder,
SearchLimit *const   limit,
const std::vector< LocalSearchFilter * > &  filters 
)

Definition at line 2961 of file local_search.cc.

LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters ( SolutionPool *const   pool,
LocalSearchOperator *const   ls_operator,
DecisionBuilder *const   sub_decision_builder 
)

Definition at line 2973 of file local_search.cc.

LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters ( SolutionPool *const   pool,
LocalSearchOperator *const   ls_operator,
DecisionBuilder *const   sub_decision_builder,
SearchLimit *const   limit 
)

Definition at line 2984 of file local_search.cc.

LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters ( SolutionPool *const   pool,
LocalSearchOperator *const   ls_operator,
DecisionBuilder *const   sub_decision_builder,
SearchLimit *const   limit,
const std::vector< LocalSearchFilter * > &  filters 
)

Definition at line 2996 of file local_search.cc.

LocalSearchFilter * operations_research::Solver::MakeVariableDomainFilter (  ) 

Local Search Filters.

namespace

Definition at line 2317 of file local_search.cc.

LocalSearchFilter * operations_research::Solver::MakeLocalSearchObjectiveFilter ( const IntVar *const *  vars,
int  size,
Solver::IndexEvaluator2 *const  values,
const IntVar *const   objective,
Solver::LocalSearchFilterBound  filter_enum,
Solver::LocalSearchOperation  op_enum 
)

namespace

Definition at line 2690 of file local_search.cc.

LocalSearchFilter * operations_research::Solver::MakeLocalSearchObjectiveFilter ( const std::vector< IntVar * > &  vars,
Solver::IndexEvaluator2 *const  values,
const IntVar *const   objective,
Solver::LocalSearchFilterBound  filter_enum,
Solver::LocalSearchOperation  op_enum 
)

Definition at line 2705 of file local_search.cc.

LocalSearchFilter * operations_research::Solver::MakeLocalSearchObjectiveFilter ( const IntVar *const *  vars,
const IntVar *const *  secondary_vars,
int  size,
ResultCallback3< int64, int64, int64, int64 > *const  values,
const IntVar *const   objective,
Solver::LocalSearchFilterBound  filter_enum,
Solver::LocalSearchOperation  op_enum 
)

Definition at line 2719 of file local_search.cc.

void operations_research::Solver::TopPeriodicCheck (  ) 

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

Definition at line 1532 of file constraint_solver.cc.

int operations_research::Solver::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 1536 of file constraint_solver.cc.

void operations_research::Solver::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 1540 of file constraint_solver.cc.

void operations_research::Solver::PopState (  ) 

Definition at line 1545 of file constraint_solver.cc.

int operations_research::Solver::SearchDepth (  )  const

Gets the search depth of the current active search.

Returns -1 in case there are no active search opened.

Definition at line 1076 of file constraint_solver.cc.

int operations_research::Solver::SearchLeftDepth (  )  const

Gets the search left depth of the current active search.

Returns -1 in case there are no active search opened.

Definition at line 1080 of file constraint_solver.cc.

int operations_research::Solver::SolveDepth (  )  const

Gets the number of nested searches.

It returns 0 outside search, 1 during the top level search, 2 if one level of NestedSolve() is used, and more if more solves are nested.

Definition at line 1072 of file constraint_solver.cc.

void operations_research::Solver::SetBranchSelector ( ResultCallback1< Solver::DecisionModification, Solver * > *const   bs  ) 

Sets the given branch selector on the current active search.

Definition at line 1056 of file constraint_solver.cc.

DecisionBuilder * operations_research::Solver::MakeApplyBranchSelector ( ResultCallback1< Solver::DecisionModification, Solver * > *const   bs  ) 

Creates a decision builder that will set the branch selector.

Definition at line 1067 of file constraint_solver.cc.

template<class T>
void operations_research::Solver::SaveAndSetValue ( T *  adr,
val 
) [inline]

All-in-one SaveAndSetValue.

Definition at line 2740 of file constraint_solver.h.

template<class T>
void operations_research::Solver::SaveAndAdd ( T *  adr,
val 
) [inline]

All-in-one SaveAndAdd_value.

Definition at line 2748 of file constraint_solver.h.

int64 operations_research::Solver::Rand64 ( int64  size  )  [inline]

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

Definition at line 2756 of file constraint_solver.h.

int32 operations_research::Solver::Rand32 ( int32  size  )  [inline]

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

Definition at line 2761 of file constraint_solver.h.

void operations_research::Solver::ReSeed ( int32  seed  )  [inline]

Reseed the solver random generator.

Definition at line 2766 of file constraint_solver.h.

void operations_research::Solver::AddFailHook ( Action a  ) 

Adds a fail hook, that is an action that will be called after each failure.

Definition at line 1607 of file constraint_solver.cc.

void operations_research::Solver::ExportProfilingOverview ( const string &  filename  ) 

Exports the profiling information in a human readable overview.

The parameter profile_level used to create the solver must be different from NO_PROFILING.

Definition at line 427 of file demon_profiler.cc.

bool operations_research::Solver::CurrentlyInSolve (  )  const

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

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

Definition at line 1776 of file constraint_solver.cc.

int operations_research::Solver::constraints (  )  const [inline]

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

Definition at line 2785 of file constraint_solver.h.

void operations_research::Solver::Accept ( ModelVisitor *const   visitor  )  const

Accepts the given model visitor.

Definition at line 1692 of file constraint_solver.cc.

void operations_research::Solver::Accept ( ModelVisitor *const   visitor,
const std::vector< SearchMonitor * > &  monitors 
) const

Accepts the given model visitor.

Definition at line 1697 of file constraint_solver.cc.

Decision* operations_research::Solver::balancing_decision (  )  const [inline]

Definition at line 2794 of file constraint_solver.h.

void operations_research::Solver::set_fail_intercept ( Closure *const   c  )  [inline]

Internal set_fail_intercept does not take ownership of the closure.

Definition at line 2798 of file constraint_solver.h.

void operations_research::Solver::clear_fail_intercept (  )  [inline]

Definition at line 2799 of file constraint_solver.h.

DemonProfiler* operations_research::Solver::demon_profiler (  )  const [inline]

Access to demon profiler.

Definition at line 2801 of file constraint_solver.h.

bool operations_research::Solver::HasName ( const PropagationBaseObject object  )  const

Returns whether the object has been named or not.

Definition at line 2520 of file constraint_solver.cc.

Demon * operations_research::Solver::RegisterDemon ( Demon *const   d  ) 

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

Definition at line 451 of file demon_profiler.cc.

IntExpr * operations_research::Solver::RegisterIntExpr ( IntExpr *const   expr  ) 

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

namespace

Definition at line 873 of file trace.cc.

IntVar * operations_research::Solver::RegisterIntVar ( IntVar *const   var  ) 

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

Definition at line 885 of file trace.cc.

IntervalVar * operations_research::Solver::RegisterIntervalVar ( IntervalVar *const   var  ) 

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

Definition at line 894 of file trace.cc.

Search * operations_research::Solver::ActiveSearch (  )  const

Returns the active search, NULL outside search.

Definition at line 1007 of file constraint_solver.cc.

ModelCache * operations_research::Solver::Cache (  )  const

Returns the cache of the model.

Definition at line 701 of file model_cache.cc.

bool operations_research::Solver::InstrumentsDemons (  )  const

Returns whether we are instrumenting demons.

Todo:
TODO(user): remove this complex logic. We need the double test because parameters are set too late when using python in the open source. This is the cheapest work-around.

Definition at line 89 of file constraint_solver.cc.

bool operations_research::Solver::IsProfilingEnabled (  )  const

Returns whether we are profiling the solver.

Definition at line 93 of file constraint_solver.cc.

bool operations_research::Solver::InstrumentsVariables (  )  const

Returns whether we are tracing variables.

Definition at line 98 of file constraint_solver.cc.

bool operations_research::Solver::NameAllVariables (  )  const

Returns whether all variables should be named.

Definition at line 103 of file constraint_solver.cc.

string operations_research::Solver::model_name (  )  const

Returns the name of the model.

Definition at line 1371 of file constraint_solver.cc.

DependencyGraph * operations_research::Solver::Graph (  )  const

Returns the dependency graph of the solver.

Definition at line 339 of file dependency_graph.cc.

PropagationMonitor * operations_research::Solver::GetPropagationMonitor (  )  const

Returns the propagation monitor.

Definition at line 3227 of file constraint_solver.cc.

void operations_research::Solver::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 3222 of file constraint_solver.cc.


Friends And Related Function Documentation

friend class BaseIntExpr [friend]

Definition at line 2836 of file constraint_solver.h.

friend class Constraint [friend]

Definition at line 2837 of file constraint_solver.h.

friend class DemonProfiler [friend]

Definition at line 2838 of file constraint_solver.h.

friend class FindOneNeighbor [friend]

Definition at line 2839 of file constraint_solver.h.

friend class IntVar [friend]

Definition at line 2840 of file constraint_solver.h.

friend class PropagationBaseObject [friend]

Definition at line 2841 of file constraint_solver.h.

friend class Queue [friend]

Definition at line 2842 of file constraint_solver.h.

friend class SearchMonitor [friend]

Definition at line 2843 of file constraint_solver.h.

friend class SimpleRevFIFO [friend]

Definition at line 2848 of file constraint_solver.h.

friend class RevImmutableMultiMap [friend]

Definition at line 2849 of file constraint_solver.h.

void InternalSaveBooleanVarValue ( Solver * const  solver,
IntVar * const  var 
) [friend]

Definition at line 851 of file constraint_solver.cc.

void SetQueueCleanerOnFail ( Solver * const  solver,
IntVar * const  var 
) [friend]

Definition at line 1651 of file constraint_solver.cc.


Member Data Documentation

Number of priorities for demons.

Definition at line 378 of file constraint_solver.h.


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