public class CTransitionSystemCalculator
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private AspInterface |
aspsolver |
| Constructor and Description |
|---|
CTransitionSystemCalculator(AspInterface aspsolver)
Creates a new transition system calculator with the given interface to an
answer set solver.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<State> |
calculateStates(CActionDescription actionDescription,
ActionSignature signature)
calculates the set of all states of the transition system described by an
action description.
|
TransitionSystem |
calculateTransitionSystem(CActionDescription actionDescription,
ActionSignature signature)
Calculates a transition system as described by the given action description
using all symbols in the given action signature.
|
private java.lang.String |
getAtomString(RelationalFormula f,
int t)
Utility function representing a given atom, either an actionname or a
fluentname, to be used in a rule in an extended logic program.
|
private java.lang.String |
getCompletenessEnforcementRules(java.util.Set<FOLAtom> atoms,
int t)
Returns rules, that enforce the existence of each atom in the given set in
all answer sets of an extended logic program.
|
private java.lang.String |
getDefaultNegationRules(java.util.Set<FOLAtom> atoms,
int t)
Returns rules of an extended logic program for the given set of atoms and a
parameter t.
|
private java.lang.String |
getLiteralString(FolFormula f,
int t,
boolean negated)
Utility function representing a single literal either in a direct manner or
using default negation.
|
java.lang.String |
getLpT(CActionDescription d,
ActionSignature signature,
int T)
Calculates an extended logic programm lp_T(D) for a given action
description D and a parameter T, which corresponds to the length of
histories in the transition system described by D.
|
private java.lang.String |
getRuleBodyString(FolFormula f,
int t,
boolean negated)
Calculates the representation of an inner formula of a causal rule
according to the translation in
"Representing Transition Systems by Logic Programs.".
|
private java.util.Set<java.util.Map<java.lang.Integer,java.util.Set<FOLAtom>>> |
parseLpT(java.lang.String[] lines,
ActionSignature signature)
Parses the resulting answer sets of an lp_T(D) program as a set.
|
private java.util.Map<java.lang.Integer,java.util.Set<FOLAtom>> |
parseLpTSingleLine(java.lang.String s,
ActionSignature signature)
Utility function parsing a single answer set to a map from timestamp to the
set of atoms with that particular timestamp.
|
private java.lang.String |
regainIllegalChars(java.lang.String s)
Regains all illegal characters from answer sets.
|
private java.lang.String |
removeIllegalChars(java.lang.String s)
Removes illegal characters from atom names, which are not parsable by an
lparse compatible answer set solver.
|
private AspInterface aspsolver
public CTransitionSystemCalculator(AspInterface aspsolver)
aspsolver - public TransitionSystem calculateTransitionSystem(CActionDescription actionDescription, ActionSignature signature) throws java.io.IOException
actionDescription - an action description.signature - an action signature.java.io.IOExceptionjava.lang.IllegalArgumentException - is thrown, when the given action
description is not definite, as this method only works for
definite action descriptions.public java.util.Set<State> calculateStates(CActionDescription actionDescription, ActionSignature signature) throws java.io.IOException
actionDescription - an action description.signature - an action signature.java.io.IOExceptionjava.lang.IllegalArgumentException - is thrown, when the given action
description is not definite.public java.lang.String getLpT(CActionDescription d, ActionSignature signature, int T)
d - an action description.signature - an action signature.T - length of histories of the transition system of D, that correspond
to answer sets of lp_T(D).private java.lang.String getDefaultNegationRules(java.util.Set<FOLAtom> atoms, int t)
atoms - set of atoms.t - parameter t.private java.lang.String getCompletenessEnforcementRules(java.util.Set<FOLAtom> atoms, int t)
atoms - a set of atoms.t - parameter to be added to each atom.private java.lang.String removeIllegalChars(java.lang.String s)
s - an atom name.private java.lang.String regainIllegalChars(java.lang.String s)
s - an atom name in lparse-compatible format.private java.util.Set<java.util.Map<java.lang.Integer,java.util.Set<FOLAtom>>> parseLpT(java.lang.String[] lines, ActionSignature signature)
lines - the output of the answer set solver.signature - the action signature of the original description.private java.util.Map<java.lang.Integer,java.util.Set<FOLAtom>> parseLpTSingleLine(java.lang.String s, ActionSignature signature) throws ParserException
s - a single answer set from the output of a solver.signature - the action signature of the original action description.ParserExceptionprivate java.lang.String getRuleBodyString(FolFormula f, int t, boolean negated)
f - the inner formula of a causal rule.t - the timestamp for this translation.negated - true iff the formula should be represented using default
negation.private java.lang.String getLiteralString(FolFormula f, int t, boolean negated)
f - the literal to be represented.t - a timestamp.negated - true, iff the literal should be represented using default
negation.private java.lang.String getAtomString(RelationalFormula f, int t)
f - an atom.t - a timestamp.