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

#include <linear_solver.h>

Public Types

enum  DoubleParam { RELATIVE_MIP_GAP = 0 , PRIMAL_TOLERANCE = 1 , DUAL_TOLERANCE = 2 }
 Enumeration of parameters that take continuous values. More...
 
enum  IntegerParam { PRESOLVE = 1000 , LP_ALGORITHM = 1001 , INCREMENTALITY = 1002 , SCALING = 1003 }
 Enumeration of parameters that take integer or categorical values. More...
 
enum  PresolveValues { PRESOLVE_OFF = 0 , PRESOLVE_ON = 1 }
 For each categorical parameter, enumeration of possible values. More...
 
enum  LpAlgorithmValues { DUAL = 10 , PRIMAL = 11 , BARRIER = 12 }
 LP algorithm to use. More...
 
enum  IncrementalityValues { INCREMENTALITY_OFF = 0 , INCREMENTALITY_ON = 1 }
 Advanced usage: Incrementality options. More...
 
enum  ScalingValues { SCALING_OFF = 0 , SCALING_ON = 1 }
 Advanced usage: Scaling options. More...
 

Public Member Functions

 MPSolverParameters ()
 The constructor sets all parameters to their default value.
 
 MPSolverParameters (const MPSolverParameters &)=delete
 This type is neither copyable nor movable.
 
MPSolverParametersoperator= (const MPSolverParameters &)=delete
 
void SetDoubleParam (MPSolverParameters::DoubleParam param, double value)
 Sets a double parameter to a specific value.
 
void SetIntegerParam (MPSolverParameters::IntegerParam param, int value)
 Sets a integer parameter to a specific value.
 
void ResetDoubleParam (MPSolverParameters::DoubleParam param)
 
void ResetIntegerParam (MPSolverParameters::IntegerParam param)
 
void Reset ()
 Sets all parameters to their default value.
 
double GetDoubleParam (MPSolverParameters::DoubleParam param) const
 Returns the value of a double parameter.
 
int GetIntegerParam (MPSolverParameters::IntegerParam param) const
 Returns the value of an integer parameter.
 

Static Public Attributes

static const double kDefaultDoubleParamValue = -1.0
 
static const int kDefaultIntegerParamValue = -1
 
static const double kUnknownDoubleParamValue = -2.0
 Placeholder value to indicate that a parameter is unknown.
 
static const int kUnknownIntegerParamValue = -2
 
static const double kDefaultRelativeMipGap = 1e-4
 -------— MPSolverParameters -------—
 
static const double kDefaultPrimalTolerance
 For the primal and dual tolerances, choose the same default as CLP and GLPK.
 
static const double kDefaultDualTolerance = 1e-7
 
static const PresolveValues kDefaultPresolve
 
static const IncrementalityValues kDefaultIncrementality
 

Detailed Description

This class stores parameter settings for LP and MIP solvers. Some parameters are marked as advanced: do not change their values unless you know what you are doing!

For developers: how to add a new parameter:

  • Add the new Foo parameter in the DoubleParam or IntegerParam enum.
  • If it is a categorical param, add a FooValues enum.
  • Decide if the wrapper should define a default value for it: yes if it controls the properties of the solution (example: tolerances) or if it consistently improves performance, no otherwise. If yes, define kDefaultFoo.
  • Add a foo_value_ member and, if no default value is defined, a foo_is_default_ member.
  • Add code to handle Foo in Set...Param, Reset...Param, Get...Param, Reset and the constructor.
  • In class MPSolverInterface, add a virtual method SetFoo, add it to SetCommonParameters or SetMIPParameters, and implement it for each solver. Sometimes, parameters need to be implemented differently, see for example the INCREMENTALITY implementation.
  • Add a test in linear_solver_test.cc.

TODO(user): store the parameter values in a protocol buffer instead. We need to figure out how to deal with the subtleties of the default values.

Definition at line 1474 of file linear_solver.h.

Member Enumeration Documentation

◆ DoubleParam

Enumeration of parameters that take continuous values.

Enumerator
RELATIVE_MIP_GAP 

Limit for relative MIP gap.

PRIMAL_TOLERANCE 

Advanced usage: tolerance for primal feasibility of basic solutions.

This does not control the integer feasibility tolerance of integer solutions for MIP or the tolerance used during presolve.

DUAL_TOLERANCE 

Advanced usage: tolerance for dual feasibility of basic solutions.

Definition at line 1477 of file linear_solver.h.

◆ IncrementalityValues

Advanced usage: Incrementality options.

Enumerator
INCREMENTALITY_OFF 

Start solve from scratch.

INCREMENTALITY_ON 

Reuse results from previous solve as much as the underlying solver allows.

Definition at line 1523 of file linear_solver.h.

◆ IntegerParam

Enumeration of parameters that take integer or categorical values.

Enumerator
PRESOLVE 

Advanced usage: presolve mode.

LP_ALGORITHM 

Algorithm to solve linear programs.

INCREMENTALITY 

Advanced usage: incrementality from one solve to the next.

SCALING 

Advanced usage: enable or disable matrix scaling.

Definition at line 1493 of file linear_solver.h.

