Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
ortools.constraint_solver.pywrapcp.Solver Class Reference

Detailed Description

 Solver Class.
A solver represents the main computation engine. It implements the
entire range of Constraint Programming protocols:
- Reversibility
- Propagation
- Search

Usually, Constraint Programming code consists of
- the creation of the Solver,
- the creation of the decision variables of the model,
- the creation of the constraints of the model and their addition to the
  solver() through the AddConstraint() method,
- the creation of the main DecisionBuilder class,
- the launch of the solve() method with the decision builder.

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

Definition at line 117 of file pywrapcp.py.

Inheritance diagram for ortools.constraint_solver.pywrapcp.Solver:

Public Member Functions

 __init__ (self, *args)
 Parameters (self)
 AddConstraint (self, c)
 Solve (self, *args)
 NewSearch (self, *args)
 NextSolution (self)
 RestartSearch (self)
 EndSearch (self)
 SolveAndCommit (self, *args)
 CheckAssignment (self, solution)
 CheckConstraint (self, ct)
 Fail (self)
 WallTime (self)
 Branches (self)
 Solutions (self)
 Failures (self)
 AcceptedNeighbors (self)
 Stamp (self)
 FailStamp (self)
 IntVar (self, *args)
 BoolVar (self, *args)
 IntConst (self, *args)
 Sum (self, vars)
 ScalProd (self, *args)
 MonotonicElement (self, values, increasing, index)
 Element (self, *args)
 IndexExpression (self, vars, value)
 Min (self, *args)
 Max (self, *args)
 ConvexPiecewiseExpr (self, expr, early_cost, early_date, late_date, late_cost)
 SemiContinuousExpr (self, expr, fixed_charge, step)
 ConditionalExpression (self, condition, expr, unperformed_value)
 TrueConstraint (self)
 FalseConstraint (self, *args)
 IsEqualCstCt (self, var, value, boolvar)
 IsEqualCstVar (self, var, value)
 IsEqualCt (self, v1, v2, b)
 IsEqualVar (self, v1, v2)
 IsDifferentCstCt (self, var, value, boolvar)
 IsDifferentCstVar (self, var, value)
 IsDifferentVar (self, v1, v2)
 IsDifferentCt (self, v1, v2, b)
 IsLessOrEqualCstCt (self, var, value, boolvar)
 IsLessOrEqualCstVar (self, var, value)
 IsLessOrEqualVar (self, left, right)
 IsLessOrEqualCt (self, left, right, b)
 IsGreaterOrEqualCstCt (self, var, value, boolvar)
 IsGreaterOrEqualCstVar (self, var, value)
 IsGreaterOrEqualVar (self, left, right)
 IsGreaterOrEqualCt (self, left, right, b)
 IsGreaterCstCt (self, v, c, b)
 IsGreaterCstVar (self, var, value)
 IsGreaterVar (self, left, right)
 IsGreaterCt (self, left, right, b)
 IsLessCstCt (self, v, c, b)
 IsLessCstVar (self, var, value)
 IsLessVar (self, left, right)
 IsLessCt (self, left, right, b)
 SumLessOrEqual (self, vars, cst)
 SumGreaterOrEqual (self, vars, cst)
 SumEquality (self, *args)
 ScalProdEquality (self, *args)
 ScalProdGreaterOrEqual (self, *args)
 ScalProdLessOrEqual (self, *args)
 MinEquality (self, vars, min_var)
 MaxEquality (self, vars, max_var)
 ElementEquality (self, *args)
 AbsEquality (self, var, abs_var)
 IndexOfConstraint (self, vars, index, target)
 ConstraintInitialPropagateCallback (self, ct)
 DelayedConstraintInitialPropagateCallback (self, ct)
 ClosureDemon (self, closure)
 BetweenCt (self, expr, l, u)
 IsBetweenCt (self, expr, l, u, b)
 IsBetweenVar (self, v, l, u)
 MemberCt (self, *args)
 NotMemberCt (self, *args)
 IsMemberCt (self, *args)
 IsMemberVar (self, *args)
 Count (self, *args)
 Distribute (self, *args)
 Deviation (self, vars, deviation_var, total_sum)
 AllDifferent (self, *args)
 AllDifferentExcept (self, vars, escape_value)
 SortingConstraint (self, vars, sorted)
 LexicalLess (self, left, right)
 LexicalLessOrEqual (self, left, right)
 InversePermutationConstraint (self, left, right)
 NullIntersect (self, first_vars, second_vars)
 NullIntersectExcept (self, first_vars, second_vars, escape_value)
 Circuit (self, nexts)
 SubCircuit (self, nexts)
 DelayedPathCumul (self, nexts, active, cumuls, transits)
 PathCumul (self, *args)
 AllowedAssignments (self, *args)
 TransitionConstraint (self, *args)
 NonOverlappingBoxesConstraint (self, *args)
 Pack (self, vars, number_of_bins)
 FixedDurationIntervalVar (self, *args)
 FixedInterval (self, start, duration, name)
 IntervalVar (self, start_min, start_max, duration_min, duration_max, end_min, end_max, optional, name)
 MirrorInterval (self, interval_var)
 FixedDurationStartSyncedOnStartIntervalVar (self, interval_var, duration, offset)
 FixedDurationStartSyncedOnEndIntervalVar (self, interval_var, duration, offset)
 FixedDurationEndSyncedOnStartIntervalVar (self, interval_var, duration, offset)
 FixedDurationEndSyncedOnEndIntervalVar (self, interval_var, duration, offset)
 IntervalRelaxedMin (self, interval_var)
 IntervalRelaxedMax (self, interval_var)
 TemporalDisjunction (self, *args)
 DisjunctiveConstraint (self, intervals, name)
 Cumulative (self, *args)
 Cover (self, vars, target_var)
 Assignment (self, *args)
 FirstSolutionCollector (self, *args)
 LastSolutionCollector (self, *args)
 BestValueSolutionCollector (self, *args)
 AllSolutionCollector (self, *args)
 Minimize (self, v, step)
 Maximize (self, v, step)
 Optimize (self, maximize, v, step)
 WeightedMinimize (self, *args)
 WeightedMaximize (self, *args)
 WeightedOptimize (self, *args)
 TabuSearch (self, maximize, objective, step, vars, keep_tenure, forbid_tenure, tabu_factor)
 SimulatedAnnealing (self, maximize, v, step, initial_temperature)
 LubyRestart (self, scale_factor)
 ConstantRestart (self, frequency)
 TimeLimit (self, *args)
 BranchesLimit (self, branches)
 FailuresLimit (self, failures)
 SolutionsLimit (self, solutions)
 Limit (self, *args)
 CustomLimit (self, limiter)
 SearchLog (self, *args)
 SearchTrace (self, prefix)
 PrintModelVisitor (self)
 StatisticsModelVisitor (self)
 AssignVariableValue (self, var, val)
 VariableLessOrEqualValue (self, var, value)
 VariableGreaterOrEqualValue (self, var, value)
 SplitVariableDomain (self, var, val, start_with_lower_half)
 AssignVariableValueOrFail (self, var, value)
 AssignVariablesValues (self, vars, values)
 FailDecision (self)
 Decision (self, apply, refute)
 Compose (self, dbs)
 Try (self, dbs)
 DefaultPhase (self, *args)
 ScheduleOrPostpone (self, var, est, marker)
 ScheduleOrExpedite (self, var, est, marker)
 RankFirstInterval (self, sequence, index)
 RankLastInterval (self, sequence, index)
 Phase (self, *args)
 DecisionBuilderFromAssignment (self, assignment, db, vars)
 ConstraintAdder (self, ct)
 SolveOnce (self, db, monitors)
 NestedOptimize (self, *args)
 RestoreAssignment (self, assignment)
 StoreAssignment (self, assignment)
 Operator (self, *args)
 RandomLnsOperator (self, *args)
 MoveTowardTargetOperator (self, *args)
 ConcatenateOperators (self, *args)
 RandomConcatenateOperators (self, *args)
 NeighborhoodLimit (self, op, limit)
 LocalSearchPhase (self, *args)
 LocalSearchPhaseParameters (self, *args)
 TopProgressPercent (self)
 SearchDepth (self)
 SearchLeftDepth (self)
 SolveDepth (self)
 Rand64 (self, size)
 Rand32 (self, size)
 ReSeed (self, seed)
 LocalSearchProfile (self)
 Constraints (self)
 Accept (self, visitor)
 FinishCurrentSearch (self)
 RestartCurrentSearch (self)
 ShouldFail (self)
 __str__ (self)
 Add (self, ct)
 TreeNoCycle (self, nexts, active, callback=0)
 SearchLogWithCallback (self, period, callback)
 ElementFunction (self, values, index)
 VarEvalValStrPhase (self, vars, var_evaluator, val_str)
 VarStrValEvalPhase (self, vars, var_str, val_eval)
 VarEvalValEvalPhase (self, vars, var_eval, val_eval)
 VarStrValEvalTieBreakPhase (self, vars, var_str, val_eval, tie_breaker)
 VarEvalValEvalTieBreakPhase (self, vars, var_eval, val_eval, tie_breaker)
 EvalEvalStrPhase (self, vars, evaluator, str)
 EvalEvalStrTieBreakPhase (self, vars, evaluator, tie_breaker, str)
 GuidedLocalSearch (self, maximize, objective, objective_function, step, vars, penalty_factor)
 SumObjectiveFilter (self, vars, values, filter_enum)

Static Public Member Functions

 DefaultSolverParameters ()
 MemoryUsage ()

