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:
ModelProvider<ASPRule,Program,AnswerSet>
,QualitativeReasoner<Program,ASPLiteral>
,Reasoner<java.lang.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
-
-
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 basejava.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 additional 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 net.sf.tweety.lp.asp.reasoner.ASPSolver
getIntegerMaximum, getMaxNumOfModels, getModel, getModels, getOutput, setIntegerMaximum, setMaxNumOfModels
-
-
-
-
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 drivebash
- 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
-
getModels
public java.util.List<AnswerSet> getModels(Program p)
Description copied from interface:ModelProvider
Returns a characterizing model of the given belief base
-
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.
-
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.
-
query
public java.lang.Boolean query(Program beliefbase, ASPLiteral formula)
Description copied from interface:Reasoner
Queries the given belief base for the given formula.- Specified by:
query
in interfaceQualitativeReasoner<Program,ASPLiteral>
- Specified by:
query
in interfaceReasoner<java.lang.Boolean,Program,ASPLiteral>
- Specified by:
query
in classASPSolver
- Parameters:
beliefbase
- a belief baseformula
- a formula- Returns:
- the answer to the query
-
query
public java.lang.Boolean query(Program beliefbase, ASPLiteral formula, InferenceMode inferenceMode)
-
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 additional command line options for Clingo.- Parameters:
options
- a string of options
-
setPathToDLV
public void setPathToDLV(java.lang.String path)
Sets the location of the Clingo solver on the hard drive.- Parameters:
path
- path to DLV
-
-