![]() |
Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
|
Classes | |
class | EnforcedLinearConstraint |
class | LinearConstraint |
class | Model |
class | Solver |
Functions | |
_add_linear_constraint_to_helper (Union[bool, mbh.BoundedLinearExpression] bounded_expr, mbh.ModelBuilderHelper helper, Optional[str] name) | |
_add_enforced_linear_constraint_to_helper (Union[bool, mbh.BoundedLinearExpression] bounded_expr, mbh.ModelBuilderHelper helper, Variable var, bool value, Optional[str] name) | |
pd.Index | _get_index (_IndexOrSeries obj) |
pd.Series | _attribute_series (*, Callable[[_VariableOrConstraint], NumberT] func, _IndexOrSeries values) |
pd.Series | _convert_to_series_and_validate_index (Union[bool, NumberT, pd.Series] value_or_series, pd.Index index) |
pd.Series | _convert_to_var_series_and_validate_index (Union["Variable", pd.Series] var_or_series, pd.Index index) |
Variables | |
NumberT = Union[int, float, numbers.Real, np.number] | |
IntegerT = Union[int, numbers.Integral, np.integer] | |
LinearExprT = Union[mbh.LinearExpr, NumberT] | |
ConstraintT = Union[mbh.BoundedLinearExpression, bool] | |
_IndexOrSeries = Union[pd.Index, pd.Series] | |
_VariableOrConstraint = Union["LinearConstraint", mbh.Variable] | |
AffineExpr = mbh.AffineExpr | |
BoundedLinearExpression = mbh.BoundedLinearExpression | |
FlatExpr = mbh.FlatExpr | |
LinearExpr = mbh.LinearExpr | |
SolveStatus = mbh.SolveStatus | |
Variable = mbh.Variable | |
ModelBuilder = Model | |
ModelSolver = Solver | |
Methods for building and solving model_builder models. The following two sections describe the main methods for building and solving those models. * [`Model`](#model_builder.Model): Methods for creating models, including variables and constraints. * [`Solver`](#model_builder.Solver): Methods for solving a model and evaluating solutions. Additional methods for solving Model models: * [`Constraint`](#model_builder.Constraint): A few utility methods for modifying constraints created by `Model`. * [`LinearExpr`](#model_builder.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 |
Creates a new enforced linear constraint in the helper. It handles boolean values (which might arise in the construction of BoundedLinearExpressions). If bounded_expr is a Boolean value, the linear part of the constraint is different. In that case, the constraint will be immutable and marked as under-specified. Its linear part will be always feasible or infeasible whether the value is True or False. Args: bounded_expr: The bounded expression used to create the constraint. helper: The helper to create the constraint. var: the variable used in the indicator value: the value used in the indicator name: The name of the constraint to be created. Returns: EnforcedLinearConstraint: a constraint in the helper corresponding to the input. Raises: TypeError: If constraint is an invalid type.
Definition at line 115 of file model_builder.py.
|
protected |
Creates a new linear constraint in the helper. It handles boolean values (which might arise in the construction of BoundedLinearExpressions). If bounded_expr is a Boolean value, the created constraint is different. In that case, the constraint will be immutable and marked as under-specified. It will be always feasible or infeasible whether the value is True or False. Args: bounded_expr: The bounded expression used to create the constraint. helper: The helper to create the constraint. name: The name of the constraint to be created. Returns: LinearConstraint: a constraint in the helper corresponding to the input. Raises: TypeError: If constraint is an invalid type.
Definition at line 64 of file model_builder.py.
|
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 1364 of file model_builder.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 1384 of file model_builder.py.
|
protected |
Returns a pd.Series of the given index with the corresponding values. Args: var_or_series: the variables 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 1412 of file model_builder.py.
|
protected |
Returns the indices of `obj` as a `pd.Index`.
Definition at line 1357 of file model_builder.py.
|
protected |
Definition at line 52 of file model_builder.py.
|
protected |
Definition at line 53 of file model_builder.py.
ortools.linear_solver.python.model_builder.AffineExpr = mbh.AffineExpr |
Definition at line 56 of file model_builder.py.
ortools.linear_solver.python.model_builder.BoundedLinearExpression = mbh.BoundedLinearExpression |
Definition at line 57 of file model_builder.py.
ortools.linear_solver.python.model_builder.ConstraintT = Union[mbh.BoundedLinearExpression, bool] |
Definition at line 51 of file model_builder.py.
ortools.linear_solver.python.model_builder.FlatExpr = mbh.FlatExpr |
Definition at line 58 of file model_builder.py.
ortools.linear_solver.python.model_builder.IntegerT = Union[int, numbers.Integral, np.integer] |
Definition at line 49 of file model_builder.py.
ortools.linear_solver.python.model_builder.LinearExpr = mbh.LinearExpr |
Definition at line 59 of file model_builder.py.
ortools.linear_solver.python.model_builder.LinearExprT = Union[mbh.LinearExpr, NumberT] |
Definition at line 50 of file model_builder.py.
ortools.linear_solver.python.model_builder.ModelBuilder = Model |
Definition at line 1441 of file model_builder.py.
ortools.linear_solver.python.model_builder.ModelSolver = Solver |
Definition at line 1442 of file model_builder.py.
ortools.linear_solver.python.model_builder.NumberT = Union[int, float, numbers.Real, np.number] |
Definition at line 48 of file model_builder.py.
ortools.linear_solver.python.model_builder.SolveStatus = mbh.SolveStatus |
Definition at line 60 of file model_builder.py.
ortools.linear_solver.python.model_builder.Variable = mbh.Variable |
Definition at line 61 of file model_builder.py.