Maps for local entities
This commit is contained in:
@@ -114,7 +114,7 @@ void CtxAut::showTransitions(void)
|
|||||||
for (const auto &t : transitions) {
|
for (const auto &t : transitions) {
|
||||||
cout << " * [" << getStateName(t.src_state) << " -> " << getStateName(
|
cout << " * [" << getStateName(t.src_state) << " -> " << getStateName(
|
||||||
t.dst_state)
|
t.dst_state)
|
||||||
<< "]: {" << parent_rctsys->procEntitiesToStr(t.ctx) << "}" << endl;
|
<< "]: { " << parent_rctsys->procEntitiesToStr(t.ctx) << "}" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
rs.cc
2
rs.cc
@@ -183,7 +183,7 @@ std::string RctSys::entitiesToStr(const Entities &entities)
|
|||||||
|
|
||||||
std::string RctSys::procEntitiesToStr(const EntitiesForProc &procEntities)
|
std::string RctSys::procEntitiesToStr(const EntitiesForProc &procEntities)
|
||||||
{
|
{
|
||||||
std::string s = " ";
|
std::string s = "";
|
||||||
|
|
||||||
for (auto const &p : procEntities) {
|
for (auto const &p : procEntities) {
|
||||||
s += getProcessName(p.first) + "={" + entitiesToStr(p.second) + "} ";
|
s += getProcessName(p.first) + "={" + entitiesToStr(p.second) + "} ";
|
||||||
|
|||||||
38
symrs.cc
38
symrs.cc
@@ -61,11 +61,28 @@ void SymRS::encode(void)
|
|||||||
VERB("Encoding done");
|
VERB("Encoding done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocalIndicesForProcEntities SymRS::buildLocalEntitiesMap(
|
||||||
|
const EntitiesForProc &procEnt)
|
||||||
|
{
|
||||||
|
LocalIndicesForProcEntities ent_map;
|
||||||
|
unsigned int cnt = 0;
|
||||||
|
|
||||||
|
for (const auto &proc_ent : procEnt) {
|
||||||
|
Process proc_id = proc_ent.first;
|
||||||
|
|
||||||
|
for (const auto &e : proc_ent.second) {
|
||||||
|
ent_map[proc_id][e] = cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ent_map;
|
||||||
|
}
|
||||||
|
|
||||||
void SymRS::mapProcEntities(void)
|
void SymRS::mapProcEntities(void)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
// Reactions
|
// Reactions
|
||||||
|
//
|
||||||
for (const auto &proc_rcts : rs->proc_reactions) {
|
for (const auto &proc_rcts : rs->proc_reactions) {
|
||||||
Process proc_id = proc_rcts.first;
|
Process proc_id = proc_rcts.first;
|
||||||
|
|
||||||
@@ -78,13 +95,20 @@ void SymRS::mapProcEntities(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prod_ent_local_idx = buildLocalEntitiesMap(usedProducts);
|
||||||
|
|
||||||
|
//
|
||||||
// Context automaton
|
// Context automaton
|
||||||
|
//
|
||||||
|
for (const auto &tr : rs->ctx_aut->transitions) {
|
||||||
|
for (const auto &proc_ctx : tr.ctx) {
|
||||||
|
Process proc_id = proc_ctx.first;
|
||||||
|
SET_ADD(usedCtxEntities[proc_id], proc_ctx.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// for (const )
|
ctx_ent_local_idx = buildLocalEntitiesMap(usedCtxEntities);
|
||||||
// usedCtxEntities
|
// cout << rs->procEntitiesToStr(usedCtxEntities) << endl;
|
||||||
|
|
||||||
cout << rs->procEntitiesToStr(usedProducts) << endl;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BDD SymRS::encEntity_raw(Entity entity, bool succ) const
|
BDD SymRS::encEntity_raw(Entity entity, bool succ) const
|
||||||
|
|||||||
8
symrs.hh
8
symrs.hh
@@ -238,6 +238,11 @@ class SymRS
|
|||||||
EntitiesForProc usedProducts;
|
EntitiesForProc usedProducts;
|
||||||
EntitiesForProc usedCtxEntities;
|
EntitiesForProc usedCtxEntities;
|
||||||
|
|
||||||
|
// Local indices for each entity (per process):
|
||||||
|
// separete for state/product entities and context
|
||||||
|
LocalIndicesForProcEntities prod_ent_local_idx;
|
||||||
|
LocalIndicesForProcEntities ctx_ent_local_idx;
|
||||||
|
|
||||||
BDD encEntity_raw(Entity entity, bool succ) const;
|
BDD encEntity_raw(Entity entity, bool succ) const;
|
||||||
BDD encEntity(Entity entity) const
|
BDD encEntity(Entity entity) const
|
||||||
{
|
{
|
||||||
@@ -296,6 +301,8 @@ class SymRS
|
|||||||
void encodeInitStatesForCtxAut(void);
|
void encodeInitStatesForCtxAut(void);
|
||||||
void encodeInitStatesNoCtxAut(void);
|
void encodeInitStatesNoCtxAut(void);
|
||||||
void mapStateToAct(void);
|
void mapStateToAct(void);
|
||||||
|
LocalIndicesForProcEntities buildLocalEntitiesMap(const EntitiesForProc
|
||||||
|
&procEnt);
|
||||||
void mapProcEntities(void);
|
void mapProcEntities(void);
|
||||||
void encode(void);
|
void encode(void);
|
||||||
|
|
||||||
@@ -307,7 +314,6 @@ class SymRS
|
|||||||
|
|
||||||
size_t getCtxAutStateEncodingSize(void);
|
size_t getCtxAutStateEncodingSize(void);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
3
types.hh
3
types.hh
@@ -39,6 +39,9 @@ typedef std::map<std::string, State> StatesByName;
|
|||||||
|
|
||||||
typedef std::map<Process, Entities> EntitiesForProc;
|
typedef std::map<Process, Entities> EntitiesForProc;
|
||||||
|
|
||||||
|
typedef std::map<Entity, unsigned int> EntiesToLocalIndex;
|
||||||
|
typedef std::map<Process, EntiesToLocalIndex> LocalIndicesForProcEntities;
|
||||||
|
|
||||||
struct ReactionCond {
|
struct ReactionCond {
|
||||||
Entities rctt;
|
Entities rctt;
|
||||||
Entities inhib;
|
Entities inhib;
|
||||||
|
|||||||
Reference in New Issue
Block a user