![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
Solve optimization problems, as defined by Model in model.py.
Classes | |
| class | IncrementalSolver |
Functions | |
| result.SolveResult | solve (model.Model opt_model, parameters.SolverType solver_type, *, Optional[parameters.SolveParameters] params=None, Optional[model_parameters.ModelSolveParameters] model_params=None, Optional[message_callback.SolveMessageCallback] msg_cb=None, Optional[callback.CallbackRegistration] callback_reg=None, Optional[SolveCallback] cb=None, Optional[init_arguments.StreamableSolverInitArguments] streamable_init_args=None) |
| compute_infeasible_subsystem_result.ComputeInfeasibleSubsystemResult | compute_infeasible_subsystem (model.Model opt_model, parameters.SolverType solver_type, *, Optional[parameters.SolveParameters] params=None, Optional[message_callback.SolveMessageCallback] msg_cb=None, Optional[init_arguments.StreamableSolverInitArguments] streamable_init_args=None) |
| Exception | _status_not_ok_to_exception (StatusNotOk err) |
Variables | |
| SolveCallback = Callable[[callback.CallbackData], callback.CallbackResult] | |
|
protected |
| compute_infeasible_subsystem_result.ComputeInfeasibleSubsystemResult ortools.math_opt.python.solve.compute_infeasible_subsystem | ( | model.Model | opt_model, |
| parameters.SolverType | solver_type, | ||
| * | , | ||
| Optional[parameters.SolveParameters] | params = None, | ||
| Optional[message_callback.SolveMessageCallback] | msg_cb = None, | ||
| Optional[init_arguments.StreamableSolverInitArguments] | streamable_init_args = None ) |
Computes an infeasible subsystem of the input model.
Args:
opt_model: The optimization model to check for infeasibility.
solver_type: Which solver to use to compute the infeasible subsystem. As of
August 2023, the only supported solver is Gurobi.
params: Configuration of the underlying solver.
msg_cb: A callback that gives back the underlying solver's logs by the line.
streamable_init_args: Configuration for initializing the underlying solver.
Returns:
An `ComputeInfeasibleSubsystemResult` where `feasibility` indicates if the
problem was proven infeasible.
Throws:
RuntimeError: on invalid inputs or an internal solver error.
| result.SolveResult ortools.math_opt.python.solve.solve | ( | model.Model | opt_model, |
| parameters.SolverType | solver_type, | ||
| * | , | ||
| Optional[parameters.SolveParameters] | params = None, | ||
| Optional[model_parameters.ModelSolveParameters] | model_params = None, | ||
| Optional[message_callback.SolveMessageCallback] | msg_cb = None, | ||
| Optional[callback.CallbackRegistration] | callback_reg = None, | ||
| Optional[SolveCallback] | cb = None, | ||
| Optional[init_arguments.StreamableSolverInitArguments] | streamable_init_args = None ) |
Solves an optimization model.
Thread-safety: this function must not be called while modifying the Model
(adding variables...). Some solvers may add more restriction regarding
threading. Please see SolverType::XXX documentation for details.
Args:
opt_model: The optimization model.
solver_type: The underlying solver to use.
params: Configuration of the underlying solver.
model_params: Configuration of the solver that is model specific.
msg_cb: A callback that gives back the underlying solver's logs by the line.
callback_reg: Configures when the callback will be invoked (if provided) and
what data will be collected to access in the callback.
cb: A callback that will be called periodically as the solver runs.
streamable_init_args: Configuration for initializing the underlying solver.
Returns:
A SolveResult containing the termination reason, solution(s) and stats.
Raises:
RuntimeError: On a solve error.
| ortools.math_opt.python.solve.SolveCallback = Callable[[callback.CallbackData], callback.CallbackResult] |