Static Public Attributes

 INT_VAR_DEFAULT = _pywrapcp.Solver_INT_VAR_DEFAULT
 INT_VAR_SIMPLE = _pywrapcp.Solver_INT_VAR_SIMPLE
 CHOOSE_FIRST_UNBOUND = _pywrapcp.Solver_CHOOSE_FIRST_UNBOUND
 CHOOSE_RANDOM = _pywrapcp.Solver_CHOOSE_RANDOM
 CHOOSE_MIN_SIZE_LOWEST_MIN = _pywrapcp.Solver_CHOOSE_MIN_SIZE_LOWEST_MIN
 CHOOSE_MIN_SIZE_HIGHEST_MIN = _pywrapcp.Solver_CHOOSE_MIN_SIZE_HIGHEST_MIN
 CHOOSE_MIN_SIZE_LOWEST_MAX = _pywrapcp.Solver_CHOOSE_MIN_SIZE_LOWEST_MAX
 CHOOSE_MIN_SIZE_HIGHEST_MAX = _pywrapcp.Solver_CHOOSE_MIN_SIZE_HIGHEST_MAX
 CHOOSE_LOWEST_MIN = _pywrapcp.Solver_CHOOSE_LOWEST_MIN
 CHOOSE_HIGHEST_MAX = _pywrapcp.Solver_CHOOSE_HIGHEST_MAX
 CHOOSE_MIN_SIZE = _pywrapcp.Solver_CHOOSE_MIN_SIZE
 CHOOSE_MAX_SIZE = _pywrapcp.Solver_CHOOSE_MAX_SIZE
 CHOOSE_MAX_REGRET_ON_MIN = _pywrapcp.Solver_CHOOSE_MAX_REGRET_ON_MIN
 CHOOSE_PATH = _pywrapcp.Solver_CHOOSE_PATH
 INT_VALUE_DEFAULT = _pywrapcp.Solver_INT_VALUE_DEFAULT
 INT_VALUE_SIMPLE = _pywrapcp.Solver_INT_VALUE_SIMPLE
 ASSIGN_MIN_VALUE = _pywrapcp.Solver_ASSIGN_MIN_VALUE
 ASSIGN_MAX_VALUE = _pywrapcp.Solver_ASSIGN_MAX_VALUE
 ASSIGN_RANDOM_VALUE = _pywrapcp.Solver_ASSIGN_RANDOM_VALUE
 ASSIGN_CENTER_VALUE = _pywrapcp.Solver_ASSIGN_CENTER_VALUE
 SPLIT_LOWER_HALF = _pywrapcp.Solver_SPLIT_LOWER_HALF
 SPLIT_UPPER_HALF = _pywrapcp.Solver_SPLIT_UPPER_HALF
 SEQUENCE_DEFAULT = _pywrapcp.Solver_SEQUENCE_DEFAULT
 SEQUENCE_SIMPLE = _pywrapcp.Solver_SEQUENCE_SIMPLE
 CHOOSE_MIN_SLACK_RANK_FORWARD = _pywrapcp.Solver_CHOOSE_MIN_SLACK_RANK_FORWARD
 CHOOSE_RANDOM_RANK_FORWARD = _pywrapcp.Solver_CHOOSE_RANDOM_RANK_FORWARD
 INTERVAL_DEFAULT = _pywrapcp.Solver_INTERVAL_DEFAULT
 INTERVAL_SIMPLE = _pywrapcp.Solver_INTERVAL_SIMPLE
 INTERVAL_SET_TIMES_FORWARD = _pywrapcp.Solver_INTERVAL_SET_TIMES_FORWARD
 INTERVAL_SET_TIMES_BACKWARD = _pywrapcp.Solver_INTERVAL_SET_TIMES_BACKWARD
 TWOOPT = _pywrapcp.Solver_TWOOPT
 OROPT = _pywrapcp.Solver_OROPT
 RELOCATE = _pywrapcp.Solver_RELOCATE
 EXCHANGE = _pywrapcp.Solver_EXCHANGE
 CROSS = _pywrapcp.Solver_CROSS
 MAKEACTIVE = _pywrapcp.Solver_MAKEACTIVE
 MAKEINACTIVE = _pywrapcp.Solver_MAKEINACTIVE
 MAKECHAININACTIVE = _pywrapcp.Solver_MAKECHAININACTIVE
 SWAPACTIVE = _pywrapcp.Solver_SWAPACTIVE
 EXTENDEDSWAPACTIVE = _pywrapcp.Solver_EXTENDEDSWAPACTIVE
 PATHLNS = _pywrapcp.Solver_PATHLNS
 FULLPATHLNS = _pywrapcp.Solver_FULLPATHLNS
 UNACTIVELNS = _pywrapcp.Solver_UNACTIVELNS
 INCREMENT = _pywrapcp.Solver_INCREMENT
 DECREMENT = _pywrapcp.Solver_DECREMENT
 SIMPLELNS = _pywrapcp.Solver_SIMPLELNS
 GE = _pywrapcp.Solver_GE
 LE = _pywrapcp.Solver_LE
 EQ = _pywrapcp.Solver_EQ
 DELAYED_PRIORITY = _pywrapcp.Solver_DELAYED_PRIORITY
 VAR_PRIORITY = _pywrapcp.Solver_VAR_PRIORITY
 NORMAL_PRIORITY = _pywrapcp.Solver_NORMAL_PRIORITY

Properties

 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

Constructor & Destructor Documentation

◆ __init__()

ortools.constraint_solver.pywrapcp.Solver.__init__ ( self,
* args )
Solver API

Definition at line 460 of file pywrapcp.py.

Member Function Documentation

◆ __str__()

ortools.constraint_solver.pywrapcp.Solver.__str__ ( self)

Definition at line 2129 of file pywrapcp.py.

◆ AbsEquality()

ortools.constraint_solver.pywrapcp.Solver.AbsEquality ( self,
var,
abs_var )
Creates the constraint abs(var) == abs_var.

Definition at line 963 of file pywrapcp.py.

◆ Accept()

ortools.constraint_solver.pywrapcp.Solver.Accept ( self,
visitor )
Accepts the given model visitor.

Definition at line 2111 of file pywrapcp.py.

◆ AcceptedNeighbors()

ortools.constraint_solver.pywrapcp.Solver.AcceptedNeighbors ( self)
The number of accepted neighbors.

Definition at line 638 of file pywrapcp.py.

◆ Add()

ortools.constraint_solver.pywrapcp.Solver.Add ( self,
ct )

Definition at line 2132 of file pywrapcp.py.

◆ AddConstraint()

ortools.constraint_solver.pywrapcp.Solver.AddConstraint ( self,
c )
Adds the constraint 'c' to the model.

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

- the most common use case is modeling: the given constraint is really
part of the problem that the user is trying to solve. In this use case,
AddConstraint is called outside of search (i.e., with state() ==
OUTSIDE_SEARCH). Most users should only use AddConstraint in this
way. In this case, the constraint will belong to the model forever: it
cannot be removed by backtracking.

- a rarer use case is that 'c' is not a real constraint of the model. It
may be a constraint generated by a branching decision (a constraint whose
goal is to restrict the search space), a symmetry breaking constraint (a
constraint that does restrict the search space, but in a way that cannot
have an impact on the quality of the solutions in the subtree), or an
inferred constraint that, while having no semantic value to the model (it
does not restrict the set of solutions), is worth having because we
believe it may strengthen the propagation. In these cases, it happens
that the constraint is added during the search (i.e., with state() ==
IN_SEARCH or state() == IN_ROOT_NODE). When a constraint is
added during a search, it applies only to the subtree of the search tree
rooted at the current node, and will be automatically removed by
backtracking.

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

Definition at line 479 of file pywrapcp.py.

◆ AllDifferent()

ortools.constraint_solver.pywrapcp.Solver.AllDifferent ( self,
* args )
*Overload 1:*
All variables are pairwise different. This corresponds to the
stronger version of the propagation algorithm.

|

*Overload 2:*
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 1109 of file pywrapcp.py.

◆ AllDifferentExcept()

ortools.constraint_solver.pywrapcp.Solver.AllDifferentExcept ( self,
vars,
escape_value )
All variables are pairwise different, unless they are assigned to
the escape value.

Definition at line 1124 of file pywrapcp.py.

◆ AllowedAssignments()

ortools.constraint_solver.pywrapcp.Solver.AllowedAssignments ( self,
* args )
*Overload 1:*
This method creates a constraint where the graph of the relation
between the variables is given in extension. There are 'arity'
variables involved in the relation and the graph is given by a
integer tuple set.

|

*Overload 2:*
Compatibility layer for Python API.

Definition at line 1241 of file pywrapcp.py.

◆ AllSolutionCollector()

ortools.constraint_solver.pywrapcp.Solver.AllSolutionCollector ( self,
* args )
*Overload 1:*
Collect all solutions of the search.

|

*Overload 2:*
Collect all solutions of the search. The variables will need to
be added later.

Definition at line 1588 of file pywrapcp.py.

◆ Assignment()

ortools.constraint_solver.pywrapcp.Solver.Assignment ( self,
* args )
*Overload 1:*
This method creates an empty assignment.

|

*Overload 2:*
This method creates an assignment which is a copy of 'a'.

Definition at line 1531 of file pywrapcp.py.

◆ AssignVariablesValues()

ortools.constraint_solver.pywrapcp.Solver.AssignVariablesValues ( self,
vars,
values )

Definition at line 1817 of file pywrapcp.py.

◆ AssignVariableValue()

ortools.constraint_solver.pywrapcp.Solver.AssignVariableValue ( self,
var,
val )
Decisions.

Definition at line 1801 of file pywrapcp.py.

◆ AssignVariableValueOrFail()

ortools.constraint_solver.pywrapcp.Solver.AssignVariableValueOrFail ( self,
var,
value )

Definition at line 1814 of file pywrapcp.py.

◆ BestValueSolutionCollector()

ortools.constraint_solver.pywrapcp.Solver.BestValueSolutionCollector ( self,
* args )
*Overload 1:*
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).

|

*Overload 2:*
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.

Definition at line 1569 of file pywrapcp.py.

◆ BetweenCt()

ortools.constraint_solver.pywrapcp.Solver.BetweenCt ( self,
expr,
l,
u )
(l <= expr <= u)

Definition at line 995 of file pywrapcp.py.

◆ BoolVar()

ortools.constraint_solver.pywrapcp.Solver.BoolVar ( self,
* args )
*Overload 1:*
MakeBoolVar will create a variable with a {0, 1} domain.

