OR-Tools  8.2
GurobiInterface

Detailed Description

Definition at line 72 of file gurobi_interface.cc.

Public Types

enum  SynchronizationStatus { MUST_RELOAD , MODEL_SYNCHRONIZED , SOLUTION_SYNCHRONIZED }
 

Public Member Functions

 GurobiInterface (MPSolver *const solver, bool mip)
 
 ~GurobiInterface () override
 
void SetOptimizationDirection (bool maximize) override
 
MPSolver::ResultStatus Solve (const MPSolverParameters &param) override
 
absl::optional< MPSolutionResponse > DirectlySolveProto (const MPModelRequest &request) override
 
void Write (const std::string &filename) override
 
void Reset () override
 
void SetVariableBounds (int var_index, double lb, double ub) override
 
void SetVariableInteger (int var_index, bool integer) override
 
void SetConstraintBounds (int row_index, double lb, double ub) override
 
void AddRowConstraint (MPConstraint *const ct) override
 
bool AddIndicatorConstraint (MPConstraint *const ct) override
 
void AddVariable (MPVariable *const var) override
 
void SetCoefficient (MPConstraint *const constraint, const MPVariable *const variable, double new_value, double old_value) override
 
void ClearConstraint (MPConstraint *const constraint) override
 
void SetObjectiveCoefficient (const MPVariable *const variable, double coefficient) override
 
void SetObjectiveOffset (double value) override
 
void ClearObjective () override
 
void BranchingPriorityChangedForVariable (int var_index) override
 
int64 iterations () const override
 
int64 nodes () const override
 
MPSolver::BasisStatus row_status (int constraint_index) const override
 
MPSolver::BasisStatus column_status (int variable_index) const override
 
bool IsContinuous () const override
 
bool IsLP () const override
 
bool IsMIP () const override
 
void ExtractNewVariables () override
 
void ExtractNewConstraints () override
 
void ExtractObjective () override
 
std::string SolverVersion () const override
 
bool InterruptSolve () override
 
void * underlying_solver () override
 
double ComputeExactConditionNumber () const override
 
bool NextSolution () override
 
void SetCallback (MPCallback *mp_callback) override
 
bool SupportsCallbacks () const override
 
double best_objective_bound () const
 
double objective_value () const
 
bool CheckSolutionIsSynchronized () const
 
virtual bool CheckSolutionExists () const
 
bool CheckSolutionIsSynchronizedAndExists () const
 
int last_variable_index () const
 
bool variable_is_extracted (int var_index) const
 
void set_variable_as_extracted (int var_index, bool extracted)
 
bool constraint_is_extracted (int ct_index) const
 
void set_constraint_as_extracted (int ct_index, bool extracted)
 
bool quiet () const
 
void set_quiet (bool quiet_value)
 
MPSolver::ResultStatus result_status () const
 
virtual void SetStartingLpBasis (const std::vector< MPSolver::BasisStatus > &variable_statuses, const std::vector< MPSolver::BasisStatus > &constraint_statuses)
 

Static Public Attributes

static constexpr int64 kUnknownNumberOfIterations = -1
 
static constexpr int64 kUnknownNumberOfNodes = -1
 

Protected Member Functions

void ExtractModel ()
 
void ResetExtractionInformation ()
 
void InvalidateSolutionSynchronization ()
 
void SetCommonParameters (const MPSolverParameters &param)
 
void SetMIPParameters (const MPSolverParameters &param)
 
void SetUnsupportedDoubleParam (MPSolverParameters::DoubleParam param)
 
virtual void SetUnsupportedIntegerParam (MPSolverParameters::IntegerParam param)
 
void SetDoubleParamToUnsupportedValue (MPSolverParameters::DoubleParam param, double value)
 
virtual void SetIntegerParamToUnsupportedValue (MPSolverParameters::IntegerParam param, int value)
 
virtual absl::Status SetNumThreads (int num_threads)
 

Protected Attributes

MPSolver *const solver_
 
SynchronizationStatus sync_status_
 
MPSolver::ResultStatus result_status_
 
bool maximize_
 
int last_constraint_index_
 
int last_variable_index_
 
double objective_value_
 
double best_objective_bound_
 
bool quiet_
 

Static Protected Attributes

static const int kDummyVariableIndex = 0
 

Member Enumeration Documentation

◆ SynchronizationStatus

