Class ClingoSolver

  • All Implemented Interfaces:
    net.sf.tweety.commons.ModelProvider<ASPRule,​Program,​AnswerSet>, net.sf.tweety.commons.QualitativeReasoner<Program,​ASPLiteral>, net.sf.tweety.commons.Reasoner<Boolean,​Program,​ASPLiteral>

    public class ClingoSolver
    extends ASPSolver
    Invokes Clingo (Part of the Potassco project), an ASP system that grounds and solves logic programs, and returns computed answer sets.
    Author:
    Nils Geilen, Matthias Thimm, Anna Gessler
    • Field Detail

      • pathToSolver

        protected String pathToSolver
        String representation of Clingo binary path, meaning the location of the clingo, clasp and grinco executables on the hard drive.
    • Constructor Detail

      • ClingoSolver

        public ClingoSolver​(String path2clingo,
                            net.sf.tweety.commons.util.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​(String path2clingo)
        Constructs a new instance pointing to specific a Clingo solver.
        Parameters:
        path2clingo - binary location of Clingo on the hard drive
    • Method Detail

      • getModels

        public List<AnswerSet> getModels​(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 List<AnswerSet> getModels​(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
      • query

        public Boolean query​(Program beliefbase,
                             ASPLiteral formula,
                             net.sf.tweety.commons.InferenceMode inferenceMode)
      • 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​(String options)
        Set additional command line options for Clingo.
        Parameters:
        options - a string of options
      • setPathToDLV

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