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 TypeMethodDescriptionvoidenableOutput(boolean enable) Enables or disables the underlying solver output.doubleChecks that the solver has found a solution, and returns the activity of the given constraint.doubleChecks that the solver has found a solution, and returns the objective value.doubleChecks that the solver has found a solution, and returns the dual value of the given constraint.doubleChecks 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.doubleReturns the user time since the creation of the solver.doubleChecks that the solver has found a solution, and returns the value of the given variable.doubleReturns the elapsed time since the creation of the solver.booleanReturns true if solve() was called, and a response was returned.booleanReturns true if solve() was called, and a solution was returned.booleanTries to interrupt the solve.voidsetLogCallback(Consumer<String> cb) Sets the log callback for the solver.voidsetSolverSpecificParameters(String parameters) Sets solver specific parameters as string.voidsetTimeLimit(Duration limit) Sets the time limit for the solve in seconds.solve(ModelBuilder model) Solves given model, and returns the status of the response.booleanReturns 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.
-