Class ModelSolver


  • public final class ModelSolver
    extends java.lang.Object
    Model 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
      void enableOutput​(boolean enable)
      Enables or disables the underlying solver output.
      double getActivity​(LinearConstraint ct)
      Checks that the solver has found a solution, and returns the activity of the given constraint.
      double getBestObjectiveBound()
      Checks that the solver has found a solution, and returns the objective value.
      double getDualValue​(LinearConstraint ct)
      Checks that the solver has found a solution, and returns the dual value of the given constraint.
      double getObjectiveValue()
      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 getUserTime()
      Returns the user time since the creation of the solver.
      double getValue​(Variable var)
      Checks that the solver has found a solution, and returns the value of the given variable.
      double getWallTime()
      Returns the elapsed time since the creation of the solver.
      boolean hasResponse()
      Returns true if solve() was called, and a response was returned.
      boolean hasSolution()
      Returns true if solve() was called, and a solution was returned.
      boolean interruptSolve()
      Tries to interrupt the solve.
      void setLogCallback​(java.util.function.Consumer<java.lang.String> cb)
      Sets the log callback for the solver.
      void setSolverSpecificParameters​(java.lang.String parameters)
      Sets solver specific parameters as string.
      void setTimeLimit​(java.time.Duration limit)
      Sets the time limit for the solve in seconds.
      SolveStatus solve​(ModelBuilder model)
      Solves given model, and returns the status of the response.
      boolean solverIsSupported()
      Returns whether solver specified during the ctor was found and correctly installed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModelSolver

        public ModelSolver​(java.lang.String solverName)
        Creates the solver with the supplied solver backend.
    • 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.