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

#include <glop_solver.h>

Inheritance diagram for operations_research::math_opt::GlopSolver:
operations_research::math_opt::SolverInterface

Public Member Functions

absl::StatusOr< SolveResultProto > Solve (const SolveParametersProto &parameters, const ModelSolveParametersProto &model_parameters, MessageCallback message_cb, const CallbackRegistrationProto &callback_registration, Callback cb, const SolveInterrupter *interrupter) override
 
absl::StatusOr< bool > Update (const ModelUpdateProto &model_update) override
 
absl::StatusOr< ComputeInfeasibleSubsystemResultProto > ComputeInfeasibleSubsystem (const SolveParametersProto &parameters, MessageCallback message_cb, const SolveInterrupter *interrupter) override
 
- Public Member Functions inherited from operations_research::math_opt::SolverInterface
 SolverInterface ()=default
 
 SolverInterface (const SolverInterface &)=delete
 
SolverInterfaceoperator= (const SolverInterface &)=delete
 
virtual ~SolverInterface ()=default
 

Static Public Member Functions

static absl::StatusOr< std::unique_ptr< SolverInterface > > New (const ModelProto &model, const InitArgs &init_args)
 
static absl::StatusOr< glop::GlopParameters > MergeSolveParameters (const SolveParametersProto &solve_parameters, bool setting_initial_basis, bool has_message_callback, bool is_maximization)
 

Additional Inherited Members

- Public Types inherited from operations_research::math_opt::SolverInterface
using MessageCallback = std::function<void(const std::vector<std::string>&)>
 
using Callback
 
using Factory
 

Detailed Description

Definition at line 46 of file glop_solver.h.

Member Function Documentation

◆ ComputeInfeasibleSubsystem()

absl::StatusOr< ComputeInfeasibleSubsystemResultProto > operations_research::math_opt::GlopSolver::ComputeInfeasibleSubsystem ( const SolveParametersProto & parameters,
MessageCallback message_cb,
const SolveInterrupter * interrupter )
overridevirtual

Computes a infeasible subsystem of the model (including all updates).

All input arguments are ensured (by solver.cc) to be valid. Furthermore, since all parameters are references or functions (which could be a lambda expression), the implementation should not keep a reference or copy of them, as they may become invalid reference after the invocation if this function.

The parameters message_cb and interrupter are optional. They are nullptr when not set.

When parameter message_cb is not null the value of parameters.enable_output should be ignored the solver should behave as it is was false (i.e. not print anything).

When parameter message_cb is not null and the underlying solver does not supports message callbacks, it should ignore it.

Implements operations_research::math_opt::SolverInterface.

Definition at line 885 of file glop_solver.cc.

◆ MergeSolveParameters()

absl::StatusOr< glop::GlopParameters > operations_research::math_opt::GlopSolver::MergeSolveParameters ( const SolveParametersProto & solve_parameters,
bool setting_initial_basis,
bool has_message_callback,
bool is_maximization )
static

Returns the merged parameters and a list of warnings from any parameter settings that are invalid for this solver.

Validate first the user specific Glop parameters.

If we have a message callback, we must set log_search_progress to get any logs. We ignore the user's input on specific solver parameters here since it would be confusing to accept a callback but never call it.

We don't want the logs to be also printed to stdout when we have a message callback. Here we ignore the user input since message callback can be used in the context of a server and printing to stdout could be a problem.

Solver stops once optimal objective is proven strictly greater than limit. limit.

Solver stops once optimal objective is proven strictly less than limit.

Validate the result of the merge. If the parameters are not valid, this is an internal error from MathOpt as user specified Glop parameters have been validated at the beginning of this function. Thus the invalid values are values translated from solve_parameters and this code should not produce invalid parameters.

Definition at line 304 of file glop_solver.cc.

◆ New()

absl::StatusOr< std::unique_ptr< SolverInterface > > operations_research::math_opt::GlopSolver::New ( const ModelProto & model,
const InitArgs & init_args )
static

By default Glop CHECKs that bounds are always consistent (lb < ub); thus it would fail if the initial model or later updates temporarily set inverted bounds.

Definition at line 829 of file glop_solver.cc.

◆ Solve()

absl::StatusOr< SolveResultProto > operations_research::math_opt::GlopSolver::Solve ( const SolveParametersProto & parameters,
const ModelSolveParametersProto & model_parameters,
MessageCallback message_cb,
const CallbackRegistrationProto & callback_registration,
Callback cb,
const SolveInterrupter * interrupter )
overridevirtual

Solves the current model (included all updates).

All input arguments are ensured (by solver.cc) to be valid. Furthermore, since all parameters are references or functions (which could be a lambda expression), the implementation should not keep a reference or copy of them, as they may become invalid reference after the invocation if this function.

Parameters message_cb, cb and interrupter are optional. They are nullptr when not set.

When parameter message_cb is not null the value of parameters.enable_output should be ignored the solver should behave as it is was false (i.e. not print anything).

When parameter message_cb is not null and the underlying solver does not supports message callbacks, it should ignore it.

Solvers should return a InvalidArgumentError when called with events on callback_registration that are not supported by the solver for the type of model being solved (for example MIP events if the model is an LP, or events that are not emitted by the solver). Solvers should use CheckRegisteredCallbackEvents() to implement that.

Please note that the logging is enabled in MergeSolveParameters() where we also disable logging to stdout. We can't modify the SolverLogger here since the values are overwritten from the parameters at the beginning of the solve.

Here we test that there are no other callbacks since we will clear them all in the cleanup below.

Check that no other callbacks have been added to the logger.

Glop returns an error when bounds are inverted and does not list the offending variables/constraints. Here we want to return a more detailed status.

Implements operations_research::math_opt::SolverInterface.

Definition at line 763 of file glop_solver.cc.

◆ Update()

absl::StatusOr< bool > operations_research::math_opt::GlopSolver::Update ( const ModelUpdateProto & model_update)
overridevirtual

Updates the model to solve and returns true, or returns false if this update is not supported.

The implementation should assume the input ModelUpdate is valid and is free to assert if this is not the case.

Implements operations_research::math_opt::SolverInterface.

Definition at line 852 of file glop_solver.cc.


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