Class ModelSolver
java.lang.Object
com.google.ortools.modelbuilder.ModelSolver
Model solver class
-
Constructor Summary
ConstructorsConstructorDescriptionModelSolver
(String solverName) Creates the solver with the supplied solver backend. -
Method Summary
Modifier and TypeMethodDescriptionvoid
enableOutput
(boolean enable) Enables or disables the underlying solver output.double
Checks that the solver has found a solution, and returns the activity of the given constraint.double
Checks that the solver has found a solution, and returns the objective value.double
Checks that the solver has found a solution, and returns the dual value of the given constraint.double
Checks that the solver has found a solution, and returns the objective value.double
getReducedCost
(Variable var) Checks that the solver has found a solution, and returns the reduced cost of the given variable.double
Returns the user time since the creation of the solver.double
Checks that the solver has found a solution, and returns the value of the given variable.double
Returns the elapsed time since the creation of the solver.boolean
Returns true if solve() was called, and a response was returned.boolean
Returns true if solve() was called, and a solution was returned.boolean
Tries to interrupt the solve.void
setLogCallback
(Consumer<String> cb) Sets the log callback for the solver.void
setSolverSpecificParameters
(String parameters) Sets solver specific parameters as string.void
setTimeLimit
(Duration limit) Sets the time limit for the solve in seconds.solve
(ModelBuilder model) Solves given model, and returns the status of the response.boolean
Returns whether solver specified during the ctor was found and correctly installed.
-
Constructor Details
-
ModelSolver
Creates the solver with the supplied solver backend.
-
-
Method Details
-
solve
Solves given model, and returns the status of the response. -
enableOutput
public void enableOutput(boolean enable) Enables or disables the underlying solver output. -
setTimeLimit
Sets the time limit for the solve in seconds. -
setSolverSpecificParameters
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
Checks that the solver has found a solution, and returns the value of the given variable. -
getReducedCost
Checks that the solver has found a solution, and returns the reduced cost of the given variable. -
getDualValue
Checks that the solver has found a solution, and returns the dual value of the given constraint. -
getActivity
Checks that the solver has found a solution, and returns the activity of the given constraint. -
setLogCallback
-
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.
-