Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
Classes | |
class | _NotBooleanVariable |
class | _ProductCst |
class | _Sum |
class | _SumArray |
class | _WeightedSum |
class | BoundedLinearExpression |
class | Constraint |
class | CpModel |
class | CpSolver |
class | CpSolverSolutionCallback |
class | IntervalVar |
class | IntVar |
class | LinearExpr |
class | ObjectiveSolutionPrinter |
class | VarArrayAndObjectiveSolutionPrinter |
class | VarArraySolutionPrinter |
Functions | |
str | display_bounds (Sequence[int] bounds) |
str | short_name (cp_model_pb2.CpModelProto model, int i) |
str | short_expr_name (cp_model_pb2.CpModelProto model, cp_model_pb2.LinearExpressionProto e) |
bool | object_is_a_true_literal (LiteralT literal) |
bool | object_is_a_false_literal (LiteralT literal) |
Union[Iterable[LiteralT], LiteralT] | expand_generator_or_tuple (Union[Tuple[LiteralT,...], Iterable[LiteralT]] args) |
Union[Iterable[LinearExprT], LinearExprT] | expand_generator_or_tuple (Union[Tuple[LinearExprT,...], Iterable[LinearExprT]] args) |
expand_generator_or_tuple (args) | |
int | evaluate_linear_expr (LinearExprT expression, cp_model_pb2.CpSolverResponse solution) |
bool | evaluate_boolean_expression (LiteralT literal, cp_model_pb2.CpSolverResponse solution) |
pd.Index | _get_index (_IndexOrSeries obj) |
pd.Series | _attribute_series (*, Callable[[IntVar], IntegralT] func, _IndexOrSeries values) |
pd.Series | _convert_to_integral_series_and_validate_index (Union[IntegralT, pd.Series] value_or_series, pd.Index index) |
pd.Series | _convert_to_linear_expr_series_and_validate_index (Union[LinearExprT, pd.Series] value_or_series, pd.Index index) |
pd.Series | _convert_to_literal_series_and_validate_index (Union[LiteralT, pd.Series] value_or_series, pd.Index index) |
Variables | |
Domain = sorted_interval_list.Domain | |
INT_MIN = -(2**63) | |
int | INT_MAX = 2**63 - 1 |
INT32_MIN = -(2**31) | |
int | INT32_MAX = 2**31 - 1 |
UNKNOWN = cp_model_pb2.UNKNOWN | |
MODEL_INVALID = cp_model_pb2.MODEL_INVALID | |
FEASIBLE = cp_model_pb2.FEASIBLE | |
INFEASIBLE = cp_model_pb2.INFEASIBLE | |
OPTIMAL = cp_model_pb2.OPTIMAL | |
CHOOSE_FIRST = cp_model_pb2.DecisionStrategyProto.CHOOSE_FIRST | |
CHOOSE_LOWEST_MIN = cp_model_pb2.DecisionStrategyProto.CHOOSE_LOWEST_MIN | |
CHOOSE_HIGHEST_MAX = cp_model_pb2.DecisionStrategyProto.CHOOSE_HIGHEST_MAX | |
CHOOSE_MIN_DOMAIN_SIZE = cp_model_pb2.DecisionStrategyProto.CHOOSE_MIN_DOMAIN_SIZE | |
CHOOSE_MAX_DOMAIN_SIZE = cp_model_pb2.DecisionStrategyProto.CHOOSE_MAX_DOMAIN_SIZE | |
SELECT_MIN_VALUE = cp_model_pb2.DecisionStrategyProto.SELECT_MIN_VALUE | |
SELECT_MAX_VALUE = cp_model_pb2.DecisionStrategyProto.SELECT_MAX_VALUE | |
SELECT_LOWER_HALF = cp_model_pb2.DecisionStrategyProto.SELECT_LOWER_HALF | |
SELECT_UPPER_HALF = cp_model_pb2.DecisionStrategyProto.SELECT_UPPER_HALF | |
AUTOMATIC_SEARCH = sat_parameters_pb2.SatParameters.AUTOMATIC_SEARCH | |
FIXED_SEARCH = sat_parameters_pb2.SatParameters.FIXED_SEARCH | |
PORTFOLIO_SEARCH = sat_parameters_pb2.SatParameters.PORTFOLIO_SEARCH | |
LP_SEARCH = sat_parameters_pb2.SatParameters.LP_SEARCH | |
PSEUDO_COST_SEARCH = sat_parameters_pb2.SatParameters.PSEUDO_COST_SEARCH | |
tuple | PORTFOLIO_WITH_QUICK_RESTART_SEARCH |
HINT_SEARCH = sat_parameters_pb2.SatParameters.HINT_SEARCH | |
PARTIAL_FIXED_SEARCH = sat_parameters_pb2.SatParameters.PARTIAL_FIXED_SEARCH | |
RANDOMIZED_SEARCH = sat_parameters_pb2.SatParameters.RANDOMIZED_SEARCH | |
IntegralT = Union[int, np.int8, np.uint8, np.int32, np.uint32, np.int64, np.uint64] | |
tuple | IntegralTypes |
NumberT | |
tuple | NumberTypes |
LiteralT = Union["IntVar", "_NotBooleanVariable", IntegralT, bool] | |
BoolVarT = Union["IntVar", "_NotBooleanVariable"] | |
VariableT = Union["IntVar", IntegralT] | |
LinearExprT = Union["LinearExpr", "IntVar", IntegralT] | |
ObjLinearExprT = Union["LinearExpr", NumberT] | |
BoundedLinearExprT = Union["BoundedLinearExpression", bool] | |
ArcT = Tuple[IntegralT, IntegralT, LiteralT] | |
_IndexOrSeries = Union[pd.Index, pd.Series] | |
Methods for building and solving CP-SAT models. The following two sections describe the main methods for building and solving CP-SAT models. * [`CpModel`](#cp_model.CpModel): Methods for creating models, including variables and constraints. * [`CPSolver`](#cp_model.CpSolver): Methods for solving a model and evaluating solutions. The following methods implement callbacks that the solver calls each time it finds a new solution. * [`CpSolverSolutionCallback`](#cp_model.CpSolverSolutionCallback): A general method for implementing callbacks. * [`ObjectiveSolutionPrinter`](#cp_model.ObjectiveSolutionPrinter): Print objective values and elapsed time for intermediate solutions. * [`VarArraySolutionPrinter`](#cp_model.VarArraySolutionPrinter): Print intermediate solutions (variable values, time). * [`VarArrayAndObjectiveSolutionPrinter`] (#cp_model.VarArrayAndObjectiveSolutionPrinter): Print both intermediate solutions and objective values. Additional methods for solving CP-SAT models: * [`Constraint`](#cp_model.Constraint): A few utility methods for modifying constraints created by `CpModel`. * [`LinearExpr`](#lineacp_model.LinearExpr): Methods for creating constraints and the objective from large arrays of coefficients. Other methods and functions listed are primarily used for developing OR-Tools, rather than for solving specific optimization problems.
|
protected |
Returns the attributes of `values`. Args: func: The function to call for getting the attribute data. values: The values that the function will be applied (element-wise) to. Returns: pd.Series: The attribute values.
Definition at line 3711 of file cp_model.py.
|
protected |
Returns a pd.Series of the given index with the corresponding values. Args: value_or_series: the values to be converted (if applicable). index: the index of the resulting pd.Series. Returns: pd.Series: The set of values with the given index. Raises: TypeError: If the type of `value_or_series` is not recognized. ValueError: If the index does not match.
Definition at line 3731 of file cp_model.py.
|
protected |
Returns a pd.Series of the given index with the corresponding values. Args: value_or_series: the values to be converted (if applicable). index: the index of the resulting pd.Series. Returns: pd.Series: The set of values with the given index. Raises: TypeError: If the type of `value_or_series` is not recognized. ValueError: If the index does not match.
Definition at line 3759 of file cp_model.py.
|
protected |
Returns a pd.Series of the given index with the corresponding values. Args: value_or_series: the values to be converted (if applicable). index: the index of the resulting pd.Series. Returns: pd.Series: The set of values with the given index. Raises: TypeError: If the type of `value_or_series` is not recognized. ValueError: If the index does not match.
Definition at line 3787 of file cp_model.py.
|
protected |
Returns the indices of `obj` as a `pd.Index`.
Definition at line 3704 of file cp_model.py.
str ortools.sat.python.cp_model.display_bounds | ( | Sequence[int] | bounds | ) |
Displays a flattened list of intervals.
Definition at line 168 of file cp_model.py.
bool ortools.sat.python.cp_model.evaluate_boolean_expression | ( | LiteralT | literal, |
cp_model_pb2.CpSolverResponse | solution ) |
Evaluate a boolean expression against a solution.
Definition at line 3127 of file cp_model.py.
int ortools.sat.python.cp_model.evaluate_linear_expr | ( | LinearExprT | expression, |
cp_model_pb2.CpSolverResponse | solution ) |
Evaluate a linear expression against a solution.
Definition at line 3089 of file cp_model.py.
ortools.sat.python.cp_model.expand_generator_or_tuple | ( | args | ) |
Definition at line 3079 of file cp_model.py.
Union[Iterable[LinearExprT], LinearExprT] ortools.sat.python.cp_model.expand_generator_or_tuple | ( | Union[Tuple[LinearExprT, ...], Iterable[LinearExprT]] | args | ) |
Definition at line 3074 of file cp_model.py.
Union[Iterable[LiteralT], LiteralT] ortools.sat.python.cp_model.expand_generator_or_tuple | ( | Union[Tuple[LiteralT, ...], Iterable[LiteralT]] | args | ) |
Definition at line 3068 of file cp_model.py.
bool ortools.sat.python.cp_model.object_is_a_false_literal | ( | LiteralT | literal | ) |
Checks if literal is either False, or a Boolean literals fixed to False.
Definition at line 1320 of file cp_model.py.
bool ortools.sat.python.cp_model.object_is_a_true_literal | ( | LiteralT | literal | ) |
Checks if literal is either True, or a Boolean literals fixed to True.
Definition at line 1307 of file cp_model.py.
str ortools.sat.python.cp_model.short_expr_name | ( | cp_model_pb2.CpModelProto | model, |
cp_model_pb2.LinearExpressionProto | e ) |
Pretty-print LinearExpressionProto instances.
Definition at line 194 of file cp_model.py.
str ortools.sat.python.cp_model.short_name | ( | cp_model_pb2.CpModelProto | model, |
int | i ) |
Returns a short name of an integer variable, or its negation.
Definition at line 181 of file cp_model.py.
|
protected |
Definition at line 165 of file cp_model.py.
Definition at line 164 of file cp_model.py.
ortools.sat.python.cp_model.AUTOMATIC_SEARCH = sat_parameters_pb2.SatParameters.AUTOMATIC_SEARCH |
Definition at line 109 of file cp_model.py.
ortools.sat.python.cp_model.BoolVarT = Union["IntVar", "_NotBooleanVariable"] |
Definition at line 156 of file cp_model.py.
ortools.sat.python.cp_model.BoundedLinearExprT = Union["BoundedLinearExpression", bool] |
Definition at line 162 of file cp_model.py.
ortools.sat.python.cp_model.CHOOSE_FIRST = cp_model_pb2.DecisionStrategyProto.CHOOSE_FIRST |
Definition at line 96 of file cp_model.py.
ortools.sat.python.cp_model.CHOOSE_HIGHEST_MAX = cp_model_pb2.DecisionStrategyProto.CHOOSE_HIGHEST_MAX |
Definition at line 98 of file cp_model.py.
ortools.sat.python.cp_model.CHOOSE_LOWEST_MIN = cp_model_pb2.DecisionStrategyProto.CHOOSE_LOWEST_MIN |
Definition at line 97 of file cp_model.py.
ortools.sat.python.cp_model.CHOOSE_MAX_DOMAIN_SIZE = cp_model_pb2.DecisionStrategyProto.CHOOSE_MAX_DOMAIN_SIZE |
Definition at line 100 of file cp_model.py.
ortools.sat.python.cp_model.CHOOSE_MIN_DOMAIN_SIZE = cp_model_pb2.DecisionStrategyProto.CHOOSE_MIN_DOMAIN_SIZE |
Definition at line 99 of file cp_model.py.
ortools.sat.python.cp_model.Domain = sorted_interval_list.Domain |
Definition at line 77 of file cp_model.py.
ortools.sat.python.cp_model.FEASIBLE = cp_model_pb2.FEASIBLE |
Definition at line 91 of file cp_model.py.
ortools.sat.python.cp_model.FIXED_SEARCH = sat_parameters_pb2.SatParameters.FIXED_SEARCH |
Definition at line 110 of file cp_model.py.
ortools.sat.python.cp_model.HINT_SEARCH = sat_parameters_pb2.SatParameters.HINT_SEARCH |
Definition at line 117 of file cp_model.py.
ortools.sat.python.cp_model.INFEASIBLE = cp_model_pb2.INFEASIBLE |
Definition at line 92 of file cp_model.py.
int ortools.sat.python.cp_model.INT32_MAX = 2**31 - 1 |
Definition at line 86 of file cp_model.py.
ortools.sat.python.cp_model.INT32_MIN = -(2**31) |
Definition at line 85 of file cp_model.py.
int ortools.sat.python.cp_model.INT_MAX = 2**63 - 1 |
Definition at line 84 of file cp_model.py.
ortools.sat.python.cp_model.INT_MIN = -(2**63) |
Definition at line 83 of file cp_model.py.
ortools.sat.python.cp_model.IntegralT = Union[int, np.int8, np.uint8, np.int32, np.uint32, np.int64, np.uint64] |
Definition at line 122 of file cp_model.py.
tuple ortools.sat.python.cp_model.IntegralTypes |
Definition at line 123 of file cp_model.py.
ortools.sat.python.cp_model.LinearExprT = Union["LinearExpr", "IntVar", IntegralT] |
Definition at line 160 of file cp_model.py.
ortools.sat.python.cp_model.LiteralT = Union["IntVar", "_NotBooleanVariable", IntegralT, bool] |
Definition at line 155 of file cp_model.py.
ortools.sat.python.cp_model.LP_SEARCH = sat_parameters_pb2.SatParameters.LP_SEARCH |
Definition at line 112 of file cp_model.py.
ortools.sat.python.cp_model.MODEL_INVALID = cp_model_pb2.MODEL_INVALID |
Definition at line 90 of file cp_model.py.
ortools.sat.python.cp_model.NumberT |
Definition at line 132 of file cp_model.py.
tuple ortools.sat.python.cp_model.NumberTypes |
Definition at line 143 of file cp_model.py.
ortools.sat.python.cp_model.ObjLinearExprT = Union["LinearExpr", NumberT] |
Definition at line 161 of file cp_model.py.
ortools.sat.python.cp_model.OPTIMAL = cp_model_pb2.OPTIMAL |
Definition at line 93 of file cp_model.py.
ortools.sat.python.cp_model.PARTIAL_FIXED_SEARCH = sat_parameters_pb2.SatParameters.PARTIAL_FIXED_SEARCH |
Definition at line 118 of file cp_model.py.
ortools.sat.python.cp_model.PORTFOLIO_SEARCH = sat_parameters_pb2.SatParameters.PORTFOLIO_SEARCH |
Definition at line 111 of file cp_model.py.
tuple ortools.sat.python.cp_model.PORTFOLIO_WITH_QUICK_RESTART_SEARCH |
Definition at line 114 of file cp_model.py.
ortools.sat.python.cp_model.PSEUDO_COST_SEARCH = sat_parameters_pb2.SatParameters.PSEUDO_COST_SEARCH |
Definition at line 113 of file cp_model.py.
ortools.sat.python.cp_model.RANDOMIZED_SEARCH = sat_parameters_pb2.SatParameters.RANDOMIZED_SEARCH |
Definition at line 119 of file cp_model.py.
ortools.sat.python.cp_model.SELECT_LOWER_HALF = cp_model_pb2.DecisionStrategyProto.SELECT_LOWER_HALF |
Definition at line 105 of file cp_model.py.
ortools.sat.python.cp_model.SELECT_MAX_VALUE = cp_model_pb2.DecisionStrategyProto.SELECT_MAX_VALUE |
Definition at line 104 of file cp_model.py.
ortools.sat.python.cp_model.SELECT_MIN_VALUE = cp_model_pb2.DecisionStrategyProto.SELECT_MIN_VALUE |
Definition at line 103 of file cp_model.py.
ortools.sat.python.cp_model.SELECT_UPPER_HALF = cp_model_pb2.DecisionStrategyProto.SELECT_UPPER_HALF |
Definition at line 106 of file cp_model.py.
ortools.sat.python.cp_model.UNKNOWN = cp_model_pb2.UNKNOWN |
Definition at line 89 of file cp_model.py.
ortools.sat.python.cp_model.VariableT = Union["IntVar", IntegralT] |
Definition at line 157 of file cp_model.py.