Package com.google.ortools.modelbuilder
Class ModelSolver
- java.lang.Object
-
- com.google.ortools.modelbuilder.ModelSolver
-
public final class ModelSolver extends java.lang.ObjectModel solver class
-
-
Constructor Summary
Constructors Constructor Description ModelSolver(java.lang.String solverName)Creates the solver with the supplied solver backend.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidenableOutput(boolean enable)Enables or disables the underlying solver output.doublegetActivity(LinearConstraint ct)Checks that the solver has found a solution, and returns the activity of the given constraint.doublegetBestObjectiveBound()Checks that the solver has found a solution, and returns the objective value.doublegetDualValue(LinearConstraint ct)Checks that the solver has found a solution, and returns the dual value of the given constraint.doublegetObjectiveValue()Checks that the solver has found a solution, and returns the objective value.doublegetReducedCost(Variable var)Checks that the solver has found a solution, and returns the reduced cost of the given variable.doublegetUserTime()Returns the user time since the creation of the solver.doublegetValue(Variable var)Checks that the solver has found a solution, and returns the value of the given variable.doublegetWallTime()Returns the elapsed time since the creation of the solver.booleanhasResponse()Returns true if solve() was called, and a response was returned.booleanhasSolution()Returns true if solve() was called, and a solution was returned.booleaninterruptSolve()Tries to interrupt the solve.voidsetLogCallback(java.util.function.Consumer<java.lang.String> cb)Sets the log callback for the solver.voidsetSolverSpecificParameters(java.lang.String parameters)Sets solver specific parameters as string.voidsetTimeLimit(java.time.Duration limit)Sets the time limit for the solve in seconds.SolveStatussolve(ModelBuilder model)Solves given model, and returns the status of the response.booleansolverIsSupported()Returns whether solver specified during the ctor was found and correctly installed.
-
-
-
Method Detail
-
solve
public SolveStatus solve(ModelBuilder model)
Solves given model, and returns the status of the response.
-
enableOutput
public void enableOutput(boolean enable)
Enables or disables the underlying solver output.
-
setTimeLimit
public void setTimeLimit(java.time.Duration limit)
Sets the time limit for the solve in seconds.
-
setSolverSpecificParameters
public void setSolverSpecificParameters(java.lang.String parameters)
Sets solver specific parameters as string.
-
solverIsSupported
public boolean solverIsSupported()
Returns whether solver specified during the ctor was found and correctly installed.
-
interruptSolve
public boolean interruptSolve()
Tries to interrupt the solve. Returns true if the feature is supported.
-
hasResponse
public boolean hasResponse()
Returns true if solve() was called, and a response was returned.
-
hasSolution
public boolean hasSolution()
Returns true if solve() was called, and a solution was returned.
-
getObjectiveValue
public double getObjectiveValue()
Checks that the solver has found a solution, and returns the objective value.
-
getBestObjectiveBound
public double getBestObjectiveBound()
Checks that the solver has found a solution, and returns the objective value.
-
getValue
public double getValue(Variable var)
Checks that the solver has found a solution, and returns the value of the given variable.
-
getReducedCost
public double getReducedCost(Variable var)
Checks that the solver has found a solution, and returns the reduced cost of the given variable.
-
getDualValue
public double getDualValue(LinearConstraint ct)
Checks that the solver has found a solution, and returns the dual value of the given constraint.
-
getActivity
public double getActivity(LinearConstraint ct)
Checks that the solver has found a solution, and returns the activity of the given constraint.
-
setLogCallback
public void setLogCallback(java.util.function.Consumer<java.lang.String> cb)
Sets the log callback for the solver.
-
getWallTime
public double getWallTime()
Returns the elapsed time since the creation of the solver.
-
getUserTime
public double getUserTime()
Returns the user time since the creation of the solver.
-
-