Class MPSolverParameters
java.lang.Object
com.google.ortools.linearsolver.MPSolverParameters
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.
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration of parameters that take continuous values.static enum
Advanced usage: Incrementality options.static enum
Enumeration of parameters that take integer or categorical values.static enum
LP algorithm to use.static enum
For each categorical parameter, enumeration of possible values.static enum
Advanced usage: Scaling options. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionThe constructor sets all parameters to their default value.protected
MPSolverParameters
(long cPtr, boolean cMemoryOwn) -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
protected void
finalize()
protected static long
double
Returns the value of a double parameter.int
Returns the value of an integer parameter.static double
static double
static double
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.protected static long
-
Field Details
-
swigCMemOwn
protected transient boolean swigCMemOwn
-
-
Constructor Details
-
MPSolverParameters
protected MPSolverParameters(long cPtr, boolean cMemoryOwn) -
MPSolverParameters
public MPSolverParameters()The constructor sets all parameters to their default value.
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
-
delete
public void delete() -
getKDefaultRelativeMipGap
public static double getKDefaultRelativeMipGap() -
getKDefaultPrimalTolerance
public static double getKDefaultPrimalTolerance() -
getKDefaultDualTolerance
public static double getKDefaultDualTolerance() -
getKDefaultPresolve
-
getKDefaultIncrementality
-
setDoubleParam
Sets a double parameter to a specific value. -
setIntegerParam
Sets a integer parameter to a specific value. -
getDoubleParam
Returns the value of a double parameter. -
getIntegerParam
Returns the value of an integer parameter.
-