Class AnswerSet
java.lang.Object
org.tweetyproject.commons.AbstractInterpretation<Program,ASPRule>
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
-
Constructor Summary
ConstructorDescriptionCreates 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()
boolean
getLiteralsWithName
(String name) Returns all literals of a given name in the AnswerSet.int
hashCode()
boolean
Checks whether this interpretation satisfies the given formula.boolean
Checks 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, toArray
Methods inherited from class org.tweetyproject.commons.AbstractInterpretation
satisfies
Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
level
public final int levellevel -
weight
public final int weightweight
-
-
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
-
-
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:
toString
in classInterpretationSet<ASPLiteral,
Program, ASPRule>
-
clone
-
satisfies
Description copied from interface:Interpretation
Checks 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:Interpretation
Checks 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:
hashCode
in interfaceCollection<ASPLiteral>
- Overrides:
hashCode
in classInterpretationSet<ASPLiteral,
Program, ASPRule>
-
equals
- Specified by:
equals
in interfaceCollection<ASPLiteral>
- Overrides:
equals
in classInterpretationSet<ASPLiteral,
Program, ASPRule>
-