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

#include <model_builder_helper.h>

Public Member Functions

 ModelSolverHelper (const std::string &solver_name)
 
bool SolverIsSupported () const
 
void Solve (const ModelBuilderHelper &model)
 
std::optional< MPSolutionResponse > SolveRequest (const MPModelRequest &request)
 Only used by the CVXPY interface. Does not store the response internally.
 
bool InterruptSolve ()
 
void SetLogCallback (std::function< void(const std::string &)> log_callback)
 
void SetLogCallbackFromDirectorClass (MbLogCallback *log_callback)
 
void ClearLogCallback ()
 
bool has_response () const
 
bool has_solution () const
 
const MPSolutionResponse & response () const
 
SolveStatus status () const
 
double objective_value () const
 If not defined, or no solution, they will silently return 0.
 
double best_objective_bound () const
 
double variable_value (int var_index) const
 
double reduced_cost (int var_index) const
 
double dual_value (int ct_index) const
 
double activity (int ct_index)
 
std::string status_string () const
 
double wall_time () const
 
double user_time () const
 
void SetTimeLimitInSeconds (double limit)
 Solve parameters.
 
void SetSolverSpecificParameters (const std::string &solver_specific_parameters)
 
void EnableOutput (bool enabled)
 

Detailed Description

Class used to solve a request. This class is not meant to be exposed to the public. Its responsibility is to bridge the MPModelProto in the non-C++ languages with the C++ Solve method.

It contains 2 helper objects: a logger, and an atomic bool to interrupt search.

Definition at line 166 of file model_builder_helper.h.

Constructor & Destructor Documentation

◆ ModelSolverHelper()

operations_research::ModelSolverHelper::ModelSolverHelper ( const std::string & solver_name)
explicit

Definition at line 517 of file model_builder_helper.cc.

Member Function Documentation

◆ activity()

double operations_research::ModelSolverHelper::activity ( int ct_index)

Definition at line 724 of file model_builder_helper.cc.

◆ best_objective_bound()

double operations_research::ModelSolverHelper::best_objective_bound ( ) const

Definition at line 701 of file model_builder_helper.cc.

◆ ClearLogCallback()

void operations_research::ModelSolverHelper::ClearLogCallback ( )

Definition at line 667 of file model_builder_helper.cc.

◆ dual_value()

double operations_research::ModelSolverHelper::dual_value ( int ct_index) const

Definition at line 718 of file model_builder_helper.cc.

◆ EnableOutput()

void operations_research::ModelSolverHelper::EnableOutput ( bool enabled)

Definition at line 769 of file model_builder_helper.cc.

◆ has_response()

bool operations_research::ModelSolverHelper::has_response ( ) const

Definition at line 675 of file model_builder_helper.cc.

◆ has_solution()

bool operations_research::ModelSolverHelper::has_solution ( ) const

Definition at line 677 of file model_builder_helper.cc.

◆ InterruptSolve()

bool operations_research::ModelSolverHelper::InterruptSolve ( )

Returns true if the interrupt signal was correctly sent, that is if the underlying solver supports it.

Definition at line 669 of file model_builder_helper.cc.

◆ objective_value()

double operations_research::ModelSolverHelper::objective_value ( ) const

If not defined, or no solution, they will silently return 0.

Definition at line 696 of file model_builder_helper.cc.

◆ reduced_cost()

double operations_research::ModelSolverHelper::reduced_cost ( int var_index) const

Definition at line 712 of file model_builder_helper.cc.

◆ response()

const MPSolutionResponse & operations_research::ModelSolverHelper::response ( ) const

Definition at line 685 of file model_builder_helper.cc.

◆ SetLogCallback()

void operations_research::ModelSolverHelper::SetLogCallback ( std::function< void(const std::string &)> log_callback)

Definition at line 655 of file model_builder_helper.cc.

◆ SetLogCallbackFromDirectorClass()

void operations_research::ModelSolverHelper::SetLogCallbackFromDirectorClass ( MbLogCallback * log_callback)

Definition at line 660 of file model_builder_helper.cc.

◆ SetSolverSpecificParameters()

void operations_research::ModelSolverHelper::SetSolverSpecificParameters ( const std::string & solver_specific_parameters)

Definition at line 764 of file model_builder_helper.cc.

◆ SetTimeLimitInSeconds()

void operations_research::ModelSolverHelper::SetTimeLimitInSeconds ( double limit)

Solve parameters.

Definition at line 760 of file model_builder_helper.cc.

◆ Solve()

void operations_research::ModelSolverHelper::Solve ( const ModelBuilderHelper & model)
Todo
(user): Enable log_callback support.
Todo
Todo
(user): Enable interrupt_solve.
Todo
(user): Enable log_callback support.
Todo
Todo
(user): Enable interrupt_solve.

Definition at line 564 of file model_builder_helper.cc.

◆ SolveRequest()

std::optional< MPSolutionResponse > operations_research::ModelSolverHelper::SolveRequest ( const MPModelRequest & request)

Only used by the CVXPY interface. Does not store the response internally.

Definition at line 470 of file model_builder_helper.cc.

◆ SolverIsSupported()

bool operations_research::ModelSolverHelper::SolverIsSupported ( ) const

Definition at line 527 of file model_builder_helper.cc.

◆ status()

SolveStatus operations_research::ModelSolverHelper::status ( ) const

Definition at line 689 of file model_builder_helper.cc.

◆ status_string()

std::string operations_research::ModelSolverHelper::status_string ( ) const

Definition at line 743 of file model_builder_helper.cc.

◆ user_time()

double operations_research::ModelSolverHelper::user_time ( ) const

Definition at line 754 of file model_builder_helper.cc.

◆ variable_value()

double operations_research::ModelSolverHelper::variable_value ( int var_index) const

Definition at line 706 of file model_builder_helper.cc.

◆ wall_time()

double operations_research::ModelSolverHelper::wall_time ( ) const

Definition at line 748 of file model_builder_helper.cc.


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