Package net.sf.tweety.lp.asp.reasoner
Class DLVSolver
- java.lang.Object
-
- net.sf.tweety.lp.asp.reasoner.ASPSolver
-
- net.sf.tweety.lp.asp.reasoner.DLVSolver
-
- All Implemented Interfaces:
ModelProvider<ASPRule,Program,AnswerSet>
,QualitativeReasoner<Program,ASPLiteral>
,Reasoner<java.lang.Boolean,Program,ASPLiteral>
public class DLVSolver extends ASPSolver
Wrapper class for the DLV answer set solver command line utility.- Author:
- Thomas Vengels, Tim Janus, Anna Gessler
-
-
Field Summary
Fields Modifier and Type Field Description private Shell
bash
Shell to run DLVprivate java.lang.String
options
Additional command line options for DLV.private java.lang.String
pathToSolver
String representation of DLV binary path.-
Fields inherited from class net.sf.tweety.lp.asp.reasoner.ASPSolver
integerMaximum, maxNumOfModels, outputData
-
-
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 p)
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 baseprotected java.util.List<AnswerSet>
parseResult(java.lang.String s)
Processes a string containing answer sets and returns an AnswerSetList.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 additional command line options for DLV.void
setPathToDLV(java.lang.String pathToDLV)
Sets the location of the DLV solver on the hard drive.-
Methods inherited from class net.sf.tweety.lp.asp.reasoner.ASPSolver
getIntegerMaximum, getMaxNumOfModels, getModel, getModels, getOutput, setIntegerMaximum, setMaxNumOfModels
-
-
-
-
Field Detail
-
pathToSolver
private java.lang.String pathToSolver
String representation of DLV binary path.
-
bash
private Shell bash
Shell to run DLV
-
options
private java.lang.String options
Additional command line options for DLV. Default value is empty.
-
-
Constructor Detail
-
DLVSolver
public DLVSolver(java.lang.String pathToDLV)
Constructs a new instance pointing to a specific DLV solver.- Parameters:
pathToDLV
- binary location of DLV on the hard drive
-
DLVSolver
public DLVSolver(java.lang.String pathToDLV, Shell bash)
Constructs a new instance pointing to a specific DLV solver.- Parameters:
pathToDLV
- binary location of DLV on the hard drivebash
- shell to run commands
-
-
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 p)
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.
-
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.
-
parseResult
protected java.util.List<AnswerSet> parseResult(java.lang.String s)
Processes a string containing answer sets and returns an AnswerSetList.- Parameters:
s
- String containing DLV output- Returns:
- AnswerSet
-
setOptions
public void setOptions(java.lang.String options)
Set additional command line options for DLV.- Parameters:
options
- a string of options
-
setPathToDLV
public void setPathToDLV(java.lang.String pathToDLV)
Sets the location of the DLV solver on the hard drive.- Parameters:
pathToDLV
- path to DLV
-
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)
-
-