Package com.google.ortools.linearsolver
Class MPSolverParameters
- java.lang.Object
-
- com.google.ortools.linearsolver.MPSolverParameters
-
public class MPSolverParameters extends java.lang.ObjectThis 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMPSolverParameters.DoubleParamEnumeration of parameters that take continuous values.static classMPSolverParameters.IncrementalityValuesAdvanced usage: Incrementality options.static classMPSolverParameters.IntegerParamEnumeration of parameters that take integer or categorical values.static classMPSolverParameters.LpAlgorithmValuesLP algorithm to use.static classMPSolverParameters.PresolveValuesFor each categorical parameter, enumeration of possible values.static classMPSolverParameters.ScalingValuesAdvanced usage: Scaling options.
-
Field Summary
Fields Modifier and Type Field Description protected booleanswigCMemOwn
-
Constructor Summary
Constructors Modifier Constructor Description MPSolverParameters()The constructor sets all parameters to their default value.protectedMPSolverParameters(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()protected voidfinalize()protected static longgetCPtr(MPSolverParameters obj)doublegetDoubleParam(MPSolverParameters.DoubleParam param)Returns the value of a double parameter.intgetIntegerParam(MPSolverParameters.IntegerParam param)Returns the value of an integer parameter.static doublegetKDefaultDualTolerance()static MPSolverParameters.IncrementalityValuesgetKDefaultIncrementality()static MPSolverParameters.PresolveValuesgetKDefaultPresolve()static doublegetKDefaultPrimalTolerance()static doublegetKDefaultRelativeMipGap()voidsetDoubleParam(MPSolverParameters.DoubleParam param, double value)Sets a double parameter to a specific value.voidsetIntegerParam(MPSolverParameters.IntegerParam param, int value)Sets a integer parameter to a specific value.protected static longswigRelease(MPSolverParameters obj)
-
-
-
Method Detail
-
getCPtr
protected static long getCPtr(MPSolverParameters obj)
-
swigRelease
protected static long swigRelease(MPSolverParameters obj)
-
finalize
protected void finalize()
- Overrides:
finalizein classjava.lang.Object
-
delete
public void delete()
-
getKDefaultRelativeMipGap
public static double getKDefaultRelativeMipGap()
-
getKDefaultPrimalTolerance
public static double getKDefaultPrimalTolerance()
-
getKDefaultDualTolerance
public static double getKDefaultDualTolerance()
-
getKDefaultPresolve
public static MPSolverParameters.PresolveValues getKDefaultPresolve()
-
getKDefaultIncrementality
public static MPSolverParameters.IncrementalityValues getKDefaultIncrementality()
-
setDoubleParam
public void setDoubleParam(MPSolverParameters.DoubleParam param, double value)
Sets a double parameter to a specific value.
-
setIntegerParam
public void setIntegerParam(MPSolverParameters.IntegerParam param, int value)
Sets a integer parameter to a specific value.
-
getDoubleParam
public double getDoubleParam(MPSolverParameters.DoubleParam param)
Returns the value of a double parameter.
-
getIntegerParam
public int getIntegerParam(MPSolverParameters.IntegerParam param)
Returns the value of an integer parameter.
-
-