Class AnswerSet
java.lang.Object
org.tweetyproject.commons.AbstractInterpretation<B,S>
org.tweetyproject.commons.InterpretationSet<ASPLiteral,Program,ASPRule>
org.tweetyproject.lp.asp.semantics.AnswerSet
- All Implemented Interfaces:
Iterable<ASPLiteral>,Collection<ASPLiteral>,Interpretation<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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty AnswerSet.AnswerSet(Collection<ASPLiteral> lits, int level, int weight) Creates a new empty AnswerSet with the given level and weight.Copy-Constructor -
Method Summary
Modifier and TypeMethodDescriptionclone()booleangetLiteralsWithName(String name) Returns all literals of a given name in the AnswerSet.inthashCode()booleanChecks whether this interpretation satisfies the given formula.booleanChecks whether this interpretation satisfies the given knowledge base.toString()Methods inherited from class org.tweetyproject.commons.InterpretationSet
add, add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArrayMethods inherited from class org.tweetyproject.commons.AbstractInterpretation
satisfiesMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
level
public final int level -
weight
public final int weight
-
-
Constructor Details
-
AnswerSet
public AnswerSet()Creates a new empty AnswerSet. -
AnswerSet
Creates a new empty AnswerSet with the given level and weight.- Parameters:
lits- the literalslevel- the levelweight- the weight
-
AnswerSet
Copy-Constructor- Parameters:
other- another answer set
-
-
Method Details
-
getLiteralsWithName
Returns all literals of a given name in the AnswerSet.- Parameters:
name- the name of the literal- Returns:
- set of literals
-
toString
- Overrides:
toStringin classInterpretationSet<ASPLiteral,Program, ASPRule>
-
clone
-
satisfies
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:
IllegalArgumentException- IllegalArgumentException if the knowledgebase does not correspond to the expected language.
-
satisfies
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:
IllegalArgumentException- if the formula does not correspond to the expected language.
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<ASPLiteral>- Overrides:
hashCodein classInterpretationSet<ASPLiteral,Program, ASPRule>
-
equals
- Specified by:
equalsin interfaceCollection<ASPLiteral>- Overrides:
equalsin classInterpretationSet<ASPLiteral,Program, ASPRule>
-