◆ LpAlgorithmValues

LP algorithm to use.

Enumerator
DUAL 

Dual simplex.

PRIMAL 

Primal simplex.

BARRIER 

Barrier algorithm.

Definition at line 1513 of file linear_solver.h.

◆ PresolveValues

For each categorical parameter, enumeration of possible values.

Enumerator
PRESOLVE_OFF 

Presolve is off.

PRESOLVE_ON 

Presolve is on.

Definition at line 1505 of file linear_solver.h.

◆ ScalingValues

Advanced usage: Scaling options.

Enumerator
SCALING_OFF 

Scaling is off.

SCALING_ON 

Scaling is on.

Definition at line 1535 of file linear_solver.h.

Constructor & Destructor Documentation

◆ MPSolverParameters() [1/2]

operations_research::MPSolverParameters::MPSolverParameters ( )

The constructor sets all parameters to their default value.

Definition at line 2153 of file linear_solver.cc.

◆ MPSolverParameters() [2/2]

operations_research::MPSolverParameters::MPSolverParameters ( const MPSolverParameters & )
delete

This type is neither copyable nor movable.

Member Function Documentation

◆ GetDoubleParam()

double operations_research::MPSolverParameters::GetDoubleParam ( MPSolverParameters::DoubleParam param) const

Returns the value of a double parameter.

Definition at line 2282 of file linear_solver.cc.

◆ GetIntegerParam()

int operations_research::MPSolverParameters::GetIntegerParam ( MPSolverParameters::IntegerParam param) const

Returns the value of an integer parameter.

Definition at line 2301 of file linear_solver.cc.

◆ operator=()

MPSolverParameters & operations_research::MPSolverParameters::operator= ( const MPSolverParameters & )
delete

◆ Reset()

void operations_research::MPSolverParameters::Reset ( )

Sets all parameters to their default value.

Definition at line 2272 of file linear_solver.cc.

◆ ResetDoubleParam()

void operations_research::MPSolverParameters::ResetDoubleParam ( MPSolverParameters::DoubleParam param)

Sets a double parameter to its default value (default value defined in MPSolverParameters if it exists, otherwise the default value defined in the underlying solver).

Definition at line 2226 of file linear_solver.cc.

◆ ResetIntegerParam()

void operations_research::MPSolverParameters::ResetIntegerParam ( MPSolverParameters::IntegerParam param)

Sets an integer parameter to its default value (default value defined in MPSolverParameters if it exists, otherwise the default value defined in the underlying solver).

Definition at line 2247 of file linear_solver.cc.

◆ SetDoubleParam()

void operations_research::MPSolverParameters::SetDoubleParam ( MPSolverParameters::DoubleParam param,
double value )

Sets a double parameter to a specific value.

Definition at line 2163 of file linear_solver.cc.

◆ SetIntegerParam()

void operations_research::MPSolverParameters::SetIntegerParam ( MPSolverParameters::IntegerParam param,
int value )

Sets a integer parameter to a specific value.

Definition at line 2184 of file linear_solver.cc.

Member Data Documentation

◆ kDefaultDoubleParamValue

const double operations_research::MPSolverParameters::kDefaultDoubleParamValue = -1.0
static

Placeholder value to indicate that a parameter is set to the default value defined in the wrapper.

Definition at line 1544 of file linear_solver.h.

◆ kDefaultDualTolerance

const double operations_research::MPSolverParameters::kDefaultDualTolerance = 1e-7
static

Definition at line 1558 of file linear_solver.h.

◆ kDefaultIncrementality

const MPSolverParameters::IncrementalityValues operations_research::MPSolverParameters::kDefaultIncrementality
static

◆ kDefaultIntegerParamValue

const int operations_research::MPSolverParameters::kDefaultIntegerParamValue = -1
static

Definition at line 1545 of file linear_solver.h.

◆ kDefaultPresolve

const MPSolverParameters::PresolveValues operations_research::MPSolverParameters::kDefaultPresolve
static
Initial value:

Definition at line 1559 of file linear_solver.h.

◆ kDefaultPrimalTolerance

const double operations_research::MPSolverParameters::kDefaultPrimalTolerance
static
Initial value:

For the primal and dual tolerances, choose the same default as CLP and GLPK.

Definition at line 1557 of file linear_solver.h.

◆ kDefaultRelativeMipGap

const double operations_research::MPSolverParameters::kDefaultRelativeMipGap = 1e-4
static

-------— MPSolverParameters -------—

Default values for parameters. Only parameters that define the properties of the solution returned need to have a default value (that is the same for all solvers). You can also define a default value for performance parameters when you are confident it is a good choice (example: always turn presolve on).

Definition at line 1556 of file linear_solver.h.

◆ kUnknownDoubleParamValue

const double operations_research::MPSolverParameters::kUnknownDoubleParamValue = -2.0
static

Placeholder value to indicate that a parameter is unknown.

Definition at line 1548 of file linear_solver.h.

◆ kUnknownIntegerParamValue

const int operations_research::MPSolverParameters::kUnknownIntegerParamValue = -2
static

Definition at line 1549 of file linear_solver.h.


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