Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <base_solver.h>
Classes | |
struct | ComputeInfeasibleSubsystemArgs |
Arguments used when calling ComputeInfeasibleSubsystem(). More... | |
struct | SolveArgs |
Arguments used when calling Solve() to solve the problem. More... | |
Public Types | |
using | MessageCallback = std::function<void(const std::vector<std::string>&)> |
using | Callback = std::function<CallbackResultProto(const CallbackDataProto&)> |
Callback function type for MIP/LP callbacks. | |
Public Member Functions | |
BaseSolver ()=default | |
BaseSolver (const BaseSolver &)=delete | |
BaseSolver & | operator= (const BaseSolver &)=delete |
virtual | ~BaseSolver ()=default |
virtual absl::StatusOr< SolveResultProto > | Solve (const SolveArgs &arguments)=0 |
Solves the current model (including all updates). | |
virtual absl::StatusOr< ComputeInfeasibleSubsystemResultProto > | ComputeInfeasibleSubsystem (const ComputeInfeasibleSubsystemArgs &arguments)=0 |
Computes an infeasible subsystem of model (including all updates). | |
virtual absl::StatusOr< bool > | Update (ModelUpdateProto model_update)=0 |
The API of solvers (in-process, sub-process and streaming RPC ones).
Thread-safety: methods Solve() and Update() must not be called concurrently; they should immediately return with an error status if this happens.
Solver
into InProcessSolver
and then rename BaseSolver
into Solver
. Definition at line 41 of file base_solver.h.
using operations_research::math_opt::BaseSolver::Callback = std::function<CallbackResultProto(const CallbackDataProto&)> |
Callback function type for MIP/LP callbacks.
Definition at line 54 of file base_solver.h.
using operations_research::math_opt::BaseSolver::MessageCallback = std::function<void(const std::vector<std::string>&)> |
Callback function for messages callback sent by the solver.
Each message represents a single output line from the solver, and each message does not contain any '
' character in it.
Thread-safety: a callback may be called concurrently from multiple threads. The users is expected to use proper synchronization primitives to deal with that.
Definition at line 51 of file base_solver.h.
|
default |
|
delete |
|
virtualdefault |
|
pure virtual |
Computes an infeasible subsystem of model
(including all updates).
Implemented in operations_research::math_opt::Solver.
|
delete |
|
pure virtual |
Solves the current model (including all updates).
Implemented in operations_research::math_opt::Solver.
|
pure virtual |
Updates the model to solve and returns true, or returns false if this update is not supported by the underlying solver.
The model_update is passed by value. Non in-process implementations will move it in-place in the messages used to communicate with the other process. Thus if possible, the caller should std::move() this proto to this function.
A status error will be returned if the model_update is invalid or the underlying solver has an internal error.
When this function returns false, the BaseSolver object is in a failed state.
Implemented in operations_research::math_opt::Solver.