This commit is contained in:
Artur Meski
2018-03-26 22:05:23 +01:00
parent 76ab891786
commit 03cbf26afa
4 changed files with 45 additions and 29 deletions

View File

@@ -186,9 +186,13 @@ int main(int argc, char **argv)
ModelChecker mc(&srs, opts);
if (reach_states)
{
mc.printReach();
}
if (reach_states_succ)
{
mc.printReachWithSucc();
}
if (rstl_model_checking)
{

13
mc.cc
View File

@@ -7,7 +7,7 @@ ModelChecker::ModelChecker(SymRS *srs, Options *opts)
cuddMgr = srs->getCuddMgr();
if (srs->usingContextAutomaton())
if (!srs->usingContextAutomaton())
initStates = srs->getEncInitStates();
totalStateVars = srs->getTotalStateVars();
@@ -107,11 +107,15 @@ inline BDD ModelChecker::getPreEctx(const BDD &states, const BDD *contexts)
void ModelChecker::printReach(void)
{
VERB_LN(2, "Printing/generating reachable states");
if (opts->measure)
opts->ver_time = cpuTime();
assert(initStates != nullptr);
BDD *reach = new BDD(*initStates);
BDD reach_p = cuddMgr->bddZero();
BDD reach_p = BDD_FALSE;
unsigned int k = 0;
@@ -138,12 +142,13 @@ void ModelChecker::printReach(void)
void ModelChecker::printReachWithSucc(void)
{
VERB_LN(2, "Printing/generating reachable states (with successors)");
BDD *reach = new BDD(*initStates);
BDD reach_p = cuddMgr->bddZero();
while (*reach != reach_p)
{
//cout << "==[ " << ++k << " ]===========================" << endl;
reach_p = *reach;
BDD newStates = getSucc(*reach) - *reach;
*reach += newStates;
@@ -530,7 +535,7 @@ bool ModelChecker::checkRSCTLbmc(FormRSCTL *form)
cleanup();
cout << "Formula " << form->toStr() << (result ? " holds" : " does not hold") << endl;
cout << "Formula " << form->toStr() << " " << (result ? "holds" : "does not hold") << endl;
if (opts->measure)
{

View File

@@ -13,6 +13,7 @@ SymRS::SymRS(RctSys *rs, Options *opts)
totalStateVars = rs->getEntitiesSize();
totalReactions = rs->getReactionsSize();
totalActions = rs->getActionsSize();
totalCtxAutStateVars = getCtxAutStateEncodingSize();
partTrans = nullptr;
@@ -200,10 +201,12 @@ void SymRS::initBDDvars(void)
*pv_act_E *= (*pv_act)[i];
}
offset += totalActions;
if (usingContextAutomaton())
{
VERB("Context automaton variables");
offset += totalActions;
pv_ca = new vector<BDD>(totalCtxAutStateVars);
pv_ca_succ = new vector<BDD>(totalCtxAutStateVars);
pv_ca_E = new BDD(BDD_TRUE);
@@ -223,6 +226,7 @@ void SymRS::initBDDvars(void)
base_index += 2;
}
}
VERB("All BDD variables ready");
}
@@ -433,6 +437,10 @@ BDD SymRS::encActStrEntity(std::string name) const
size_t SymRS::getCtxAutStateEncodingSize(void)
{
if (!usingContextAutomaton()) return 0;
assert(rs->ctx_aut != nullptr);
size_t bitCount = 0;
size_t bitCountMaxVal = 1;
size_t numStates = rs->ctx_aut->statesCount();

View File

@@ -65,7 +65,6 @@ class SymRS
unsigned int totalActions;
unsigned int totalCtxAutStateVars;
BDD encEntity_raw(Entity entity, bool succ) const;
BDD encEntity(Entity entity) const {
return encEntity_raw(entity, false);