Formatting, initial state encoding
This commit is contained in:
5
mc.cc
5
mc.cc
@@ -7,8 +7,7 @@ ModelChecker::ModelChecker(SymRS *srs, Options *opts)
|
||||
|
||||
cuddMgr = srs->getCuddMgr();
|
||||
|
||||
if (!srs->usingContextAutomaton())
|
||||
initStates = srs->getEncInitStates();
|
||||
initStates = srs->getEncInitStates();
|
||||
|
||||
totalStateVars = srs->getTotalStateVars();
|
||||
|
||||
@@ -35,7 +34,7 @@ ModelChecker::ModelChecker(SymRS *srs, Options *opts)
|
||||
|
||||
if (srs->usingContextAutomaton())
|
||||
{
|
||||
ca_init_state = srs->getEncCtxAutInitState();
|
||||
// ca_init_state = srs->getEncCtxAutInitState();
|
||||
pv_ca = srs->getEncCtxAutPV();
|
||||
pv_ca_succ = srs->getEncCtxAutPVsucc();
|
||||
ca_tr = srs->getEncCtxAutTrans();
|
||||
|
||||
4
mc.hh
4
mc.hh
@@ -31,10 +31,10 @@ class ModelChecker
|
||||
BDD *trm;
|
||||
|
||||
// Context Automaton
|
||||
BDD *ca_init_state;
|
||||
vector<BDD> *pv_ca;
|
||||
vector<BDD> *pv_ca_succ;
|
||||
BDD *ca_tr;
|
||||
// BDD *ca_tr;
|
||||
// BDD *ca_init_state;
|
||||
|
||||
unsigned int trp_size;
|
||||
unsigned int totalStateVars;
|
||||
|
||||
35
symrs.cc
35
symrs.cc
@@ -337,8 +337,33 @@ BDD SymRS::encNoContext(void)
|
||||
|
||||
void SymRS::encodeInitStates(void)
|
||||
{
|
||||
VERB("Encoding initial states");
|
||||
if (usingContextAutomaton())
|
||||
{
|
||||
VERB("Encoding initial states (using context automaton)");
|
||||
encodeInitStatesForCtxAut();
|
||||
}
|
||||
else
|
||||
{
|
||||
VERB("Encoding initial states (for the action entities method -- no CA)");
|
||||
encodeInitStatesNoCtxAut();
|
||||
}
|
||||
VERB("Initial states encoded");
|
||||
}
|
||||
|
||||
void SymRS::encodeInitStatesForCtxAut(void)
|
||||
{
|
||||
initStates = new BDD(BDD_TRUE);
|
||||
|
||||
for (unsigned int i = 0; i < totalStateVars; ++i)
|
||||
{
|
||||
*initStates *= !(*pv)[i];
|
||||
}
|
||||
|
||||
*initStates *= getEncCtxAutInitState();
|
||||
}
|
||||
|
||||
void SymRS::encodeInitStatesNoCtxAut(void)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if (opts->part_tr_rel)
|
||||
assert(partTrans != nullptr);
|
||||
@@ -370,8 +395,6 @@ void SymRS::encodeInitStates(void)
|
||||
|
||||
*initStates += q;
|
||||
}
|
||||
|
||||
VERB("Initial states encoded");
|
||||
}
|
||||
|
||||
void SymRS::mapStateToAct(void)
|
||||
@@ -487,15 +510,13 @@ BDD SymRS::encCtxAutState_raw(State state_id, bool succ) const
|
||||
return r;
|
||||
}
|
||||
|
||||
BDD *SymRS::getEncCtxAutInitState(void)
|
||||
BDD SymRS::getEncCtxAutInitState(void)
|
||||
{
|
||||
VERB_LN(2, "Encoding context automaton's initial state");
|
||||
|
||||
State state = rs->ctx_aut->getInitState();
|
||||
|
||||
BDD *r = new BDD(encCtxAutState(state));
|
||||
|
||||
return r;
|
||||
return encCtxAutState(state);
|
||||
}
|
||||
|
||||
BDD *SymRS::getEncCtxAutTrans(void)
|
||||
|
||||
84
symrs.hh
84
symrs.hh
@@ -113,6 +113,8 @@ class SymRS
|
||||
void encodeTransitions(void);
|
||||
void encodeTransitions_old(void);
|
||||
void encodeInitStates(void);
|
||||
void encodeInitStatesForCtxAut(void);
|
||||
void encodeInitStatesNoCtxAut(void);
|
||||
void mapStateToAct(void);
|
||||
void encode(void);
|
||||
|
||||
@@ -142,60 +144,60 @@ public:
|
||||
BDD getBDDtrue(void) const { return BDD_TRUE; }
|
||||
BDD getBDDfalse(void) const { return BDD_FALSE; }
|
||||
|
||||
/**
|
||||
* @brief Checks if context automaton is used
|
||||
*
|
||||
* @return True if CA is used
|
||||
*/
|
||||
/**
|
||||
* @brief Checks if context automaton is used
|
||||
*
|
||||
* @return True if CA is used
|
||||
*/
|
||||
bool usingContextAutomaton(void) { return rs->ctx_aut != nullptr; }
|
||||
|
||||
/**
|
||||
* @brief Encodes a context automaton's state
|
||||
*
|
||||
* @return Returns the encoded state
|
||||
*/
|
||||
/**
|
||||
* @brief Encodes a context automaton's state
|
||||
*
|
||||
* @return Returns the encoded state
|
||||
*/
|
||||
BDD encCtxAutState_raw(State state_id, bool succ) const;
|
||||
|
||||
/**
|
||||
* @brief Encodes a context automaton's state (as predecessor/non-primed)
|
||||
*
|
||||
* @return Returns the encoded state
|
||||
*/
|
||||
/**
|
||||
* @brief Encodes a context automaton's state (as predecessor/non-primed)
|
||||
*
|
||||
* @return Returns the encoded state
|
||||
*/
|
||||
BDD encCtxAutState(State state_id) const { return encCtxAutState_raw(state_id, false); }
|
||||
|
||||
/**
|
||||
* @brief Encodes a context automaton's state (as successor/primed)
|
||||
*
|
||||
* @return Returns the encoded state
|
||||
*/
|
||||
/**
|
||||
* @brief Encodes a context automaton's state (as successor/primed)
|
||||
*
|
||||
* @return Returns the encoded state
|
||||
*/
|
||||
BDD encCtxAutStateSucc(State state_id) const { return encCtxAutState_raw(state_id, true); }
|
||||
|
||||
/**
|
||||
* @brief Encodes the initial state of context automaton
|
||||
*
|
||||
* @return Returns the encoded state(s)
|
||||
*/
|
||||
BDD *getEncCtxAutInitState(void);
|
||||
/**
|
||||
* @brief Encodes the initial state of context automaton
|
||||
*
|
||||
* @return Returns the encoded state(s)
|
||||
*/
|
||||
BDD getEncCtxAutInitState(void);
|
||||
|
||||
/**
|
||||
* @brief Getter for context automaton's state variables (predecessor/non-primed)
|
||||
*
|
||||
* @return Returns a vector of BDDs
|
||||
*/
|
||||
/**
|
||||
* @brief Getter for context automaton's state variables (predecessor/non-primed)
|
||||
*
|
||||
* @return Returns a vector of BDDs
|
||||
*/
|
||||
vector<BDD> *getEncCtxAutPV(void) { return pv_ca; }
|
||||
|
||||
/**
|
||||
* @brief Getter for context automaton's successor (primed) state variables
|
||||
*
|
||||
* @return Returns a vector of BDDs
|
||||
*/
|
||||
/**
|
||||
* @brief Getter for context automaton's successor (primed) state variables
|
||||
*
|
||||
* @return Returns a vector of BDDs
|
||||
*/
|
||||
vector<BDD> *getEncCtxAutPVsucc(void) { return pv_ca_succ; }
|
||||
|
||||
/**
|
||||
* @brief Encodes the monolithic transition relation
|
||||
*
|
||||
* @return Returns a BDD encoding the transition relation
|
||||
*/
|
||||
/**
|
||||
* @brief Encodes the monolithic transition relation
|
||||
*
|
||||
* @return Returns a BDD encoding the transition relation
|
||||
*/
|
||||
BDD *getEncCtxAutTrans(void);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user