Class MPSolverParameters

java.lang.Object
com.google.ortools.linearsolver.MPSolverParameters

public class MPSolverParameters
extends java.lang.Object
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.
  • 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

      protected static long getCPtr​(MPSolverParameters obj)
    • finalize

      protected void finalize()
      Overrides:
      finalize in class java.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.