Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::math_opt::BaseSolver Class Referenceabstract

#include <base_solver.h>

Inheritance diagram for operations_research::math_opt::BaseSolver:
operations_research::math_opt::Solver

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
 
BaseSolveroperator= (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
 

Detailed Description

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.

Todo
: b/350984134 - Rename Solver into InProcessSolver and then rename BaseSolver into Solver.

Definition at line 41 of file base_solver.h.

Member Typedef Documentation

◆ Callback

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.

◆ MessageCallback

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.

Constructor & Destructor Documentation

◆ BaseSolver() [1/2]

operations_research::math_opt::BaseSolver::BaseSolver ( )
default

◆ BaseSolver() [2/2]

operations_research::math_opt::BaseSolver::BaseSolver ( const BaseSolver & )
delete

◆ ~BaseSolver()

virtual operations_research::math_opt::BaseSolver::~BaseSolver ( )
virtualdefault

Member Function Documentation

◆ ComputeInfeasibleSubsystem()

virtual absl::StatusOr< ComputeInfeasibleSubsystemResultProto > operations_research::math_opt::BaseSolver::ComputeInfeasibleSubsystem ( const ComputeInfeasibleSubsystemArgs & arguments)
pure virtual

Computes an infeasible subsystem of model (including all updates).

Implemented in operations_research::math_opt::Solver.

◆ operator=()

BaseSolver & operations_research::math_opt::BaseSolver::operator= ( const BaseSolver & )
delete

◆ Solve()

virtual absl::StatusOr< SolveResultProto > operations_research::math_opt::BaseSolver::Solve ( const SolveArgs & arguments)
pure virtual

Solves the current model (including all updates).

Implemented in operations_research::math_opt::Solver.

◆ Update()

virtual absl::StatusOr< bool > operations_research::math_opt::BaseSolver::Update ( ModelUpdateProto model_update)
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.


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