enum SynchronizationStatus
inherited
Enumerator
MUST_RELOAD 
MODEL_SYNCHRONIZED 
SOLUTION_SYNCHRONIZED 

Definition at line 1519 of file linear_solver.h.

Constructor & Destructor Documentation

◆ GurobiInterface()

GurobiInterface ( MPSolver *const  solver,
bool  mip 
)
explicit

Definition at line 600 of file gurobi_interface.cc.

◆ ~GurobiInterface()

~GurobiInterface ( )
override

Definition at line 619 of file gurobi_interface.cc.

Member Function Documentation

◆ AddIndicatorConstraint()

bool AddIndicatorConstraint ( MPConstraint *const  ct)
overridevirtual

Reimplemented from MPSolverInterface.

Definition at line 712 of file gurobi_interface.cc.

◆ AddRowConstraint()

void AddRowConstraint ( MPConstraint *const  ct)
overridevirtual

Implements MPSolverInterface.

Definition at line 708 of file gurobi_interface.cc.

◆ AddVariable()

void AddVariable ( MPVariable *const  var)
overridevirtual

Implements MPSolverInterface.

Definition at line 718 of file gurobi_interface.cc.

◆ best_objective_bound()

double best_objective_bound ( ) const
inherited

Definition at line 1704 of file linear_solver.cc.

◆ BranchingPriorityChangedForVariable()

void BranchingPriorityChangedForVariable ( int  var_index)
overridevirtual

Reimplemented from MPSolverInterface.

Definition at line 785 of file gurobi_interface.cc.

◆ CheckSolutionExists()

bool CheckSolutionExists ( ) const
virtualinherited

Definition at line 1689 of file linear_solver.cc.

◆ CheckSolutionIsSynchronized()

bool CheckSolutionIsSynchronized ( ) const
inherited

Definition at line 1677 of file linear_solver.cc.

◆ CheckSolutionIsSynchronizedAndExists()

bool CheckSolutionIsSynchronizedAndExists ( ) const
inlineinherited

Definition at line 1635 of file linear_solver.h.

◆ ClearConstraint()

void ClearConstraint ( MPConstraint *const  constraint)
overridevirtual

Implements MPSolverInterface.

Definition at line 744 of file gurobi_interface.cc.

◆ ClearObjective()

void ClearObjective ( )
overridevirtual

Implements MPSolverInterface.

Definition at line 773 of file gurobi_interface.cc.

◆ column_status()

MPSolver::BasisStatus column_status ( int  variable_index) const
overridevirtual

Implements MPSolverInterface.

Definition at line 885 of file gurobi_interface.cc.

◆ ComputeExactConditionNumber()

double ComputeExactConditionNumber ( ) const
inlineoverridevirtual

Reimplemented from MPSolverInterface.

Definition at line 155 of file gurobi_interface.cc.

◆ constraint_is_extracted()

bool constraint_is_extracted ( int  ct_index) const
inlineinherited

Definition at line 1661 of file linear_solver.h.

◆ DirectlySolveProto()

absl::optional< MPSolutionResponse > DirectlySolveProto ( const MPModelRequest &  request)
overridevirtual

Reimplemented from MPSolverInterface.

Definition at line 1318 of file gurobi_interface.cc.

◆ ExtractModel()

void ExtractModel ( )
protectedinherited

Definition at line 1641 of file linear_solver.cc.

◆ ExtractNewConstraints()

void ExtractNewConstraints ( )
overridevirtual

Implements MPSolverInterface.

Definition at line 954 of file gurobi_interface.cc.

◆ ExtractNewVariables()

void ExtractNewVariables ( )
overridevirtual

Implements MPSolverInterface.

Definition at line 903 of file gurobi_interface.cc.

◆ ExtractObjective()

void ExtractObjective ( )
overridevirtual

Implements MPSolverInterface.

Definition at line 1021 of file gurobi_interface.cc.

◆ InterruptSolve()

bool InterruptSolve ( )
inlineoverridevirtual

Reimplemented from MPSolverInterface.

Definition at line 147 of file gurobi_interface.cc.

◆ InvalidateSolutionSynchronization()

void InvalidateSolutionSynchronization ( )
protectedinherited

Definition at line 1722 of file linear_solver.cc.

◆ IsContinuous()

bool IsContinuous ( ) const
inlineoverridevirtual

