Partitioned trnasition relation with reordering

This commit is contained in:
Artur Meski
2018-07-22 18:25:19 +01:00
parent 482828a04e
commit 18e840ce17
4 changed files with 60 additions and 20 deletions

View File

@@ -2,7 +2,7 @@
TMPINPUT="tmp_$RANDOM$RANDOM.rs" TMPINPUT="tmp_$RANDOM$RANDOM.rs"
CMD="./reactics -b -B" CMD="./reactics -z -b -B"
for i in `seq 2 20`;do for i in `seq 2 20`;do

14
mc.cc
View File

@@ -73,8 +73,8 @@ inline BDD ModelChecker::getSucc(const BDD &states)
VERB_L2("Computing successors"); VERB_L2("Computing successors");
if (opts->part_tr_rel) { if (opts->part_tr_rel) {
for (unsigned int i = 0; i < trp_size; ++i) { for (const auto &trans : *trp) {
q *= states * (*trp)[i]; q *= states * trans;
} }
} }
else { else {
@@ -99,8 +99,8 @@ inline BDD ModelChecker::getPreE(const BDD &states)
BDD x = states.SwapVariables(*pv, *pv_succ); BDD x = states.SwapVariables(*pv, *pv_succ);
if (opts->part_tr_rel) { if (opts->part_tr_rel) {
for (unsigned int i = 0; i < trp_size; ++i) { for (const auto &trans : *trp) {
q *= x * (*trp)[i]; q *= x * trans;
} }
} }
else { else {
@@ -110,6 +110,7 @@ inline BDD ModelChecker::getPreE(const BDD &states)
q = q.ExistAbstract(*pv_succ_E); q = q.ExistAbstract(*pv_succ_E);
q = q.ExistAbstract(*pv_ctx_E); q = q.ExistAbstract(*pv_ctx_E);
q = q.ExistAbstract(*pv_proc_enab_E); q = q.ExistAbstract(*pv_proc_enab_E);
return q; return q;
} }
@@ -120,9 +121,10 @@ inline BDD ModelChecker::getPreEctx(const BDD &states, const BDD *contexts)
BDD x = states.SwapVariables(*pv, *pv_succ); BDD x = states.SwapVariables(*pv, *pv_succ);
if (opts->part_tr_rel) { if (opts->part_tr_rel) {
for (unsigned int i = 0; i < trp_size; ++i) { for (const auto &trans : *trp) {
q *= x * (*trp)[i] * *contexts; q *= x * trans;
} }
q *= *contexts;
} }
else { else {
q *= x * *trm * *contexts; q *= x * *trm * *contexts;

View File

@@ -660,11 +660,7 @@ BDD SymRS::encEnabledness(Process prod_proc_id, Entity entity_id)
} // END FOR: cond } // END FOR: cond
if (opts->reorder_trans) { reorder();
VERB_L2("Reordering START");
Cudd_ReduceHeap(cuddMgr->getManager(), CUDD_REORDER_SIFT, 10000);
VERB_L2("Reordering DONE");
}
return enab; return enab;
} }
@@ -762,22 +758,51 @@ void SymRS::encodeTransitions(void)
if (opts->part_tr_rel) { if (opts->part_tr_rel) {
VERB("Using partitioned transition relation encoding"); VERB("Using partitioned transition relation encoding");
FERROR("Partitioned transition relation is currently not supported");
if (usingContextAutomaton()) {
partTrans = new BDDvec(numberOfProc+1);
}
else {
partTrans = new BDDvec(numberOfProc);
}
} }
else { else {
VERB("Using monolithic transition relation encoding"); VERB("Using monolithic transition relation encoding");
monoTrans = new BDD(BDD_TRUE); monoTrans = new BDD(BDD_TRUE);
} }
VERB_LN(3, "Entity production encoding for all the processes and their products"); VERB_LN(3, "Entity production encoding for all the processes and their products");
for (const auto &proc_products : usedProducts) { if (opts->part_tr_rel)
auto proc_id = proc_products.first; {
auto products = proc_products.second;
for (const auto &prod : products) { for (const auto &proc_products : usedProducts) {
*monoTrans *= encEntityProduction(proc_id, prod); auto proc_id = proc_products.first;
auto products = proc_products.second;
(*partTrans)[proc_id] = BDD_TRUE;
for (const auto &prod : products) {
(*partTrans)[proc_id] *= encEntityProduction(proc_id, prod);
}
} }
}
else {
for (const auto &proc_products : usedProducts) {
auto proc_id = proc_products.first;
auto products = proc_products.second;
for (const auto &prod : products) {
*monoTrans *= encEntityProduction(proc_id, prod);
}
}
} }
VERB("Reactions ready"); VERB("Reactions ready");
@@ -786,7 +811,8 @@ void SymRS::encodeTransitions(void)
VERB("Augmenting transition relation encoding with the transition relation for context automaton"); VERB("Augmenting transition relation encoding with the transition relation for context automaton");
if (opts->part_tr_rel) { if (opts->part_tr_rel) {
FERROR("Partitioned transition relation is currently not supported"); auto last_index = numberOfProc;
(*partTrans)[last_index] = *tr_ca;
} }
else { else {
assert(tr_ca != nullptr); assert(tr_ca != nullptr);
@@ -915,4 +941,14 @@ void SymRS::encodeCtxAutTrans(void)
} }
} }
void SymRS::reorder(void)
{
if (opts->reorder_trans) {
VERB_L2("Reordering START");
Cudd_ReduceHeap(cuddMgr->getManager(), CUDD_REORDER_SIFT, 10000);
VERB_L2("Reordering DONE");
}
}
/** EOF **/ /** EOF **/

View File

@@ -344,6 +344,8 @@ class SymRS
size_t getCtxAutStateEncodingSize(void); size_t getCtxAutStateEncodingSize(void);
void reorder(void);
}; };
#endif #endif