Class CredibilityRevision
- java.lang.Object
-
- net.sf.tweety.beliefdynamics.MultipleBaseRevisionOperator<T>
-
- net.sf.tweety.beliefdynamics.CredibilityRevision<T>
-
- net.sf.tweety.beliefdynamics.CredibilityRevisionNonIterative<ASPRule>
-
- net.sf.tweety.lp.asp.beliefdynamics.revision.CredibilityRevision
-
- All Implemented Interfaces:
BaseRevisionOperator<ASPRule>
public class CredibilityRevision extends CredibilityRevisionNonIterative<ASPRule>
Implements the credibility revision approach for ASP described in Kruempelmann et al. 2008. It extends the NonIterativeRevision interface by providing methods to receive the last calculated answer sets and it's projection. Internally the prefixes 'c__' 'neg_c' are used to prefix constants and the prefix 'p__' is used to prefix literals of the extended alphabet of the credibility program.- Author:
- Tim Janus
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CredibilityRevision.AnswersetProcessing
interface defines a method to process the extended answer sets of the credibility revision to generate the new ELP.static class
CredibilityRevision.DefaultBehavior
This class implements a default behavior for the processing of the answer sets of the credibility logic programs.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
constantPrefix
a prefix used to mark constants which represents the id of positive literals.private java.util.Collection<AnswerSet>
lastAnswersets
private java.util.Collection<AnswerSet>
lastProjectedAnswersets
private java.util.Map<ASPLiteral,java.lang.String>
literalMap
a map used during the creation of the credibility logic programprivate int
maxInt
private java.lang.String
negConstantPrefix
a prefix used to mark constants which represent the id of negative literals.private java.lang.String
predCredibilityPrefix
a prefix used to mark the prioritzed version of predicatesprivate CredibilityRevision.AnswersetProcessing
processing
private int
ruleIndex
a rule index counter used during the creation of the credibility logic programprivate ASPSolver
solver
reference to the solver used for the answer set generation
-
Constructor Summary
Constructors Constructor Description CredibilityRevision()
Default Ctor: Do not forget to set the solverCredibilityRevision(ASPSolver solver)
Ctor: setting the solver at construction timeCredibilityRevision(ASPSolver solver, int maxInt)
-
Method Summary
Modifier and Type Method Description java.util.Collection<AnswerSet>
getLastAnswerset()
java.util.Collection<AnswerSet>
getLastProjectedAnswerSet()
static void
main(java.lang.String[] args)
private void
projectAnswerSet()
Projects the answer set of the credibility program to the original alphabetProgram
revise(java.util.List<java.util.Collection<ASPRule>> ol)
Revises the belief bases in the orderer list into one belief base.void
setAnswersetProcessing(CredibilityRevision.AnswersetProcessing processing)
Program
translate(java.util.List<Program> orderedList)
Translates the given list of programs to the credibility logic program.private Program
translate(Program p, int programCredibility)
Helper method: Translates the given programprivate java.lang.String
translateLiteral(ASPLiteral lit)
Helper method: creates a string representing the literal and an literal representing the prioritzed version of the literal.-
Methods inherited from class net.sf.tweety.beliefdynamics.CredibilityRevisionNonIterative
revise
-
Methods inherited from class net.sf.tweety.beliefdynamics.CredibilityRevision
revise
-
-
-
-
Field Detail
-
processing
private CredibilityRevision.AnswersetProcessing processing
-
literalMap
private java.util.Map<ASPLiteral,java.lang.String> literalMap
a map used during the creation of the credibility logic program
-
negConstantPrefix
private java.lang.String negConstantPrefix
a prefix used to mark constants which represent the id of negative literals.
-
constantPrefix
private java.lang.String constantPrefix
a prefix used to mark constants which represents the id of positive literals.
-
predCredibilityPrefix
private java.lang.String predCredibilityPrefix
a prefix used to mark the prioritzed version of predicates
-
ruleIndex
private int ruleIndex
a rule index counter used during the creation of the credibility logic program
-
solver
private ASPSolver solver
reference to the solver used for the answer set generation
-
lastAnswersets
private java.util.Collection<AnswerSet> lastAnswersets
-
lastProjectedAnswersets
private java.util.Collection<AnswerSet> lastProjectedAnswersets
-
maxInt
private int maxInt
-
-
Constructor Detail
-
CredibilityRevision
public CredibilityRevision()
Default Ctor: Do not forget to set the solver
-
CredibilityRevision
public CredibilityRevision(ASPSolver solver)
Ctor: setting the solver at construction time- Parameters:
solver
- Reference to the solver used for answer set generation.
-
CredibilityRevision
public CredibilityRevision(ASPSolver solver, int maxInt)
-
-
Method Detail
-
getLastAnswerset
public java.util.Collection<AnswerSet> getLastAnswerset()
-
getLastProjectedAnswerSet
public java.util.Collection<AnswerSet> getLastProjectedAnswerSet()
-
setAnswersetProcessing
public void setAnswersetProcessing(CredibilityRevision.AnswersetProcessing processing)
-
revise
public Program revise(java.util.List<java.util.Collection<ASPRule>> ol)
Description copied from class:CredibilityRevision
Revises the belief bases in the orderer list into one belief base.- Specified by:
revise
in classCredibilityRevision<ASPRule>
- Parameters:
ol
- An orderer list of belief bases which assumes that belief bases with a lower index have a lower priority.- Returns:
- The belief base which is the result of the revision.
-
projectAnswerSet
private void projectAnswerSet()
Projects the answer set of the credibility program to the original alphabet
-
translate
public Program translate(java.util.List<Program> orderedList)
Translates the given list of programs to the credibility logic program. The index of the program in the list represents its credibility, this means the first program in the list has lesser credibility than the second.- Parameters:
orderedList
- The ordered list of extended logic programs which shall be translated.- Returns:
- The credibility logic program representing the revision of the given ELPs.
-
translate
private Program translate(Program p, int programCredibility)
Helper method: Translates the given program- Parameters:
p
- Reference to the programprogramCredibility
- The credibility value for the program- Returns:
- The credibility logic program of the given extendend logic program
-
translateLiteral
private java.lang.String translateLiteral(ASPLiteral lit)
Helper method: creates a string representing the literal and an literal representing the prioritzed version of the literal.- Parameters:
lit
- The unprioritzed version of the literal.- Returns:
- A pair containing the string id representing the prioritzed literal and the prioritzed literal.
-
main
public static void main(java.lang.String[] args)
-
-