Class ClingoSolver

    • Constructor Summary

      Constructors 
      Constructor Description
      ClingoSolver​(java.lang.String path2clingo)
      Constructs a new instance pointing to specific a Clingo solver.
      ClingoSolver​(java.lang.String path2clingo, Shell bash)
      Constructs a new instance pointing to a specific Clingo solver.
    • Method Summary

      Modifier and Type Method Description
      AnswerSet getModel​(Program p)
      Returns a single (dedicated) model of the given belief base.
      java.util.List<AnswerSet> getModels​(java.io.File file)
      Returns a characterizing model (answer set) of the given belief base.
      java.util.List<AnswerSet> getModels​(java.lang.String s)
      Returns a characterizing model (answer set) of the given belief base.
      java.util.List<AnswerSet> getModels​(Program p)
      Returns a characterizing model of the given belief base
      java.util.List<java.lang.Integer> getOptimum​(Program p)
      Computes the optimum of a program that contains optimization statements, if there is one.
      java.lang.String getOptimumString()
      Returns the optimum of the previously solved program, if there is one.
      java.lang.Boolean query​(Program beliefbase, ASPLiteral formula)
      Queries the given belief base for the given formula.
      java.lang.Boolean query​(Program beliefbase, ASPLiteral formula, InferenceMode inferenceMode)  
      void setOptions​(java.lang.String options)
      Set the command line options for Clingo.
      void setPathToDLV​(java.lang.String path)
      Sets the location of the Clingo solver on the hard drive.
      void toggleOutputWhitelist​(boolean b)
      Activates or deactivates the option to use a whitelist of predicates.
      • Methods inherited from class java.lang.Object

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

      • ClingoSolver

        public ClingoSolver​(java.lang.String path2clingo,
                            Shell bash)
        Constructs a new instance pointing to a specific Clingo solver.
        Parameters:
        path2clingo - binary location of Clingo on the hard drive
        bash - shell to run commands
      • ClingoSolver

        public ClingoSolver​(java.lang.String path2clingo)
        Constructs a new instance pointing to specific a Clingo solver.
        Parameters:
        path2clingo - binary location of Clingo on the hard drive
    • Method Detail

      • getOptimumString

        public java.lang.String getOptimumString()
                                          throws SolverException
        Returns the optimum of the previously solved program, if there is one.
        Returns:
        optimum of previously solved program in string format, i.e. numbers separated by spaces
        Throws:
        SolverException
      • getOptimum

        public java.util.List<java.lang.Integer> getOptimum​(Program p)
        Computes the optimum of a program that contains optimization statements, if there is one. Note: This methods calculates only the optimum and returns no answer sets.
        Parameters:
        p - ASP program
        Returns:
        list of calculated optima
      • getModels

        public java.util.List<AnswerSet> getModels​(java.lang.String s)
        Description copied from class: ASPSolver
        Returns a characterizing model (answer set) of the given belief base.
        Specified by:
        getModels in class ASPSolver
        Parameters:
        s - containing belief base
        Returns:
        AnswerSet
      • getModels

        public java.util.List<AnswerSet> getModels​(java.io.File file)
        Description copied from class: ASPSolver
        Returns a characterizing model (answer set) of the given belief base.
        Specified by:
        getModels in class ASPSolver
        Parameters:
        file - containing belief base
        Returns:
        AnswerSet
      • getModel

        public AnswerSet getModel​(Program p)
        Description copied from interface: ModelProvider
        Returns a single (dedicated) model of the given belief base. If the implemented method allows for more than one dedicated model, the selection may be non-deterministic.
        Parameters:
        p - some belief base
        Returns:
        a selected model of the belief base.
      • toggleOutputWhitelist

        public void toggleOutputWhitelist​(boolean b)
        Activates or deactivates the option to use a whitelist of predicates. If activated, answer sets will only contain atoms over predicates that are part of the whitelist. This corresponds to the #show statement of the clingo input language.
        Parameters:
        b - whether to use a whitelist of predicate
      • setOptions

        public void setOptions​(java.lang.String options)
        Set the command line options for Clingo.
        Parameters:
        options - a string of options in the correct format, e.g. in the form "--opt" and separated by spaces
      • setPathToDLV

        public void setPathToDLV​(java.lang.String path)
        Sets the location of the Clingo solver on the hard drive.
        Parameters:
        path - path to Clingo