C++ Reference
C++ Reference: Linear solver
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 1321 of file 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. More... | |
void | SetDoubleParam (MPSolverParameters::DoubleParam param, double value) |
Sets a double parameter to a specific value. More... | |
void | SetIntegerParam (MPSolverParameters::IntegerParam param, int value) |
Sets a integer parameter to a specific value. More... | |
void | 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). More... | |
void | 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). More... | |
void | Reset () |
Sets all parameters to their default value. More... | |
double | GetDoubleParam (MPSolverParameters::DoubleParam param) const |
Returns the value of a double parameter. More... | |
int | GetIntegerParam (MPSolverParameters::IntegerParam param) const |
Returns the value of an integer parameter. More... | |
Static Public Attributes | |
static const double | kDefaultDoubleParamValue |
static const int | kDefaultIntegerParamValue |
static const double | kUnknownDoubleParamValue |
static const int | kUnknownIntegerParamValue |
static const double | kDefaultRelativeMipGap |
static const double | kDefaultPrimalTolerance |
static const double | kDefaultDualTolerance |
static const PresolveValues | kDefaultPresolve |
static const IncrementalityValues | kDefaultIncrementality |
Member Enumeration Documentation
◆ DoubleParam
enum DoubleParam |
Enumeration of parameters that take continuous values.
Definition at line 1324 of file linear_solver.h.
◆ IncrementalityValues
enum 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 1370 of file linear_solver.h.
◆ IntegerParam
enum IntegerParam |
Enumeration of parameters that take integer or categorical values.
Definition at line 1340 of file linear_solver.h.
◆ LpAlgorithmValues
enum LpAlgorithmValues |
LP algorithm to use.
Enumerator | |
---|---|
DUAL | Dual simplex. |
PRIMAL | Primal simplex. |
BARRIER | Barrier algorithm. |
Definition at line 1360 of file linear_solver.h.
◆ PresolveValues
enum PresolveValues |
For each categorical parameter, enumeration of possible values.
Enumerator | |
---|---|
PRESOLVE_OFF | Presolve is off. |
PRESOLVE_ON | Presolve is on. |
Definition at line 1352 of file linear_solver.h.
◆ ScalingValues
enum ScalingValues |
Advanced usage: Scaling options.
Enumerator | |
---|---|
SCALING_OFF | Scaling is off. |
SCALING_ON | Scaling is on. |
Definition at line 1382 of file linear_solver.h.
Constructor & Destructor Documentation
◆ MPSolverParameters()
The constructor sets all parameters to their default value.
Member Function Documentation
◆ GetDoubleParam()
double GetDoubleParam | ( | MPSolverParameters::DoubleParam | param | ) | const |
Returns the value of a double parameter.
◆ GetIntegerParam()
int GetIntegerParam | ( | MPSolverParameters::IntegerParam | param | ) | const |
Returns the value of an integer parameter.
◆ Reset()
void Reset | ( | ) |
Sets all parameters to their default value.
◆ ResetDoubleParam()
void 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).
◆ ResetIntegerParam()
void 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).
◆ SetDoubleParam()
void SetDoubleParam | ( | MPSolverParameters::DoubleParam | param, |
double | value | ||
) |
Sets a double parameter to a specific value.
◆ SetIntegerParam()
void SetIntegerParam | ( | MPSolverParameters::IntegerParam | param, |
int | value | ||
) |
Sets a integer parameter to a specific value.
Member Data Documentation
◆ kDefaultDoubleParamValue
|
static |
Definition at line 1391 of file linear_solver.h.
◆ kDefaultDualTolerance
|
static |
Definition at line 1405 of file linear_solver.h.
◆ kDefaultIncrementality
|
static |
Definition at line 1407 of file linear_solver.h.
◆ kDefaultIntegerParamValue
|
static |
Definition at line 1392 of file linear_solver.h.
◆ kDefaultPresolve
|
static |
Definition at line 1406 of file linear_solver.h.
◆ kDefaultPrimalTolerance
|
static |
Definition at line 1404 of file linear_solver.h.
◆ kDefaultRelativeMipGap
|
static |
Definition at line 1403 of file linear_solver.h.
◆ kUnknownDoubleParamValue
|
static |
Definition at line 1395 of file linear_solver.h.
◆ kUnknownIntegerParamValue
|
static |
Definition at line 1396 of file linear_solver.h.
The documentation for this class was generated from the following file: