Class Solver

    • Constructor Summary

      Constructors 
      Constructor Description
      Solver()  
    • Method Summary

      Modifier and Type Method Description
      static Solver getDefaultGeneralSolver()
      Returns the default solver for non-linear (general) optimization problems.
      static Solver getDefaultIntegerLinearSolver()
      Returns the default solver for integer linear optimization problems.
      static Solver getDefaultLinearSolver()
      Returns the default solver for linear optimization problems.

      If a default solver for linear problems has been configured this solver is returned by this method.
      static boolean hasDefaultGeneralSolver()
      Returns "true" if a default solver for general optimization problems is configured.
      static boolean hasDefaultIntegerLinearSolver()
      Returns "true" if a default solver for integer linear optimization problems is configured.
      static boolean hasDefaultLinearSolver()
      Returns "true" if a default solver for linear optimization problems is configured.
      static boolean isInstalled()
      Checks whether the solver of this class is actually installed, i.e.
      static void setDefaultGeneralSolver​(Solver solver)
      Sets the default solver for non-linear (general) optimization problems.
      static void setDefaultIntegerLinearSolver​(Solver solver)
      Sets the default solver for integer linear optimization problems.
      static void setDefaultLinearSolver​(Solver solver)
      Sets the default solver for linear optimization problems.
      abstract java.util.Map<Variable,​Term> solve​(ConstraintSatisfactionProblem problem)
      Computes a solution to the given constraint satisfaction or optimization problem, i.e.
      • Methods inherited from class java.lang.Object

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

      • Solver

        public Solver()
    • Method Detail

      • setDefaultGeneralSolver

        public static void setDefaultGeneralSolver​(Solver solver)
        Sets the default solver for non-linear (general) optimization problems.
        Parameters:
        solver - some solver
      • setDefaultLinearSolver

        public static void setDefaultLinearSolver​(Solver solver)
        Sets the default solver for linear optimization problems.
        Parameters:
        solver - some solver
      • setDefaultIntegerLinearSolver

        public static void setDefaultIntegerLinearSolver​(Solver solver)
        Sets the default solver for integer linear optimization problems.
        Parameters:
        solver - some solver
      • hasDefaultGeneralSolver

        public static boolean hasDefaultGeneralSolver()
        Returns "true" if a default solver for general optimization problems is configured.
        Returns:
        "true" if a default solver for general optimization problems is configured.
      • hasDefaultLinearSolver

        public static boolean hasDefaultLinearSolver()
        Returns "true" if a default solver for linear optimization problems is configured.
        Returns:
        "true" if a default solver for linear optimization problems is configured.
      • hasDefaultIntegerLinearSolver

        public static boolean hasDefaultIntegerLinearSolver()
        Returns "true" if a default solver for integer linear optimization problems is configured.
        Returns:
        "true" if a default solver for integer linear optimization problems is configured.
      • getDefaultGeneralSolver

        public static Solver getDefaultGeneralSolver()
        Returns the default solver for non-linear (general) optimization problems. If a default solver for general problems has been configured this solver is returned by this method. If no default solver for general problems is configured, a message is printed to stderr pointing out that no default solver is configured and the application is terminated.
        Returns:
        the default solver for non-linear (general) optimization problems.
      • getDefaultIntegerLinearSolver

        public static Solver getDefaultIntegerLinearSolver()
        Returns the default solver for integer linear optimization problems. If a default solver for general problems has been configured this solver is returned by this method. If no default solver for general problems is configured, a message is printed to stderr pointing out that no default solver is configured and the application is terminated.
        Returns:
        the default solver for non-linear (general) optimization problems.
      • getDefaultLinearSolver

        public static Solver getDefaultLinearSolver()
        Returns the default solver for linear optimization problems.

        If a default solver for linear problems has been configured this solver is returned by this method. If no default solver for linear problems is configured, the default solver for general optimization problems is returned. If this one is not defined as well, the ApacheCommonsSimplex solver (net.sf.tweety.math.opt.solver.ApacheCommonsSimplex) is returned (with a default setting of 50000 number of iterations that returns both positive and non-positive results) as a fallback and message is printed to stderr pointing out that no default solver is configured.
        Returns:
        the default solver for linear optimization problems.
      • solve

        public abstract java.util.Map<Variable,​Term> solve​(ConstraintSatisfactionProblem problem)
                                                          throws GeneralMathException
        Computes a solution to the given constraint satisfaction or optimization problem, i.e. a mapping from variables of the problem to terms.
        Parameters:
        problem - the actual problem
        Returns:
        a mapping from variables of the problem to terms.
        Throws:
        GeneralMathException - if something went wrong.
      • isInstalled

        public static boolean isInstalled()
                                   throws java.lang.UnsupportedOperationException
        Checks whether the solver of this class is actually installed, i.e. whether external binaries needed for running the solver are available and dependencies are satisfied.
        Returns:
        "true" if the solver of this class is installed and can therefore be instantiated and used.
        Throws:
        java.lang.UnsupportedOperationException - if the operation is not supported