|

*Overload 2:*
MakeBoolVar will create a variable with a {0, 1} domain.

Definition at line 685 of file pywrapcp.py.

◆ Branches()

ortools.constraint_solver.pywrapcp.Solver.Branches ( self)
The number of branches explored since the creation of the solver.

Definition at line 626 of file pywrapcp.py.

◆ BranchesLimit()

ortools.constraint_solver.pywrapcp.Solver.BranchesLimit ( self,
branches )
Creates a search limit that constrains the number of branches
explored in the search tree.

Definition at line 1695 of file pywrapcp.py.

◆ CheckAssignment()

ortools.constraint_solver.pywrapcp.Solver.CheckAssignment ( self,
solution )
Checks whether the given assignment satisfies all relevant constraints.

Definition at line 598 of file pywrapcp.py.

◆ CheckConstraint()

ortools.constraint_solver.pywrapcp.Solver.CheckConstraint ( self,
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 602 of file pywrapcp.py.

◆ Circuit()

ortools.constraint_solver.pywrapcp.Solver.Circuit ( self,
nexts )
Force the "nexts" variable to create a complete Hamiltonian path.

Definition at line 1193 of file pywrapcp.py.

◆ ClosureDemon()

ortools.constraint_solver.pywrapcp.Solver.ClosureDemon ( self,
closure )
Creates a demon from a closure.

Definition at line 991 of file pywrapcp.py.

◆ Compose()

ortools.constraint_solver.pywrapcp.Solver.Compose ( self,
dbs )

Definition at line 1826 of file pywrapcp.py.

◆ ConcatenateOperators()

ortools.constraint_solver.pywrapcp.Solver.ConcatenateOperators ( self,
* args )
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 1962 of file pywrapcp.py.

◆ ConditionalExpression()

ortools.constraint_solver.pywrapcp.Solver.ConditionalExpression ( self,
condition,
expr,
unperformed_value )
Conditional Expr condition ? expr : unperformed_value

Definition at line 827 of file pywrapcp.py.

◆ ConstantRestart()

ortools.constraint_solver.pywrapcp.Solver.ConstantRestart ( self,
frequency )
This search monitor will restart the search periodically after 'frequency'
failures.

Definition at line 1684 of file pywrapcp.py.

◆ ConstraintAdder()

ortools.constraint_solver.pywrapcp.Solver.ConstraintAdder ( self,
ct )
Returns a decision builder that will add the given constraint to
the model.

Definition at line 1889 of file pywrapcp.py.

◆ ConstraintInitialPropagateCallback()

ortools.constraint_solver.pywrapcp.Solver.ConstraintInitialPropagateCallback ( self,
ct )
This method is a specialized case of the MakeConstraintDemon
method to call the InitiatePropagate of the constraint 'ct'.

Definition at line 976 of file pywrapcp.py.

◆ Constraints()

ortools.constraint_solver.pywrapcp.Solver.Constraints ( self)
Counts the number of constraints that have been added
to the solver before the search.

Definition at line 2104 of file pywrapcp.py.

◆ ConvexPiecewiseExpr()

ortools.constraint_solver.pywrapcp.Solver.ConvexPiecewiseExpr ( self,
expr,
early_cost,
early_date,
late_date,
late_cost )
Convex piecewise function.

Definition at line 816 of file pywrapcp.py.

◆ Count()

ortools.constraint_solver.pywrapcp.Solver.Count ( self,
* args )
*Overload 1:*
|{i | vars[i] == value}| == max_count

|

*Overload 2:*
|{i | vars[i] == value}| == max_count

Definition at line 1037 of file pywrapcp.py.

◆ Cover()

ortools.constraint_solver.pywrapcp.Solver.Cover ( self,
vars,
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 1521 of file pywrapcp.py.

◆ Cumulative()

ortools.constraint_solver.pywrapcp.Solver.Cumulative ( self,
* args )
*Overload 1:*
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.

|

*Overload 2:*
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.

|

*Overload 3:*
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.

|

*Overload 4:*
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.

|

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

Intervals and demands should be vectors of equal size.

Demands should be positive.

|

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

Intervals and demands should be vectors of equal size.

Demands should be positive.

Definition at line 1445 of file pywrapcp.py.

◆ CustomLimit()

ortools.constraint_solver.pywrapcp.Solver.CustomLimit ( self,
limiter )
Callback-based search limit. Search stops when limiter returns true; if
this happens at a leaf the corresponding solution will be rejected.

Definition at line 1736 of file pywrapcp.py.

◆ Decision()

ortools.constraint_solver.pywrapcp.Solver.Decision ( self,
apply,
refute )

Definition at line 1823 of file pywrapcp.py.

◆ DecisionBuilderFromAssignment()

ortools.constraint_solver.pywrapcp.Solver.DecisionBuilderFromAssignment ( self,
assignment,
db,
vars )
Returns a decision builder for which the left-most leaf corresponds
to assignment, the rest of the tree being explored using 'db'.

Definition at line 1882 of file pywrapcp.py.

◆ DefaultPhase()

ortools.constraint_solver.pywrapcp.Solver.DefaultPhase ( self,
* args )

Definition at line 1832 of file pywrapcp.py.

◆ DefaultSolverParameters()

ortools.constraint_solver.pywrapcp.Solver.DefaultSolverParameters ( )
static
Create a ConstraintSolverParameters proto with all the default values.

Definition at line 475 of file pywrapcp.py.

◆ DelayedConstraintInitialPropagateCallback()

ortools.constraint_solver.pywrapcp.Solver.DelayedConstraintInitialPropagateCallback ( self,
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 983 of file pywrapcp.py.

◆ DelayedPathCumul()

ortools.constraint_solver.pywrapcp.Solver.DelayedPathCumul ( self,
nexts,
active,
cumuls,
transits )
Delayed version of the same constraint: propagation on the nexts variables
is delayed until all constraints have propagated.

Definition at line 1204 of file pywrapcp.py.

◆ Deviation()

ortools.constraint_solver.pywrapcp.Solver.Deviation ( self,
vars,
deviation_var,
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 1100 of file pywrapcp.py.

◆ DisjunctiveConstraint()

ortools.constraint_solver.pywrapcp.Solver.DisjunctiveConstraint ( self,
intervals,
name )
This constraint forces all interval vars into an non-overlapping
sequence. Intervals with zero duration can be scheduled anywhere.

Definition at line 1438 of file pywrapcp.py.

◆ Distribute()

ortools.constraint_solver.pywrapcp.Solver.Distribute ( self,
* args )
*Overload 1:*
Aggregated version of count:  |{i | v[i] == values[j]}| == cards[j]

|

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

|

*Overload 3:*
Aggregated version of count:  |{i | v[i] == j}| == cards[j]

|

*Overload 4:*
Aggregated version of count with bounded cardinalities:
forall j in 0 .. card_size - 1: card_min <= |{i | v[i] == j}| <= card_max

|

*Overload 5:*
Aggregated version of count with bounded cardinalities:
forall j in 0 .. card_size - 1:
   card_min[j] <= |{i | v[i] == j}| <= card_max[j]

|

*Overload 6:*
Aggregated version of count with bounded cardinalities:
forall j in 0 .. card_size - 1:
   card_min[j] <= |{i | v[i] == j}| <= card_max[j]

|

*Overload 7:*
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]

|

*Overload 8:*
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 1049 of file pywrapcp.py.

◆ Element()

ortools.constraint_solver.pywrapcp.Solver.Element ( self,
* args )
*Overload 1:*
values[index]

|

*Overload 2:*
values[index]

|

*Overload 3:*
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).

|

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

|

*Overload 5:*
vars[expr]

Definition at line 736 of file pywrapcp.py.

◆ ElementEquality()

ortools.constraint_solver.pywrapcp.Solver.ElementEquality ( self,
* args )

Definition at line 960 of file pywrapcp.py.

◆ ElementFunction()

ortools.constraint_solver.pywrapcp.Solver.ElementFunction ( self,
values,
index )

Definition at line 2144 of file pywrapcp.py.

◆ EndSearch()

ortools.constraint_solver.pywrapcp.Solver.EndSearch ( self)

Definition at line 582 of file pywrapcp.py.

◆ EvalEvalStrPhase()

ortools.constraint_solver.pywrapcp.Solver.EvalEvalStrPhase ( self,
vars,
evaluator,
str )

Definition at line 2162 of file pywrapcp.py.

◆ EvalEvalStrTieBreakPhase()

ortools.constraint_solver.pywrapcp.Solver.EvalEvalStrTieBreakPhase ( self,
vars,
evaluator,
tie_breaker,
str )

Definition at line 2165 of file pywrapcp.py.

◆ Fail()

ortools.constraint_solver.pywrapcp.Solver.Fail ( self)
Abandon the current branch in the search tree. A backtrack will follow.

Definition at line 610 of file pywrapcp.py.

◆ FailDecision()

ortools.constraint_solver.pywrapcp.Solver.FailDecision ( self)

Definition at line 1820 of file pywrapcp.py.

◆ FailStamp()

ortools.constraint_solver.pywrapcp.Solver.FailStamp ( self)
The fail_stamp() is incremented after each backtrack.

Definition at line 649 of file pywrapcp.py.

◆ Failures()

ortools.constraint_solver.pywrapcp.Solver.Failures ( self)
The number of failures encountered since the creation of the solver.

Definition at line 634 of file pywrapcp.py.

◆ FailuresLimit()

ortools.constraint_solver.pywrapcp.Solver.FailuresLimit ( self,
failures )
Creates a search limit that constrains the number of failures
that can happen when exploring the search tree.

Definition at line 1702 of file pywrapcp.py.

◆ FalseConstraint()

ortools.constraint_solver.pywrapcp.Solver.FalseConstraint ( self,
* args )
This constraint always fails.

Definition at line 835 of file pywrapcp.py.

◆ FinishCurrentSearch()

ortools.constraint_solver.pywrapcp.Solver.FinishCurrentSearch ( self)
Tells the solver to kill or restart the current search.

Definition at line 2115 of file pywrapcp.py.

◆ FirstSolutionCollector()

ortools.constraint_solver.pywrapcp.Solver.FirstSolutionCollector ( self,
* args )
*Overload 1:*
Collect the first solution of the search.

|

*Overload 2:*
Collect the first solution of the search. The variables will need to
be added later.

Definition at line 1543 of file pywrapcp.py.

◆ FixedDurationEndSyncedOnEndIntervalVar()

ortools.constraint_solver.pywrapcp.Solver.FixedDurationEndSyncedOnEndIntervalVar ( self,
interval_var,
duration,
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 1370 of file pywrapcp.py.

◆ FixedDurationEndSyncedOnStartIntervalVar()

ortools.constraint_solver.pywrapcp.Solver.FixedDurationEndSyncedOnStartIntervalVar ( self,
interval_var,
duration,
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 1361 of file pywrapcp.py.

◆ FixedDurationIntervalVar()

ortools.constraint_solver.pywrapcp.Solver.FixedDurationIntervalVar ( self,
* args )
*Overload 1:*
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.

|

*Overload 2:*
Creates a performed interval var with a fixed duration. The duration must
be greater than 0.

|

*Overload 3:*
Creates an interval var with a fixed duration, and performed_variable.
The duration must be greater than 0.

Definition at line 1303 of file pywrapcp.py.

◆ FixedDurationStartSyncedOnEndIntervalVar()

ortools.constraint_solver.pywrapcp.Solver.FixedDurationStartSyncedOnEndIntervalVar ( self,
interval_var,
duration,
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 1352 of file pywrapcp.py.

◆ FixedDurationStartSyncedOnStartIntervalVar()

ortools.constraint_solver.pywrapcp.Solver.FixedDurationStartSyncedOnStartIntervalVar ( self,
interval_var,
duration,
offset )
Creates an interval var with a fixed duration whose start is
synchronized with the start of another interval, with a given
offset. The performed status is also in sync with the performed
status of the given interval variable.

Definition at line 1343 of file pywrapcp.py.

◆ FixedInterval()

ortools.constraint_solver.pywrapcp.Solver.FixedInterval ( self,
start,
duration,
name )
Creates a fixed and performed interval.

Definition at line 1325 of file pywrapcp.py.

◆ GuidedLocalSearch()

ortools.constraint_solver.pywrapcp.Solver.GuidedLocalSearch ( self,
maximize,
objective,
objective_function,
step,
vars,
penalty_factor )

Definition at line 2168 of file pywrapcp.py.

◆ IndexExpression()

ortools.constraint_solver.pywrapcp.Solver.IndexExpression ( self,
vars,
value )
Returns the expression expr such that vars[expr] == value.
It assumes that vars are all different.

Definition at line 765 of file pywrapcp.py.

◆ IndexOfConstraint()

ortools.constraint_solver.pywrapcp.Solver.IndexOfConstraint ( self,
vars,
index,
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 967 of file pywrapcp.py.

◆ IntConst()

ortools.constraint_solver.pywrapcp.Solver.IntConst ( self,
* args )
*Overload 1:*
IntConst will create a constant expression.

|

*Overload 2:*
IntConst will create a constant expression.

Definition at line 697 of file pywrapcp.py.

◆ IntervalRelaxedMax()

ortools.constraint_solver.pywrapcp.Solver.IntervalRelaxedMax ( self,
interval_var )
 Creates and returns an interval variable that wraps around the given one,
 relaxing the max start and end. Relaxing means making unbounded when
 optional. If the variable is non optional, this method returns
 interval_var.

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

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

Definition at line 1401 of file pywrapcp.py.

◆ IntervalRelaxedMin()

ortools.constraint_solver.pywrapcp.Solver.IntervalRelaxedMin ( self,
interval_var )
 Creates and returns an interval variable that wraps around the given one,
 relaxing the min start and end. Relaxing means making unbounded when
 optional. If the variable is non-optional, this method returns
 interval_var.

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

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

Definition at line 1379 of file pywrapcp.py.

◆ IntervalVar()

ortools.constraint_solver.pywrapcp.Solver.IntervalVar ( self,
start_min,
start_max,
duration_min,
duration_max,
end_min,
end_max,
optional,
name )
Creates an interval var by specifying the bounds on start,
duration, and end.

Definition at line 1329 of file pywrapcp.py.

◆ IntVar()

ortools.constraint_solver.pywrapcp.Solver.IntVar ( self,
* args )
*Overload 1:*
MakeIntVar will create the best range based int var for the bounds given.

|

*Overload 2:*
MakeIntVar will create a variable with the given sparse domain.

|

*Overload 3:*
MakeIntVar will create a variable with the given sparse domain.

|

*Overload 4:*
MakeIntVar will create the best range based int var for the bounds given.

|

*Overload 5:*
MakeIntVar will create a variable with the given sparse domain.

|

*Overload 6:*
MakeIntVar will create a variable with the given sparse domain.

Definition at line 653 of file pywrapcp.py.

◆ InversePermutationConstraint()

ortools.constraint_solver.pywrapcp.Solver.InversePermutationConstraint ( self,
left,
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 1165 of file pywrapcp.py.

◆ IsBetweenCt()

ortools.constraint_solver.pywrapcp.Solver.IsBetweenCt ( self,
expr,
l,
u,
b )
b == (l <= expr <= u)

Definition at line 999 of file pywrapcp.py.

◆ IsBetweenVar()

ortools.constraint_solver.pywrapcp.Solver.IsBetweenVar ( self,
v,
l,
u )

Definition at line 1003 of file pywrapcp.py.

◆ IsDifferentCstCt()

ortools.constraint_solver.pywrapcp.Solver.IsDifferentCstCt ( self,
var,
value,
boolvar )
boolvar == (var != value)

Definition at line 855 of file pywrapcp.py.

◆ IsDifferentCstVar()

ortools.constraint_solver.pywrapcp.Solver.IsDifferentCstVar ( self,
var,
value )
status var of (var != value)

Definition at line 859 of file pywrapcp.py.

◆ IsDifferentCt()

ortools.constraint_solver.pywrapcp.Solver.IsDifferentCt ( self,
v1,
v2,
b )
b == (v1 != v2)

Definition at line 867 of file pywrapcp.py.

◆ IsDifferentVar()

ortools.constraint_solver.pywrapcp.Solver.IsDifferentVar ( self,
v1,
v2 )
status var of (v1 != v2)

Definition at line 863 of file pywrapcp.py.

◆ IsEqualCstCt()

ortools.constraint_solver.pywrapcp.Solver.IsEqualCstCt ( self,
var,
value,
boolvar )
boolvar == (var == value)

Definition at line 839 of file pywrapcp.py.

◆ IsEqualCstVar()

ortools.constraint_solver.pywrapcp.Solver.IsEqualCstVar ( self,
var,
value )
status var of (var == value)

Definition at line 843 of file pywrapcp.py.

◆ IsEqualCt()

ortools.constraint_solver.pywrapcp.Solver.IsEqualCt ( self,
v1,
v2,
b )
b == (v1 == v2)

Definition at line 847 of file pywrapcp.py.

◆ IsEqualVar()

ortools.constraint_solver.pywrapcp.Solver.IsEqualVar ( self,
v1,
v2 )
status var of (v1 == v2)

Definition at line 851 of file pywrapcp.py.

◆ IsGreaterCstCt()

ortools.constraint_solver.pywrapcp.Solver.IsGreaterCstCt ( self,
v,
c,
b )
b == (v > c)

Definition at line 903 of file pywrapcp.py.

◆ IsGreaterCstVar()

ortools.constraint_solver.pywrapcp.Solver.IsGreaterCstVar ( self,
var,
value )
status var of (var > value)

Definition at line 907 of file pywrapcp.py.

◆ IsGreaterCt()

ortools.constraint_solver.pywrapcp.Solver.IsGreaterCt ( self,
left,
right,
b )
b == (left > right)

Definition at line 915 of file pywrapcp.py.

◆ IsGreaterOrEqualCstCt()

ortools.constraint_solver.pywrapcp.Solver.IsGreaterOrEqualCstCt ( self,
var,
value,
boolvar )
boolvar == (var >= value)

Definition at line 887 of file pywrapcp.py.

◆ IsGreaterOrEqualCstVar()

ortools.constraint_solver.pywrapcp.Solver.IsGreaterOrEqualCstVar ( self,
var,
value )
status var of (var >= value)

Definition at line 891 of file pywrapcp.py.

◆ IsGreaterOrEqualCt()

ortools.constraint_solver.pywrapcp.Solver.IsGreaterOrEqualCt ( self,
left,
right,
b )
b == (left >= right)

Definition at line 899 of file pywrapcp.py.

◆ IsGreaterOrEqualVar()

ortools.constraint_solver.pywrapcp.Solver.IsGreaterOrEqualVar ( self,
left,
right )
status var of (left >= right)

Definition at line 895 of file pywrapcp.py.

◆ IsGreaterVar()

ortools.constraint_solver.pywrapcp.Solver.IsGreaterVar ( self,
left,
right )
status var of (left > right)

Definition at line 911 of file pywrapcp.py.

◆ IsLessCstCt()

ortools.constraint_solver.pywrapcp.Solver.IsLessCstCt ( self,
v,
c,
b )
b == (v < c)

Definition at line 919 of file pywrapcp.py.

◆ IsLessCstVar()

ortools.constraint_solver.pywrapcp.Solver.IsLessCstVar ( self,
var,
value )
status var of (var < value)

Definition at line 923 of file pywrapcp.py.

◆ IsLessCt()

ortools.constraint_solver.pywrapcp.Solver.IsLessCt ( self,
left,
right,
b )
b == (left < right)

Definition at line 931 of file pywrapcp.py.

◆ IsLessOrEqualCstCt()

ortools.constraint_solver.pywrapcp.Solver.IsLessOrEqualCstCt ( self,
var,
value,
boolvar )
boolvar == (var <= value)

Definition at line 871 of file pywrapcp.py.

◆ IsLessOrEqualCstVar()

ortools.constraint_solver.pywrapcp.Solver.IsLessOrEqualCstVar ( self,
var,
value )
status var of (var <= value)

Definition at line 875 of file pywrapcp.py.

◆ IsLessOrEqualCt()

ortools.constraint_solver.pywrapcp.Solver.IsLessOrEqualCt ( self,
left,
right,
b )
b == (left <= right)

Definition at line 883 of file pywrapcp.py.

◆ IsLessOrEqualVar()

ortools.constraint_solver.pywrapcp.Solver.IsLessOrEqualVar ( self,
left,
right )
status var of (left <= right)

Definition at line 879 of file pywrapcp.py.

◆ IsLessVar()

ortools.constraint_solver.pywrapcp.Solver.IsLessVar ( self,
left,
right )
status var of (left < right)

Definition at line 927 of file pywrapcp.py.

◆ IsMemberCt()

ortools.constraint_solver.pywrapcp.Solver.IsMemberCt ( self,
* args )
boolvar == (expr in set)

Definition at line 1030 of file pywrapcp.py.

◆ IsMemberVar()

ortools.constraint_solver.pywrapcp.Solver.IsMemberVar ( self,
* args )

Definition at line 1034 of file pywrapcp.py.

◆ LastSolutionCollector()

ortools.constraint_solver.pywrapcp.Solver.LastSolutionCollector ( self,
* args )
*Overload 1:*
Collect the last solution of the search.

|

*Overload 2:*
Collect the last solution of the search. The variables will need to
be added later.

Definition at line 1556 of file pywrapcp.py.

◆ LexicalLess()

ortools.constraint_solver.pywrapcp.Solver.LexicalLess ( self,
left,
right )
Creates a constraint that enforces that left is lexicographically less
than right.

Definition at line 1151 of file pywrapcp.py.

◆ LexicalLessOrEqual()

ortools.constraint_solver.pywrapcp.Solver.LexicalLessOrEqual ( self,
left,
right )
Creates a constraint that enforces that left is lexicographically less
than or equal to right.

Definition at line 1158 of file pywrapcp.py.

◆ Limit()

ortools.constraint_solver.pywrapcp.Solver.Limit ( self,
* args )
*Overload 1:*
Limits the search with the 'time', 'branches', 'failures' and
'solutions' limits. 'smart_time_check' reduces the calls to the wall

|

*Overload 2:*
Creates a search limit from its protobuf description

|

*Overload 3:*
Creates a search limit that is reached when either of the underlying limit
is reached. That is, the returned limit is more stringent than both
argument limits.

Definition at line 1716 of file pywrapcp.py.

◆ LocalSearchPhase()

ortools.constraint_solver.pywrapcp.Solver.LocalSearchPhase ( self,
* args )
*Overload 1:*
Local Search decision builders factories.
Local search is used to improve a given solution. This initial solution
can be specified either by an Assignment or by a DecisionBulder, and the
corresponding variables, the initial solution being the first solution
found by the DecisionBuilder.
The LocalSearchPhaseParameters parameter holds the actual definition of
the local search phase:
- a local search operator used to explore the neighborhood of the current
  solution,
- a decision builder to instantiate unbound variables once a neighbor has
  been defined; in the case of LNS-based operators instantiates fragment
  variables; search monitors can be added to this sub-search by wrapping
  the decision builder with MakeSolveOnce.
- a search limit specifying how long local search looks for neighbors
  before accepting one; the last neighbor is always taken and in the case
  of a greedy search, this corresponds to the best local neighbor;
  first-accept (which is the default behavior) can be modeled using a
  solution found limit of 1,
- a vector of local search filters used to speed up the search by pruning
  unfeasible neighbors.
Metaheuristics can be added by defining specialized search monitors;
currently down/up-hill climbing is available through OptimizeVar, as well
as Guided Local Search, Tabu Search and Simulated Annealing.

|

*Overload 2:*
Variant with a sub_decison_builder specific to the first solution.

Definition at line 2021 of file pywrapcp.py.

◆ LocalSearchPhaseParameters()

ortools.constraint_solver.pywrapcp.Solver.LocalSearchPhaseParameters ( self,
* args )
Local Search Phase Parameters

Definition at line 2055 of file pywrapcp.py.

◆ LocalSearchProfile()

ortools.constraint_solver.pywrapcp.Solver.LocalSearchProfile ( self)
Returns local search profiling information in a human readable format.

Definition at line 2100 of file pywrapcp.py.

◆ LubyRestart()

ortools.constraint_solver.pywrapcp.Solver.LubyRestart ( self,
scale_factor )
This search monitor will restart the search periodically.
At the iteration n, it will restart after scale_factor * Luby(n) failures
where Luby is the Luby Strategy (i.e. 1 1 2 1 1 2 4 1 1 2 1 1 2 4 8...).

Definition at line 1676 of file pywrapcp.py.

◆ Max()

ortools.constraint_solver.pywrapcp.Solver.Max ( self,
* args )
*Overload 1:*
std::max(vars)

|

*Overload 2:*
std::max(left, right)

|

*Overload 3:*
std::max(expr, value)

|

*Overload 4:*
std::max(expr, value)

Definition at line 794 of file pywrapcp.py.

◆ MaxEquality()

ortools.constraint_solver.pywrapcp.Solver.MaxEquality ( self,
vars,
max_var )

Definition at line 957 of file pywrapcp.py.

◆ Maximize()

ortools.constraint_solver.pywrapcp.Solver.Maximize ( self,
v,
step )
Creates a maximization objective.

Definition at line 1605 of file pywrapcp.py.

◆ MemberCt()

ortools.constraint_solver.pywrapcp.Solver.MemberCt ( self,
* args )
expr in set. Propagation is lazy, i.e. this constraint does not
creates holes in the domain of the variable.

Definition at line 1006 of file pywrapcp.py.

◆ MemoryUsage()

ortools.constraint_solver.pywrapcp.Solver.MemoryUsage ( )
static
Current memory usage in bytes

Definition at line 615 of file pywrapcp.py.

◆ Min()

ortools.constraint_solver.pywrapcp.Solver.Min ( self,
* args )
*Overload 1:*
std::min(vars)

|

*Overload 2:*
std::min (left, right)

|

*Overload 3:*
std::min(expr, value)

|

*Overload 4:*
std::min(expr, value)

Definition at line 772 of file pywrapcp.py.

◆ MinEquality()

ortools.constraint_solver.pywrapcp.Solver.MinEquality ( self,
vars,
min_var )

Definition at line 954 of file pywrapcp.py.

◆ Minimize()

ortools.constraint_solver.pywrapcp.Solver.Minimize ( self,
v,
step )
Creates a minimization objective.

Definition at line 1601 of file pywrapcp.py.

◆ MirrorInterval()

ortools.constraint_solver.pywrapcp.Solver.MirrorInterval ( self,
interval_var )
Creates an interval var that is the mirror image of the given one, that
is, the interval var obtained by reversing the axis.

Definition at line 1336 of file pywrapcp.py.

◆ MonotonicElement()

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

Definition at line 725 of file pywrapcp.py.

◆ MoveTowardTargetOperator()

ortools.constraint_solver.pywrapcp.Solver.MoveTowardTargetOperator ( self,
* args )
*Overload 1:*
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.

|

*Overload 2:*
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 1941 of file pywrapcp.py.

◆ NeighborhoodLimit()

ortools.constraint_solver.pywrapcp.Solver.NeighborhoodLimit ( self,
op,
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 2011 of file pywrapcp.py.

◆ NestedOptimize()

ortools.constraint_solver.pywrapcp.Solver.NestedOptimize ( self,
* args )
NestedOptimize will collapse a search tree described by a
decision builder 'db' and a set of monitors and wrap it into a
single point. If there are no solutions to this nested tree, then
NestedOptimize will fail. If there are solutions, it will find
the best as described by the mandatory objective in the solution
as well as the optimization direction, instantiate all variables
to this solution, and return nullptr.

Definition at line 1899 of file pywrapcp.py.

◆ NewSearch()

ortools.constraint_solver.pywrapcp.Solver.NewSearch ( self,
* args )
 Decomposed search.
 The code for a top level search should look like
 solver->NewSearch(db);
 while (solver->NextSolution()) {
.. use the current solution
 }
 solver()->EndSearch();

Definition at line 564 of file pywrapcp.py.

◆ NextSolution()

ortools.constraint_solver.pywrapcp.Solver.NextSolution ( self)

Definition at line 576 of file pywrapcp.py.

◆ NonOverlappingBoxesConstraint()

ortools.constraint_solver.pywrapcp.Solver.NonOverlappingBoxesConstraint ( self,
* args )
This constraint states that all the boxes must not overlap.
The coordinates of box i are:
  (x_vars[i], y_vars[i]),
  (x_vars[i], y_vars[i] + y_size[i]),
  (x_vars[i] + x_size[i], y_vars[i]),
  (x_vars[i] + x_size[i], y_vars[i] + y_size[i]).
The sizes must be non-negative. Boxes with a zero dimension can be
pushed like any box.

Definition at line 1280 of file pywrapcp.py.

◆ NotMemberCt()

ortools.constraint_solver.pywrapcp.Solver.NotMemberCt ( self,
* args )
*Overload 1:*
expr not in set.

|

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

|

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

Definition at line 1013 of file pywrapcp.py.

◆ NullIntersect()

ortools.constraint_solver.pywrapcp.Solver.NullIntersect ( self,
first_vars,
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 1174 of file pywrapcp.py.

◆ NullIntersectExcept()

ortools.constraint_solver.pywrapcp.Solver.NullIntersectExcept ( self,
first_vars,
second_vars,
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 1183 of file pywrapcp.py.

◆ Operator()

ortools.constraint_solver.pywrapcp.Solver.Operator ( self,
* args )
Local Search Operators.

Definition at line 1925 of file pywrapcp.py.

◆ Optimize()

ortools.constraint_solver.pywrapcp.Solver.Optimize ( self,
maximize,
v,
step )
Creates a objective with a given sense (true = maximization).

Definition at line 1609 of file pywrapcp.py.

◆ Pack()

ortools.constraint_solver.pywrapcp.Solver.Pack ( self,
vars,
number_of_bins )
This constraint packs all variables onto 'number_of_bins'
variables.  For any given variable, a value of 'number_of_bins'
indicates that the variable is not assigned to any bin.
Dimensions, i.e., cumulative constraints on this packing, can be
added directly from the pack class.

Definition at line 1293 of file pywrapcp.py.

◆ Parameters()

ortools.constraint_solver.pywrapcp.Solver.Parameters ( self)
Stored Parameters.

Definition at line 470 of file pywrapcp.py.

◆ PathCumul()

ortools.constraint_solver.pywrapcp.Solver.PathCumul ( self,
* args )
*Overload 1:*
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.

|

*Overload 2:*
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.

|

*Overload 3:*
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 1211 of file pywrapcp.py.

◆ Phase()

ortools.constraint_solver.pywrapcp.Solver.Phase ( self,
* args )
*Overload 1:*
Phases on IntVar arrays.
for all other functions that have several homonyms in this .h).

|

*Overload 2:*
Scheduling phases.

Definition at line 1869 of file pywrapcp.py.

◆ PrintModelVisitor()

ortools.constraint_solver.pywrapcp.Solver.PrintModelVisitor ( self)
Prints the model.

Definition at line 1793 of file pywrapcp.py.

◆ Rand32()

ortools.constraint_solver.pywrapcp.Solver.Rand32 ( self,
size )
Returns a random value between 0 and 'size' - 1;

Definition at line 2092 of file pywrapcp.py.

◆ Rand64()

ortools.constraint_solver.pywrapcp.Solver.Rand64 ( self,
size )
Returns a random value between 0 and 'size' - 1;

Definition at line 2088 of file pywrapcp.py.

◆ RandomConcatenateOperators()

ortools.constraint_solver.pywrapcp.Solver.RandomConcatenateOperators ( self,
* args )
*Overload 1:*
Randomized version of local search concatenator; calls a random operator
at each call to MakeNextNeighbor().

|

*Overload 2:*
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 1996 of file pywrapcp.py.

◆ RandomLnsOperator()

ortools.constraint_solver.pywrapcp.Solver.RandomLnsOperator ( self,
* args )
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 1929 of file pywrapcp.py.

◆ RankFirstInterval()

ortools.constraint_solver.pywrapcp.Solver.RankFirstInterval ( self,
sequence,
index )
Returns a decision that tries to rank first the ith interval var
in the sequence variable.

Definition at line 1855 of file pywrapcp.py.

◆ RankLastInterval()

ortools.constraint_solver.pywrapcp.Solver.RankLastInterval ( self,
sequence,
index )
Returns a decision that tries to rank last the ith interval var
in the sequence variable.

Definition at line 1862 of file pywrapcp.py.

◆ ReSeed()

ortools.constraint_solver.pywrapcp.Solver.ReSeed ( self,
seed )
Reseed the solver random generator.

Definition at line 2096 of file pywrapcp.py.

◆ RestartCurrentSearch()

ortools.constraint_solver.pywrapcp.Solver.RestartCurrentSearch ( self)

Definition at line 2119 of file pywrapcp.py.

◆ RestartSearch()

ortools.constraint_solver.pywrapcp.Solver.RestartSearch ( self)

Definition at line 579 of file pywrapcp.py.

◆ RestoreAssignment()

ortools.constraint_solver.pywrapcp.Solver.RestoreAssignment ( self,
assignment )
Returns a DecisionBuilder which restores an Assignment
(calls void Assignment::Restore())

Definition at line 1911 of file pywrapcp.py.

◆ ScalProd()

ortools.constraint_solver.pywrapcp.Solver.ScalProd ( self,
* args )
*Overload 1:*
scalar product

|

*Overload 2:*
scalar product

Definition at line 713 of file pywrapcp.py.

◆ ScalProdEquality()

ortools.constraint_solver.pywrapcp.Solver.ScalProdEquality ( self,
* args )

Definition at line 945 of file pywrapcp.py.

◆ ScalProdGreaterOrEqual()

ortools.constraint_solver.pywrapcp.Solver.ScalProdGreaterOrEqual ( self,
* args )

Definition at line 948 of file pywrapcp.py.

◆ ScalProdLessOrEqual()

ortools.constraint_solver.pywrapcp.Solver.ScalProdLessOrEqual ( self,
* args )

Definition at line 951 of file pywrapcp.py.

◆ ScheduleOrExpedite()

ortools.constraint_solver.pywrapcp.Solver.ScheduleOrExpedite ( self,
var,
est,
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 1845 of file pywrapcp.py.

◆ ScheduleOrPostpone()

ortools.constraint_solver.pywrapcp.Solver.ScheduleOrPostpone ( self,
var,
est,
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 1835 of file pywrapcp.py.

◆ SearchDepth()

ortools.constraint_solver.pywrapcp.Solver.SearchDepth ( self)
Gets the search depth of the current active search. Returns -1 if
there is no active search opened.

Definition at line 2067 of file pywrapcp.py.

◆ SearchLeftDepth()

ortools.constraint_solver.pywrapcp.Solver.SearchLeftDepth ( self)
Gets the search left depth of the current active search. Returns -1 if
there is no active search opened.

Definition at line 2074 of file pywrapcp.py.

◆ SearchLog()

ortools.constraint_solver.pywrapcp.Solver.SearchLog ( self,
* args )
*Overload 1:*
 The SearchMonitors below will display a periodic search log
 on LOG(INFO) every branch_period branches explored.

|

*Overload 2:*
 At each solution, this monitor also display the var value.

|

*Overload 3:*
 At each solution, this monitor will also display result of
``display_callback``.

|

*Overload 4:*
 At each solution, this monitor will display the 'var' value and the
 result of ``display_callback``.

|

*Overload 5:*
 At each solution, this monitor will display the 'vars' values and the
 result of ``display_callback``.

|

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

|

*Overload 7:*
 Creates a search monitor that will also print the result of the
 display callback.

Definition at line 1743 of file pywrapcp.py.

◆ SearchLogWithCallback()

ortools.constraint_solver.pywrapcp.Solver.SearchLogWithCallback ( self,
period,
callback )

Definition at line 2141 of file pywrapcp.py.

◆ SearchTrace()

ortools.constraint_solver.pywrapcp.Solver.SearchTrace ( self,
prefix )
Creates a search monitor that will trace precisely the behavior of the
search. Use this only for low level debugging.

Definition at line 1786 of file pywrapcp.py.

◆ SemiContinuousExpr()

ortools.constraint_solver.pywrapcp.Solver.SemiContinuousExpr ( self,
expr,
fixed_charge,
step )
Semi continuous Expression (x <= 0 -> f(x) = 0; x > 0 -> f(x) = ax + b)
a >= 0 and b >= 0

Definition at line 820 of file pywrapcp.py.

◆ ShouldFail()

ortools.constraint_solver.pywrapcp.Solver.ShouldFail ( self)
These methods are only useful for the SWIG wrappers, which need a way
to externally cause the Solver to fail.

Definition at line 2122 of file pywrapcp.py.

◆ SimulatedAnnealing()

ortools.constraint_solver.pywrapcp.Solver.SimulatedAnnealing ( self,
maximize,
v,
step,
initial_temperature )
Creates a Simulated Annealing monitor.

Definition at line 1672 of file pywrapcp.py.

◆ Solutions()

ortools.constraint_solver.pywrapcp.Solver.Solutions ( self)
The number of solutions found since the start of the search.

Definition at line 630 of file pywrapcp.py.

◆ SolutionsLimit()

ortools.constraint_solver.pywrapcp.Solver.SolutionsLimit ( self,
solutions )
Creates a search limit that constrains the number of solutions found
during the search.

Definition at line 1709 of file pywrapcp.py.

◆ Solve()

ortools.constraint_solver.pywrapcp.Solver.Solve ( self,
* args )
 Solves the problem using the given DecisionBuilder and returns true if a
 solution was found and accepted.

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

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

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

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

Use a search monitor that can process such a leaf. See, in particular,
     the SolutionCollector class.
Do not use Solve. Instead, use the more fine-grained approach using
     methods NewSearch(...), NextSolution(), and EndSearch().

 :type db: :py:class:`DecisionBuilder`
 :param db: The decision builder that will generate the search tree.
 :type monitors: std::vector< operations_research::SearchMonitor * >
 :param 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 517 of file pywrapcp.py.

◆ SolveAndCommit()

ortools.constraint_solver.pywrapcp.Solver.SolveAndCommit ( self,
* args )
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 585 of file pywrapcp.py.

◆ SolveDepth()

ortools.constraint_solver.pywrapcp.Solver.SolveDepth ( self)
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 2081 of file pywrapcp.py.

◆ SolveOnce()

ortools.constraint_solver.pywrapcp.Solver.SolveOnce ( self,
db,
monitors )

Definition at line 1896 of file pywrapcp.py.

◆ SortingConstraint()

ortools.constraint_solver.pywrapcp.Solver.SortingConstraint ( self,
vars,
sorted )
Creates a constraint binding the arrays of variables "vars" and
"sorted_vars": sorted_vars[0] must be equal to the minimum of all
variables in vars, and so on: the value of sorted_vars[i] must be
equal to the i-th value of variables invars.

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

Behind the scenes, this constraint maintains that:
  - sorted is always increasing.
  - whatever the values of vars, there exists a permutation that
    injects its values into the sorted variables.

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

Definition at line 1131 of file pywrapcp.py.

◆ SplitVariableDomain()

ortools.constraint_solver.pywrapcp.Solver.SplitVariableDomain ( self,
var,
val,
start_with_lower_half )

Definition at line 1811 of file pywrapcp.py.

◆ Stamp()

ortools.constraint_solver.pywrapcp.Solver.Stamp ( self)
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 642 of file pywrapcp.py.

◆ StatisticsModelVisitor()

ortools.constraint_solver.pywrapcp.Solver.StatisticsModelVisitor ( self)
Displays some nice statistics on the model.

Definition at line 1797 of file pywrapcp.py.

◆ StoreAssignment()

ortools.constraint_solver.pywrapcp.Solver.StoreAssignment ( self,
assignment )
Returns a DecisionBuilder which stores an Assignment
(calls void Assignment::Store())

Definition at line 1918 of file pywrapcp.py.

◆ SubCircuit()

ortools.constraint_solver.pywrapcp.Solver.SubCircuit ( self,
nexts )
Force the "nexts" variable to create a complete Hamiltonian path
for those that do not loop upon themselves.

Definition at line 1197 of file pywrapcp.py.

◆ Sum()

ortools.constraint_solver.pywrapcp.Solver.Sum ( self,
vars )
sum of all vars.

Definition at line 709 of file pywrapcp.py.

◆ SumEquality()

ortools.constraint_solver.pywrapcp.Solver.SumEquality ( self,
* args )

Definition at line 942 of file pywrapcp.py.

◆ SumGreaterOrEqual()

ortools.constraint_solver.pywrapcp.Solver.SumGreaterOrEqual ( self,
vars,
cst )

Definition at line 939 of file pywrapcp.py.

◆ SumLessOrEqual()

ortools.constraint_solver.pywrapcp.Solver.SumLessOrEqual ( self,
vars,
cst )
Variation on arrays.

Definition at line 935 of file pywrapcp.py.

◆ SumObjectiveFilter()

ortools.constraint_solver.pywrapcp.Solver.SumObjectiveFilter ( self,
vars,
values,
filter_enum )

Definition at line 2171 of file pywrapcp.py.

◆ TabuSearch()

ortools.constraint_solver.pywrapcp.Solver.TabuSearch ( self,
maximize,
objective,
step,
vars,
keep_tenure,
forbid_tenure,
tabu_factor )
MetaHeuristics which try to get the search out of local optima.
Creates a Tabu Search monitor.
In the context of local search the behavior is similar to MakeOptimize(),
creating an objective in a given sense. The behavior differs once a local
optimum is reached: thereafter solutions which degrade the value of the
objective are allowed if they are not "tabu". A solution is "tabu" if it
doesn't respect the following rules:
- improving the best solution found so far
- variables in the "keep" list must keep their value, variables in the
"forbid" list must not take the value they have in the list.
Variables with new values enter the tabu lists after each new solution
found and leave the lists after a given number of iterations (called
tenure). Only the variables passed to the method can enter the lists.
The tabu criterion is softened by the tabu factor which gives the number
of "tabu" violations which is tolerated; a factor of 1 means no violations
allowed; a factor of 0 means all violations are allowed.

Definition at line 1651 of file pywrapcp.py.

◆ TemporalDisjunction()

ortools.constraint_solver.pywrapcp.Solver.TemporalDisjunction ( self,
* args )
*Overload 1:*
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).

|

*Overload 2:*
This constraint implements a temporal disjunction between two
interval vars.

Definition at line 1423 of file pywrapcp.py.

◆ TimeLimit()

ortools.constraint_solver.pywrapcp.Solver.TimeLimit ( self,
* args )
Creates a search limit that constrains the running time.

Definition at line 1691 of file pywrapcp.py.

◆ TopProgressPercent()

ortools.constraint_solver.pywrapcp.Solver.TopProgressPercent ( self)
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 2059 of file pywrapcp.py.

◆ TransitionConstraint()

ortools.constraint_solver.pywrapcp.Solver.TransitionConstraint ( self,
* args )
*Overload 1:*
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.

|

*Overload 2:*
This constraint create a finite automaton that will check the
sequence of variables vars. It uses a transition table called
'transition_table'. Each transition is a triple
   (current_state, variable_value, new_state).
The initial state is given, and the set of accepted states is decribed
by 'final_states'. These states are hidden inside the constraint.
Only the transitions (i.e. the variables) are visible.

Definition at line 1256 of file pywrapcp.py.

◆ TreeNoCycle()

ortools.constraint_solver.pywrapcp.Solver.TreeNoCycle ( self,
nexts,
active,
callback = 0 )

Definition at line 2138 of file pywrapcp.py.

◆ TrueConstraint()

ortools.constraint_solver.pywrapcp.Solver.TrueConstraint ( self)
This constraint always succeeds.

Definition at line 831 of file pywrapcp.py.

◆ Try()

ortools.constraint_solver.pywrapcp.Solver.Try ( self,
dbs )

Definition at line 1829 of file pywrapcp.py.

◆ VarEvalValEvalPhase()

ortools.constraint_solver.pywrapcp.Solver.VarEvalValEvalPhase ( self,
vars,
var_eval,
val_eval )

Definition at line 2153 of file pywrapcp.py.

◆ VarEvalValEvalTieBreakPhase()

ortools.constraint_solver.pywrapcp.Solver.VarEvalValEvalTieBreakPhase ( self,
vars,
var_eval,
val_eval,
tie_breaker )

Definition at line 2159 of file pywrapcp.py.

◆ VarEvalValStrPhase()

ortools.constraint_solver.pywrapcp.Solver.VarEvalValStrPhase ( self,
vars,
var_evaluator,
val_str )

Definition at line 2147 of file pywrapcp.py.

◆ VariableGreaterOrEqualValue()

ortools.constraint_solver.pywrapcp.Solver.VariableGreaterOrEqualValue ( self,
var,
value )

Definition at line 1808 of file pywrapcp.py.

◆ VariableLessOrEqualValue()

ortools.constraint_solver.pywrapcp.Solver.VariableLessOrEqualValue ( self,
var,
value )

Definition at line 1805 of file pywrapcp.py.

◆ VarStrValEvalPhase()

ortools.constraint_solver.pywrapcp.Solver.VarStrValEvalPhase ( self,
vars,
var_str,
val_eval )

Definition at line 2150 of file pywrapcp.py.

◆ VarStrValEvalTieBreakPhase()

ortools.constraint_solver.pywrapcp.Solver.VarStrValEvalTieBreakPhase ( self,
vars,
var_str,
val_eval,
tie_breaker )

Definition at line 2156 of file pywrapcp.py.

◆ WallTime()

ortools.constraint_solver.pywrapcp.Solver.WallTime ( self)
Deprecated: Use Now() instead.
Time elapsed, in ms since the creation of the solver.

Definition at line 619 of file pywrapcp.py.

◆ WeightedMaximize()

ortools.constraint_solver.pywrapcp.Solver.WeightedMaximize ( self,
* args )
*Overload 1:*
Creates a maximization weigthed objective.

|

*Overload 2:*
Creates a maximization weigthed objective.

Definition at line 1627 of file pywrapcp.py.

◆ WeightedMinimize()

ortools.constraint_solver.pywrapcp.Solver.WeightedMinimize ( self,
* args )
*Overload 1:*
Creates a minimization weighted objective. The actual objective is
scalar_prod(sub_objectives, weights).

|

*Overload 2:*
Creates a minimization weighted objective. The actual objective is
scalar_prod(sub_objectives, weights).

Definition at line 1613 of file pywrapcp.py.

◆ WeightedOptimize()

ortools.constraint_solver.pywrapcp.Solver.WeightedOptimize ( self,
* args )
*Overload 1:*
Creates a weighted objective with a given sense (true = maximization).

|

*Overload 2:*
Creates a weighted objective with a given sense (true = maximization).

Definition at line 1639 of file pywrapcp.py.

Member Data Documentation

◆ ASSIGN_CENTER_VALUE

ortools.constraint_solver.pywrapcp.Solver.ASSIGN_CENTER_VALUE = _pywrapcp.Solver_ASSIGN_CENTER_VALUE
static

Definition at line 233 of file pywrapcp.py.

◆ ASSIGN_MAX_VALUE

ortools.constraint_solver.pywrapcp.Solver.ASSIGN_MAX_VALUE = _pywrapcp.Solver_ASSIGN_MAX_VALUE
static

Definition at line 229 of file pywrapcp.py.

◆ ASSIGN_MIN_VALUE

ortools.constraint_solver.pywrapcp.Solver.ASSIGN_MIN_VALUE = _pywrapcp.Solver_ASSIGN_MIN_VALUE
static

Definition at line 227 of file pywrapcp.py.

◆ ASSIGN_RANDOM_VALUE

ortools.constraint_solver.pywrapcp.Solver.ASSIGN_RANDOM_VALUE = _pywrapcp.Solver_ASSIGN_RANDOM_VALUE
static

Definition at line 231 of file pywrapcp.py.

◆ CHOOSE_FIRST_UNBOUND

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_FIRST_UNBOUND = _pywrapcp.Solver_CHOOSE_FIRST_UNBOUND
static

Definition at line 143 of file pywrapcp.py.

◆ CHOOSE_HIGHEST_MAX

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_HIGHEST_MAX = _pywrapcp.Solver_CHOOSE_HIGHEST_MAX
static

Definition at line 194 of file pywrapcp.py.

◆ CHOOSE_LOWEST_MIN

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_LOWEST_MIN = _pywrapcp.Solver_CHOOSE_LOWEST_MIN
static

Definition at line 187 of file pywrapcp.py.

◆ CHOOSE_MAX_REGRET_ON_MIN

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_MAX_REGRET_ON_MIN = _pywrapcp.Solver_CHOOSE_MAX_REGRET_ON_MIN
static

Definition at line 213 of file pywrapcp.py.

◆ CHOOSE_MAX_SIZE

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_MAX_SIZE = _pywrapcp.Solver_CHOOSE_MAX_SIZE
static

Definition at line 207 of file pywrapcp.py.

◆ CHOOSE_MIN_SIZE

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_MIN_SIZE = _pywrapcp.Solver_CHOOSE_MIN_SIZE
static

Definition at line 201 of file pywrapcp.py.

◆ CHOOSE_MIN_SIZE_HIGHEST_MAX

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_MIN_SIZE_HIGHEST_MAX = _pywrapcp.Solver_CHOOSE_MIN_SIZE_HIGHEST_MAX
static

Definition at line 178 of file pywrapcp.py.

◆ CHOOSE_MIN_SIZE_HIGHEST_MIN

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_MIN_SIZE_HIGHEST_MIN = _pywrapcp.Solver_CHOOSE_MIN_SIZE_HIGHEST_MIN
static

Definition at line 160 of file pywrapcp.py.

◆ CHOOSE_MIN_SIZE_LOWEST_MAX

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_MIN_SIZE_LOWEST_MAX = _pywrapcp.Solver_CHOOSE_MIN_SIZE_LOWEST_MAX
static

Definition at line 169 of file pywrapcp.py.

◆ CHOOSE_MIN_SIZE_LOWEST_MIN

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_MIN_SIZE_LOWEST_MIN = _pywrapcp.Solver_CHOOSE_MIN_SIZE_LOWEST_MIN
static

Definition at line 151 of file pywrapcp.py.

◆ CHOOSE_MIN_SLACK_RANK_FORWARD

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_MIN_SLACK_RANK_FORWARD = _pywrapcp.Solver_CHOOSE_MIN_SLACK_RANK_FORWARD
static

Definition at line 251 of file pywrapcp.py.

◆ CHOOSE_PATH

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_PATH = _pywrapcp.Solver_CHOOSE_PATH
static

Definition at line 218 of file pywrapcp.py.

◆ CHOOSE_RANDOM

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_RANDOM = _pywrapcp.Solver_CHOOSE_RANDOM
static

Definition at line 149 of file pywrapcp.py.

◆ CHOOSE_RANDOM_RANK_FORWARD

ortools.constraint_solver.pywrapcp.Solver.CHOOSE_RANDOM_RANK_FORWARD = _pywrapcp.Solver_CHOOSE_RANDOM_RANK_FORWARD
static

Definition at line 252 of file pywrapcp.py.

◆ CROSS

ortools.constraint_solver.pywrapcp.Solver.CROSS = _pywrapcp.Solver_CROSS
static

Definition at line 316 of file pywrapcp.py.

◆ DECREMENT

ortools.constraint_solver.pywrapcp.Solver.DECREMENT = _pywrapcp.Solver_DECREMENT
static

Definition at line 425 of file pywrapcp.py.

◆ DELAYED_PRIORITY

ortools.constraint_solver.pywrapcp.Solver.DELAYED_PRIORITY = _pywrapcp.Solver_DELAYED_PRIORITY
static

Definition at line 450 of file pywrapcp.py.

◆ EQ

ortools.constraint_solver.pywrapcp.Solver.EQ = _pywrapcp.Solver_EQ
static

Definition at line 445 of file pywrapcp.py.

◆ EXCHANGE

ortools.constraint_solver.pywrapcp.Solver.EXCHANGE = _pywrapcp.Solver_EXCHANGE
static

Definition at line 303 of file pywrapcp.py.

◆ EXTENDEDSWAPACTIVE

ortools.constraint_solver.pywrapcp.Solver.EXTENDEDSWAPACTIVE = _pywrapcp.Solver_EXTENDEDSWAPACTIVE
static

Definition at line 377 of file pywrapcp.py.

◆ FULLPATHLNS

ortools.constraint_solver.pywrapcp.Solver.FULLPATHLNS = _pywrapcp.Solver_FULLPATHLNS
static

Definition at line 403 of file pywrapcp.py.

◆ GE

ortools.constraint_solver.pywrapcp.Solver.GE = _pywrapcp.Solver_GE
static

Definition at line 441 of file pywrapcp.py.

◆ INCREMENT

ortools.constraint_solver.pywrapcp.Solver.INCREMENT = _pywrapcp.Solver_INCREMENT
static

Definition at line 414 of file pywrapcp.py.

◆ INT_VALUE_DEFAULT

ortools.constraint_solver.pywrapcp.Solver.INT_VALUE_DEFAULT = _pywrapcp.Solver_INT_VALUE_DEFAULT
static

Definition at line 223 of file pywrapcp.py.

◆ INT_VALUE_SIMPLE

ortools.constraint_solver.pywrapcp.Solver.INT_VALUE_SIMPLE = _pywrapcp.Solver_INT_VALUE_SIMPLE
static

Definition at line 225 of file pywrapcp.py.

◆ INT_VAR_DEFAULT

ortools.constraint_solver.pywrapcp.Solver.INT_VAR_DEFAULT = _pywrapcp.Solver_INT_VAR_DEFAULT
static

Definition at line 139 of file pywrapcp.py.

◆ INT_VAR_SIMPLE

ortools.constraint_solver.pywrapcp.Solver.INT_VAR_SIMPLE = _pywrapcp.Solver_INT_VAR_SIMPLE
static

Definition at line 141 of file pywrapcp.py.

◆ INTERVAL_DEFAULT

ortools.constraint_solver.pywrapcp.Solver.INTERVAL_DEFAULT = _pywrapcp.Solver_INTERVAL_DEFAULT
static

Definition at line 253 of file pywrapcp.py.

◆ INTERVAL_SET_TIMES_BACKWARD

ortools.constraint_solver.pywrapcp.Solver.INTERVAL_SET_TIMES_BACKWARD = _pywrapcp.Solver_INTERVAL_SET_TIMES_BACKWARD
static

Definition at line 262 of file pywrapcp.py.

◆ INTERVAL_SET_TIMES_FORWARD

ortools.constraint_solver.pywrapcp.Solver.INTERVAL_SET_TIMES_FORWARD = _pywrapcp.Solver_INTERVAL_SET_TIMES_FORWARD
static

Definition at line 257 of file pywrapcp.py.

◆ INTERVAL_SIMPLE

ortools.constraint_solver.pywrapcp.Solver.INTERVAL_SIMPLE = _pywrapcp.Solver_INTERVAL_SIMPLE
static

Definition at line 255 of file pywrapcp.py.

◆ LE

ortools.constraint_solver.pywrapcp.Solver.LE = _pywrapcp.Solver_LE
static

Definition at line 443 of file pywrapcp.py.

◆ MAKEACTIVE

ortools.constraint_solver.pywrapcp.Solver.MAKEACTIVE = _pywrapcp.Solver_MAKEACTIVE
static

Definition at line 331 of file pywrapcp.py.

◆ MAKECHAININACTIVE

ortools.constraint_solver.pywrapcp.Solver.MAKECHAININACTIVE = _pywrapcp.Solver_MAKECHAININACTIVE
static

Definition at line 354 of file pywrapcp.py.

◆ MAKEINACTIVE

ortools.constraint_solver.pywrapcp.Solver.MAKEINACTIVE = _pywrapcp.Solver_MAKEINACTIVE
static

Definition at line 343 of file pywrapcp.py.

◆ NORMAL_PRIORITY

ortools.constraint_solver.pywrapcp.Solver.NORMAL_PRIORITY = _pywrapcp.Solver_NORMAL_PRIORITY
static

Definition at line 457 of file pywrapcp.py.

◆ OROPT

ortools.constraint_solver.pywrapcp.Solver.OROPT = _pywrapcp.Solver_OROPT
static

Definition at line 282 of file pywrapcp.py.

◆ PATHLNS

ortools.constraint_solver.pywrapcp.Solver.PATHLNS = _pywrapcp.Solver_PATHLNS
static

Definition at line 393 of file pywrapcp.py.

◆ RELOCATE

ortools.constraint_solver.pywrapcp.Solver.RELOCATE = _pywrapcp.Solver_RELOCATE
static

Definition at line 301 of file pywrapcp.py.

◆ SEQUENCE_DEFAULT

ortools.constraint_solver.pywrapcp.Solver.SEQUENCE_DEFAULT = _pywrapcp.Solver_SEQUENCE_DEFAULT
static

Definition at line 249 of file pywrapcp.py.

◆ SEQUENCE_SIMPLE

ortools.constraint_solver.pywrapcp.Solver.SEQUENCE_SIMPLE = _pywrapcp.Solver_SEQUENCE_SIMPLE
static

Definition at line 250 of file pywrapcp.py.

◆ SIMPLELNS

ortools.constraint_solver.pywrapcp.Solver.SIMPLELNS = _pywrapcp.Solver_SIMPLELNS
static

Definition at line 431 of file pywrapcp.py.

◆ SPLIT_LOWER_HALF

ortools.constraint_solver.pywrapcp.Solver.SPLIT_LOWER_HALF = _pywrapcp.Solver_SPLIT_LOWER_HALF
static

Definition at line 239 of file pywrapcp.py.

◆ SPLIT_UPPER_HALF

ortools.constraint_solver.pywrapcp.Solver.SPLIT_UPPER_HALF = _pywrapcp.Solver_SPLIT_UPPER_HALF
static

Definition at line 244 of file pywrapcp.py.

◆ SWAPACTIVE

ortools.constraint_solver.pywrapcp.Solver.SWAPACTIVE = _pywrapcp.Solver_SWAPACTIVE
static

Definition at line 366 of file pywrapcp.py.

◆ TWOOPT

ortools.constraint_solver.pywrapcp.Solver.TWOOPT = _pywrapcp.Solver_TWOOPT
static

Definition at line 267 of file pywrapcp.py.

◆ UNACTIVELNS

ortools.constraint_solver.pywrapcp.Solver.UNACTIVELNS = _pywrapcp.Solver_UNACTIVELNS
static

Definition at line 408 of file pywrapcp.py.

◆ VAR_PRIORITY

ortools.constraint_solver.pywrapcp.Solver.VAR_PRIORITY = _pywrapcp.Solver_VAR_PRIORITY
static

Definition at line 455 of file pywrapcp.py.

Property Documentation

◆ thisown

ortools.constraint_solver.pywrapcp.Solver.thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
static

Definition at line 137 of file pywrapcp.py.


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