Implements MPSolverInterface.

Definition at line 132 of file gurobi_interface.cc.

◆ IsLP()

bool IsLP ( ) const
inlineoverridevirtual

Implements MPSolverInterface.

Definition at line 133 of file gurobi_interface.cc.

◆ IsMIP()

bool IsMIP ( ) const
inlineoverridevirtual

Implements MPSolverInterface.

Definition at line 134 of file gurobi_interface.cc.

◆ iterations()

int64 iterations ( ) const
overridevirtual

Implements MPSolverInterface.

Definition at line 791 of file gurobi_interface.cc.

◆ last_variable_index()

int last_variable_index ( ) const
inlineinherited

Definition at line 1653 of file linear_solver.h.

◆ NextSolution()

bool NextSolution ( )
overridevirtual

Reimplemented from MPSolverInterface.

Definition at line 1337 of file gurobi_interface.cc.

◆ nodes()

int64 nodes ( ) const
overridevirtual

Implements MPSolverInterface.

Definition at line 798 of file gurobi_interface.cc.

◆ objective_value()

double objective_value ( ) const
inherited

Definition at line 1699 of file linear_solver.cc.

◆ quiet()

bool quiet ( ) const
inlineinherited

Definition at line 1669 of file linear_solver.h.

◆ Reset()

void Reset ( )
overridevirtual

Implements MPSolverInterface.

Definition at line 626 of file gurobi_interface.cc.

◆ ResetExtractionInformation()

void ResetExtractionInformation ( )
protectedinherited

Definition at line 1669 of file linear_solver.cc.

◆ result_status()

MPSolver::ResultStatus result_status ( ) const
inlineinherited

Definition at line 1674 of file linear_solver.h.

◆ row_status()

MPSolver::BasisStatus row_status ( int  constraint_index) const
overridevirtual

Implements MPSolverInterface.

Definition at line 862 of file gurobi_interface.cc.

◆ set_constraint_as_extracted()

void set_constraint_as_extracted ( int  ct_index,
bool  extracted 
)
inlineinherited

Definition at line 1664 of file linear_solver.h.

◆ set_quiet()

void set_quiet ( bool  quiet_value)
inlineinherited

Definition at line 1671 of file linear_solver.h.

◆ set_variable_as_extracted()

void set_variable_as_extracted ( int  var_index,
bool  extracted 
)
inlineinherited

Definition at line 1658 of file linear_solver.h.

◆ SetCallback()

void SetCallback ( MPCallback mp_callback)
overridevirtual

Reimplemented from MPSolverInterface.

Definition at line 1386 of file gurobi_interface.cc.

◆ SetCoefficient()

void SetCoefficient ( MPConstraint *const  constraint,
const MPVariable *const  variable,
double  new_value,
double  old_value 
)
overridevirtual

Implements MPSolverInterface.

Definition at line 722 of file gurobi_interface.cc.

◆ SetCommonParameters()

void SetCommonParameters ( const MPSolverParameters param)
protectedinherited

Definition at line 1737 of file linear_solver.cc.

◆ SetConstraintBounds()

void SetConstraintBounds ( int  row_index,
double  lb,
double  ub 
)
overridevirtual

Implements MPSolverInterface.

Definition at line 693 of file gurobi_interface.cc.

◆ SetDoubleParamToUnsupportedValue()

void SetDoubleParamToUnsupportedValue ( MPSolverParameters::DoubleParam  param,
double  value 
)
protectedinherited

Definition at line 1773 of file linear_solver.cc.

◆ SetIntegerParamToUnsupportedValue()

void SetIntegerParamToUnsupportedValue ( MPSolverParameters::IntegerParam  param,
int  value 
)
protectedvirtualinherited

Definition at line 1778 of file linear_solver.cc.

◆ SetMIPParameters()

void SetMIPParameters ( const MPSolverParameters param)
protectedinherited

Definition at line 1758 of file linear_solver.cc.

◆ SetNumThreads()

absl::Status SetNumThreads ( int  num_threads)
protectedvirtualinherited

Reimplemented in SatInterface, and CBCInterface.

Definition at line 1784 of file linear_solver.cc.

◆ SetObjectiveCoefficient()

void SetObjectiveCoefficient ( const MPVariable *const  variable,
double  coefficient 
)
overridevirtual

Implements MPSolverInterface.

