Added encoding of the DRS state constraints to the context automaton

This commit is contained in:
Artur Meski
2018-10-07 21:45:28 +01:00
parent ac97db8ead
commit 469ca7e46b
4 changed files with 21 additions and 15 deletions

View File

@@ -46,14 +46,21 @@ std::string StateConstr::toStr(void) const
BDD StateConstr::getBDDforState(const SymRS *srs) const
{
assert(0);
// return BDD_FALSE;
return getBDD(srs, false);
}
BDD StateConstr::getBDDforContext(const SymRS *srs) const
{
return getBDD(srs, true);
}
BDD StateConstr::getBDD(const SymRS *srs, bool encode_context) const
{
if (oper == STC_PV) {
return srs->encActStrEntity(proc_name, entity_name);
if (encode_context)
return srs->encActStrEntity(proc_name, entity_name);
else
return srs->encEntity(proc_name, entity_name);
}
else if (oper == STC_TF) {
if (tf) {
@@ -64,20 +71,20 @@ BDD StateConstr::getBDDforContext(const SymRS *srs) const
}
}
else if (oper == STC_AND) {
return arg[0]->getBDD(srs) * arg[1]->getBDD(srs);
return arg[0]->getBDD(srs, encode_context) * arg[1]->getBDD(srs, encode_context);
}
else if (oper == STC_OR) {
return arg[0]->getBDD(srs) + arg[1]->getBDD(srs);
return arg[0]->getBDD(srs, encode_context) + arg[1]->getBDD(srs, encode_context);
}
else if (oper == STC_XOR) {
return arg[0]->getBDD(srs) ^ arg[1]->getBDD(srs);
return arg[0]->getBDD(srs, encode_context) ^ arg[1]->getBDD(srs, encode_context);
}
else if (oper == STC_NOT) {
return !arg[0]->getBDD(srs);
return !arg[0]->getBDD(srs, encode_context);
}
else {
assert(0);
FERROR("Undefined operator used in Boolean context definition. This should not happen.");
FERROR("Undefined operator used in Boolean state/context definition. This should not happen.");
return srs->getBDDfalse();
}
}