Package net.sf.tweety.lp.asp.semantics
Class AnswerSet
- java.lang.Object
-
- net.sf.tweety.commons.AbstractInterpretation<B,S>
-
- net.sf.tweety.commons.InterpretationSet<ASPLiteral,Program,ASPRule>
-
- net.sf.tweety.lp.asp.semantics.AnswerSet
-
- All Implemented Interfaces:
java.lang.Iterable<ASPLiteral>,java.util.Collection<ASPLiteral>,Interpretation<Program,ASPRule>
public class AnswerSet extends InterpretationSet<ASPLiteral,Program,ASPRule>
An answer set is a belief set which only contains literals and represents the deductive belief set of an extended logic program under the answer set semantic.- Author:
- Thomas Vengels, Tim Janus, Anna Gessler
-
-
Constructor Summary
Constructors Constructor Description AnswerSet()Creates a new empty AnswerSet.AnswerSet(java.util.Collection<ASPLiteral> lits, int level, int weight)Creates a new empty AnswerSet with the given level and weight.AnswerSet(AnswerSet other)Copy-Constructor
-
Method Summary
Modifier and Type Method Description java.lang.Objectclone()java.util.Set<ASPLiteral>getLiteralsWithName(java.lang.String name)Returns all literals of a given name in the AnswerSet.booleansatisfies(ASPRule formula)Checks whether this interpretation satisfies the given formula.booleansatisfies(Program beliefBase)Checks whether this interpretation satisfies the given knowledge base.java.lang.StringtoString()-
Methods inherited from class net.sf.tweety.commons.InterpretationSet
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from class net.sf.tweety.commons.AbstractInterpretation
satisfies
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
AnswerSet
public AnswerSet()
Creates a new empty AnswerSet.
-
AnswerSet
public AnswerSet(java.util.Collection<ASPLiteral> lits, int level, int weight)
Creates a new empty AnswerSet with the given level and weight.- Parameters:
lits- the literalslevel- the levelweight- the weight
-
AnswerSet
public AnswerSet(AnswerSet other)
Copy-Constructor- Parameters:
other- another answer set
-
-
Method Detail
-
getLiteralsWithName
public java.util.Set<ASPLiteral> getLiteralsWithName(java.lang.String name)
Returns all literals of a given name in the AnswerSet.- Parameters:
name- the name of the literal- Returns:
- set of literals
-
toString
public java.lang.String toString()
- Overrides:
toStringin classInterpretationSet<ASPLiteral,Program,ASPRule>
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
satisfies
public boolean satisfies(Program beliefBase) throws java.lang.IllegalArgumentException
Description copied from interface:InterpretationChecks whether this interpretation satisfies the given knowledge base.- Parameters:
beliefBase- a knowledge base.- Returns:
- "true" if this interpretation satisfies the given knowledge base.
- Throws:
java.lang.IllegalArgumentException- IllegalArgumentException if the knowledgebase does not correspond to the expected language.
-
satisfies
public boolean satisfies(ASPRule formula) throws java.lang.IllegalArgumentException
Description copied from interface:InterpretationChecks whether this interpretation satisfies the given formula.- Parameters:
formula- a formula .- Returns:
- "true" if this interpretation satisfies the given formula.
- Throws:
java.lang.IllegalArgumentException- if the formula does not correspond to the expected language.
-
-