Package net.sf.tweety.lp.asp.reasoner
Class ClingoSolver
- java.lang.Object
-
- net.sf.tweety.lp.asp.reasoner.ASPSolver
-
- net.sf.tweety.lp.asp.reasoner.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 Summary
Fields Modifier and Type Field Description protected StringpathToSolverString representation of Clingo binary path, meaning the location of the clingo, clasp and grinco executables on the hard drive.-
Fields inherited from class net.sf.tweety.lp.asp.reasoner.ASPSolver
integerMaximum, maxNumOfModels, outputData
-
-
Constructor Summary
Constructors Constructor Description ClingoSolver(String path2clingo)Constructs a new instance pointing to specific a Clingo solver.ClingoSolver(String path2clingo, net.sf.tweety.commons.util.Shell bash)Constructs a new instance pointing to a specific Clingo solver.
-
Method Summary
Modifier and Type Method Description AnswerSetgetModel(Program p)List<AnswerSet>getModels(File file)Returns a characterizing model (answer set) of the given belief base.List<AnswerSet>getModels(String s)Returns a characterizing model (answer set) of the given belief base.List<AnswerSet>getModels(Program p)Booleanquery(Program beliefbase, ASPLiteral formula)Booleanquery(Program beliefbase, ASPLiteral formula, net.sf.tweety.commons.InferenceMode inferenceMode)voidsetOptions(String options)Set additional command line options for Clingo.voidsetPathToDLV(String path)Sets the location of the Clingo solver on the hard drive.voidtoggleOutputWhitelist(boolean b)Activates or deactivates the option to use a whitelist of predicates.-
Methods inherited from class net.sf.tweety.lp.asp.reasoner.ASPSolver
getIntegerMaximum, getMaxNumOfModels, getModel, getModels, getOutput, setIntegerMaximum, setMaxNumOfModels
-
-
-
-
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 drivebash- 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:ASPSolverReturns a characterizing model (answer set) of the given belief base.
-
getModels
public List<AnswerSet> getModels(File file)
Description copied from class:ASPSolverReturns a characterizing model (answer set) of the given belief base.
-
query
public Boolean query(Program beliefbase, ASPLiteral formula)
- Specified by:
queryin interfacenet.sf.tweety.commons.QualitativeReasoner<Program,ASPLiteral>- Specified by:
queryin interfacenet.sf.tweety.commons.Reasoner<Boolean,Program,ASPLiteral>- Specified by:
queryin classASPSolver
-
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
-
-