Package net.sf.tweety.lp.asp.reasoner
Class ASPSolver
- java.lang.Object
-
- net.sf.tweety.lp.asp.reasoner.ASPSolver
-
- 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>
- Direct Known Subclasses:
ClingoSolver,DLVSolver
public abstract class ASPSolver extends Object implements net.sf.tweety.commons.QualitativeReasoner<Program,ASPLiteral>, net.sf.tweety.commons.ModelProvider<ASPRule,Program,AnswerSet>
This class provides a common interface for asp solvers. Most implementing classes will simply call an external grounder and solver and return the resulting string.- Author:
- Sebastian Homann (Original), Thomas Vengels (Modifications), Anna Gessler (Modifications)
-
-
Field Summary
Fields Modifier and Type Field Description protected intintegerMaximumRepresents the upper integer bound.protected intmaxNumOfModelsThe maximum number of models to be generated.protected StringoutputDataStores the (latest) result of the solver as a String.
-
Constructor Summary
Constructors Constructor Description ASPSolver()
-
Method Summary
Modifier and Type Method Description intgetIntegerMaximum()Get the upper integer bound.intgetMaxNumOfModels()Get the maximum number of models to be generated.AnswerSetgetModel(Program p, int maxInt)Returns a characterizing model (answer set) of the given belief base using the given upper integer limit.abstract Collection<AnswerSet>getModels(File f)Returns a characterizing model (answer set) of the given belief base.abstract Collection<AnswerSet>getModels(String p)Returns a characterizing model (answer set) of the given belief base.abstract Collection<AnswerSet>getModels(Program p)Collection<AnswerSet>getModels(Program p, int maxInt)Returns a characterizing model (answer set) of the given belief base using the given upper integer limit.StringgetOutput()abstract Booleanquery(Program beliefbase, ASPLiteral formula)voidsetIntegerMaximum(int integerMaximum)Set the upper integer bound.voidsetMaxNumOfModels(int maxNumOfModels)Set the maximum number of models to be generated.
-
-
-
Field Detail
-
outputData
protected String outputData
Stores the (latest) result of the solver as a String.
-
maxNumOfModels
protected int maxNumOfModels
The maximum number of models to be generated.
-
integerMaximum
protected int integerMaximum
Represents the upper integer bound. Solvers that use this attribute will only accept integers in [0,IntegerMaximum] in input programs. Likewise, only integers in [0,IntegerMaximum] will be considered by when evaluating arithmetic predicates.
-
-
Method Detail
-
getOutput
public String getOutput()
-
getMaxNumOfModels
public int getMaxNumOfModels()
Get the maximum number of models to be generated.- Returns:
- maximum number
-
setMaxNumOfModels
public void setMaxNumOfModels(int maxNumOfModels)
Set the maximum number of models to be generated.- Parameters:
maxNumOfModels- the maximum number of models to be generated.
-
getIntegerMaximum
public int getIntegerMaximum()
Get the upper integer bound. Solvers that use this attribute will only accept integers in [0,IntegerMaximum] in input programs. Likewise, only integers in [0,IntegerMaximum] will be considered by when evaluating arithmetic predicates.- Returns:
- the upper integer bound.
-
setIntegerMaximum
public void setIntegerMaximum(int integerMaximum)
Set the upper integer bound. Solvers that use this attribute will only accept integers in [0,IntegerMaximum] in input programs. Likewise, only integers in [0,IntegerMaximum] will be considered by when evaluating arithmetic predicates.- Parameters:
integerMaximum- the upper integer bound
-
getModels
public abstract Collection<AnswerSet> getModels(Program p)
-
getModels
public Collection<AnswerSet> getModels(Program p, int maxInt)
Returns a characterizing model (answer set) of the given belief base using the given upper integer limit.- Parameters:
p- a programmaxInt- the max number of models to be returned- Returns:
- AnswerSet
-
getModel
public AnswerSet getModel(Program p, int maxInt)
Returns a characterizing model (answer set) of the given belief base using the given upper integer limit.- Parameters:
p- a programmaxInt- the max number of models to be returned- Returns:
- AnswerSet
-
getModels
public abstract Collection<AnswerSet> getModels(String p)
Returns a characterizing model (answer set) of the given belief base.- Parameters:
p- containing belief base- Returns:
- AnswerSet
-
getModels
public abstract Collection<AnswerSet> getModels(File f)
Returns a characterizing model (answer set) of the given belief base.- Parameters:
f- containing belief base- Returns:
- AnswerSet
-
query
public abstract 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>
-
-