Definition at line 752 of file gurobi_interface.cc.

◆ SetObjectiveOffset()

void SetObjectiveOffset ( double  value)
overridevirtual

Implements MPSolverInterface.

Definition at line 764 of file gurobi_interface.cc.

◆ SetOptimizationDirection()

void SetOptimizationDirection ( bool  maximize)
overridevirtual

Implements MPSolverInterface.

Definition at line 660 of file gurobi_interface.cc.

◆ SetStartingLpBasis()

virtual void SetStartingLpBasis ( const std::vector< MPSolver::BasisStatus > &  variable_statuses,
const std::vector< MPSolver::BasisStatus > &  constraint_statuses 
)
inlinevirtualinherited

Reimplemented in GLOPInterface.

Definition at line 1690 of file linear_solver.h.

◆ SetUnsupportedDoubleParam()

void SetUnsupportedDoubleParam ( MPSolverParameters::DoubleParam  param)
protectedinherited

Definition at line 1765 of file linear_solver.cc.

◆ SetUnsupportedIntegerParam()

void SetUnsupportedIntegerParam ( MPSolverParameters::IntegerParam  param)
protectedvirtualinherited

Definition at line 1769 of file linear_solver.cc.

◆ SetVariableBounds()

void SetVariableBounds ( int  var_index,
double  lb,
double  ub 
)
overridevirtual

Implements MPSolverInterface.

Definition at line 665 of file gurobi_interface.cc.

◆ SetVariableInteger()

void SetVariableInteger ( int  var_index,
bool  integer 
)
overridevirtual

Implements MPSolverInterface.

Definition at line 677 of file gurobi_interface.cc.

◆ Solve()

MPSolver::ResultStatus Solve ( const MPSolverParameters param)
overridevirtual

Implements MPSolverInterface.

Definition at line 1144 of file gurobi_interface.cc.

◆ SolverVersion()

std::string SolverVersion ( ) const
inlineoverridevirtual

Implements MPSolverInterface.

Definition at line 140 of file gurobi_interface.cc.

◆ SupportsCallbacks()

bool SupportsCallbacks ( ) const
inlineoverridevirtual

Reimplemented from MPSolverInterface.

Definition at line 182 of file gurobi_interface.cc.

◆ underlying_solver()

void* underlying_solver ( )
inlineoverridevirtual

Implements MPSolverInterface.

Definition at line 153 of file gurobi_interface.cc.

◆ variable_is_extracted()

bool variable_is_extracted ( int  var_index) const
inlineinherited

Definition at line 1655 of file linear_solver.h.

◆ Write()

void Write ( const std::string &  filename)
overridevirtual

Reimplemented from MPSolverInterface.

Definition at line 1368 of file gurobi_interface.cc.

Member Data Documentation

◆ best_objective_bound_

double best_objective_bound_
protectedinherited

Definition at line 1733 of file linear_solver.h.

◆ kDummyVariableIndex

const int kDummyVariableIndex = 0
staticprotectedinherited

Definition at line 1740 of file linear_solver.h.

◆ kUnknownNumberOfIterations

constexpr int64 kUnknownNumberOfIterations = -1
staticconstexprinherited

Definition at line 1534 of file linear_solver.h.

◆ kUnknownNumberOfNodes

constexpr int64 kUnknownNumberOfNodes = -1
staticconstexprinherited

Definition at line 1537 of file linear_solver.h.

◆ last_constraint_index_

int last_constraint_index_
protectedinherited

Definition at line 1725 of file linear_solver.h.

◆ last_variable_index_

int last_variable_index_
protectedinherited

Definition at line 1727 of file linear_solver.h.

◆ maximize_

bool maximize_
protectedinherited

Definition at line 1722 of file linear_solver.h.

◆ objective_value_

double objective_value_
protectedinherited

Definition at line 1730 of file linear_solver.h.

◆ quiet_

bool quiet_
protectedinherited

Definition at line 1736 of file linear_solver.h.

◆ result_status_

MPSolver::ResultStatus result_status_
protectedinherited

Definition at line 1720 of file linear_solver.h.

◆ solver_

MPSolver* const solver_
protectedinherited

Definition at line 1715 of file linear_solver.h.

◆ sync_status_

SynchronizationStatus sync_status_
protectedinherited

Definition at line 1717 of file linear_solver.h.


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