Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
For the time being, Solver is neither MT_SAFE nor MT_HOT. More...
#include <constraint_solver.h>
Classes | |
struct | IntegerCastInfo |
struct | PathEnergyCostConstraintSpecification |
struct | SearchLogParameters |
Creates a search monitor from logging parameters. More... | |
Public Member Functions | |
Solver (const std::string &name) | |
Solver API. | |
Solver (const std::string &name, const ConstraintSolverParameters ¶meters) | |
Solver (const Solver &)=delete | |
This type is neither copyable nor movable. | |
Solver & | operator= (const Solver &)=delete |
~Solver () | |
ConstraintSolverParameters | parameters () const |
Stored Parameters. | |
const ConstraintSolverParameters & | const_parameters () const |
Read-only. | |
template<class T > | |
void | SaveValue (T *o) |
reversibility | |
template<typename T > | |
T * | RevAlloc (T *object) |
template<typename T > | |
T * | RevAllocArray (T *object) |
void | AddConstraint (Constraint *c) |
void | AddCastConstraint (CastConstraint *constraint, IntVar *target_var, IntExpr *expr) |
bool | SolveAndCommit (DecisionBuilder *db, const std::vector< SearchMonitor * > &monitors) |
bool | SolveAndCommit (DecisionBuilder *db) |
bool | SolveAndCommit (DecisionBuilder *db, SearchMonitor *m1) |
bool | SolveAndCommit (DecisionBuilder *db, SearchMonitor *m1, SearchMonitor *m2) |
bool | SolveAndCommit (DecisionBuilder *db, SearchMonitor *m1, SearchMonitor *m2, SearchMonitor *m3) |
bool | CheckAssignment (Assignment *solution) |
Checks whether the given assignment satisfies all relevant constraints. | |
bool | CheckConstraint (Constraint *ct) |
SolverState | state () const |
State of the solver. | |
void | Fail () |
Abandon the current branch in the search tree. A backtrack will follow. | |
void | AddBacktrackAction (Action a, bool fast) |
std::string | DebugString () const |
!defined(SWIG) | |
absl::Time | Now () const |
int64_t | wall_time () const |
int64_t | branches () const |
The number of branches explored since the creation of the solver. | |
int64_t | solutions () const |
The number of solutions found since the start of the search. | |
int64_t | unchecked_solutions () const |
The number of unchecked solutions found by local search. | |
int64_t | demon_runs (DemonPriority p) const |
The number of demons executed during search for a given priority. | |
int64_t | failures () const |
The number of failures encountered since the creation of the solver. | |
int64_t | neighbors () const |
The number of neighbors created. | |
void | ClearNeighbors () |
void | IncrementNeighbors () |
int64_t | filtered_neighbors () const |
The number of filtered neighbors (neighbors accepted by filters). | |
int64_t | accepted_neighbors () const |
The number of accepted neighbors. | |
uint64_t | stamp () const |
uint64_t | fail_stamp () const |
The fail_stamp() is incremented after each backtrack. | |
void | set_context (absl::string_view context) |
Sets the current context of the search. | |
const std::string & | context () const |
Gets the current context of the search. | |
OptimizationDirection | optimization_direction () const |
The direction of optimization, getter and setter. | |
void | set_optimization_direction (OptimizationDirection direction) |
IntVar * | MakeIntVar (int64_t min, int64_t max, const std::string &name) |
--— Int Variables and Constants --— | |
IntVar * | MakeIntVar (const std::vector< int64_t > &values, const std::string &name) |
MakeIntVar will create a variable with the given sparse domain. | |
IntVar * | MakeIntVar (const std::vector< int > &values, const std::string &name) |
MakeIntVar will create a variable with the given sparse domain. | |
IntVar * | MakeIntVar (int64_t min, int64_t max) |
MakeIntVar will create the best range based int var for the bounds given. | |
IntVar * | MakeIntVar (const std::vector< int64_t > &values) |
MakeIntVar will create a variable with the given sparse domain. | |
IntVar * | MakeIntVar (const std::vector< int > &values) |
MakeIntVar will create a variable with the given sparse domain. | |
IntVar * | MakeBoolVar (const std::string &name) |
MakeBoolVar will create a variable with a {0, 1} domain. | |
IntVar * | MakeBoolVar () |
MakeBoolVar will create a variable with a {0, 1} domain. | |
IntVar * | MakeIntConst (int64_t val, const std::string &name) |
IntConst will create a constant expression. | |
IntVar * | MakeIntConst (int64_t val) |
IntConst will create a constant expression. | |
void | MakeIntVarArray (int var_count, int64_t vmin, int64_t vmax, const std::string &name, std::vector< IntVar * > *vars) |
void | MakeIntVarArray (int var_count, int64_t vmin, int64_t vmax, std::vector< IntVar * > *vars) |
IntVar ** | MakeIntVarArray (int var_count, int64_t vmin, int64_t vmax, const std::string &name) |
Same but allocates an array and returns it. | |
void | MakeBoolVarArray (int var_count, const std::string &name, std::vector< IntVar * > *vars) |
void | MakeBoolVarArray (int var_count, std::vector< IntVar * > *vars) |
IntVar ** | MakeBoolVarArray (int var_count, const std::string &name) |
Same but allocates an array and returns it. | |
IntExpr * | MakeSum (IntExpr *left, IntExpr *right) |
--— Integer Expressions --— | |
IntExpr * | MakeSum (IntExpr *expr, int64_t value) |
expr + value. | |
IntExpr * | MakeSum (const std::vector< IntVar * > &vars) |
sum of all vars. | |
IntExpr * | MakeScalProd (const std::vector< IntVar * > &vars, const std::vector< int64_t > &coefs) |
scalar product | |
IntExpr * | MakeScalProd (const std::vector< IntVar * > &vars, const std::vector< int > &coefs) |
scalar product | |
IntExpr * | MakeDifference (IntExpr *left, IntExpr *right) |
left - right | |
IntExpr * | MakeDifference (int64_t value, IntExpr *expr) |
value - expr | |
IntExpr * | MakeOpposite (IntExpr *expr) |
-expr | |
IntExpr * | MakeProd (IntExpr *left, IntExpr *right) |
left * right | |
IntExpr * | MakeProd (IntExpr *expr, int64_t value) |
expr * value | |
IntExpr * | MakeDiv (IntExpr *expr, int64_t value) |
expr / value (integer division) | |
IntExpr * | MakeDiv (IntExpr *numerator, IntExpr *denominator) |
numerator / denominator (integer division). Terms need to be positive. | |
IntExpr * | MakeAbs (IntExpr *expr) |
expr | |
IntExpr * | MakeSquare (IntExpr *expr) |
expr * expr | |
IntExpr * | MakePower (IntExpr *expr, int64_t n) |
expr ^ n (n > 0) | |
IntExpr * | MakeElement (const std::vector< int64_t > &values, IntVar *index) |
values[index] | |
IntExpr * | MakeElement (const std::vector< int > &values, IntVar *index) |
values[index] | |
IntExpr * | MakeElement (IndexEvaluator1 values, IntVar *index) |
IntExpr * | MakeMonotonicElement (IndexEvaluator1 values, bool increasing, IntVar *index) |
IntExpr * | MakeElement (IndexEvaluator2 values, IntVar *index1, IntVar *index2) |
2D version of function-based element expression, values(expr1, expr2). | |
IntExpr * | MakeElement (const std::vector< IntVar * > &vars, IntVar *index) |
vars[expr] | |
IntExpr * | MakeElement (Int64ToIntVar vars, int64_t range_start, int64_t range_end, IntVar *argument) |
vars(argument) | |
template<typename F > | |
Constraint * | MakeLightElement (F values, IntVar *const var, IntVar *const index, std::function< bool()> deep_serialize=nullptr) |
template<typename F > | |
Constraint * | MakeLightElement (F values, IntVar *const var, IntVar *const index1, IntVar *const index2, std::function< bool()> deep_serialize=nullptr) |
IntExpr * | MakeIndexExpression (const std::vector< IntVar * > &vars, int64_t value) |
Constraint * | MakeIfThenElseCt (IntVar *condition, IntExpr *then_expr, IntExpr *else_expr, IntVar *target_var) |
Special cases with arrays of size two. | |
IntExpr * | MakeMin (const std::vector< IntVar * > &vars) |
std::min(vars) | |
IntExpr * | MakeMin (IntExpr *left, IntExpr *right) |
std::min (left, right) | |
IntExpr * | MakeMin (IntExpr *expr, int64_t value) |
std::min(expr, value) | |
IntExpr * | MakeMin (IntExpr *expr, int value) |
std::min(expr, value) | |
IntExpr * | MakeMax (const std::vector< IntVar * > &vars) |
std::max(vars) | |
IntExpr * | MakeMax (IntExpr *left, IntExpr *right) |
std::max(left, right) | |
IntExpr * | MakeMax (IntExpr *expr, int64_t value) |
std::max(expr, value) | |
IntExpr * | MakeMax (IntExpr *expr, int value) |
std::max(expr, value) | |
IntExpr * | MakeConvexPiecewiseExpr (IntExpr *expr, int64_t early_cost, int64_t early_date, int64_t late_date, int64_t late_cost) |
Convex piecewise function. | |
IntExpr * | MakeSemiContinuousExpr (IntExpr *expr, int64_t fixed_charge, int64_t step) |
IntExpr * | MakePiecewiseLinearExpr (IntExpr *expr, const PiecewiseLinearFunction &f) |
IntExpr * | MakeModulo (IntExpr *x, int64_t mod) |
Modulo expression x % mod (with the python convention for modulo). | |
IntExpr * | MakeModulo (IntExpr *x, IntExpr *mod) |
Modulo expression x % mod (with the python convention for modulo). | |
IntExpr * | MakeConditionalExpression (IntVar *condition, IntExpr *expr, int64_t unperformed_value) |
Conditional Expr condition ? expr : unperformed_value. | |
Constraint * | MakeTrueConstraint () |
This constraint always succeeds. | |
Constraint * | MakeFalseConstraint () |
This constraint always fails. | |
Constraint * | MakeFalseConstraint (const std::string &explanation) |
Constraint * | MakeIsEqualCstCt (IntExpr *var, int64_t value, IntVar *boolvar) |
boolvar == (var == value) | |
IntVar * | MakeIsEqualCstVar (IntExpr *var, int64_t value) |
status var of (var == value) | |
Constraint * | MakeIsEqualCt (IntExpr *v1, IntExpr *v2, IntVar *b) |
b == (v1 == v2) | |
IntVar * | MakeIsEqualVar (IntExpr *v1, IntExpr *v2) |
status var of (v1 == v2) | |
Constraint * | MakeEquality (IntExpr *left, IntExpr *right) |
left == right | |
Constraint * | MakeEquality (IntExpr *expr, int64_t value) |
expr == value | |
Constraint * | MakeEquality (IntExpr *expr, int value) |
expr == value | |
Constraint * | MakeIsDifferentCstCt (IntExpr *var, int64_t value, IntVar *boolvar) |
boolvar == (var != value) | |
IntVar * | MakeIsDifferentCstVar (IntExpr *var, int64_t value) |
status var of (var != value) | |
IntVar * | MakeIsDifferentVar (IntExpr *v1, IntExpr *v2) |
status var of (v1 != v2) | |
Constraint * | MakeIsDifferentCt (IntExpr *v1, IntExpr *v2, IntVar *b) |
b == (v1 != v2) | |
Constraint * | MakeNonEquality (IntExpr *left, IntExpr *right) |
left != right | |
Constraint * | MakeNonEquality (IntExpr *expr, int64_t value) |
expr != value | |
Constraint * | MakeNonEquality (IntExpr *expr, int value) |
expr != value | |
Constraint * | MakeIsLessOrEqualCstCt (IntExpr *var, int64_t value, IntVar *boolvar) |
boolvar == (var <= value) | |
IntVar * | MakeIsLessOrEqualCstVar (IntExpr *var, int64_t value) |
status var of (var <= value) | |
IntVar * | MakeIsLessOrEqualVar (IntExpr *left, IntExpr *right) |
status var of (left <= right) | |
Constraint * | MakeIsLessOrEqualCt (IntExpr *left, IntExpr *right, IntVar *b) |
b == (left <= right) | |
Constraint * | MakeLessOrEqual (IntExpr *left, IntExpr *right) |
left <= right | |
Constraint * | MakeLessOrEqual (IntExpr *expr, int64_t value) |
expr <= value | |
Constraint * | MakeLessOrEqual (IntExpr *expr, int value) |
expr <= value | |
Constraint * | MakeIsGreaterOrEqualCstCt (IntExpr *var, int64_t value, IntVar *boolvar) |
boolvar == (var >= value) | |
IntVar * | MakeIsGreaterOrEqualCstVar (IntExpr *var, int64_t value) |
status var of (var >= value) | |
IntVar * | MakeIsGreaterOrEqualVar (IntExpr *left, IntExpr *right) |
status var of (left >= right) | |
Constraint * | MakeIsGreaterOrEqualCt (IntExpr *left, IntExpr *right, IntVar *b) |
b == (left >= right) | |
Constraint * | MakeGreaterOrEqual (IntExpr *left, IntExpr *right) |
left >= right | |
Constraint * | MakeGreaterOrEqual (IntExpr *expr, int64_t value) |
expr >= value | |
Constraint * | MakeGreaterOrEqual (IntExpr *expr, int value) |
expr >= value | |
Constraint * | MakeIsGreaterCstCt (IntExpr *v, int64_t c, IntVar *b) |
b == (v > c) | |
IntVar * | MakeIsGreaterCstVar (IntExpr *var, int64_t value) |
status var of (var > value) | |
IntVar * | MakeIsGreaterVar (IntExpr *left, IntExpr *right) |
status var of (left > right) | |
Constraint * | MakeIsGreaterCt (IntExpr *left, IntExpr *right, IntVar *b) |
b == (left > right) | |
Constraint * | MakeGreater (IntExpr *left, IntExpr *right) |
left > right | |
Constraint * | MakeGreater (IntExpr *expr, int64_t value) |
expr > value | |
Constraint * | MakeGreater (IntExpr *expr, int value) |
expr > value | |
Constraint * | MakeIsLessCstCt (IntExpr *v, int64_t c, IntVar *b) |
b == (v < c) | |
IntVar * | MakeIsLessCstVar (IntExpr *var, int64_t value) |
status var of (var < value) | |
IntVar * | MakeIsLessVar (IntExpr *left, IntExpr *right) |
status var of (left < right) | |
Constraint * | MakeIsLessCt (IntExpr *left, IntExpr *right, IntVar *b) |
b == (left < right) | |
Constraint * | MakeLess (IntExpr *left, IntExpr *right) |
left < right | |
Constraint * | MakeLess (IntExpr *expr, int64_t value) |
expr < value | |
Constraint * | MakeLess (IntExpr *expr, int value) |
expr < value | |
Constraint * | MakeSumLessOrEqual (const std::vector< IntVar * > &vars, int64_t cst) |
Variation on arrays. | |
Constraint * | MakeSumGreaterOrEqual (const std::vector< IntVar * > &vars, int64_t cst) |
Constraint * | MakeSumEquality (const std::vector< IntVar * > &vars, int64_t cst) |
Constraint * | MakeSumEquality (const std::vector< IntVar * > &vars, IntVar *var) |
Constraint * | MakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int64_t > &coefficients, int64_t cst) |
Constraint * | MakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64_t cst) |
Constraint * | MakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int64_t > &coefficients, IntVar *target) |
Constraint * | MakeScalProdEquality (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, IntVar *target) |
Constraint * | MakeScalProdGreaterOrEqual (const std::vector< IntVar * > &vars, const std::vector< int64_t > &coeffs, int64_t cst) |
Constraint * | MakeScalProdGreaterOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coeffs, int64_t cst) |
Constraint * | MakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int64_t > &coefficients, int64_t cst) |
Constraint * | MakeScalProdLessOrEqual (const std::vector< IntVar * > &vars, const std::vector< int > &coefficients, int64_t cst) |
Constraint * | MakeMinEquality (const std::vector< IntVar * > &vars, IntVar *min_var) |
Constraint * | MakeMaxEquality (const std::vector< IntVar * > &vars, IntVar *max_var) |
Constraint * | MakeElementEquality (const std::vector< int64_t > &vals, IntVar *index, IntVar *target) |
Constraint * | MakeElementEquality (const std::vector< int > &vals, IntVar *index, IntVar *target) |
Constraint * | MakeElementEquality (const std::vector< IntVar * > &vars, IntVar *index, IntVar *target) |
Constraint * | MakeElementEquality (const std::vector< IntVar * > &vars, IntVar *index, int64_t target) |
Constraint * | MakeAbsEquality (IntVar *var, IntVar *abs_var) |
Creates the constraint abs(var) == abs_var. | |
Constraint * | MakeIndexOfConstraint (const std::vector< IntVar * > &vars, IntVar *index, int64_t target) |
Demon * | MakeConstraintInitialPropagateCallback (Constraint *ct) |
Demon * | MakeDelayedConstraintInitialPropagateCallback (Constraint *ct) |
Demon * | MakeActionDemon (Action action) |
Creates a demon from a callback. | |
Demon * | MakeClosureDemon (Closure closure) |
Creates a demon from a closure. | |
Constraint * | MakeBetweenCt (IntExpr *expr, int64_t l, int64_t u) |
--— Between and related constraints --— | |
Constraint * | MakeNotBetweenCt (IntExpr *expr, int64_t l, int64_t u) |
Constraint * | MakeIsBetweenCt (IntExpr *expr, int64_t l, int64_t u, IntVar *b) |
b == (l <= expr <= u) | |
IntVar * | MakeIsBetweenVar (IntExpr *v, int64_t l, int64_t u) |
Constraint * | MakeMemberCt (IntExpr *expr, const std::vector< int64_t > &values) |
--— Member and related constraints --— | |
Constraint * | MakeMemberCt (IntExpr *expr, const std::vector< int > &values) |
Constraint * | MakeNotMemberCt (IntExpr *expr, const std::vector< int64_t > &values) |
expr not in set. | |
Constraint * | MakeNotMemberCt (IntExpr *expr, const std::vector< int > &values) |
Constraint * | MakeNotMemberCt (IntExpr *expr, std::vector< int64_t > starts, std::vector< int64_t > ends) |
expr should not be in the list of forbidden intervals [start[i]..end[i]]. | |
Constraint * | MakeNotMemberCt (IntExpr *expr, std::vector< int > starts, std::vector< int > ends) |
expr should not be in the list of forbidden intervals [start[i]..end[i]]. | |
Constraint * | MakeNotMemberCt (IntExpr *expr, SortedDisjointIntervalList intervals) |
expr should not be in the list of forbidden intervals. | |
Constraint * | MakeIsMemberCt (IntExpr *expr, const std::vector< int64_t > &values, IntVar *boolvar) |
boolvar == (expr in set) | |
Constraint * | MakeIsMemberCt (IntExpr *expr, const std::vector< int > &values, IntVar *boolvar) |
IntVar * | MakeIsMemberVar (IntExpr *expr, const std::vector< int64_t > &values) |
IntVar * | MakeIsMemberVar (IntExpr *expr, const std::vector< int > &values) |
Constraint * | MakeAtMost (std::vector< IntVar * > vars, int64_t value, int64_t max_count) |
|{i | vars[i] == value}| <= max_count | |
Constraint * | MakeCount (const std::vector< IntVar * > &vars, int64_t value, int64_t max_count) |
|{i | vars[i] == value}| == max_count | |
Constraint * | MakeCount (const std::vector< IntVar * > &vars, int64_t value, IntVar *max_count) |
|{i | vars[i] == value}| == max_count | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int64_t > &values, const std::vector< IntVar * > &cards) |
Aggregated version of count: |{i | v[i] == values[j]}| == cards[j]. | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int > &values, const std::vector< IntVar * > &cards) |
Aggregated version of count: |{i | v[i] == values[j]}| == cards[j]. | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &cards) |
Aggregated version of count: |{i | v[i] == j}| == cards[j]. | |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, int64_t card_min, int64_t card_max, int64_t card_size) |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int64_t > &card_min, const std::vector< int64_t > &card_max) |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int > &card_min, const std::vector< int > &card_max) |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int64_t > &values, const std::vector< int64_t > &card_min, const std::vector< int64_t > &card_max) |
Constraint * | MakeDistribute (const std::vector< IntVar * > &vars, const std::vector< int > &values, const std::vector< int > &card_min, const std::vector< int > &card_max) |
Constraint * | MakeDeviation (const std::vector< IntVar * > &vars, IntVar *deviation_var, int64_t total_sum) |
Constraint * | MakeAllDifferent (const std::vector< IntVar * > &vars) |
Constraint * | MakeAllDifferent (const std::vector< IntVar * > &vars, bool stronger_propagation) |
Constraint * | MakeAllDifferentExcept (const std::vector< IntVar * > &vars, int64_t escape_value) |
Constraint * | MakeSortingConstraint (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &sorted) |
Constraint * | MakeLexicalLess (const std::vector< IntVar * > &left, const std::vector< IntVar * > &right) |
Constraint * | MakeLexicalLessOrEqual (const std::vector< IntVar * > &left, const std::vector< IntVar * > &right) |
Constraint * | MakeLexicalLessOrEqualWithOffsets (std::vector< IntVar * > left, std::vector< IntVar * > right, std::vector< int64_t > offsets) |
Constraint * | MakeIsLexicalLessOrEqualWithOffsetsCt (std::vector< IntVar * > left, std::vector< IntVar * > right, std::vector< int64_t > offsets, IntVar *boolvar) |
Semi-reified version of the above: boolvar -> LexLE(left, right, offsets). | |
Constraint * | MakeInversePermutationConstraint (const std::vector< IntVar * > &left, const std::vector< IntVar * > &right) |
Constraint * | MakeIndexOfFirstMaxValueConstraint (IntVar *index, const std::vector< IntVar * > &vars) |
Constraint * | MakeIndexOfFirstMinValueConstraint (IntVar *index, const std::vector< IntVar * > &vars) |
Constraint * | MakeNullIntersect (const std::vector< IntVar * > &first_vars, const std::vector< IntVar * > &second_vars) |
Constraint * | MakeNullIntersectExcept (const std::vector< IntVar * > &first_vars, const std::vector< IntVar * > &second_vars, int64_t escape_value) |
Constraint * | MakeNoCycle (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, IndexFilter1 sink_handler=nullptr) |
Constraint * | MakeNoCycle (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, IndexFilter1 sink_handler, bool assume_paths) |
Constraint * | MakeCircuit (const std::vector< IntVar * > &nexts) |
Force the "nexts" variable to create a complete Hamiltonian path. | |
Constraint * | MakeSubCircuit (const std::vector< IntVar * > &nexts) |
Constraint * | MakePathCumul (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, const std::vector< IntVar * > &cumuls, const std::vector< IntVar * > &transits) |
Constraint * | MakeDelayedPathCumul (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, const std::vector< IntVar * > &cumuls, const std::vector< IntVar * > &transits) |
Constraint * | MakePathCumul (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, const std::vector< IntVar * > &cumuls, IndexEvaluator2 transit_evaluator) |
Constraint * | MakePathCumul (const std::vector< IntVar * > &nexts, const std::vector< IntVar * > &active, const std::vector< IntVar * > &cumuls, const std::vector< IntVar * > &slacks, IndexEvaluator2 transit_evaluator) |
Constraint * | MakePathConnected (std::vector< IntVar * > nexts, std::vector< int64_t > sources, std::vector< int64_t > sinks, std::vector< IntVar * > status) |
Constraint * | MakePathPrecedenceConstraint (std::vector< IntVar * > nexts, const std::vector< std::pair< int, int > > &precedences) |
Constraint * | MakePathPrecedenceConstraint (std::vector< IntVar * > nexts, const std::vector< std::pair< int, int > > &precedences, absl::Span< const int > lifo_path_starts, absl::Span< const int > fifo_path_starts) |
Constraint * | MakePathTransitPrecedenceConstraint (std::vector< IntVar * > nexts, std::vector< IntVar * > transits, const std::vector< std::pair< int, int > > &precedences) |
Constraint * | MakePathEnergyCostConstraint (PathEnergyCostConstraintSpecification specification) |
Constraint * | MakeMapDomain (IntVar *var, const std::vector< IntVar * > &actives) |
Constraint * | MakeAllowedAssignments (const std::vector< IntVar * > &vars, const IntTupleSet &tuples) |
------— API -------— | |
Constraint * | MakeTransitionConstraint (const std::vector< IntVar * > &vars, const IntTupleSet &transition_table, int64_t initial_state, const std::vector< int64_t > &final_states) |
Constraint * | MakeTransitionConstraint (const std::vector< IntVar * > &vars, const IntTupleSet &transition_table, int64_t initial_state, const std::vector< int > &final_states) |
Constraint * | MakeNonOverlappingBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< IntVar * > &x_size, const std::vector< IntVar * > &y_size) |
Constraint * | MakeNonOverlappingBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, absl::Span< const int64_t > x_size, absl::Span< const int64_t > y_size) |
Constraint * | MakeNonOverlappingBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, absl::Span< const int > x_size, absl::Span< const int > y_size) |
Constraint * | MakeNonOverlappingNonStrictBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, const std::vector< IntVar * > &x_size, const std::vector< IntVar * > &y_size) |
Constraint * | MakeNonOverlappingNonStrictBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, absl::Span< const int64_t > x_size, absl::Span< const int64_t > y_size) |
Constraint * | MakeNonOverlappingNonStrictBoxesConstraint (const std::vector< IntVar * > &x_vars, const std::vector< IntVar * > &y_vars, absl::Span< const int > x_size, absl::Span< const int > y_size) |
Pack * | MakePack (const std::vector< IntVar * > &vars, int number_of_bins) |
IntervalVar * | MakeFixedDurationIntervalVar (int64_t start_min, int64_t start_max, int64_t duration, bool optional, const std::string &name) |
void | MakeFixedDurationIntervalVarArray (int count, int64_t start_min, int64_t start_max, int64_t duration, bool optional, absl::string_view name, std::vector< IntervalVar * > *array) |
IntervalVar * | MakeFixedDurationIntervalVar (IntVar *start_variable, int64_t duration, const std::string &name) |
IntervalVar * | MakeFixedDurationIntervalVar (IntVar *start_variable, int64_t duration, IntVar *performed_variable, const std::string &name) |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, int64_t duration, absl::string_view name, std::vector< IntervalVar * > *array) |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, absl::Span< const int64_t > durations, absl::string_view name, std::vector< IntervalVar * > *array) |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, absl::Span< const int > durations, absl::string_view name, std::vector< IntervalVar * > *array) |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, absl::Span< const int64_t > durations, const std::vector< IntVar * > &performed_variables, absl::string_view name, std::vector< IntervalVar * > *array) |
void | MakeFixedDurationIntervalVarArray (const std::vector< IntVar * > &start_variables, absl::Span< const int > durations, const std::vector< IntVar * > &performed_variables, absl::string_view name, std::vector< IntervalVar * > *array) |
IntervalVar * | MakeFixedInterval (int64_t start, int64_t duration, const std::string &name) |
Creates a fixed and performed interval. | |
IntervalVar * | MakeIntervalVar (int64_t start_min, int64_t start_max, int64_t duration_min, int64_t duration_max, int64_t end_min, int64_t end_max, bool optional, const std::string &name) |
Variable Duration Interval Var. | |
void | MakeIntervalVarArray (int count, int64_t start_min, int64_t start_max, int64_t duration_min, int64_t duration_max, int64_t end_min, int64_t end_max, bool optional, absl::string_view name, std::vector< IntervalVar * > *array) |
IntervalVar * | MakeMirrorInterval (IntervalVar *interval_var) |
--— API --— | |
IntervalVar * | MakeFixedDurationStartSyncedOnStartIntervalVar (IntervalVar *interval_var, int64_t duration, int64_t offset) |
Synced Interval Vars. | |
IntervalVar * | MakeFixedDurationStartSyncedOnEndIntervalVar (IntervalVar *interval_var, int64_t duration, int64_t offset) |
IntervalVar * | MakeFixedDurationEndSyncedOnStartIntervalVar (IntervalVar *interval_var, int64_t duration, int64_t offset) |
IntervalVar * | MakeFixedDurationEndSyncedOnEndIntervalVar (IntervalVar *interval_var, int64_t duration, int64_t offset) |
IntervalVar * | MakeIntervalRelaxedMin (IntervalVar *interval_var) |
IntervalVar * | MakeIntervalRelaxedMax (IntervalVar *interval_var) |
Constraint * | MakeIntervalVarRelation (IntervalVar *t, UnaryIntervalRelation r, int64_t d) |
Constraint * | MakeIntervalVarRelation (IntervalVar *t1, BinaryIntervalRelation r, IntervalVar *t2) |
This method creates a relation between two interval vars. | |
Constraint * | MakeIntervalVarRelationWithDelay (IntervalVar *t1, BinaryIntervalRelation r, IntervalVar *t2, int64_t delay) |
Constraint * | MakeTemporalDisjunction (IntervalVar *t1, IntervalVar *t2, IntVar *alt) |
Constraint * | MakeTemporalDisjunction (IntervalVar *t1, IntervalVar *t2) |
DisjunctiveConstraint * | MakeDisjunctiveConstraint (const std::vector< IntervalVar * > &intervals, const std::string &name) |
-------— Factory methods -------— | |
DisjunctiveConstraint * | MakeStrictDisjunctiveConstraint (const std::vector< IntervalVar * > &intervals, const std::string &name) |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int64_t > &demands, int64_t capacity, const std::string &name) |
Demands are constant. | |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int > &demands, int64_t capacity, const std::string &name) |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int64_t > &demands, IntVar *capacity, absl::string_view name) |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< int > &demands, IntVar *capacity, const std::string &name) |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< IntVar * > &demands, int64_t capacity, const std::string &name) |
Demands should be positive. | |
Constraint * | MakeCumulative (const std::vector< IntervalVar * > &intervals, const std::vector< IntVar * > &demands, IntVar *capacity, const std::string &name) |
Demands should be positive. | |
Constraint * | MakeCover (const std::vector< IntervalVar * > &vars, IntervalVar *target_var) |
Constraint * | MakeEquality (IntervalVar *var1, IntervalVar *var2) |
This constraints states that the two interval variables are equal. | |
Assignment * | MakeAssignment () |
This method creates an empty assignment. | |
Assignment * | MakeAssignment (const Assignment *a) |
This method creates an assignment which is a copy of 'a'. | |
SolutionCollector * | MakeFirstSolutionCollector (const Assignment *assignment) |
Collect the first solution of the search. | |
SolutionCollector * | MakeFirstSolutionCollector () |
SolutionCollector * | MakeLastSolutionCollector (const Assignment *assignment) |
Collect the last solution of the search. | |
SolutionCollector * | MakeLastSolutionCollector () |
SolutionCollector * | MakeBestValueSolutionCollector (const Assignment *assignment, bool maximize) |
SolutionCollector * | MakeBestLexicographicValueSolutionCollector (const Assignment *assignment, std::vector< bool > maximize) |
SolutionCollector * | MakeBestValueSolutionCollector (bool maximize) |
SolutionCollector * | MakeBestLexicographicValueSolutionCollector (std::vector< bool > maximize) |
SolutionCollector * | MakeNBestValueSolutionCollector (const Assignment *assignment, int solution_count, bool maximize) |
SolutionCollector * | MakeNBestValueSolutionCollector (int solution_count, bool maximize) |
SolutionCollector * | MakeNBestLexicographicValueSolutionCollector (const Assignment *assignment, int solution_count, std::vector< bool > maximize) |
SolutionCollector * | MakeNBestLexicographicValueSolutionCollector (int solution_count, std::vector< bool > maximize) |
SolutionCollector * | MakeAllSolutionCollector (const Assignment *assignment) |
Collect all solutions of the search. | |
SolutionCollector * | MakeAllSolutionCollector () |
OptimizeVar * | MakeMinimize (IntVar *v, int64_t step) |
Creates a minimization objective. | |
OptimizeVar * | MakeMaximize (IntVar *v, int64_t step) |
Creates a maximization objective. | |
OptimizeVar * | MakeOptimize (bool maximize, IntVar *v, int64_t step) |
Creates a objective with a given sense (true = maximization). | |
OptimizeVar * | MakeWeightedMinimize (const std::vector< IntVar * > &sub_objectives, const std::vector< int64_t > &weights, int64_t step) |
OptimizeVar * | MakeWeightedMinimize (const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64_t step) |
OptimizeVar * | MakeWeightedMaximize (const std::vector< IntVar * > &sub_objectives, const std::vector< int64_t > &weights, int64_t step) |
Creates a maximization weigthed objective. | |
OptimizeVar * | MakeWeightedMaximize (const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64_t step) |
Creates a maximization weigthed objective. | |
OptimizeVar * | MakeWeightedOptimize (bool maximize, const std::vector< IntVar * > &sub_objectives, const std::vector< int64_t > &weights, int64_t step) |
Creates a weighted objective with a given sense (true = maximization). | |
OptimizeVar * | MakeWeightedOptimize (bool maximize, const std::vector< IntVar * > &sub_objectives, const std::vector< int > &weights, int64_t step) |
Creates a weighted objective with a given sense (true = maximization). | |
OptimizeVar * | MakeLexicographicOptimize (std::vector< bool > maximize, std::vector< IntVar * > variables, std::vector< int64_t > steps) |
ObjectiveMonitor * | MakeTabuSearch (bool maximize, IntVar *objective, int64_t step, const std::vector< IntVar * > &vars, int64_t keep_tenure, int64_t forbid_tenure, double tabu_factor) |
MetaHeuristics which try to get the search out of local optima. | |
ObjectiveMonitor * | MakeLexicographicTabuSearch (const std::vector< bool > &maximize, std::vector< IntVar * > objectives, std::vector< int64_t > steps, const std::vector< IntVar * > &vars, int64_t keep_tenure, int64_t forbid_tenure, double tabu_factor) |
ObjectiveMonitor * | MakeGenericTabuSearch (bool maximize, IntVar *v, int64_t step, const std::vector< IntVar * > &tabu_vars, int64_t forbid_tenure) |
ObjectiveMonitor * | MakeSimulatedAnnealing (bool maximize, IntVar *v, int64_t step, int64_t initial_temperature) |
ObjectiveMonitor * | MakeLexicographicSimulatedAnnealing (const std::vector< bool > &maximize, std::vector< IntVar * > vars, std::vector< int64_t > steps, std::vector< int64_t > initial_temperatures) |
ObjectiveMonitor * | MakeGuidedLocalSearch (bool maximize, IntVar *objective, IndexEvaluator2 objective_function, int64_t step, const std::vector< IntVar * > &vars, double penalty_factor, bool reset_penalties_on_new_best_solution=false) |
ObjectiveMonitor * | MakeGuidedLocalSearch (bool maximize, IntVar *objective, IndexEvaluator3 objective_function, int64_t step, const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, double penalty_factor, bool reset_penalties_on_new_best_solution=false) |
SearchMonitor * | MakeLubyRestart (int scale_factor) |
SearchMonitor * | MakeConstantRestart (int frequency) |
ABSL_MUST_USE_RESULT RegularLimit * | MakeTimeLimit (absl::Duration time) |
Creates a search limit that constrains the running time. | |
ABSL_MUST_USE_RESULT RegularLimit * | MakeTimeLimit (int64_t time_in_ms) |
ABSL_MUST_USE_RESULT RegularLimit * | MakeBranchesLimit (int64_t branches) |
ABSL_MUST_USE_RESULT RegularLimit * | MakeFailuresLimit (int64_t failures) |
ABSL_MUST_USE_RESULT RegularLimit * | MakeSolutionsLimit (int64_t solutions) |
ABSL_MUST_USE_RESULT RegularLimit * | MakeLimit (absl::Duration time, int64_t branches, int64_t failures, int64_t solutions, bool smart_time_check=false, bool cumulative=false) |
ABSL_MUST_USE_RESULT RegularLimit * | MakeLimit (const RegularLimitParameters &proto) |
Creates a search limit from its protobuf description. | |
ABSL_MUST_USE_RESULT RegularLimit * | MakeLimit (int64_t time, int64_t branches, int64_t failures, int64_t solutions, bool smart_time_check=false, bool cumulative=false) |
RegularLimitParameters | MakeDefaultRegularLimitParameters () const |
Creates a regular limit proto containing default values. | |
ABSL_MUST_USE_RESULT SearchLimit * | MakeLimit (SearchLimit *limit_1, SearchLimit *limit_2) |
ABSL_MUST_USE_RESULT ImprovementSearchLimit * | MakeImprovementLimit (IntVar *objective_var, bool maximize, double objective_scaling_factor, double objective_offset, double improvement_rate_coefficient, int improvement_rate_solutions_distance) |
ABSL_MUST_USE_RESULT ImprovementSearchLimit * | MakeLexicographicImprovementLimit (std::vector< IntVar * > objective_vars, std::vector< bool > maximize, std::vector< double > objective_scaling_factors, std::vector< double > objective_offsets, double improvement_rate_coefficient, int improvement_rate_solutions_distance) |
ABSL_MUST_USE_RESULT SearchLimit * | MakeCustomLimit (std::function< bool()> limiter) |
SearchMonitor * | MakeSearchLog (int branch_period) |
SearchMonitor * | MakeSearchLog (int branch_period, IntVar *var) |
At each solution, this monitor also display the var value. | |
SearchMonitor * | MakeSearchLog (int branch_period, std::function< std::string()> display_callback) |
SearchMonitor * | MakeSearchLog (int branch_period, IntVar *var, std::function< std::string()> display_callback) |
SearchMonitor * | MakeSearchLog (int branch_period, std::vector< IntVar * > vars, std::function< std::string()> display_callback) |
SearchMonitor * | MakeSearchLog (int branch_period, OptimizeVar *opt_var) |
SearchMonitor * | MakeSearchLog (int branch_period, OptimizeVar *opt_var, std::function< std::string()> display_callback) |
SearchMonitor * | MakeSearchLog (SearchLogParameters parameters) |
SearchMonitor * | MakeSearchTrace (const std::string &prefix) |
SearchMonitor * | MakeEnterSearchCallback (std::function< void()> callback) |
--— Callback-based search monitors --— | |
SearchMonitor * | MakeExitSearchCallback (std::function< void()> callback) |
SearchMonitor * | MakeAtSolutionCallback (std::function< void()> callback) |
ModelVisitor * | MakePrintModelVisitor () |
Prints the model. | |
ModelVisitor * | MakeStatisticsModelVisitor () |
Displays some nice statistics on the model. | |
ModelVisitor * | MakeVariableDegreeVisitor (absl::flat_hash_map< const IntVar *, int > *map) |
Compute the number of constraints a variable is attached to. | |
SearchMonitor * | MakeSymmetryManager (const std::vector< SymmetryBreaker * > &visitors) |
Symmetry Breaking. | |
SearchMonitor * | MakeSymmetryManager (SymmetryBreaker *v1) |
SearchMonitor * | MakeSymmetryManager (SymmetryBreaker *v1, SymmetryBreaker *v2) |
SearchMonitor * | MakeSymmetryManager (SymmetryBreaker *v1, SymmetryBreaker *v2, SymmetryBreaker *v3) |
SearchMonitor * | MakeSymmetryManager (SymmetryBreaker *v1, SymmetryBreaker *v2, SymmetryBreaker *v3, SymmetryBreaker *v4) |
Decision * | MakeAssignVariableValue (IntVar *var, int64_t val) |
Decisions. | |
Decision * | MakeVariableLessOrEqualValue (IntVar *var, int64_t value) |
Decision * | MakeVariableGreaterOrEqualValue (IntVar *var, int64_t value) |
Decision * | MakeSplitVariableDomain (IntVar *var, int64_t val, bool start_with_lower_half) |
Decision * | MakeAssignVariableValueOrFail (IntVar *var, int64_t value) |
Decision * | MakeAssignVariableValueOrDoNothing (IntVar *var, int64_t value) |
Decision * | MakeAssignVariablesValues (const std::vector< IntVar * > &vars, const std::vector< int64_t > &values) |
Decision * | MakeAssignVariablesValuesOrDoNothing (const std::vector< IntVar * > &vars, const std::vector< int64_t > &values) |
Decision * | MakeAssignVariablesValuesOrFail (const std::vector< IntVar * > &vars, const std::vector< int64_t > &values) |
Decision * | MakeFailDecision () |
Decision * | MakeDecision (Action apply, Action refute) |
DecisionBuilder * | Compose (DecisionBuilder *db1, DecisionBuilder *db2) |
DecisionBuilder * | Compose (DecisionBuilder *db1, DecisionBuilder *db2, DecisionBuilder *db3) |
DecisionBuilder * | Compose (DecisionBuilder *db1, DecisionBuilder *db2, DecisionBuilder *db3, DecisionBuilder *db4) |
DecisionBuilder * | Compose (const std::vector< DecisionBuilder * > &dbs) |
DecisionBuilder * | Try (DecisionBuilder *db1, DecisionBuilder *db2) |
DecisionBuilder * | Try (DecisionBuilder *db1, DecisionBuilder *db2, DecisionBuilder *db3) |
DecisionBuilder * | Try (DecisionBuilder *db1, DecisionBuilder *db2, DecisionBuilder *db3, DecisionBuilder *db4) |
DecisionBuilder * | Try (const std::vector< DecisionBuilder * > &dbs) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IntValueStrategy val_str) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 var_evaluator, IntValueStrategy val_str) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IndexEvaluator2 value_evaluator) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, VariableValueComparator var_val1_val2_comparator) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 var_evaluator, IndexEvaluator2 value_evaluator) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IntVarStrategy var_str, IndexEvaluator2 value_evaluator, IndexEvaluator1 tie_breaker) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator1 var_evaluator, IndexEvaluator2 value_evaluator, IndexEvaluator1 tie_breaker) |
DecisionBuilder * | MakeDefaultPhase (const std::vector< IntVar * > &vars) |
DecisionBuilder * | MakeDefaultPhase (const std::vector< IntVar * > &vars, const DefaultPhaseParameters ¶meters) |
DecisionBuilder * | MakePhase (IntVar *v0, IntVarStrategy var_str, IntValueStrategy val_str) |
Shortcuts for small arrays. | |
DecisionBuilder * | MakePhase (IntVar *v0, IntVar *v1, IntVarStrategy var_str, IntValueStrategy val_str) |
DecisionBuilder * | MakePhase (IntVar *v0, IntVar *v1, IntVar *v2, IntVarStrategy var_str, IntValueStrategy val_str) |
DecisionBuilder * | MakePhase (IntVar *v0, IntVar *v1, IntVar *v2, IntVar *v3, IntVarStrategy var_str, IntValueStrategy val_str) |
Decision * | MakeScheduleOrPostpone (IntervalVar *var, int64_t est, int64_t *marker) |
Decision * | MakeScheduleOrExpedite (IntervalVar *var, int64_t est, int64_t *marker) |
Decision * | MakeRankFirstInterval (SequenceVar *sequence, int index) |
Decision * | MakeRankLastInterval (SequenceVar *sequence, int index) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator2 eval, EvaluatorStrategy str) |
DecisionBuilder * | MakePhase (const std::vector< IntVar * > &vars, IndexEvaluator2 eval, IndexEvaluator1 tie_breaker, EvaluatorStrategy str) |
DecisionBuilder * | MakePhase (const std::vector< IntervalVar * > &intervals, IntervalStrategy str) |
Scheduling phases. | |
DecisionBuilder * | MakePhase (const std::vector< SequenceVar * > &sequences, SequenceStrategy str) |
DecisionBuilder * | MakeDecisionBuilderFromAssignment (Assignment *assignment, DecisionBuilder *db, const std::vector< IntVar * > &vars) |
DecisionBuilder * | MakeConstraintAdder (Constraint *ct) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *db) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *db, SearchMonitor *monitor1) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *db, SearchMonitor *monitor1, SearchMonitor *monitor2) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *db, SearchMonitor *monitor1, SearchMonitor *monitor2, SearchMonitor *monitor3) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *db, SearchMonitor *monitor1, SearchMonitor *monitor2, SearchMonitor *monitor3, SearchMonitor *monitor4) |
DecisionBuilder * | MakeSolveOnce (DecisionBuilder *db, const std::vector< SearchMonitor * > &monitors) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *db, Assignment *solution, bool maximize, int64_t step) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *db, Assignment *solution, bool maximize, int64_t step, SearchMonitor *monitor1) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *db, Assignment *solution, bool maximize, int64_t step, SearchMonitor *monitor1, SearchMonitor *monitor2) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *db, Assignment *solution, bool maximize, int64_t step, SearchMonitor *monitor1, SearchMonitor *monitor2, SearchMonitor *monitor3) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *db, Assignment *solution, bool maximize, int64_t step, SearchMonitor *monitor1, SearchMonitor *monitor2, SearchMonitor *monitor3, SearchMonitor *monitor4) |
DecisionBuilder * | MakeNestedOptimize (DecisionBuilder *db, Assignment *solution, bool maximize, int64_t step, const std::vector< SearchMonitor * > &monitors) |
DecisionBuilder * | MakeRestoreAssignment (Assignment *assignment) |
DecisionBuilder * | MakeStoreAssignment (Assignment *assignment) |
LocalSearchOperator * | MakeOperator (const std::vector< IntVar * > &vars, LocalSearchOperators op, std::function< const std::vector< int > &(int, int)> get_neighbors=nullptr) |
Local Search Operators. | |
LocalSearchOperator * | MakeOperator (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, LocalSearchOperators op, std::function< const std::vector< int > &(int, int)> get_neighbors=nullptr) |
LocalSearchOperator * | MakeOperator (const std::vector< IntVar * > &vars, IndexEvaluator3 evaluator, EvaluatorLocalSearchOperators op) |
LocalSearchOperator * | MakeOperator (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, IndexEvaluator3 evaluator, EvaluatorLocalSearchOperators op) |
LocalSearchOperator * | MakeRandomLnsOperator (const std::vector< IntVar * > &vars, int number_of_variables) |
LocalSearchOperator * | MakeRandomLnsOperator (const std::vector< IntVar * > &vars, int number_of_variables, int32_t seed) |
LocalSearchOperator * | MakeMoveTowardTargetOperator (const Assignment &target) |
LocalSearchOperator * | MakeMoveTowardTargetOperator (const std::vector< IntVar * > &variables, const std::vector< int64_t > &target_values) |
LocalSearchOperator * | ConcatenateOperators (const std::vector< LocalSearchOperator * > &ops) |
LocalSearchOperator * | ConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, bool restart) |
LocalSearchOperator * | ConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, std::function< int64_t(int, int)> evaluator) |
LocalSearchOperator * | RandomConcatenateOperators (const std::vector< LocalSearchOperator * > &ops) |
LocalSearchOperator * | RandomConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, int32_t seed) |
LocalSearchOperator * | MultiArmedBanditConcatenateOperators (const std::vector< LocalSearchOperator * > &ops, double memory_coefficient, double exploration_coefficient, bool maximize) |
LocalSearchOperator * | MakeNeighborhoodLimit (LocalSearchOperator *op, int64_t limit) |
DecisionBuilder * | MakeLocalSearchPhase (Assignment *assignment, LocalSearchPhaseParameters *parameters) |
DecisionBuilder * | MakeLocalSearchPhase (const std::vector< IntVar * > &vars, DecisionBuilder *first_solution, LocalSearchPhaseParameters *parameters) |
DecisionBuilder * | MakeLocalSearchPhase (const std::vector< IntVar * > &vars, DecisionBuilder *first_solution, DecisionBuilder *first_solution_sub_decision_builder, LocalSearchPhaseParameters *parameters) |
Variant with a sub_decison_builder specific to the first solution. | |
DecisionBuilder * | MakeLocalSearchPhase (const std::vector< SequenceVar * > &vars, DecisionBuilder *first_solution, LocalSearchPhaseParameters *parameters) |
Assignment * | RunUncheckedLocalSearch (const Assignment *initial_solution, LocalSearchFilterManager *filter_manager, LocalSearchOperator *ls_operator, const std::vector< SearchMonitor * > &monitors, RegularLimit *limit, absl::flat_hash_set< IntVar * > *touched=nullptr) |
SolutionPool * | MakeDefaultSolutionPool () |
Solution Pool. | |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder) |
Local Search Phase Parameters. | |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder, RegularLimit *limit) |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder, RegularLimit *limit, LocalSearchFilterManager *filter_manager) |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, SolutionPool *pool, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder) |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, SolutionPool *pool, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder, RegularLimit *limit) |
LocalSearchPhaseParameters * | MakeLocalSearchPhaseParameters (IntVar *objective, SolutionPool *pool, LocalSearchOperator *ls_operator, DecisionBuilder *sub_decision_builder, RegularLimit *limit, LocalSearchFilterManager *filter_manager) |
LocalSearchFilter * | MakeAcceptFilter () |
Local Search Filters. | |
LocalSearchFilter * | MakeRejectFilter () |
LocalSearchFilter * | MakeVariableDomainFilter () |
IntVarLocalSearchFilter * | MakeSumObjectiveFilter (const std::vector< IntVar * > &vars, IndexEvaluator2 values, Solver::LocalSearchFilterBound filter_enum) |
IntVarLocalSearchFilter * | MakeSumObjectiveFilter (const std::vector< IntVar * > &vars, const std::vector< IntVar * > &secondary_vars, IndexEvaluator3 values, Solver::LocalSearchFilterBound filter_enum) |
void | TopPeriodicCheck () |
int | TopProgressPercent () |
void | PushState () |
void | PopState () |
int | SearchDepth () const |
int | SearchLeftDepth () const |
int | SolveDepth () const |
void | SetBranchSelector (BranchSelector bs) |
Sets the given branch selector on the current active search. | |
DecisionBuilder * | MakeApplyBranchSelector (BranchSelector 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_t | Rand64 (int64_t size) |
Returns a random value between 0 and 'size' - 1;. | |
int32_t | Rand32 (int32_t size) |
Returns a random value between 0 and 'size' - 1;. | |
void | ReSeed (int32_t seed) |
Reseed the solver random generator. | |
void | ExportProfilingOverview (const std::string &filename) |
std::string | LocalSearchProfile () const |
ConstraintSolverStatistics | GetConstraintSolverStatistics () const |
Returns detailed cp search statistics. | |
LocalSearchStatistics | GetLocalSearchStatistics () const |
Returns detailed local search statistics. | |
bool | CurrentlyInSolve () const |
int | constraints () const |
void | Accept (ModelVisitor *visitor) const |
Accepts the given model visitor. | |
Decision * | balancing_decision () const |
void | set_fail_intercept (std::function< void()> fail_intercept) |
Internal. | |
void | clear_fail_intercept () |
DemonProfiler * | demon_profiler () const |
Access to demon profiler. | |
void | SetUseFastLocalSearch (bool use_fast_local_search) |
bool | UseFastLocalSearch () const |
Returns true if fast local search is enabled. | |
bool | HasName (const PropagationBaseObject *object) const |
Returns whether the object has been named or not. | |
Demon * | RegisterDemon (Demon *demon) |
Adds a new demon and wraps it inside a DemonProfiler if necessary. | |
IntExpr * | RegisterIntExpr (IntExpr *expr) |
Registers a new IntExpr and wraps it inside a TraceIntExpr if necessary. | |
IntVar * | RegisterIntVar (IntVar *var) |
Registers a new IntVar and wraps it inside a TraceIntVar if necessary. | |
IntervalVar * | RegisterIntervalVar (IntervalVar *var) |
Search * | ActiveSearch () const |
Returns the active search, nullptr outside search. | |
ModelCache * | Cache () 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 | IsLocalSearchProfilingEnabled () const |
Returns whether we are profiling local search. | |
bool | InstrumentsVariables () const |
Returns whether we are tracing variables. | |
bool | NameAllVariables () const |
Returns whether all variables should be named. | |
std::string | model_name () const |
Returns the name of the model. | |
PropagationMonitor * | GetPropagationMonitor () const |
Returns the propagation monitor. | |
void | AddPropagationMonitor (PropagationMonitor *monitor) |
LocalSearchMonitor * | GetLocalSearchMonitor () const |
Returns the local search monitor. | |
void | AddLocalSearchMonitor (LocalSearchMonitor *monitor) |
void | SetSearchContext (Search *search, absl::string_view search_context) |
std::string | SearchContext () const |
std::string | SearchContext (const Search *search) const |
Assignment * | GetOrCreateLocalSearchState () |
void | ClearLocalSearchState () |
Clears the local search state. | |
bool | IsBooleanVar (IntExpr *expr, IntVar **inner_var, bool *is_negated) const |
bool | IsProduct (IntExpr *expr, IntExpr **inner_expr, int64_t *coefficient) |
IntExpr * | CastExpression (const IntVar *var) const |
!defined(SWIG) | |
void | FinishCurrentSearch () |
Tells the solver to kill or restart the current search. | |
void | RestartCurrentSearch () |
void | ShouldFail () |
void | CheckFail () |
DecisionBuilder * | MakeProfiledDecisionBuilderWrapper (DecisionBuilder *db) |
Activates profiling on a decision builder. | |
bool | Solve (DecisionBuilder *db, const std::vector< SearchMonitor * > &monitors) |
bool | Solve (DecisionBuilder *db) |
bool | Solve (DecisionBuilder *db, SearchMonitor *m1) |
bool | Solve (DecisionBuilder *db, SearchMonitor *m1, SearchMonitor *m2) |
bool | Solve (DecisionBuilder *db, SearchMonitor *m1, SearchMonitor *m2, SearchMonitor *m3) |
bool | Solve (DecisionBuilder *db, SearchMonitor *m1, SearchMonitor *m2, SearchMonitor *m3, SearchMonitor *m4) |
void | NewSearch (DecisionBuilder *db, const std::vector< SearchMonitor * > &monitors) |
Opens a new top level search. | |
void | NewSearch (DecisionBuilder *db) |
void | NewSearch (DecisionBuilder *db, SearchMonitor *m1) |
void | NewSearch (DecisionBuilder *db, SearchMonitor *m1, SearchMonitor *m2) |
void | NewSearch (DecisionBuilder *db, SearchMonitor *m1, SearchMonitor *m2, SearchMonitor *m3) |
void | NewSearch (DecisionBuilder *db, SearchMonitor *m1, SearchMonitor *m2, SearchMonitor *m3, SearchMonitor *m4) |
bool | NextSolution () |
Search for the next solution in the search tree. | |
void | RestartSearch () |
void | EndSearch () |
Static Public Member Functions | |
static ConstraintSolverParameters | DefaultSolverParameters () |
--— ConstraintSolverParameters --— | |
static int64_t | MemoryUsage () |
Current memory usage in bytes. | |
Public Attributes | |
std::vector< int64_t > | tmp_vector_ |
Static Public Attributes | |
static constexpr 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 | SearchLimit |
class | RoutingModel |
class | LocalSearch |
class | LocalSearchProfiler |
template<class > | |
class | SimpleRevFIFO |
template<class K , class V > | |
class | RevImmutableMultiMap |
void | InternalSaveBooleanVarValue (Solver *solver, IntVar *var) |
For the time being, Solver is neither MT_SAFE nor MT_HOT.
Solver Class A solver represents the main computation engine. It implements the entire range of Constraint Programming protocols:
Definition at line 266 of file constraint_solver.h.
std::function<void(Solver*)> operations_research::Solver::Action |
Definition at line 807 of file constraint_solver.h.
std::function<DecisionModification()> operations_research::Solver::BranchSelector |
Definition at line 805 of file constraint_solver.h.
std::function<void()> operations_research::Solver::Closure |
Definition at line 808 of file constraint_solver.h.
std::function<int64_t(int64_t)> operations_research::Solver::IndexEvaluator1 |
Callback typedefs.
Definition at line 788 of file constraint_solver.h.
std::function<int64_t(int64_t, int64_t)> operations_research::Solver::IndexEvaluator2 |
Definition at line 789 of file constraint_solver.h.
std::function<int64_t(int64_t, int64_t, int64_t)> operations_research::Solver::IndexEvaluator3 |
Definition at line 790 of file constraint_solver.h.
std::function<bool(int64_t)> operations_research::Solver::IndexFilter1 |
Definition at line 792 of file constraint_solver.h.
std::function<IntVar*(int64_t)> operations_research::Solver::Int64ToIntVar |
Definition at line 794 of file constraint_solver.h.
std::function<int64_t(Solver* solver, const std::vector<IntVar*>& vars, int64_t first_unbound, int64_t last_unbound)> operations_research::Solver::VariableIndexSelector |
Definition at line 799 of file constraint_solver.h.
std::function<bool(int64_t, int64_t, int64_t)> operations_research::Solver::VariableValueComparator |
Definition at line 804 of file constraint_solver.h.
std::function<int64_t(const IntVar* v, int64_t id)> operations_research::Solver::VariableValueSelector |
Definition at line 802 of file constraint_solver.h.
This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between the two intervals t1 and t2.
Definition at line 641 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.
Definition at line 709 of file constraint_solver.h.
This enum represents the three possible priorities for a demon in the Solver queue.
Definition at line 627 of file constraint_solver.h.
This enum is used in Solver::MakeOperator associated with an evaluator to specify the neighborhood to create.
Definition at line 586 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.
Definition at line 408 of file constraint_solver.h.
This enum describes the straregy used to select the next interval variable and its value to be fixed.
Definition at line 432 of file constraint_solver.h.
This enum describes the strategy used to select the next variable value to set.
Definition at line 368 of file constraint_solver.h.
This enum describes the strategy used to select the next branching variable at each node during the search.
Definition at line 287 of file constraint_solver.h.
This enum is used in Solver::MakeLocalSearchObjectiveFilter. It specifies the behavior of the objective filter to create. The goal is to define under which condition a move is accepted based on the current objective value.
Definition at line 614 of file constraint_solver.h.
This enum is used in Solver::MakeOperator to specify the neighborhood to create.
Enumerator | |
---|---|
TWOOPT | Operator which reverses a sub-chain of a path. It is called TwoOpt because it breaks two arcs on the path; resulting paths are called two-optimal. Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5 (where (1, 5) are first and last nodes of the path and can therefore not be moved): 1 -> [3 -> 2] -> 4 -> 5 1 -> [4 -> 3 -> 2] -> 5 1 -> 2 -> [4 -> 3] -> 5 |
OROPT | Relocate: OROPT and RELOCATE. Operator which moves a sub-chain of a path to another position; the specified chain length is the fixed length of the chains being moved. When this length is 1, the operator simply moves a node to another position. Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5, for a chain length of 2 (where (1, 5) are first and last nodes of the path and can therefore not be moved): 1 -> 4 -> [2 -> 3] -> 5 1 -> [3 -> 4] -> 2 -> 5 Using Relocate with chain lengths of 1, 2 and 3 together is equivalent to the OrOpt operator on a path. The OrOpt operator is a limited version of 3Opt (breaks 3 arcs on a path). |
RELOCATE | Relocate neighborhood with length of 1 (see OROPT comment). |
EXCHANGE | Operator which exchanges the positions of two nodes. Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5 (where (1, 5) are first and last nodes of the path and can therefore not be moved): 1 -> [3] -> [2] -> 4 -> 5 1 -> [4] -> 3 -> [2] -> 5 1 -> 2 -> [4] -> [3] -> 5 |
CROSS | Operator which cross exchanges the starting chains of 2 paths, including exchanging the whole paths. First and last nodes are not moved. Possible neighbors for the paths 1 -> 2 -> 3 -> 4 -> 5 and 6 -> 7 -> 8 (where (1, 5) and (6, 8) are first and last nodes of the paths and can therefore not be moved): 1 -> [7] -> 3 -> 4 -> 5 6 -> [2] -> 8 1 -> [7] -> 4 -> 5 6 -> [2 -> 3] -> 8 1 -> [7] -> 5 6 -> [2 -> 3 -> 4] -> 8 |
MAKEACTIVE | Operator which inserts an inactive node into a path. Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive (where 1 and 4 are first and last nodes of the path) are: 1 -> [5] -> 2 -> 3 -> 4 1 -> 2 -> [5] -> 3 -> 4 1 -> 2 -> 3 -> [5] -> 4 |
MAKEINACTIVE | Operator which makes path nodes inactive. Possible neighbors for the path 1 -> 2 -> 3 -> 4 (where 1 and 4 are first and last nodes of the path) are: 1 -> 3 -> 4 with 2 inactive 1 -> 2 -> 4 with 3 inactive |
MAKECHAININACTIVE | Operator which makes a "chain" of path nodes inactive. Possible neighbors for the path 1 -> 2 -> 3 -> 4 (where 1 and 4 are first and last nodes of the path) are: 1 -> 3 -> 4 with 2 inactive 1 -> 2 -> 4 with 3 inactive 1 -> 4 with 2 and 3 inactive |
SWAPACTIVE | Operator which replaces an active node by an inactive one. Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive (where 1 and 4 are first and last nodes of the path) are: 1 -> [5] -> 3 -> 4 with 2 inactive 1 -> 2 -> [5] -> 4 with 3 inactive |
EXTENDEDSWAPACTIVE | Operator which makes an inactive node active and an active one inactive. It is similar to SwapActiveOperator except that it tries to insert the inactive node in all possible positions instead of just the position of the node made inactive. Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive (where 1 and 4 are first and last nodes of the path) are: 1 -> [5] -> 3 -> 4 with 2 inactive 1 -> 3 -> [5] -> 4 with 2 inactive 1 -> [5] -> 2 -> 4 with 3 inactive 1 -> 2 -> [5] -> 4 with 3 inactive |
PATHLNS | Operator which relaxes two sub-chains of three consecutive arcs each. Each sub-chain is defined by a start node and the next three arcs. Those six arcs are relaxed to build a new neighbor. PATHLNS explores all possible pairs of starting nodes and so defines n^2 neighbors, n being the number of nodes.
|
FULLPATHLNS | Operator which relaxes one entire path and all inactive nodes, thus defining num_paths neighbors. |
UNACTIVELNS | Operator which relaxes all inactive nodes and one sub-chain of six consecutive arcs. That way the path can be improved by inserting inactive nodes or swapping arcs. |
INCREMENT | Operator which defines one neighbor per variable. Each neighbor tries to increment by one the value of the corresponding variable. When a new solution is found the neighborhood is rebuilt from scratch, i.e., tries to increment values in the variable order. Consider for instance variables x and y. x is incremented one by one to its max, and when it is not possible to increment x anymore, y is incremented once. If this is a solution, then next neighbor tries to increment x. |
DECREMENT | Operator which defines a neighborhood to decrement values. The behavior is the same as INCREMENT, except values are decremented instead of incremented. |
SIMPLELNS | Operator which defines one neighbor per variable. Each neighbor relaxes one variable. When a new solution is found the neighborhood is rebuilt from scratch. Consider for instance variables x and y. First x is relaxed and the solver is looking for the best possible solution (with only x relaxed). Then y is relaxed, and the solver is looking for a new solution. If a new solution is found, then the next variable to be relaxed is x. |
Definition at line 447 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 735 of file constraint_solver.h.
|
strong |
Search monitor events.
Definition at line 758 of file constraint_solver.h.
Optimization directions.
Enumerator | |
---|---|
NOT_SET | |
MAXIMIZATION | |
MINIMIZATION |
Definition at line 754 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 423 of file constraint_solver.h.
This enum represents the state of the solver w.r.t. the search.
Definition at line 738 of file constraint_solver.h.
This enum is used in Solver::MakeIntervalVarRelation to specify the temporal relation between an interval t and an integer d.
Definition at line 674 of file constraint_solver.h.
|
explicit |
Solver API.
Definition at line 1448 of file constraint_solver.cc.
operations_research::Solver::Solver | ( | const std::string & | name, |
const ConstraintSolverParameters & | parameters ) |
Definition at line 1437 of file constraint_solver.cc.
|
delete |
This type is neither copyable nor movable.
operations_research::Solver::~Solver | ( | ) |
solver destructor called with searches open.
Not popping a SENTINEL in Solver destructor.
Not popping initial SENTINEL in Solver destructor.
Definition at line 1502 of file constraint_solver.cc.
void operations_research::Solver::Accept | ( | ModelVisitor * | visitor | ) | const |
Accepts the given model visitor.
Definition at line 1726 of file constraint_solver.cc.
|
inline |
The number of accepted neighbors.
Definition at line 1081 of file constraint_solver.h.
Search * operations_research::Solver::ActiveSearch | ( | ) | const |
Returns the active search, nullptr outside search.
Definition at line 1155 of file constraint_solver.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 1622 of file constraint_solver.cc.
void operations_research::Solver::AddCastConstraint | ( | CastConstraint * | constraint, |
IntVar * | target_var, | ||
IntExpr * | expr ) |
Adds 'constraint' to the solver and marks it as a cast constraint, that is, a constraint created calling Var() on an expression. This is used internally.
Definition at line 1714 of file constraint_solver.cc.
void operations_research::Solver::AddConstraint | ( | Constraint * | c | ) |
Adds the constraint 'c' to the model. After calling this method, and until there is a backtrack that undoes the addition, any assignment of variables to values must satisfy the given constraint in order to be considered feasible. There are two fairly different use cases:
state() == OUTSIDE_SEARCH
). Most users should only use AddConstraint in this way. In this case, the constraint will belong to the model forever: it cannot be removed by backtracking.Definition at line 1690 of file constraint_solver.cc.
void operations_research::Solver::AddLocalSearchMonitor | ( | LocalSearchMonitor * | monitor | ) |
Adds the local search monitor to the solver. This is called internally when a propagation monitor is passed to the Solve() or NewSearch() method.
Definition at line 3231 of file constraint_solver.cc.
void operations_research::Solver::AddPropagationMonitor | ( | PropagationMonitor * | 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 3153 of file constraint_solver.cc.
|
inline |
Definition at line 3076 of file constraint_solver.h.
|
inline |
The number of branches explored since the creation of the solver.
Definition at line 1055 of file constraint_solver.h.
ModelCache * operations_research::Solver::Cache | ( | ) | const |
Returns the cache of the model.
Definition at line 850 of file model_cache.cc.
!defined(SWIG)
--— Cast Expression --—
Internal. If the variables is the result of expr->Var(), this method returns expr, nullptr otherwise.
Definition at line 2427 of file constraint_solver.cc.
bool operations_research::Solver::CheckAssignment | ( | Assignment * | solution | ) |
Checks whether the given assignment satisfies all relevant constraints.
Check state and go to OUTSIDE_SEARCH.
Push monitors and enter search.
Push sentinel and set decision builder.
Definition at line 2293 of file constraint_solver.cc.
bool operations_research::Solver::CheckConstraint | ( | Constraint * | ct | ) |
Checks whether adding this constraint will lead to an immediate failure. It will return false if the model is already inconsistent, or if adding the constraint makes it inconsistent.
Definition at line 2372 of file constraint_solver.cc.
|
inline |
Definition at line 3192 of file constraint_solver.h.
|
inline |
Definition at line 3084 of file constraint_solver.h.
|
inline |
Clears the local search state.
Definition at line 3140 of file constraint_solver.h.
|
inline |
Manipulate neighbors count; to be used for testing purposes only.
Definition at line 1074 of file constraint_solver.h.
DecisionBuilder * operations_research::Solver::Compose | ( | const std::vector< DecisionBuilder * > & | dbs | ) |
DecisionBuilder * operations_research::Solver::Compose | ( | DecisionBuilder * | db1, |
DecisionBuilder * | db2 ) |
Creates a decision builder which sequentially composes decision builders. At each leaf of a decision builder, the next decision builder is therefore called. For instance, Compose(db1, db2) will result in the following tree: d1 tree | / | \ | db1 leaves | / | \ | db2 tree db2 tree db2 tree |
DecisionBuilder * operations_research::Solver::Compose | ( | DecisionBuilder * | db1, |
DecisionBuilder * | db2, | ||
DecisionBuilder * | db3 ) |
DecisionBuilder * operations_research::Solver::Compose | ( | DecisionBuilder * | db1, |
DecisionBuilder * | db2, | ||
DecisionBuilder * | db3, | ||
DecisionBuilder * | db4 ) |
LocalSearchOperator * operations_research::Solver::ConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops | ) |
Creates a local search operator which concatenates a vector of operators. Each operator from the vector is called sequentially. By default, when a neighbor is found the neighborhood exploration restarts from the last active operator (the one which produced the neighbor). This can be overridden by setting restart to true to force the exploration to start from the first operator in the vector. The default behavior can also be overridden using an evaluation callback to set the order in which the operators are explored (the callback is called in LocalSearchOperator::Start()). The first argument of the callback is the index of the operator which produced the last move, the second argument is the index of the operator to be evaluated. Ownership of the callback is taken by ConcatenateOperators. Example: const int kPriorities = {10, 100, 10, 0}; int64_t Evaluate(int active_operator, int current_operator) { return kPriorities[current_operator]; } LocalSearchOperator* concat = solver.ConcatenateOperators(operators, NewPermanentCallback(&Evaluate)); The elements of the vector operators will be sorted by increasing priority and explored in that order (tie-breaks are handled by keeping the relative operator order in the vector). This would result in the following order: operators[3], operators[0], operators[2], operators[1].
Definition at line 2161 of file local_search.cc.
LocalSearchOperator * operations_research::Solver::ConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
bool | restart ) |
Definition at line 2166 of file local_search.cc.
LocalSearchOperator * operations_research::Solver::ConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
std::function< int64_t(int, int)> | evaluator ) |
Definition at line 2178 of file local_search.cc.
|
inline |
Read-only.
Definition at line 825 of file constraint_solver.h.
|
inline |
Counts the number of constraints that have been added to the solver before the search.
Definition at line 3071 of file constraint_solver.h.
|
inline |
Gets the current context of the search.
Definition at line 1094 of file constraint_solver.h.
bool operations_research::Solver::CurrentlyInSolve | ( | ) | const |
Returns true whether the current search has been created using a Solve() call instead of a NewSearch one. It returns false if the solver is not in search at all.
Definition at line 1779 of file constraint_solver.cc.
std::string operations_research::Solver::DebugString | ( | ) | const |
|
static |
--— ConstraintSolverParameters --—
Create a ConstraintSolverParameters proto with all the default values.
Definition at line 129 of file constraint_solver.cc.
|
inline |
Access to demon profiler.
Definition at line 3086 of file constraint_solver.h.
|
inline |
The number of demons executed during search for a given priority.
Definition at line 1064 of file constraint_solver.h.
void operations_research::Solver::EndSearch | ( | ) |
Restores the state.
Checks if we want to export the profile info.
Definition at line 2262 of file constraint_solver.cc.
void operations_research::Solver::ExportProfilingOverview | ( | const std::string & | filename | ) |
Exports the profiling information in a human readable overview. The parameter profile_level used to create the solver must be set to true.
Definition at line 435 of file demon_profiler.cc.
void operations_research::Solver::Fail | ( | ) |
Abandon the current branch in the search tree. A backtrack will follow.
Definition at line 2406 of file constraint_solver.cc.
uint64_t operations_research::Solver::fail_stamp | ( | ) | const |
The fail_stamp() is incremented after each backtrack.
Definition at line 1678 of file constraint_solver.cc.
|
inline |
The number of failures encountered since the creation of the solver.
Definition at line 1067 of file constraint_solver.h.
|
inline |
The number of filtered neighbors (neighbors accepted by filters).
Definition at line 1078 of file constraint_solver.h.
void operations_research::Solver::FinishCurrentSearch | ( | ) |
Tells the solver to kill or restart the current search.
Definition at line 2417 of file constraint_solver.cc.
ConstraintSolverStatistics operations_research::Solver::GetConstraintSolverStatistics | ( | ) | const |
Returns detailed cp search statistics.
Definition at line 1579 of file constraint_solver.cc.
LocalSearchMonitor * operations_research::Solver::GetLocalSearchMonitor | ( | ) | const |
Returns the local search monitor.
Definition at line 3237 of file constraint_solver.cc.
LocalSearchStatistics operations_research::Solver::GetLocalSearchStatistics | ( | ) | const |
Returns detailed local search statistics.
Definition at line 4598 of file local_search.cc.
Assignment * operations_research::Solver::GetOrCreateLocalSearchState | ( | ) |
Returns (or creates) an assignment representing the state of local search.
Definition at line 3254 of file constraint_solver.cc.
PropagationMonitor * operations_research::Solver::GetPropagationMonitor | ( | ) | const |
Returns the propagation monitor.
Definition at line 3158 of file constraint_solver.cc.
bool operations_research::Solver::HasName | ( | const PropagationBaseObject * | object | ) | const |
Returns whether the object has been named or not.
Definition at line 2475 of file constraint_solver.cc.
|
inline |
Definition at line 1075 of file constraint_solver.h.
bool operations_research::Solver::InstrumentsDemons | ( | ) | const |
Returns whether we are instrumenting demons.
Definition at line 180 of file constraint_solver.cc.
bool operations_research::Solver::InstrumentsVariables | ( | ) | const |
Returns whether we are tracing variables.
Definition at line 194 of file constraint_solver.cc.
bool operations_research::Solver::IsBooleanVar | ( | IntExpr * | expr, |
IntVar ** | inner_var, | ||
bool * | is_negated ) const |
Returns true if expr represents either boolean_var or 1 - boolean_var. In that case, it fills inner_var and is_negated to be true if the expression is 1 - boolean_var – equivalent to not(boolean_var).
Definition at line 7508 of file expressions.cc.
bool operations_research::Solver::IsLocalSearchProfilingEnabled | ( | ) | const |
Returns whether we are profiling local search.
Definition at line 189 of file constraint_solver.cc.
bool operations_research::Solver::IsProduct | ( | IntExpr * | expr, |
IntExpr ** | inner_expr, | ||
int64_t * | coefficient ) |
Returns true if expr represents a product of a expr and a constant. In that case, it fills inner_expr and coefficient with these, and returns true. In the other case, it fills inner_expr with expr, coefficient with 1, and returns false.
Definition at line 7526 of file expressions.cc.
bool operations_research::Solver::IsProfilingEnabled | ( | ) | const |
Returns whether we are profiling the solver.
Definition at line 184 of file constraint_solver.cc.
std::string operations_research::Solver::LocalSearchProfile | ( | ) | const |
Returns local search profiling information in a human readable format.
Definition at line 4591 of file local_search.cc.
expr
Definition at line 7049 of file expressions.cc.
Constraint * operations_research::Solver::MakeAbsEquality | ( | IntVar * | var, |
IntVar * | abs_var ) |
Creates the constraint abs(var) == abs_var.
Definition at line 7042 of file expressions.cc.
LocalSearchFilter * operations_research::Solver::MakeAcceptFilter | ( | ) |
Local Search Filters.
Definition at line 2634 of file local_search.cc.
Demon * operations_research::Solver::MakeActionDemon | ( | Solver::Action | action | ) |
Constraint * operations_research::Solver::MakeAllDifferent | ( | const std::vector< IntVar * > & | vars | ) |
All variables are pairwise different. This corresponds to the stronger version of the propagation algorithm.
Definition at line 694 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 698 of file alldiff_cst.cc.
Constraint * operations_research::Solver::MakeAllDifferentExcept | ( | const std::vector< IntVar * > & | vars, |
int64_t | escape_value ) |
All variables are pairwise different, unless they are assigned to the escape value.
Definition at line 724 of file alldiff_cst.cc.
Constraint * operations_research::Solver::MakeAllowedAssignments | ( | const std::vector< IntVar * > & | vars, |
const IntTupleSet & | tuples ) |
SolutionCollector * operations_research::Solver::MakeAllSolutionCollector | ( | ) |
SolutionCollector * operations_research::Solver::MakeAllSolutionCollector | ( | const Assignment * | assignment | ) |
DecisionBuilder * operations_research::Solver::MakeApplyBranchSelector | ( | BranchSelector | bs | ) |
Creates a decision builder that will set the branch selector.
Definition at line 1195 of file constraint_solver.cc.
Assignment * operations_research::Solver::MakeAssignment | ( | ) |
This method creates an empty assignment.
Definition at line 969 of file assignment.cc.
Assignment * operations_research::Solver::MakeAssignment | ( | const Assignment * | a | ) |
This method creates an assignment which is a copy of 'a'.
Definition at line 971 of file assignment.cc.
Constraint * operations_research::Solver::MakeAtMost | ( | std::vector< IntVar * > | vars, |
int64_t | value, | ||
int64_t | max_count ) |
SearchMonitor * operations_research::Solver::MakeAtSolutionCallback | ( | std::function< void()> | callback | ) |
SolutionCollector * operations_research::Solver::MakeBestLexicographicValueSolutionCollector | ( | const Assignment * | assignment, |
std::vector< bool > | maximize ) |
SolutionCollector * operations_research::Solver::MakeBestLexicographicValueSolutionCollector | ( | std::vector< bool > | maximize | ) |
SolutionCollector * operations_research::Solver::MakeBestValueSolutionCollector | ( | bool | maximize | ) |
Collect the solution corresponding to the optimal value of the objective of the internal assignment; if this assignment does not have an objective no solution is collected. This collector only collects one solution corresponding to the best objective value (the first one found). The variables and objective(s) will need to be added later.
SolutionCollector * operations_research::Solver::MakeBestValueSolutionCollector | ( | const Assignment * | assignment, |
bool | maximize ) |
Collect the solution corresponding to the optimal value of the objective of 'assignment'; if 'assignment' does not have an objective no solution is collected. This collector only collects one solution corresponding to the best objective value (the first one found).
Constraint * operations_research::Solver::MakeBetweenCt | ( | IntExpr * | expr, |
int64_t | l, | ||
int64_t | u ) |
--— Between and related constraints --—
(l <= expr <= u)
Catch empty and singleton intervals.
Catch the trivial cases first.
Catch one-sided constraints.
Simplify the common factor, if any.
No further reduction is possible.
Definition at line 929 of file expr_cst.cc.
IntVar * operations_research::Solver::MakeBoolVar | ( | ) |
MakeBoolVar will create a variable with a {0, 1} domain.
Definition at line 6444 of file expressions.cc.
IntVar * operations_research::Solver::MakeBoolVar | ( | const std::string & | name | ) |
MakeBoolVar will create a variable with a {0, 1} domain.
Definition at line 6440 of file expressions.cc.
IntVar ** operations_research::Solver::MakeBoolVarArray | ( | int | var_count, |
const std::string & | name ) |
Same but allocates an array and returns it.
Definition at line 6581 of file expressions.cc.
void operations_research::Solver::MakeBoolVarArray | ( | int | var_count, |
const std::string & | name, | ||
std::vector< IntVar * > * | vars ) |
This method will append the vector vars with 'var_count' boolean variables having name "name<i>" where is the index of the variable.
Definition at line 6568 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 6575 of file expressions.cc.
RegularLimit * operations_research::Solver::MakeBranchesLimit | ( | int64_t | branches | ) |
Constraint * operations_research::Solver::MakeCircuit | ( | const std::vector< IntVar * > & | nexts | ) |
Force the "nexts" variable to create a complete Hamiltonian path.
Definition at line 640 of file graph_constraints.cc.
Demon * operations_research::Solver::MakeClosureDemon | ( | Solver::Closure | closure | ) |
IntExpr * operations_research::Solver::MakeConditionalExpression | ( | IntVar * | condition, |
IntExpr * | expr, | ||
int64_t | unperformed_value ) |
Conditional Expr condition ? expr : unperformed_value.
--— Conditional Expression --—
Definition at line 7281 of file expressions.cc.
SearchMonitor * operations_research::Solver::MakeConstantRestart | ( | int | frequency | ) |
DecisionBuilder * operations_research::Solver::MakeConstraintAdder | ( | Constraint * | ct | ) |
Returns a decision builder that will add the given constraint to the model.
Definition at line 2368 of file constraint_solver.cc.
Demon * operations_research::Solver::MakeConstraintInitialPropagateCallback | ( | Constraint * | ct | ) |
This method is a specialized case of the MakeConstraintDemon method to call the InitiatePropagate of the constraint 'ct'.
Definition at line 37 of file constraints.cc.
IntExpr * operations_research::Solver::MakeConvexPiecewiseExpr | ( | IntExpr * | expr, |
int64_t | early_cost, | ||
int64_t | early_date, | ||
int64_t | late_date, | ||
int64_t | late_cost ) |
Convex piecewise function.
Definition at line 7194 of file expressions.cc.
Constraint * operations_research::Solver::MakeCount | ( | const std::vector< IntVar * > & | vars, |
int64_t | value, | ||
int64_t | max_count ) |
|{i | vars[i] == value}| == max_count
Definition at line 33 of file count_cst.cc.
Constraint * operations_research::Solver::MakeCount | ( | const std::vector< IntVar * > & | vars, |
int64_t | value, | ||
IntVar * | max_count ) |
|{i | vars[i] == value}| == max_count
Definition at line 48 of file count_cst.cc.
Constraint * operations_research::Solver::MakeCover | ( | const std::vector< IntervalVar * > & | vars, |
IntervalVar * | target_var ) |
This constraint states that the target_var is the convex hull of the intervals. If none of the interval variables is performed, then the target var is unperformed too. Also, if the target variable is unperformed, then all the intervals variables are unperformed too.
Definition at line 588 of file sched_constraints.cc.
Constraint * operations_research::Solver::MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< int > & | demands, | ||
int64_t | capacity, | ||
const std::string & | name ) |
This constraint forces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity. Intervals and demands should be vectors of equal size. Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.
Definition at line 2634 of file resource.cc.
Constraint * operations_research::Solver::MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< int > & | demands, | ||
IntVar * | capacity, | ||
const std::string & | name ) |
This constraint enforces that, for any integer t, the sum of the demands corresponding to an interval containing t does not exceed the given capacity. Intervals and demands should be vectors of equal size. Demands should only contain non-negative values. Zero values are supported, and the corresponding intervals are filtered out, as they neither impact nor are impacted by this constraint.
Definition at line 2652 of file resource.cc.
Constraint * operations_research::Solver::MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< int64_t > & | demands, | ||
int64_t | capacity, | ||
const std::string & | name ) |
Demands are constant.
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 2620 of file resource.cc.
Constraint * operations_research::Solver::MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< int64_t > & | demands, | ||
IntVar * | capacity, | ||
absl::string_view | 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 2640 of file resource.cc.
Constraint * operations_research::Solver::MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< IntVar * > & | demands, | ||
int64_t | capacity, | ||
const std::string & | name ) |
Demands should be positive.
Demands are variable.
This constraint enforces that, for any integer t, the sum of demands corresponding to an interval containing t does not exceed the given capacity. Intervals and demands should be vectors of equal size.
Definition at line 2661 of file resource.cc.
Constraint * operations_research::Solver::MakeCumulative | ( | const std::vector< IntervalVar * > & | intervals, |
const std::vector< IntVar * > & | demands, | ||
IntVar * | capacity, | ||
const std::string & | name ) |
Demands should be positive.
This constraint enforces that, for any integer t, the sum of demands corresponding to an interval containing t does not exceed the given capacity. Intervals and demands should be vectors of equal size.
Definition at line 2679 of file resource.cc.
SearchLimit * operations_research::Solver::MakeCustomLimit | ( | std::function< bool()> | limiter | ) |
DecisionBuilder * operations_research::Solver::MakeDecisionBuilderFromAssignment | ( | Assignment * | assignment, |
DecisionBuilder * | db, | ||
const std::vector< IntVar * > & | vars ) |
DecisionBuilder * operations_research::Solver::MakeDefaultPhase | ( | const std::vector< IntVar * > & | vars | ) |
Definition at line 1126 of file default_search.cc.
DecisionBuilder * operations_research::Solver::MakeDefaultPhase | ( | const std::vector< IntVar * > & | vars, |
const DefaultPhaseParameters & | parameters ) |
Definition at line 1131 of file default_search.cc.
RegularLimitParameters operations_research::Solver::MakeDefaultRegularLimitParameters | ( | ) | const |
SolutionPool * operations_research::Solver::MakeDefaultSolutionPool | ( | ) |
Solution Pool.
Definition at line 5562 of file local_search.cc.
Demon * operations_research::Solver::MakeDelayedConstraintInitialPropagateCallback | ( | Constraint * | 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 42 of file constraints.cc.
Constraint * operations_research::Solver::MakeDelayedPathCumul | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
const std::vector< IntVar * > & | cumuls, | ||
const std::vector< IntVar * > & | transits ) |
Delayed version of the same constraint: propagation on the nexts variables is delayed until all constraints have propagated.
Definition at line 1328 of file graph_constraints.cc.
Constraint * operations_research::Solver::MakeDeviation | ( | const std::vector< IntVar * > & | vars, |
IntVar * | deviation_var, | ||
int64_t | total_sum ) |
Deviation constraint: sum_i |n * vars[i] - total_sum| <= deviation_var and sum_i vars[i] == total_sum n = #vars
Definition at line 414 of file deviation.cc.
left - right
Definition at line 6699 of file expressions.cc.
DisjunctiveConstraint * operations_research::Solver::MakeDisjunctiveConstraint | ( | const std::vector< IntervalVar * > & | intervals, |
const std::string & | name ) |
-------— Factory methods -------—
This constraint forces all interval vars into an non-overlapping sequence. Intervals with zero duration can be scheduled anywhere.
Definition at line 2608 of file resource.cc.
Constraint * operations_research::Solver::MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | card_min, | ||
const std::vector< int > & | card_max ) |
Aggregated version of count with bounded cardinalities: forall j in 0 .. card_size - 1: card_min[j] <= |{i | v[i] == j}| <= card_max[j]
Definition at line 1054 of file count_cst.cc.
Constraint * operations_research::Solver::MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | values, | ||
const std::vector< int > & | card_min, | ||
const std::vector< int > & | card_max ) |
Aggregated version of count with bounded cardinalities: forall j in 0 .. card_size - 1: card_min[j] <= |{i | v[i] == values[j]}| <= card_max[j]
Definition at line 1077 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 995 of file count_cst.cc.
Constraint * operations_research::Solver::MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64_t > & | card_min, | ||
const std::vector< int64_t > & | card_max ) |
Aggregated version of count with bounded cardinalities: forall j in 0 .. card_size - 1: card_min[j] <= |{i | v[i] == j}| <= card_max[j]
Definition at line 1034 of file count_cst.cc.
Constraint * operations_research::Solver::MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64_t > & | values, | ||
const std::vector< int64_t > & | card_min, | ||
const std::vector< int64_t > & | card_max ) |
Aggregated version of count with bounded cardinalities: forall j in 0 .. card_size - 1: card_min[j] <= |{i | v[i] == values[j]}| <= card_max[j]
Definition at line 1060 of file count_cst.cc.
Constraint * operations_research::Solver::MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64_t > & | values, | ||
const std::vector< IntVar * > & | cards ) |
Aggregated version of count: |{i | v[i] == values[j]}| == cards[j].
Definition at line 966 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 1001 of file count_cst.cc.
Constraint * operations_research::Solver::MakeDistribute | ( | const std::vector< IntVar * > & | vars, |
int64_t | card_min, | ||
int64_t | card_max, | ||
int64_t | card_size ) |
Aggregated version of count with bounded cardinalities: forall j in 0 .. card_size - 1: card_min <= |{i | v[i] == j}| <= card_max
Definition at line 1015 of file count_cst.cc.
expr / value (integer division)
Definition at line 7021 of file expressions.cc.
numerator / denominator (integer division). Terms need to be positive.
Definition at line 6983 of file expressions.cc.
IntExpr * operations_research::Solver::MakeElement | ( | const std::vector< int > & | values, |
IntVar * | index ) |
values[index]
Definition at line 668 of file element.cc.
IntExpr * operations_research::Solver::MakeElement | ( | const std::vector< int64_t > & | values, |
IntVar * | index ) |
values[index]
Definition at line 658 of file element.cc.
IntExpr * operations_research::Solver::MakeElement | ( | Solver::IndexEvaluator1 | values, |
IntVar * | index ) |
Function-based element. The constraint takes ownership of the callback. The callback must be able to cope with any possible value in the domain of 'index' (potentially negative ones too).
Definition at line 862 of file element.cc.
IntExpr * operations_research::Solver::MakeElement | ( | Solver::IndexEvaluator2 | values, |
IntVar * | index1, | ||
IntVar * | index2 ) |
2D version of function-based element expression, values(expr1, expr2).
Definition at line 1114 of file element.cc.
IntExpr * operations_research::Solver::MakeElement | ( | Int64ToIntVar | vars, |
int64_t | range_start, | ||
int64_t | range_end, | ||
IntVar * | argument ) |
vars(argument)
Definition at line 1664 of file element.cc.
Constraint * operations_research::Solver::MakeElementEquality | ( | const std::vector< int > & | vals, |
IntVar * | index, | ||
IntVar * | target ) |
Definition at line 1687 of file element.cc.
Constraint * operations_research::Solver::MakeElementEquality | ( | const std::vector< int64_t > & | vals, |
IntVar * | index, | ||
IntVar * | target ) |
Definition at line 1681 of file element.cc.
Constraint * operations_research::Solver::MakeElementEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar * | index, | ||
int64_t | target ) |
Definition at line 1720 of file element.cc.
Constraint * operations_research::Solver::MakeElementEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar * | index, | ||
IntVar * | target ) |
Definition at line 1693 of file element.cc.
SearchMonitor * operations_research::Solver::MakeEnterSearchCallback | ( | std::function< void()> | callback | ) |
Constraint * operations_research::Solver::MakeEquality | ( | IntervalVar * | var1, |
IntervalVar * | var2 ) |
This constraints states that the two interval variables are equal.
Definition at line 598 of file sched_constraints.cc.
Constraint * operations_research::Solver::MakeEquality | ( | IntExpr * | expr, |
int | value ) |
expr == value
Definition at line 104 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeEquality | ( | IntExpr * | expr, |
int64_t | value ) |
expr == value
Definition at line 89 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeEquality | ( | IntExpr * | left, |
IntExpr * | right ) |
left == right
Definition at line 518 of file range_cst.cc.
SearchMonitor * operations_research::Solver::MakeExitSearchCallback | ( | std::function< void()> | callback | ) |
Decision * operations_research::Solver::MakeFailDecision | ( | ) |
Definition at line 1410 of file constraint_solver.cc.
RegularLimit * operations_research::Solver::MakeFailuresLimit | ( | int64_t | failures | ) |
Constraint * operations_research::Solver::MakeFalseConstraint | ( | ) |
This constraint always fails.
Definition at line 535 of file constraints.cc.
Constraint * operations_research::Solver::MakeFalseConstraint | ( | const std::string & | explanation | ) |
Definition at line 539 of file constraints.cc.
SolutionCollector * operations_research::Solver::MakeFirstSolutionCollector | ( | ) |
SolutionCollector * operations_research::Solver::MakeFirstSolutionCollector | ( | const Assignment * | assignment | ) |
IntervalVar * operations_research::Solver::MakeFixedDurationEndSyncedOnEndIntervalVar | ( | IntervalVar * | interval_var, |
int64_t | duration, | ||
int64_t | offset ) |
Creates an interval var with a fixed duration whose end is synchronized with the end of another interval, with a given offset. The performed status is also in sync with the performed status of the given interval variable.
Definition at line 2464 of file interval.cc.
IntervalVar * operations_research::Solver::MakeFixedDurationEndSyncedOnStartIntervalVar | ( | IntervalVar * | interval_var, |
int64_t | duration, | ||
int64_t | offset ) |
Creates an interval var with a fixed duration whose end is synchronized with the start of another interval, with a given offset. The performed status is also in sync with the performed status of the given interval variable.
Definition at line 2457 of file interval.cc.
IntervalVar * operations_research::Solver::MakeFixedDurationIntervalVar | ( | int64_t | start_min, |
int64_t | start_max, | ||
int64_t | duration, | ||
bool | optional, | ||
const std::string & | name ) |
Creates an interval var with a fixed duration. The duration must be greater than 0. If optional is true, then the interval can be performed or unperformed. If optional is false, then the interval is always performed.
Definition at line 2284 of file interval.cc.
IntervalVar * operations_research::Solver::MakeFixedDurationIntervalVar | ( | IntVar * | start_variable, |
int64_t | duration, | ||
const std::string & | name ) |
Creates a performed interval var with a fixed duration. The duration must be greater than 0.
Definition at line 2312 of file interval.cc.
IntervalVar * operations_research::Solver::MakeFixedDurationIntervalVar | ( | IntVar * | start_variable, |
int64_t | duration, | ||
IntVar * | performed_variable, | ||
const std::string & | name ) |
Creates an interval var with a fixed duration, and performed_variable. The duration must be greater than 0.
Creates an interval var with a fixed duration, and performed var. The duration must be greater than 0.
Definition at line 2323 of file interval.cc.
void operations_research::Solver::MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
absl::Span< const int > | durations, | ||
absl::string_view | name, | ||
std::vector< IntervalVar * > * | array ) |
This method fills the vector with interval variables built with the corresponding start variables.
Definition at line 2372 of file interval.cc.
void operations_research::Solver::MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
absl::Span< const int > | durations, | ||
const std::vector< IntVar * > & | performed_variables, | ||
absl::string_view | name, | ||
std::vector< IntervalVar * > * | array ) |
This method fills the vector with interval variables built with the corresponding start and performed variables.
Definition at line 2386 of file interval.cc.
void operations_research::Solver::MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
absl::Span< const int64_t > | durations, | ||
absl::string_view | name, | ||
std::vector< IntervalVar * > * | array ) |
This method fills the vector with interval variables built with the corresponding start variables.
Definition at line 2358 of file interval.cc.
void operations_research::Solver::MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
absl::Span< const int64_t > | durations, | ||
const std::vector< IntVar * > & | performed_variables, | ||
absl::string_view | name, | ||
std::vector< IntervalVar * > * | array ) |
This method fills the vector with interval variables built with the corresponding start and performed variables.
Definition at line 2400 of file interval.cc.
void operations_research::Solver::MakeFixedDurationIntervalVarArray | ( | const std::vector< IntVar * > & | start_variables, |
int64_t | duration, | ||
absl::string_view | name, | ||
std::vector< IntervalVar * > * | array ) |
This method fills the vector with 'count' interval var built with the corresponding start variables.
Definition at line 2344 of file interval.cc.
void operations_research::Solver::MakeFixedDurationIntervalVarArray | ( | int | count, |
int64_t | start_min, | ||
int64_t | start_max, | ||
int64_t | duration, | ||
bool | optional, | ||
absl::string_view | name, | ||
std::vector< IntervalVar * > * | array ) |
This method fills the vector with 'count' interval variables built with the corresponding parameters.
Definition at line 2299 of file interval.cc.
IntervalVar * operations_research::Solver::MakeFixedDurationStartSyncedOnEndIntervalVar | ( | IntervalVar * | interval_var, |
int64_t | duration, | ||
int64_t | offset ) |
Creates an interval var with a fixed duration whose start is synchronized with the end of another interval, with a given offset. The performed status is also in sync with the performed status of the given interval variable.
Definition at line 2450 of file interval.cc.
IntervalVar * operations_research::Solver::MakeFixedDurationStartSyncedOnStartIntervalVar | ( | IntervalVar * | interval_var, |
int64_t | duration, | ||
int64_t | offset ) |
Synced Interval Vars.
Creates an interval var with a fixed duration whose start is synchronized with the start of another interval, with a given offset. The performed status is also in sync with the performed status of the given interval variable.
Definition at line 2443 of file interval.cc.
IntervalVar * operations_research::Solver::MakeFixedInterval | ( | int64_t | start, |
int64_t | duration, | ||
const std::string & | name ) |
Creates a fixed and performed interval.
Definition at line 2279 of file interval.cc.
ObjectiveMonitor * operations_research::Solver::MakeGenericTabuSearch | ( | bool | maximize, |
IntVar * | v, | ||
int64_t | step, | ||
const std::vector< IntVar * > & | tabu_vars, | ||
int64_t | forbid_tenure ) |
Constraint * operations_research::Solver::MakeGreater | ( | IntExpr * | expr, |
int | value ) |
expr > value
Definition at line 207 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeGreater | ( | IntExpr * | expr, |
int64_t | value ) |
expr > value
Definition at line 196 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeGreater | ( | IntExpr * | left, |
IntExpr * | right ) |
left > right
Definition at line 566 of file range_cst.cc.
Constraint * operations_research::Solver::MakeGreaterOrEqual | ( | IntExpr * | expr, |
int | value ) |
expr >= value
Definition at line 185 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeGreaterOrEqual | ( | IntExpr * | expr, |
int64_t | value ) |
expr >= value
Definition at line 174 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeGreaterOrEqual | ( | IntExpr * | left, |
IntExpr * | right ) |
left >= right
Definition at line 548 of file range_cst.cc.
ObjectiveMonitor * operations_research::Solver::MakeGuidedLocalSearch | ( | bool | maximize, |
IntVar * | objective, | ||
Solver::IndexEvaluator2 | objective_function, | ||
int64_t | step, | ||
const std::vector< IntVar * > & | vars, | ||
double | penalty_factor, | ||
bool | reset_penalties_on_new_best_solution = false ) |
Creates a Guided Local Search monitor. Description here: http://en.wikipedia.org/wiki/Guided_Local_Search
ObjectiveMonitor * operations_research::Solver::MakeGuidedLocalSearch | ( | bool | maximize, |
IntVar * | objective, | ||
Solver::IndexEvaluator3 | objective_function, | ||
int64_t | step, | ||
const std::vector< IntVar * > & | vars, | ||
const std::vector< IntVar * > & | secondary_vars, | ||
double | penalty_factor, | ||
bool | reset_penalties_on_new_best_solution = false ) |
Constraint * operations_research::Solver::MakeIfThenElseCt | ( | IntVar * | condition, |
IntExpr * | then_expr, | ||
IntExpr * | else_expr, | ||
IntVar * | target_var ) |
Special cases with arrays of size two.
Definition at line 1609 of file element.cc.
ImprovementSearchLimit * operations_research::Solver::MakeImprovementLimit | ( | IntVar * | objective_var, |
bool | maximize, | ||
double | objective_scaling_factor, | ||
double | objective_offset, | ||
double | improvement_rate_coefficient, | ||
int | improvement_rate_solutions_distance ) |
IntExpr * operations_research::Solver::MakeIndexExpression | ( | const std::vector< IntVar * > & | vars, |
int64_t | value ) |
Returns the expression expr such that vars[expr] == value. It assumes that vars are all different.
Definition at line 1759 of file element.cc.
Constraint * operations_research::Solver::MakeIndexOfConstraint | ( | const std::vector< IntVar * > & | vars, |
IntVar * | index, | ||
int64_t | target ) |
This constraint is a special case of the element constraint with an array of integer variables, where the variables are all different and the index variable is constrained such that vars[index] == target.
Definition at line 1744 of file element.cc.
Constraint * operations_research::Solver::MakeIndexOfFirstMaxValueConstraint | ( | IntVar * | index, |
const std::vector< IntVar * > & | vars ) |
Creates a constraint that binds the index variable to the index of the first variable with the maximum value.
Definition at line 598 of file constraints.cc.
Constraint * operations_research::Solver::MakeIndexOfFirstMinValueConstraint | ( | IntVar * | index, |
const std::vector< IntVar * > & | vars ) |
Creates a constraint that binds the index variable to the index of the first variable with the minimum value.
Definition at line 603 of file constraints.cc.
IntVar * operations_research::Solver::MakeIntConst | ( | int64_t | val | ) |
IntConst will create a constant expression.
Definition at line 6523 of file expressions.cc.
IntVar * operations_research::Solver::MakeIntConst | ( | int64_t | val, |
const std::string & | name ) |
IntConst will create a constant expression.
If IntConst is going to be named after its creation, cp_share_int_consts should be set to false otherwise names can potentially be overwritten.
Definition at line 6512 of file expressions.cc.
IntervalVar * operations_research::Solver::MakeIntervalRelaxedMax | ( | IntervalVar * | interval_var | ) |
Creates and returns an interval variable that wraps around the given one, relaxing the max start and end. Relaxing means making unbounded when optional. If the variable is non optional, this method returns interval_var. More precisely, such an interval variable behaves as follows:
Definition at line 2254 of file interval.cc.
IntervalVar * operations_research::Solver::MakeIntervalRelaxedMin | ( | IntervalVar * | interval_var | ) |
Creates and returns an interval variable that wraps around the given one, relaxing the min start and end. Relaxing means making unbounded when optional. If the variable is non-optional, this method returns interval_var. More precisely, such an interval variable behaves as follows:
Definition at line 2263 of file interval.cc.
IntervalVar * operations_research::Solver::MakeIntervalVar | ( | int64_t | start_min, |
int64_t | start_max, | ||
int64_t | duration_min, | ||
int64_t | duration_max, | ||
int64_t | end_min, | ||
int64_t | end_max, | ||
bool | optional, | ||
const std::string & | name ) |
Variable Duration Interval Var.
Creates an interval var by specifying the bounds on start, duration, and end.
Definition at line 2416 of file interval.cc.
void operations_research::Solver::MakeIntervalVarArray | ( | int | count, |
int64_t | start_min, | ||
int64_t | start_max, | ||
int64_t | duration_min, | ||
int64_t | duration_max, | ||
int64_t | end_min, | ||
int64_t | end_max, | ||
bool | optional, | ||
absl::string_view | name, | ||
std::vector< IntervalVar * > * | array ) |
This method fills the vector with 'count' interval var built with the corresponding parameters.
Definition at line 2425 of file interval.cc.
Constraint * operations_research::Solver::MakeIntervalVarRelation | ( | IntervalVar * | t, |
Solver::UnaryIntervalRelation | r, | ||
int64_t | d ) |
This method creates a relation between an interval var and a date.
Definition at line 112 of file timetabling.cc.
Constraint * operations_research::Solver::MakeIntervalVarRelation | ( | IntervalVar * | t1, |
Solver::BinaryIntervalRelation | r, | ||
IntervalVar * | t2 ) |
This method creates a relation between two interval vars.
Definition at line 231 of file timetabling.cc.
Constraint * operations_research::Solver::MakeIntervalVarRelationWithDelay | ( | IntervalVar * | t1, |
Solver::BinaryIntervalRelation | r, | ||
IntervalVar * | t2, | ||
int64_t | delay ) |
This method creates a relation between two interval vars. The given delay is added to the second interval. i.e.: t1 STARTS_AFTER_END of t2 with a delay of 2 means t1 will start at least two units of time after the end of t2.
Definition at line 237 of file timetabling.cc.
IntVar * operations_research::Solver::MakeIntVar | ( | const std::vector< int > & | values | ) |
MakeIntVar will create a variable with the given sparse domain.
Definition at line 6508 of file expressions.cc.
IntVar * operations_research::Solver::MakeIntVar | ( | const std::vector< int > & | values, |
const std::string & | name ) |
MakeIntVar will create a variable with the given sparse domain.
Definition at line 6503 of file expressions.cc.
IntVar * operations_research::Solver::MakeIntVar | ( | const std::vector< int64_t > & | values | ) |
MakeIntVar will create a variable with the given sparse domain.
Definition at line 6499 of file expressions.cc.
IntVar * operations_research::Solver::MakeIntVar | ( | const std::vector< int64_t > & | values, |
const std::string & | name ) |
MakeIntVar will create a variable with the given sparse domain.
Fast-track the case where we have a single value.
Sort and remove duplicates.
Case when we have a single value, after clean-up.
Case when the values are a dense interval of integers.
Compute the GCD: if it's not 1, we can express the variable's domain as the product of the GCD and of a domain with smaller values.
If it's 1, though, we can't do anything special, so we immediately return a new DomainIntVar.
Catch the case where the divided values are a dense set of integers.
Definition at line 6448 of file expressions.cc.
IntVar * operations_research::Solver::MakeIntVar | ( | int64_t | min, |
int64_t | max ) |
MakeIntVar will create the best range based int var for the bounds given.
Definition at line 6436 of file expressions.cc.
IntVar * operations_research::Solver::MakeIntVar | ( | int64_t | min, |
int64_t | max, | ||
const std::string & | name ) |
--— Int Variables and Constants --—
--— 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. MakeIntVar will create the best range based int var for the bounds given.
Definition at line 6420 of file expressions.cc.
IntVar ** operations_research::Solver::MakeIntVarArray | ( | int | var_count, |
int64_t | vmin, | ||
int64_t | vmax, | ||
const std::string & | name ) |
Same but allocates an array and returns it.
Definition at line 6559 of file expressions.cc.
void operations_research::Solver::MakeIntVarArray | ( | int | var_count, |
int64_t | vmin, | ||
int64_t | vmax, | ||
const std::string & | name, | ||
std::vector< IntVar * > * | vars ) |
This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having name "name<i>" where is the index of the variable.
Definition at line 6544 of file expressions.cc.
void operations_research::Solver::MakeIntVarArray | ( | int | var_count, |
int64_t | vmin, | ||
int64_t | vmax, | ||
std::vector< IntVar * > * | vars ) |
This method will append the vector vars with 'var_count' variables having bounds vmin and vmax and having no names.
Definition at line 6552 of file expressions.cc.
Constraint * operations_research::Solver::MakeInversePermutationConstraint | ( | const std::vector< IntVar * > & | left, |
const std::vector< IntVar * > & | right ) |
Creates a constraint that enforces that 'left' and 'right' both represent permutations of [0..left.size()-1], and that 'right' is the inverse permutation of 'left', i.e. for all i in [0..left.size()-1], right[left[i]] = i.
Definition at line 593 of file constraints.cc.
Constraint * operations_research::Solver::MakeIsBetweenCt | ( | IntExpr * | expr, |
int64_t | l, | ||
int64_t | u, | ||
IntVar * | b ) |
b == (l <= expr <= u)
Catch empty and singleton intervals.
Catch the trivial cases first.
Catch one-sided constraints.
Simplify the common factor, if any.
No further reduction is possible.
Definition at line 1057 of file expr_cst.cc.
Definition at line 1093 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeIsDifferentCstCt | ( | IntExpr * | var, |
int64_t | value, | ||
IntVar * | boolvar ) |
boolvar == (var != value)
Definition at line 595 of file expr_cst.cc.
status var of (var != value)
Definition at line 586 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeIsDifferentCt | ( | IntExpr * | v1, |
IntExpr * | v2, | ||
IntVar * | b ) |
b == (v1 != v2)
Definition at line 692 of file range_cst.cc.
status var of (v1 != v2)
Definition at line 647 of file range_cst.cc.
Constraint * operations_research::Solver::MakeIsEqualCstCt | ( | IntExpr * | var, |
int64_t | value, | ||
IntVar * | boolvar ) |
boolvar == (var == value)
Definition at line 493 of file expr_cst.cc.
status var of (var == value)
Definition at line 468 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeIsEqualCt | ( | IntExpr * | v1, |
IntExpr * | v2, | ||
IntVar * | b ) |
b == (v1 == v2)
Definition at line 628 of file range_cst.cc.
status var of (v1 == v2)
Definition at line 583 of file range_cst.cc.
Constraint * operations_research::Solver::MakeIsGreaterCstCt | ( | IntExpr * | v, |
int64_t | c, | ||
IntVar * | b ) |
b == (v > c)
Definition at line 722 of file expr_cst.cc.
status var of (var > value)
Definition at line 702 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeIsGreaterCt | ( | IntExpr * | left, |
IntExpr * | right, | ||
IntVar * | b ) |
b == (left > right)
Definition at line 806 of file range_cst.cc.
Constraint * operations_research::Solver::MakeIsGreaterOrEqualCstCt | ( | IntExpr * | var, |
int64_t | value, | ||
IntVar * | boolvar ) |
boolvar == (var >= value)
Definition at line 706 of file expr_cst.cc.
status var of (var >= value)
Definition at line 685 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeIsGreaterOrEqualCt | ( | IntExpr * | left, |
IntExpr * | right, | ||
IntVar * | b ) |
b == (left >= right)
Definition at line 796 of file range_cst.cc.
status var of (left >= right)
Definition at line 791 of file range_cst.cc.
status var of (left > right)
Definition at line 802 of file range_cst.cc.
Constraint * operations_research::Solver::MakeIsLessCstCt | ( | IntExpr * | v, |
int64_t | c, | ||
IntVar * | b ) |
b == (v < c)
Definition at line 822 of file expr_cst.cc.
status var of (var < value)
Definition at line 802 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeIsLessCt | ( | IntExpr * | left, |
IntExpr * | right, | ||
IntVar * | b ) |
b == (left < right)
Definition at line 779 of file range_cst.cc.
Constraint * operations_research::Solver::MakeIsLessOrEqualCstCt | ( | IntExpr * | var, |
int64_t | value, | ||
IntVar * | boolvar ) |
boolvar == (var <= value)
Definition at line 806 of file expr_cst.cc.
status var of (var <= value)
Definition at line 785 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeIsLessOrEqualCt | ( | IntExpr * | left, |
IntExpr * | right, | ||
IntVar * | b ) |
b == (left <= right)
Definition at line 736 of file range_cst.cc.
status var of (left <= right)
Definition at line 704 of file range_cst.cc.
status var of (left < right)
Definition at line 748 of file range_cst.cc.
Constraint * operations_research::Solver::MakeIsLexicalLessOrEqualWithOffsetsCt | ( | std::vector< IntVar * > | left, |
std::vector< IntVar * > | right, | ||
std::vector< int64_t > | offsets, | ||
IntVar * | boolvar ) |
Semi-reified version of the above: boolvar -> LexLE(left, right, offsets).
Definition at line 579 of file constraints.cc.
Constraint * operations_research::Solver::MakeIsMemberCt | ( | IntExpr * | expr, |
const std::vector< int > & | values, | ||
IntVar * | boolvar ) |
Definition at line 1495 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeIsMemberCt | ( | IntExpr * | expr, |
const std::vector< int64_t > & | values, | ||
IntVar * | boolvar ) |
boolvar == (expr in set)
Definition at line 1489 of file expr_cst.cc.
IntVar * operations_research::Solver::MakeIsMemberVar | ( | IntExpr * | expr, |
const std::vector< int > & | values ) |
Definition at line 1508 of file expr_cst.cc.
IntVar * operations_research::Solver::MakeIsMemberVar | ( | IntExpr * | expr, |
const std::vector< int64_t > & | values ) |
Definition at line 1501 of file expr_cst.cc.
SolutionCollector * operations_research::Solver::MakeLastSolutionCollector | ( | ) |
SolutionCollector * operations_research::Solver::MakeLastSolutionCollector | ( | const Assignment * | assignment | ) |
Constraint * operations_research::Solver::MakeLess | ( | IntExpr * | expr, |
int | value ) |
expr < value
Definition at line 305 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeLess | ( | IntExpr * | expr, |
int64_t | value ) |
expr < value
Definition at line 294 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeLess | ( | IntExpr * | left, |
IntExpr * | right ) |
left < right
Definition at line 552 of file range_cst.cc.
Constraint * operations_research::Solver::MakeLessOrEqual | ( | IntExpr * | expr, |
int | value ) |
expr <= value
Definition at line 283 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeLessOrEqual | ( | IntExpr * | expr, |
int64_t | value ) |
expr <= value
Definition at line 272 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeLessOrEqual | ( | IntExpr * | left, |
IntExpr * | right ) |
left <= right
Definition at line 532 of file range_cst.cc.
Constraint * operations_research::Solver::MakeLexicalLess | ( | const std::vector< IntVar * > & | left, |
const std::vector< IntVar * > & | right ) |
Creates a constraint that enforces that left is lexicographically less than right.
Definition at line 555 of file constraints.cc.
Constraint * operations_research::Solver::MakeLexicalLessOrEqual | ( | const std::vector< IntVar * > & | left, |
const std::vector< IntVar * > & | right ) |
Creates a constraint that enforces that left is lexicographically less than or equal to right.
Definition at line 566 of file constraints.cc.
Constraint * operations_research::Solver::MakeLexicalLessOrEqualWithOffsets | ( | std::vector< IntVar * > | left, |
std::vector< IntVar * > | right, | ||
std::vector< int64_t > | offsets ) |
Creates a constraint that enforces that left is lexicographically less than or equal to right with an offset. This means that for the first index i such that left[i] is not in [right[i] - (offset[i] - 1), right[i]], left[i] + offset[i] <= right[i]. Offset values must be > 0.
Definition at line 572 of file constraints.cc.
ImprovementSearchLimit * operations_research::Solver::MakeLexicographicImprovementLimit | ( | std::vector< IntVar * > | objective_vars, |
std::vector< bool > | maximize, | ||
std::vector< double > | objective_scaling_factors, | ||
std::vector< double > | objective_offsets, | ||
double | improvement_rate_coefficient, | ||
int | improvement_rate_solutions_distance ) |
OptimizeVar * operations_research::Solver::MakeLexicographicOptimize | ( | std::vector< bool > | maximize, |
std::vector< IntVar * > | variables, | ||
std::vector< int64_t > | steps ) |
ObjectiveMonitor * operations_research::Solver::MakeLexicographicSimulatedAnnealing | ( | const std::vector< bool > & | maximize, |
std::vector< IntVar * > | vars, | ||
std::vector< int64_t > | steps, | ||
std::vector< int64_t > | initial_temperatures ) |
ObjectiveMonitor * operations_research::Solver::MakeLexicographicTabuSearch | ( | const std::vector< bool > & | maximize, |
std::vector< IntVar * > | objectives, | ||
std::vector< int64_t > | steps, | ||
const std::vector< IntVar * > & | vars, | ||
int64_t | keep_tenure, | ||
int64_t | forbid_tenure, | ||
double | tabu_factor ) |
|
inline |
Light versions of function-based elements, in constraint version only, well-suited for use within Local Search. These constraints are "checking" constraints, only triggered on WhenBound events. They provide very little (or no) domain filtering. Returns a light one-dimension function-based element constraint ensuring var == values(index). The constraint does not perform bound reduction of the resulting variable until the index variable is bound. If deep_serialize returns false, the model visitor will not extract all possible values from the values function.
Definition at line 1248 of file constraint_solver.h.
|
inline |
Light two-dimension function-based element constraint ensuring var == values(index1, index2). The constraint does not perform bound reduction of the resulting variable until the index variables are bound. If deep_serialize returns false, the model visitor will not extract all possible values from the values function.
Definition at line 1261 of file constraint_solver.h.
RegularLimit * operations_research::Solver::MakeLimit | ( | absl::Duration | time, |
int64_t | branches, | ||
int64_t | failures, | ||
int64_t | solutions, | ||
bool | smart_time_check = false, | ||
bool | cumulative = false ) |
Limits the search with the 'time', 'branches', 'failures' and 'solutions' limits. 'smart_time_check' reduces the calls to the wall timer by estimating the number of remaining calls, and 'cumulative' means that the limit applies cumulatively, instead of search-by-search.
RegularLimit * operations_research::Solver::MakeLimit | ( | const RegularLimitParameters & | proto | ) |
RegularLimit * operations_research::Solver::MakeLimit | ( | int64_t | time, |
int64_t | branches, | ||
int64_t | failures, | ||
int64_t | solutions, | ||
bool | smart_time_check = false, | ||
bool | cumulative = false ) |
SearchLimit * operations_research::Solver::MakeLimit | ( | SearchLimit * | limit_1, |
SearchLimit * | limit_2 ) |
DecisionBuilder * operations_research::Solver::MakeLocalSearchPhase | ( | Assignment * | assignment, |
LocalSearchPhaseParameters * | parameters ) |
Local Search decision builders factories. Local search is used to improve a given solution. This initial solution can be specified either by an Assignment or by a DecisionBulder, and the corresponding variables, the initial solution being the first solution found by the DecisionBuilder. The LocalSearchPhaseParameters parameter holds the actual definition of the local search phase:
Definition at line 5566 of file local_search.cc.
DecisionBuilder * operations_research::Solver::MakeLocalSearchPhase | ( | const std::vector< IntVar * > & | vars, |
DecisionBuilder * | first_solution, | ||
DecisionBuilder * | first_solution_sub_decision_builder, | ||
LocalSearchPhaseParameters * | parameters ) |
Variant with a sub_decison_builder specific to the first solution.
Definition at line 5584 of file local_search.cc.
DecisionBuilder * operations_research::Solver::MakeLocalSearchPhase | ( | const std::vector< IntVar * > & | vars, |
DecisionBuilder * | first_solution, | ||
LocalSearchPhaseParameters * | parameters ) |
Definition at line 5574 of file local_search.cc.
DecisionBuilder * operations_research::Solver::MakeLocalSearchPhase | ( | const std::vector< SequenceVar * > & | vars, |
DecisionBuilder * | first_solution, | ||
LocalSearchPhaseParameters * | parameters ) |
Definition at line 5595 of file local_search.cc.
LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
LocalSearchOperator * | ls_operator, | ||
DecisionBuilder * | sub_decision_builder ) |
Local Search Phase Parameters.
Definition at line 5143 of file local_search.cc.
LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
LocalSearchOperator * | ls_operator, | ||
DecisionBuilder * | sub_decision_builder, | ||
RegularLimit * | limit ) |
Definition at line 5151 of file local_search.cc.
LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
LocalSearchOperator * | ls_operator, | ||
DecisionBuilder * | sub_decision_builder, | ||
RegularLimit * | limit, | ||
LocalSearchFilterManager * | filter_manager ) |
Definition at line 5159 of file local_search.cc.
LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
SolutionPool * | pool, | ||
LocalSearchOperator * | ls_operator, | ||
DecisionBuilder * | sub_decision_builder ) |
Definition at line 5168 of file local_search.cc.
LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
SolutionPool * | pool, | ||
LocalSearchOperator * | ls_operator, | ||
DecisionBuilder * | sub_decision_builder, | ||
RegularLimit * | limit ) |
Definition at line 5176 of file local_search.cc.
LocalSearchPhaseParameters * operations_research::Solver::MakeLocalSearchPhaseParameters | ( | IntVar * | objective, |
SolutionPool * | pool, | ||
LocalSearchOperator * | ls_operator, | ||
DecisionBuilder * | sub_decision_builder, | ||
RegularLimit * | limit, | ||
LocalSearchFilterManager * | filter_manager ) |
Definition at line 5184 of file local_search.cc.
SearchMonitor * operations_research::Solver::MakeLubyRestart | ( | int | scale_factor | ) |
Constraint * operations_research::Solver::MakeMapDomain | ( | IntVar * | var, |
const std::vector< IntVar * > & | actives ) |
This constraint maps the domain of 'var' onto the array of variables 'actives'. That is for all i in [0 .. size - 1]: actives[i] == 1 <=> var->Contains(i);
Definition at line 550 of file constraints.cc.
std::max(vars)
Definition at line 3346 of file expr_array.cc.
std::max(expr, value)
Definition at line 7190 of file expressions.cc.
std::max(expr, value)
Definition at line 7176 of file expressions.cc.
std::max(left, right)
Definition at line 7158 of file expressions.cc.
Constraint * operations_research::Solver::MakeMaxEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar * | max_var ) |
Definition at line 3411 of file expr_array.cc.
OptimizeVar * operations_research::Solver::MakeMaximize | ( | IntVar * | v, |
int64_t | step ) |
Constraint * operations_research::Solver::MakeMemberCt | ( | IntExpr * | expr, |
const std::vector< int > & | values ) |
Definition at line 1234 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeMemberCt | ( | IntExpr * | expr, |
const std::vector< int64_t > & | values ) |
--— Member and related constraints --—
expr in set. Propagation is lazy, i.e. this constraint does not creates holes in the domain of the variable.
If the expression is a non-trivial product, we filter out the values that aren't multiples of "coeff", and divide them.
Filter out the values that are outside the [Min, Max] interval.
Catch empty set.
Sort and remove duplicates.
Special case for singleton.
Catch contiguous intervals.
If the set of values in [expr.Min(), expr.Max()] that are not in "values" is smaller than "values", then it's more efficient to use NotMemberCt. Catch that case here.
Convert "copied_values" to list the values not allowed.
We use the zero valued indices of is_among_input_values to build the complement of copied_values.
The empty' case (all values in range [expr.Min(), expr.Max()] are in the "values" input) was caught earlier, by the "contiguous interval" case.
Otherwise, just use MemberCt. No further reduction is possible.
Definition at line 1169 of file expr_cst.cc.
std::min(vars)
Definition at line 3303 of file expr_array.cc.
std::min(expr, value)
Definition at line 7154 of file expressions.cc.
std::min(expr, value)
Definition at line 7140 of file expressions.cc.
std::min (left, right)
Definition at line 7122 of file expressions.cc.
Constraint * operations_research::Solver::MakeMinEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar * | min_var ) |
Definition at line 3389 of file expr_array.cc.
OptimizeVar * operations_research::Solver::MakeMinimize | ( | IntVar * | v, |
int64_t | step ) |
IntervalVar * operations_research::Solver::MakeMirrorInterval | ( | IntervalVar * | interval_var | ) |
--— API --—
Creates an interval var that is the mirror image of the given one, that is, the interval var obtained by reversing the axis.
Definition at line 2249 of file interval.cc.
Modulo expression x % mod (with the python convention for modulo).
--— Modulo --—
Definition at line 7305 of file expressions.cc.
Modulo expression x % mod (with the python convention for modulo).
Definition at line 7316 of file expressions.cc.
IntExpr * operations_research::Solver::MakeMonotonicElement | ( | Solver::IndexEvaluator1 | values, |
bool | increasing, | ||
IntVar * | index ) |
Function based element. The constraint takes ownership of the callback. The callback must be monotonic. It must be able to cope with any possible value in the domain of 'index' (potentially negative ones too). Furtermore, monotonicity is not checked. Thus giving a non-monotonic function, or specifying an incorrect increasing parameter will result in undefined behavior.
You need to pass by copy such that opposite_value does not include a dandling reference when leaving this scope.
Definition at line 869 of file element.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. 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.
Copy target values and construct the vector of variables
Definition at line 278 of file local_search.cc.
LocalSearchOperator * operations_research::Solver::MakeMoveTowardTargetOperator | ( | const std::vector< IntVar * > & | variables, |
const std::vector< int64_t > & | target_values ) |
Creates a local search operator that tries to move the assignment of some variables toward a target. The target is given either as two vectors: a vector of variables and a vector of associated target values. The two vectors should be of the same length. This operator generates neighbors in which the only difference compared to the current state is that one variable that belongs to the given vector is set to its target value.
Definition at line 294 of file local_search.cc.
SolutionCollector * operations_research::Solver::MakeNBestLexicographicValueSolutionCollector | ( | const Assignment * | assignment, |
int | solution_count, | ||
std::vector< bool > | maximize ) |
SolutionCollector * operations_research::Solver::MakeNBestLexicographicValueSolutionCollector | ( | int | solution_count, |
std::vector< bool > | maximize ) |
SolutionCollector * operations_research::Solver::MakeNBestValueSolutionCollector | ( | const Assignment * | assignment, |
int | solution_count, | ||
bool | maximize ) |
SolutionCollector * operations_research::Solver::MakeNBestValueSolutionCollector | ( | int | solution_count, |
bool | maximize ) |
LocalSearchOperator * operations_research::Solver::MakeNeighborhoodLimit | ( | LocalSearchOperator * | op, |
int64_t | limit ) |
Creates a local search operator that wraps another local search operator and limits the number of neighbors explored (i.e., calls to MakeNextNeighbor from the current solution (between two calls to Start()). When this limit is reached, MakeNextNeighbor() returns false. The counter is cleared when Start() is called.
Definition at line 2030 of file local_search.cc.
DecisionBuilder * operations_research::Solver::MakeNestedOptimize | ( | DecisionBuilder * | db, |
Assignment * | solution, | ||
bool | maximize, | ||
int64_t | step ) |
NestedOptimize will collapse a search tree described by a decision builder 'db' and a set of monitors and wrap it into a single point. If there are no solutions to this nested tree, then NestedOptimize will fail. If there are solutions, it will find the best as described by the mandatory objective in the solution as well as the optimization direction, instantiate all variables to this solution, and return nullptr.
DecisionBuilder * operations_research::Solver::MakeNestedOptimize | ( | DecisionBuilder * | db, |
Assignment * | solution, | ||
bool | maximize, | ||
int64_t | step, | ||
const std::vector< SearchMonitor * > & | monitors ) |
DecisionBuilder * operations_research::Solver::MakeNestedOptimize | ( | DecisionBuilder * | db, |
Assignment * | solution, | ||
bool | maximize, | ||
int64_t | step, | ||
SearchMonitor * | monitor1 ) |
DecisionBuilder * operations_research::Solver::MakeNestedOptimize | ( | DecisionBuilder * | db, |
Assignment * | solution, | ||
bool | maximize, | ||
int64_t | step, | ||
SearchMonitor * | monitor1, | ||
SearchMonitor * | monitor2 ) |
DecisionBuilder * operations_research::Solver::MakeNestedOptimize | ( | DecisionBuilder * | db, |
Assignment * | solution, | ||
bool | maximize, | ||
int64_t | step, | ||
SearchMonitor * | monitor1, | ||
SearchMonitor * | monitor2, | ||
SearchMonitor * | monitor3 ) |
DecisionBuilder * operations_research::Solver::MakeNestedOptimize | ( | DecisionBuilder * | db, |
Assignment * | solution, | ||
bool | maximize, | ||
int64_t | step, | ||
SearchMonitor * | monitor1, | ||
SearchMonitor * | monitor2, | ||
SearchMonitor * | monitor3, | ||
SearchMonitor * | monitor4 ) |
Constraint * operations_research::Solver::MakeNoCycle | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
Solver::IndexFilter1 | sink_handler, | ||
bool | assume_paths ) |
Definition at line 621 of file graph_constraints.cc.
Constraint * operations_research::Solver::MakeNoCycle | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
Solver::IndexFilter1 | sink_handler = nullptr ) |
Prevent cycles. The "nexts" variables represent the next in the chain. "active" variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem. A callback can be added to specify sink values (by default sink values are values >= vars.size()). Ownership of the callback is passed to the constraint. If assume_paths is either not specified or true, the constraint assumes the "nexts" variables represent paths (and performs a faster propagation); otherwise the constraint assumes they represent a forest.
Definition at line 633 of file graph_constraints.cc.
Constraint * operations_research::Solver::MakeNonEquality | ( | IntExpr * | expr, |
int | value ) |
expr != value
Definition at line 400 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeNonEquality | ( | IntExpr * | expr, |
int64_t | value ) |
expr != value
Definition at line 385 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeNonEquality | ( | IntExpr * | left, |
IntExpr * | right ) |
left != right
Definition at line 570 of file range_cst.cc.
Constraint * operations_research::Solver::MakeNonOverlappingBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
absl::Span< const int > | x_size, | ||
absl::Span< const int > | y_size ) |
Constraint * operations_research::Solver::MakeNonOverlappingBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
absl::Span< const int64_t > | x_size, | ||
absl::Span< const int64_t > | y_size ) |
Constraint * operations_research::Solver::MakeNonOverlappingBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
const std::vector< IntVar * > & | x_size, | ||
const std::vector< IntVar * > & | y_size ) |
This constraint states that all the boxes must not overlap. The coordinates of box i are: (x_vars[i], y_vars[i]), (x_vars[i], y_vars[i] + y_size[i]), (x_vars[i] + x_size[i], y_vars[i]), (x_vars[i] + x_size[i], y_vars[i] + y_size[i]). The sizes must be non-negative. Boxes with a zero dimension can be pushed like any box.
Constraint * operations_research::Solver::MakeNonOverlappingNonStrictBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
absl::Span< const int > | x_size, | ||
absl::Span< const int > | y_size ) |
Constraint * operations_research::Solver::MakeNonOverlappingNonStrictBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
absl::Span< const int64_t > | x_size, | ||
absl::Span< const int64_t > | y_size ) |
Constraint * operations_research::Solver::MakeNonOverlappingNonStrictBoxesConstraint | ( | const std::vector< IntVar * > & | x_vars, |
const std::vector< IntVar * > & | y_vars, | ||
const std::vector< IntVar * > & | x_size, | ||
const std::vector< IntVar * > & | y_size ) |
This constraint states that all the boxes must not overlap. The coordinates of box i are: (x_vars[i], y_vars[i]), (x_vars[i], y_vars[i] + y_size[i]), (x_vars[i] + x_size[i], y_vars[i]), (x_vars[i] + x_size[i], y_vars[i] + y_size[i]). The sizes must be positive. Boxes with a zero dimension can be placed anywhere.
Constraint * operations_research::Solver::MakeNotBetweenCt | ( | IntExpr * | expr, |
int64_t | l, | ||
int64_t | u ) |
(expr < l || expr > u) This constraint is lazy as it will not make holes in the domain of variables. It will propagate only when expr->Min() >= l or expr->Max() <= u.
Catch empty interval.
Catch the trivial cases first.
Catch one-sided constraints.
Definition at line 962 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeNotMemberCt | ( | IntExpr * | expr, |
const std::vector< int > & | values ) |
Definition at line 1303 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeNotMemberCt | ( | IntExpr * | expr, |
const std::vector< int64_t > & | values ) |
expr not in set.
If the expression is a non-trivial product, we filter out the values that aren't multiples of "coeff", and divide them.
Filter out the values that are outside the [Min, Max] interval.
Catch empty set.
Sort and remove duplicates.
Special case for singleton.
Catch contiguous intervals.
If the set of values in [expr.Min(), expr.Max()] that are not in "values" is smaller than "values", then it's more efficient to use MemberCt. Catch that case here.
Convert "copied_values" to a dense boolean vector.
Use zero valued indices for is_among_input_values to build the complement of copied_values.
The empty' case (all values in range [expr.Min(), expr.Max()] are in the "values" input) was caught earlier, by the "contiguous interval" case.
Otherwise, just use NotMemberCt. No further reduction is possible.
Definition at line 1239 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeNotMemberCt | ( | IntExpr * | expr, |
SortedDisjointIntervalList | intervals ) |
expr should not be in the list of forbidden intervals.
Definition at line 1596 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeNotMemberCt | ( | IntExpr * | expr, |
std::vector< int > | starts, | ||
std::vector< int > | ends ) |
expr should not be in the list of forbidden intervals [start[i]..end[i]].
Definition at line 1589 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeNotMemberCt | ( | IntExpr * | expr, |
std::vector< int64_t > | starts, | ||
std::vector< int64_t > | ends ) |
expr should not be in the list of forbidden intervals [start[i]..end[i]].
Definition at line 1582 of file expr_cst.cc.
Constraint * operations_research::Solver::MakeNullIntersect | ( | const std::vector< IntVar * > & | first_vars, |
const std::vector< IntVar * > & | second_vars ) |
Creates a constraint that states that all variables in the first vector are different from all variables in the second group. Thus the set of values in the first vector does not intersect with the set of values in the second vector.
Definition at line 737 of file alldiff_cst.cc.
Constraint * operations_research::Solver::MakeNullIntersectExcept | ( | const std::vector< IntVar * > & | first_vars, |
const std::vector< IntVar * > & | second_vars, | ||
int64_t | escape_value ) |
Creates a constraint that states that all variables in the first vector are different from all variables from the second group, unless they are assigned to the escape value. Thus the set of values in the first vector minus the escape value does not intersect with the set of values in the second vector.
Definition at line 742 of file alldiff_cst.cc.
LocalSearchOperator * operations_research::Solver::MakeOperator | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | secondary_vars, | ||
Solver::IndexEvaluator3 | evaluator, | ||
Solver::EvaluatorLocalSearchOperators | op ) |
Definition at line 2592 of file local_search.cc.
LocalSearchOperator * operations_research::Solver::MakeOperator | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | secondary_vars, | ||
Solver::LocalSearchOperators | op, | ||
std::function< const std::vector< int > &(int, int)> | get_neighbors = nullptr ) |
Definition at line 2494 of file local_search.cc.
LocalSearchOperator * operations_research::Solver::MakeOperator | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator3 | evaluator, | ||
Solver::EvaluatorLocalSearchOperators | op ) |
Definition at line 2586 of file local_search.cc.
LocalSearchOperator * operations_research::Solver::MakeOperator | ( | const std::vector< IntVar * > & | vars, |
Solver::LocalSearchOperators | op, | ||
std::function< const std::vector< int > &(int, int)> | get_neighbors = nullptr ) |
Local Search Operators.
Definition at line 2488 of file local_search.cc.
-expr
Definition at line 6793 of file expressions.cc.
OptimizeVar * operations_research::Solver::MakeOptimize | ( | bool | maximize, |
IntVar * | v, | ||
int64_t | step ) |
Pack * operations_research::Solver::MakePack | ( | const std::vector< IntVar * > & | vars, |
int | number_of_bins ) |
This constraint packs all variables onto 'number_of_bins' variables. For any given variable, a value of 'number_of_bins' indicates that the variable is not assigned to any bin. Dimensions, i.e., cumulative constraints on this packing, can be added directly from the pack class.
Constraint * operations_research::Solver::MakePathConnected | ( | std::vector< IntVar * > | nexts, |
std::vector< int64_t > | sources, | ||
std::vector< int64_t > | sinks, | ||
std::vector< IntVar * > | status ) |
Constraint enforcing that status[i] is true iff there's a path defined on next variables from sources[i] to sinks[i].
Definition at line 1438 of file graph_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 * > & | slacks, | ||
Solver::IndexEvaluator2 | transit_evaluator ) |
Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transit_evaluator(i, next[i]) + slacks[i]. Active variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem. Ownership of transit_evaluator is taken and it must be a repeatable callback.
Definition at line 1318 of file graph_constraints.cc.
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 ) |
Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transits[i]. Active variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem.
Definition at line 1300 of file graph_constraints.cc.
Constraint * operations_research::Solver::MakePathCumul | ( | const std::vector< IntVar * > & | nexts, |
const std::vector< IntVar * > & | active, | ||
const std::vector< IntVar * > & | cumuls, | ||
Solver::IndexEvaluator2 | transit_evaluator ) |
Creates a constraint which accumulates values along a path such that: cumuls[next[i]] = cumuls[i] + transit_evaluator(i, next[i]). Active variables indicate if the corresponding next variable is active; this could be useful to model unperformed nodes in a routing problem. Ownership of transit_evaluator is taken and it must be a repeatable callback.
Definition at line 1309 of file graph_constraints.cc.
Constraint * operations_research::Solver::MakePathEnergyCostConstraint | ( | PathEnergyCostConstraintSpecification | specification | ) |
Definition at line 1771 of file graph_constraints.cc.
Constraint * operations_research::Solver::MakePathPrecedenceConstraint | ( | std::vector< IntVar * > | nexts, |
const std::vector< std::pair< int, int > > & | precedences ) |
Constraint enforcing, for each pair (i,j) in precedences, i to be before j in paths defined by next variables.
Definition at line 1623 of file graph_constraints.cc.
Constraint * operations_research::Solver::MakePathPrecedenceConstraint | ( | std::vector< IntVar * > | nexts, |
const std::vector< std::pair< int, int > > & | precedences, | ||
absl::Span< const int > | lifo_path_starts, | ||
absl::Span< const int > | fifo_path_starts ) |
Same as MakePathPrecedenceConstraint but ensures precedence pairs on some paths follow a LIFO or FIFO order. LIFO order: given 2 pairs (a,b) and (c,d), if a is before c on the path then d must be before b or b must be before c. FIFO order: given 2 pairs (a,b) and (c,d), if a is before c on the path then b must be before d. LIFO (resp. FIFO) orders are enforced only on paths starting by indices in lifo_path_starts (resp. fifo_path_start).
Definition at line 1629 of file graph_constraints.cc.
Constraint * operations_research::Solver::MakePathTransitPrecedenceConstraint | ( | std::vector< IntVar * > | nexts, |
std::vector< IntVar * > | transits, | ||
const std::vector< std::pair< int, int > > & | precedences ) |
Same as MakePathPrecedenceConstraint but will force i to be before j if the sum of transits on the path from i to j is strictly positive.
Definition at line 1646 of file graph_constraints.cc.
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntervalVar * > & | intervals, |
IntervalStrategy | str ) |
Scheduling phases.
Definition at line 855 of file sched_search.cc.
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator1 | var_evaluator, | ||
Solver::IndexEvaluator2 | value_evaluator ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator1 | var_evaluator, | ||
Solver::IndexEvaluator2 | value_evaluator, | ||
Solver::IndexEvaluator1 | tie_breaker ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator1 | var_evaluator, | ||
Solver::IntValueStrategy | val_str ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator2 | eval, | ||
Solver::EvaluatorStrategy | str ) |
Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator. The arguments passed to the evaluator callback are the indices of the variables in vars and the values of these variables. Ownership of the callback is passed to the decision builder.
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator2 | eval, | ||
Solver::IndexEvaluator1 | tie_breaker, | ||
Solver::EvaluatorStrategy | str ) |
Returns a decision builder which assigns values to variables which minimize the values returned by the evaluator. In case of tie breaks, the second callback is used to choose the best index in the array of equivalent pairs with equivalent evaluations. The arguments passed to the evaluator callback are the indices of the variables in vars and the values of these variables. Ownership of the callback is passed to the decision builder.
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IntVarStrategy | var_str, | ||
Solver::IndexEvaluator2 | value_evaluator ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IntVarStrategy | var_str, | ||
Solver::IndexEvaluator2 | value_evaluator, | ||
Solver::IndexEvaluator1 | tie_breaker ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntVar * > & | vars, |
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< IntVar * > & | vars, |
IntVarStrategy | var_str, | ||
VariableValueComparator | var_val1_val2_comparator ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | const std::vector< SequenceVar * > & | sequences, |
SequenceStrategy | str ) |
Definition at line 880 of file sched_search.cc.
DecisionBuilder * operations_research::Solver::MakePhase | ( | IntVar * | v0, |
IntVar * | v1, | ||
IntVar * | v2, | ||
IntVar * | v3, | ||
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | IntVar * | v0, |
IntVar * | v1, | ||
IntVar * | v2, | ||
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | IntVar * | v0, |
IntVar * | v1, | ||
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str ) |
DecisionBuilder * operations_research::Solver::MakePhase | ( | IntVar * | v0, |
Solver::IntVarStrategy | var_str, | ||
Solver::IntValueStrategy | val_str ) |
IntExpr * operations_research::Solver::MakePiecewiseLinearExpr | ( | IntExpr * | expr, |
const PiecewiseLinearFunction & | f ) |
General piecewise-linear function expression, built from f(x) where f is piecewise-linear. The resulting expression is f(expr).
Definition at line 7274 of file expressions.cc.
expr ^ n (n > 0)
Definition at line 7088 of file expressions.cc.
ModelVisitor * operations_research::Solver::MakePrintModelVisitor | ( | ) |
Prints the model.
Definition at line 814 of file utilities.cc.
expr * value
Definition at line 6811 of file expressions.cc.
left * right
--— Discover squares and powers --—
--— Discover nested products --—
--— Standard build --—
Definition at line 6901 of file expressions.cc.
DecisionBuilder * operations_research::Solver::MakeProfiledDecisionBuilderWrapper | ( | DecisionBuilder * | db | ) |
Activates profiling on a decision builder.
Definition at line 4566 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). 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 200 of file local_search.cc.
LocalSearchOperator * operations_research::Solver::MakeRandomLnsOperator | ( | const std::vector< IntVar * > & | vars, |
int | number_of_variables, | ||
int32_t | seed ) |
Definition at line 205 of file local_search.cc.
Decision * operations_research::Solver::MakeRankFirstInterval | ( | SequenceVar * | sequence, |
int | index ) |
Returns a decision that tries to rank first the ith interval var in the sequence variable.
Definition at line 869 of file sched_search.cc.
Decision * operations_research::Solver::MakeRankLastInterval | ( | SequenceVar * | sequence, |
int | index ) |
Returns a decision that tries to rank last the ith interval var in the sequence variable.
Definition at line 875 of file sched_search.cc.
LocalSearchFilter * operations_research::Solver::MakeRejectFilter | ( | ) |
Definition at line 2650 of file local_search.cc.
DecisionBuilder * operations_research::Solver::MakeRestoreAssignment | ( | Assignment * | assignment | ) |
Returns a DecisionBuilder which restores an Assignment (calls void Assignment::Restore())
Definition at line 1013 of file assignment.cc.
IntExpr * operations_research::Solver::MakeScalProd | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefs ) |
scalar product
Definition at line 3572 of file expr_array.cc.
IntExpr * operations_research::Solver::MakeScalProd | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64_t > & | coefs ) |
scalar product
Definition at line 3566 of file expr_array.cc.
Constraint * operations_research::Solver::MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefficients, | ||
int64_t | cst ) |
Definition at line 3515 of file expr_array.cc.
Constraint * operations_research::Solver::MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefficients, | ||
IntVar * | target ) |
Definition at line 3529 of file expr_array.cc.
Constraint * operations_research::Solver::MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64_t > & | coefficients, | ||
int64_t | cst ) |
Definition at line 3508 of file expr_array.cc.
Constraint * operations_research::Solver::MakeScalProdEquality | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64_t > & | coefficients, | ||
IntVar * | target ) |
Definition at line 3522 of file expr_array.cc.
Constraint * operations_research::Solver::MakeScalProdGreaterOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coeffs, | ||
int64_t | cst ) |
Definition at line 3544 of file expr_array.cc.
Constraint * operations_research::Solver::MakeScalProdGreaterOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64_t > & | coeffs, | ||
int64_t | cst ) |
Definition at line 3537 of file expr_array.cc.
Constraint * operations_research::Solver::MakeScalProdLessOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int > & | coefficients, | ||
int64_t | cst ) |
Definition at line 3558 of file expr_array.cc.
Constraint * operations_research::Solver::MakeScalProdLessOrEqual | ( | const std::vector< IntVar * > & | vars, |
const std::vector< int64_t > & | coefficients, | ||
int64_t | cst ) |
Definition at line 3551 of file expr_array.cc.
Decision * operations_research::Solver::MakeScheduleOrExpedite | ( | IntervalVar * | var, |
int64_t | est, | ||
int64_t * | marker ) |
Returns a decision that tries to schedule a task at a given time. On the Apply branch, it will set that interval var as performed and set its end to 'est'. On the Refute branch, it will just update the 'marker' to 'est' - 1. This decision is used in the INTERVAL_SET_TIMES_BACKWARD strategy.
Definition at line 848 of file sched_search.cc.
Decision * operations_research::Solver::MakeScheduleOrPostpone | ( | IntervalVar * | var, |
int64_t | est, | ||
int64_t * | marker ) |
Returns a decision that tries to schedule a task at a given time. On the Apply branch, it will set that interval var as performed and set its start to 'est'. On the Refute branch, it will just update the 'marker' to 'est' + 1. This decision is used in the INTERVAL_SET_TIMES_FORWARD strategy.
Definition at line 841 of file sched_search.cc.
SearchMonitor * operations_research::Solver::MakeSearchLog | ( | int | branch_period | ) |
SearchMonitor * operations_research::Solver::MakeSearchLog | ( | int | branch_period, |
IntVar * | var ) |
SearchMonitor * operations_research::Solver::MakeSearchLog | ( | int | branch_period, |
IntVar * | var, | ||
std::function< std::string()> | display_callback ) |
SearchMonitor * operations_research::Solver::MakeSearchLog | ( | int | branch_period, |
OptimizeVar * | opt_var ) |
OptimizeVar Search Logs At each solution, this monitor will also display the 'opt_var' value.
SearchMonitor * operations_research::Solver::MakeSearchLog | ( | int | branch_period, |
OptimizeVar * | opt_var, | ||
std::function< std::string()> | display_callback ) |
SearchMonitor * operations_research::Solver::MakeSearchLog | ( | int | branch_period, |
std::function< std::string()> | display_callback ) |
SearchMonitor * operations_research::Solver::MakeSearchLog | ( | int | branch_period, |
std::vector< IntVar * > | vars, | ||
std::function< std::string()> | display_callback ) |
SearchMonitor * operations_research::Solver::MakeSearchLog | ( | SearchLogParameters | parameters | ) |
SearchMonitor * operations_research::Solver::MakeSearchTrace | ( | const std::string & | prefix | ) |
IntExpr * operations_research::Solver::MakeSemiContinuousExpr | ( | IntExpr * | expr, |
int64_t | fixed_charge, | ||
int64_t | step ) |
Semi continuous Expression (x <= 0 -> f(x) = 0; x > 0 -> f(x) = ax + b) a >= 0 and b >= 0
Definition at line 7201 of file expressions.cc.
ObjectiveMonitor * operations_research::Solver::MakeSimulatedAnnealing | ( | bool | maximize, |
IntVar * | v, | ||
int64_t | step, | ||
int64_t | initial_temperature ) |
RegularLimit * operations_research::Solver::MakeSolutionsLimit | ( | int64_t | solutions | ) |
DecisionBuilder * operations_research::Solver::MakeSolveOnce | ( | DecisionBuilder * | db | ) |
SolveOnce will collapse a search tree described by a decision builder 'db' and a set of monitors and wrap it into a single point. If there are no solutions to this nested tree, then SolveOnce will fail. If there is a solution, it will find it and returns nullptr.
DecisionBuilder * operations_research::Solver::MakeSolveOnce | ( | DecisionBuilder * | db, |
const std::vector< SearchMonitor * > & | monitors ) |
DecisionBuilder * operations_research::Solver::MakeSolveOnce | ( | DecisionBuilder * | db, |
SearchMonitor * | monitor1 ) |
DecisionBuilder * operations_research::Solver::MakeSolveOnce | ( | DecisionBuilder * | db, |
SearchMonitor * | monitor1, | ||
SearchMonitor * | monitor2 ) |
DecisionBuilder * operations_research::Solver::MakeSolveOnce | ( | DecisionBuilder * | db, |
SearchMonitor * | monitor1, | ||
SearchMonitor * | monitor2, | ||
SearchMonitor * | monitor3 ) |
DecisionBuilder * operations_research::Solver::MakeSolveOnce | ( | DecisionBuilder * | db, |
SearchMonitor * | monitor1, | ||
SearchMonitor * | monitor2, | ||
SearchMonitor * | monitor3, | ||
SearchMonitor * | monitor4 ) |
Constraint * operations_research::Solver::MakeSortingConstraint | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | sorted ) |
Creates a constraint binding the arrays of variables "vars" and "sorted_vars": sorted_vars[0] must be equal to the minimum of all variables in vars, and so on: the value of sorted_vars[i] must be equal to the i-th value of variables invars. This constraint propagates in both directions: from "vars" to "sorted_vars" and vice-versa. Behind the scenes, this constraint maintains that:
Definition at line 718 of file alldiff_cst.cc.
expr * expr
Definition at line 7070 of file expressions.cc.
ModelVisitor * operations_research::Solver::MakeStatisticsModelVisitor | ( | ) |
Displays some nice statistics on the model.
Definition at line 818 of file utilities.cc.
DecisionBuilder * operations_research::Solver::MakeStoreAssignment | ( | Assignment * | assignment | ) |
Returns a DecisionBuilder which stores an Assignment (calls void Assignment::Store())
Definition at line 1017 of file assignment.cc.
DisjunctiveConstraint * operations_research::Solver::MakeStrictDisjunctiveConstraint | ( | const std::vector< IntervalVar * > & | intervals, |
const std::string & | name ) |
This constraint forces all interval vars into an non-overlapping sequence. Intervals with zero durations cannot overlap with over intervals.
Definition at line 2613 of file resource.cc.
Constraint * operations_research::Solver::MakeSubCircuit | ( | const std::vector< IntVar * > & | nexts | ) |
Force the "nexts" variable to create a complete Hamiltonian path for those that do not loop upon themselves.
Definition at line 644 of file graph_constraints.cc.
expr + value.
Definition at line 6628 of file expressions.cc.
Constraint * operations_research::Solver::MakeSumEquality | ( | const std::vector< IntVar * > & | vars, |
int64_t | cst ) |
Definition at line 3453 of file expr_array.cc.
Constraint * operations_research::Solver::MakeSumEquality | ( | const std::vector< IntVar * > & | vars, |
IntVar * | var ) |
Definition at line 3483 of file expr_array.cc.
Constraint * operations_research::Solver::MakeSumGreaterOrEqual | ( | const std::vector< IntVar * > & | vars, |
int64_t | cst ) |
Definition at line 3443 of file expr_array.cc.
Constraint * operations_research::Solver::MakeSumLessOrEqual | ( | const std::vector< IntVar * > & | vars, |
int64_t | cst ) |
Variation on arrays.
Definition at line 3433 of file expr_array.cc.
IntVarLocalSearchFilter * operations_research::Solver::MakeSumObjectiveFilter | ( | const std::vector< IntVar * > & | vars, |
const std::vector< IntVar * > & | secondary_vars, | ||
Solver::IndexEvaluator3 | values, | ||
Solver::LocalSearchFilterBound | filter_enum ) |
Definition at line 3734 of file local_search.cc.
IntVarLocalSearchFilter * operations_research::Solver::MakeSumObjectiveFilter | ( | const std::vector< IntVar * > & | vars, |
Solver::IndexEvaluator2 | values, | ||
Solver::LocalSearchFilterBound | filter_enum ) |
Definition at line 3702 of file local_search.cc.
SearchMonitor * operations_research::Solver::MakeSymmetryManager | ( | const std::vector< SymmetryBreaker * > & | visitors | ) |
SearchMonitor * operations_research::Solver::MakeSymmetryManager | ( | SymmetryBreaker * | v1 | ) |
SearchMonitor * operations_research::Solver::MakeSymmetryManager | ( | SymmetryBreaker * | v1, |
SymmetryBreaker * | v2 ) |
SearchMonitor * operations_research::Solver::MakeSymmetryManager | ( | SymmetryBreaker * | v1, |
SymmetryBreaker * | v2, | ||
SymmetryBreaker * | v3 ) |
SearchMonitor * operations_research::Solver::MakeSymmetryManager | ( | SymmetryBreaker * | v1, |
SymmetryBreaker * | v2, | ||
SymmetryBreaker * | v3, | ||
SymmetryBreaker * | v4 ) |
ObjectiveMonitor * operations_research::Solver::MakeTabuSearch | ( | bool | maximize, |
IntVar * | objective, | ||
int64_t | step, | ||
const std::vector< IntVar * > & | vars, | ||
int64_t | keep_tenure, | ||
int64_t | forbid_tenure, | ||
double | tabu_factor ) |
MetaHeuristics which try to get the search out of local optima.
Creates a Tabu Search monitor. In the context of local search the behavior is similar to MakeOptimize(), creating an objective in a given sense. The behavior differs once a local optimum is reached: thereafter solutions which degrade the value of the objective are allowed if they are not "tabu". A solution is "tabu" if it doesn't respect the following rules:
Constraint * operations_research::Solver::MakeTemporalDisjunction | ( | IntervalVar * | t1, |
IntervalVar * | t2 ) |
This constraint implements a temporal disjunction between two interval vars.
Definition at line 408 of file timetabling.cc.
Constraint * operations_research::Solver::MakeTemporalDisjunction | ( | IntervalVar * | t1, |
IntervalVar * | t2, | ||
IntVar * | alt ) |
This constraint implements a temporal disjunction between two interval vars t1 and t2. 'alt' indicates which alternative was chosen (alt == 0 is equivalent to t1 before t2).
Definition at line 402 of file timetabling.cc.
RegularLimit * operations_research::Solver::MakeTimeLimit | ( | absl::Duration | time | ) |
|
inline |
Definition at line 2390 of file constraint_solver.h.
Constraint * operations_research::Solver::MakeTransitionConstraint | ( | const std::vector< IntVar * > & | vars, |
const IntTupleSet & | transition_table, | ||
int64_t | initial_state, | ||
const std::vector< int > & | final_states ) |
This constraint create a finite automaton that will check the sequence of variables vars. It uses a transition table called 'transition_table'. Each transition is a triple (current_state, variable_value, new_state). The initial state is given, and the set of accepted states is decribed by 'final_states'. These states are hidden inside the constraint. Only the transitions (i.e. the variables) are visible.
Constraint * operations_research::Solver::MakeTransitionConstraint | ( | const std::vector< IntVar * > & | vars, |
const IntTupleSet & | transition_table, | ||
int64_t | initial_state, | ||
const std::vector< int64_t > & | final_states ) |
This constraint create a finite automaton that will check the sequence of variables vars. It uses a transition table called 'transition_table'. Each transition is a triple (current_state, variable_value, new_state). The initial state is given, and the set of accepted states is decribed by 'final_states'. These states are hidden inside the constraint. Only the transitions (i.e. the variables) are visible.
Constraint * operations_research::Solver::MakeTrueConstraint | ( | ) |
This constraint always succeeds.
Definition at line 530 of file constraints.cc.
ModelVisitor * operations_research::Solver::MakeVariableDegreeVisitor | ( | absl::flat_hash_map< const IntVar *, int > * | map | ) |
Compute the number of constraints a variable is attached to.
Definition at line 822 of file utilities.cc.
LocalSearchFilter * operations_research::Solver::MakeVariableDomainFilter | ( | ) |
Definition at line 3437 of file local_search.cc.
OptimizeVar * operations_research::Solver::MakeWeightedMaximize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int > & | weights, | ||
int64_t | step ) |
OptimizeVar * operations_research::Solver::MakeWeightedMaximize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int64_t > & | weights, | ||
int64_t | step ) |
OptimizeVar * operations_research::Solver::MakeWeightedMinimize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int > & | weights, | ||
int64_t | step ) |
OptimizeVar * operations_research::Solver::MakeWeightedMinimize | ( | const std::vector< IntVar * > & | sub_objectives, |
const std::vector< int64_t > & | weights, | ||
int64_t | step ) |
OptimizeVar * operations_research::Solver::MakeWeightedOptimize | ( | bool | maximize, |
const std::vector< IntVar * > & | sub_objectives, | ||
const std::vector< int > & | weights, | ||
int64_t | step ) |
OptimizeVar * operations_research::Solver::MakeWeightedOptimize | ( | bool | maximize, |
const std::vector< IntVar * > & | sub_objectives, | ||
const std::vector< int64_t > & | weights, | ||
int64_t | step ) |
|
static |
Current memory usage in bytes.
Definition at line 1549 of file constraint_solver.cc.
std::string operations_research::Solver::model_name | ( | ) | const |
Returns the name of the model.
Definition at line 1428 of file constraint_solver.cc.
LocalSearchOperator * operations_research::Solver::MultiArmedBanditConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
double | memory_coefficient, | ||
double | exploration_coefficient, | ||
bool | maximize ) |
Creates a local search operator which concatenates a vector of operators. Uses Multi-Armed Bandit approach for choosing the next operator to use. Sorts operators based on Upper Confidence Bound Algorithm which evaluates each operator as sum of average improvement and exploration function. Updates the order of operators when accepts a neighbor with objective improvement.
Definition at line 2415 of file local_search.cc.
bool operations_research::Solver::NameAllVariables | ( | ) | const |
Returns whether all variables should be named.
Definition at line 198 of file constraint_solver.cc.
|
inline |
The number of neighbors created.
Definition at line 1070 of file constraint_solver.h.
void operations_research::Solver::NewSearch | ( | DecisionBuilder * | db | ) |
Definition at line 1821 of file constraint_solver.cc.
void operations_research::Solver::NewSearch | ( | DecisionBuilder * | db, |
const std::vector< SearchMonitor * > & | monitors ) |
Opens a new top level search.
Decomposed search. The code for a top level search should look like solver->NewSearch(db); while (solver->NextSolution()) { ///<.. use the current solution } solver()->EndSearch();
--— jumps to correct state --—
Nested searches are created on demand, and deleted afterwards.
Top level search is persistent.
--— manages all monitors --—
Always install the main propagation and local search monitors.
Push monitors and enter search.
Install the print trace if needed. The print_trace needs to be last to detect propagation from the objective.
This is useful to trace the exact behavior of the search. The '######## ' prefix is the same as the progagation trace. Search trace is subsumed by propagation trace, thus only one is necessary.
--— enters search --—
Push sentinel and set decision builder.
Definition at line 1842 of file constraint_solver.cc.
void operations_research::Solver::NewSearch | ( | DecisionBuilder * | db, |
SearchMonitor * | m1 ) |
Definition at line 1817 of file constraint_solver.cc.
void operations_research::Solver::NewSearch | ( | DecisionBuilder * | db, |
SearchMonitor * | m1, | ||
SearchMonitor * | m2 ) |
Definition at line 1823 of file constraint_solver.cc.
void operations_research::Solver::NewSearch | ( | DecisionBuilder * | db, |
SearchMonitor * | m1, | ||
SearchMonitor * | m2, | ||
SearchMonitor * | m3 ) |
Definition at line 1828 of file constraint_solver.cc.
void operations_research::Solver::NewSearch | ( | DecisionBuilder * | db, |
SearchMonitor * | m1, | ||
SearchMonitor * | m2, | ||
SearchMonitor * | m3, | ||
SearchMonitor * | m4 ) |
Definition at line 1833 of file constraint_solver.cc.
bool operations_research::Solver::NextSolution | ( | ) |
Search for the next solution in the search tree.
Check the fail state that could have been set in the python/java/C# layer.
We reverse the decision and fall through the normal code.
We do not need to push back the sentinel as we are exiting anyway.
Definition at line 2092 of file constraint_solver.cc.
absl::Time operations_research::Solver::Now | ( | ) | const |
The 'absolute time' as seen by the solver. Unless a user-provided clock was injected via SetClock() (eg. for unit tests), this is a real walltime, shifted so that it was 0 at construction. All so-called "walltime" limits are relative to this time.
Definition at line 1555 of file constraint_solver.cc.
|
inline |
The direction of optimization, getter and setter.
Definition at line 1097 of file constraint_solver.h.
|
inline |
Stored Parameters.
Definition at line 823 of file constraint_solver.h.
void operations_research::Solver::PopState | ( | ) |
Definition at line 1594 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 1589 of file constraint_solver.cc.
|
inline |
Returns a random value between 0 and 'size' - 1;.
Definition at line 3040 of file constraint_solver.h.
|
inline |
Returns a random value between 0 and 'size' - 1;.
Definition at line 3034 of file constraint_solver.h.
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().
Definition at line 2251 of file local_search.cc.
LocalSearchOperator * operations_research::Solver::RandomConcatenateOperators | ( | const std::vector< LocalSearchOperator * > & | ops, |
int32_t | seed ) |
Randomized version of local search concatenator; calls a random operator at each call to MakeNextNeighbor(). The provided seed is used to initialize the random number generator.
Definition at line 2256 of file local_search.cc.
Adds a new demon and wraps it inside a DemonProfiler if necessary.
Definition at line 455 of file demon_profiler.cc.
IntervalVar * operations_research::Solver::RegisterIntervalVar | ( | IntervalVar * | var | ) |
Registers a new IntervalVar and wraps it inside a TraceIntervalVar if necessary.
|
inline |
Reseed the solver random generator.
Definition at line 3046 of file constraint_solver.h.
void operations_research::Solver::RestartCurrentSearch | ( | ) |
Definition at line 2421 of file constraint_solver.cc.
void operations_research::Solver::RestartSearch | ( | ) |
Definition at line 1984 of file constraint_solver.cc.
|
inline |
Registers the given object as being reversible. By calling this method, the caller gives ownership of the object to the solver, which will delete it when there is a backtrack out of the current state. Returns the argument for convenience: this way, the caller may directly invoke a constructor in the argument, without having to store the pointer first. This function is only for users that define their own subclasses of BaseObject: for all subclasses predefined in the library, the corresponding factory methods (e.g., MakeIntVar(...), MakeAllDifferent(...) already take care of the registration.
Definition at line 857 of file constraint_solver.h.
|
inline |
Like RevAlloc() above, but for an array of objects: the array must have been allocated with the new[] operator. The entire array will be deleted when backtracking out of the current state. This method is valid for arrays of int, int64_t, uint64_t, bool, BaseObject*, IntVar*, IntExpr*, and Constraint*.
Definition at line 869 of file constraint_solver.h.
Assignment * operations_research::Solver::RunUncheckedLocalSearch | ( | const Assignment * | initial_solution, |
LocalSearchFilterManager * | filter_manager, | ||
LocalSearchOperator * | ls_operator, | ||
const std::vector< SearchMonitor * > & | monitors, | ||
RegularLimit * | limit, | ||
absl::flat_hash_set< IntVar * > * | touched = nullptr ) |
Experimental: runs a local search on the given initial solution, checking the feasibility and the objective value of solutions using the filter manager only (solutions are never restored in the CP world). Only greedy descent is supported.
Definition at line 5704 of file local_search.cc.
|
inline |
All-in-one SaveAndAdd_value.
Definition at line 3026 of file constraint_solver.h.
|
inline |
All-in-one SaveAndSetValue.
Definition at line 3017 of file constraint_solver.h.
|
inline |
reversibility
SaveValue() saves the value of the corresponding object. It must be called before modifying the object. The value will be restored upon backtrack.
Definition at line 838 of file constraint_solver.h.
std::string operations_research::Solver::SearchContext | ( | ) | const |
Definition at line 3246 of file constraint_solver.cc.
std::string operations_research::Solver::SearchContext | ( | const Search * | search | ) | const |
Definition at line 3250 of file constraint_solver.cc.
int operations_research::Solver::SearchDepth | ( | ) | const |
Gets the search depth of the current active search. Returns -1 if there is no active search opened.
Definition at line 1203 of file constraint_solver.cc.
int operations_research::Solver::SearchLeftDepth | ( | ) | const |
Gets the search left depth of the current active search. Returns -1 if there is no active search opened.
Definition at line 1205 of file constraint_solver.cc.
|
inline |
Sets the current context of the search.
Definition at line 1091 of file constraint_solver.h.
|
inline |
Internal.
Definition at line 3080 of file constraint_solver.h.
|
inline |
Definition at line 1100 of file constraint_solver.h.
void operations_research::Solver::SetBranchSelector | ( | BranchSelector | bs | ) |
Sets the given branch selector on the current active search.
We cannot use the trail as the search can be nested and thus deleted upon backtrack. Thus we guard the undo action by a check on the number of nesting of solve().
Definition at line 1180 of file constraint_solver.cc.
void operations_research::Solver::SetSearchContext | ( | Search * | search, |
absl::string_view | search_context ) |
Definition at line 3241 of file constraint_solver.cc.
|
inline |
Definition at line 3090 of file constraint_solver.h.
|
inline |
These methods are only useful for the SWIG wrappers, which need a way to externally cause the Solver to fail.
Definition at line 3191 of file constraint_solver.h.
int64_t operations_research::Solver::solutions | ( | ) | const |
The number of solutions found since the start of the search.
Definition at line 1559 of file constraint_solver.cc.
bool operations_research::Solver::Solve | ( | DecisionBuilder * | db | ) |
Definition at line 1789 of file constraint_solver.cc.
bool operations_research::Solver::Solve | ( | DecisionBuilder * | 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.
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 1807 of file constraint_solver.cc.
bool operations_research::Solver::Solve | ( | DecisionBuilder * | db, |
SearchMonitor * | m1 ) |
Definition at line 1785 of file constraint_solver.cc.
bool operations_research::Solver::Solve | ( | DecisionBuilder * | db, |
SearchMonitor * | m1, | ||
SearchMonitor * | m2 ) |
Definition at line 1791 of file constraint_solver.cc.
bool operations_research::Solver::Solve | ( | DecisionBuilder * | db, |
SearchMonitor * | m1, | ||
SearchMonitor * | m2, | ||
SearchMonitor * | m3 ) |
Definition at line 1796 of file constraint_solver.cc.
bool operations_research::Solver::Solve | ( | DecisionBuilder * | db, |
SearchMonitor * | m1, | ||
SearchMonitor * | m2, | ||
SearchMonitor * | m3, | ||
SearchMonitor * | m4 ) |
Definition at line 1801 of file constraint_solver.cc.
bool operations_research::Solver::SolveAndCommit | ( | DecisionBuilder * | db | ) |
Definition at line 2381 of file constraint_solver.cc.
bool operations_research::Solver::SolveAndCommit | ( | DecisionBuilder * | db, |
const std::vector< SearchMonitor * > & | monitors ) |
SolveAndCommit using a decision builder and up to three search monitors, usually one for the objective, one for the limits and one to collect solutions. The difference between a SolveAndCommit() and a Solve() method call is the fact that SolveAndCommit will not backtrack all modifications at the end of the search. This method is only usable during the Next() method of a decision builder.
Definition at line 2395 of file constraint_solver.cc.
bool operations_research::Solver::SolveAndCommit | ( | DecisionBuilder * | db, |
SearchMonitor * | m1 ) |
Definition at line 2376 of file constraint_solver.cc.
bool operations_research::Solver::SolveAndCommit | ( | DecisionBuilder * | db, |
SearchMonitor * | m1, | ||
SearchMonitor * | m2 ) |
Definition at line 2385 of file constraint_solver.cc.
bool operations_research::Solver::SolveAndCommit | ( | DecisionBuilder * | db, |
SearchMonitor * | m1, | ||
SearchMonitor * | m2, | ||
SearchMonitor * | m3 ) |
Definition at line 2390 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 or more in case of nested searches.
Definition at line 1199 of file constraint_solver.cc.
uint64_t 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 1676 of file constraint_solver.cc.
|
inline |
State of the solver.
Definition at line 1025 of file constraint_solver.h.
void operations_research::Solver::TopPeriodicCheck | ( | ) |
Performs PeriodicCheck on the top-level search; for instance, can be called from a nested solve to check top-level limits.
Definition at line 1575 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 1577 of file constraint_solver.cc.
DecisionBuilder * operations_research::Solver::Try | ( | const std::vector< DecisionBuilder * > & | dbs | ) |
DecisionBuilder * operations_research::Solver::Try | ( | DecisionBuilder * | db1, |
DecisionBuilder * | db2 ) |
Creates a decision builder which will create a search tree where each decision builder is called from the top of the search tree. For instance the decision builder Try(db1, db2) will entirely explore the search tree of db1 then the one of db2, resulting in the following search tree: Tree root | / \ | db1 tree db2 tree | This is very handy to try a decision builder which partially explores the search space and if it fails to try another decision builder.
DecisionBuilder * operations_research::Solver::Try | ( | DecisionBuilder * | db1, |
DecisionBuilder * | db2, | ||
DecisionBuilder * | db3 ) |
DecisionBuilder * operations_research::Solver::Try | ( | DecisionBuilder * | db1, |
DecisionBuilder * | db2, | ||
DecisionBuilder * | db3, | ||
DecisionBuilder * | db4 ) |
int64_t operations_research::Solver::unchecked_solutions | ( | ) | const |
The number of unchecked solutions found by local search.
Definition at line 1563 of file constraint_solver.cc.
|
inline |
Returns true if fast local search is enabled.
Definition at line 3094 of file constraint_solver.h.
int64_t operations_research::Solver::wall_time | ( | ) | const |
Definition at line 1551 of file constraint_solver.cc.
|
friend |
Definition at line 3148 of file constraint_solver.h.
|
friend |
Definition at line 3149 of file constraint_solver.h.
|
friend |
Definition at line 3150 of file constraint_solver.h.
|
friend |
Definition at line 3151 of file constraint_solver.h.
Definition at line 965 of file constraint_solver.cc.
|
friend |
Definition at line 3152 of file constraint_solver.h.
|
friend |
Definition at line 3158 of file constraint_solver.h.
|
friend |
Definition at line 3159 of file constraint_solver.h.
|
friend |
Definition at line 3153 of file constraint_solver.h.
|
friend |
Definition at line 3154 of file constraint_solver.h.
|
friend |
Definition at line 3166 of file constraint_solver.h.
|
friend |
Definition at line 3157 of file constraint_solver.h.
|
friend |
Definition at line 3156 of file constraint_solver.h.
|
friend |
Definition at line 3155 of file constraint_solver.h.
|
friend |
Definition at line 3164 of file constraint_solver.h.
|
staticconstexpr |
Number of priorities for demons.
Definition at line 283 of file constraint_solver.h.
std::vector<int64_t> operations_research::Solver::tmp_vector_ |
Unsafe temporary vector. It is used to avoid leaks in operations that need storage and that may fail. See IntVar::SetValues() for instance. It is not locked; do not use in a multi-threaded or reentrant setup.
Definition at line 3146 of file constraint_solver.h.