Maps for local entities
This commit is contained in:
38
symrs.cc
38
symrs.cc
@@ -61,11 +61,28 @@ void SymRS::encode(void)
|
||||
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)
|
||||
{
|
||||
|
||||
//
|
||||
// Reactions
|
||||
|
||||
//
|
||||
for (const auto &proc_rcts : rs->proc_reactions) {
|
||||
Process proc_id = proc_rcts.first;
|
||||
|
||||
@@ -78,13 +95,20 @@ void SymRS::mapProcEntities(void)
|
||||
}
|
||||
}
|
||||
|
||||
prod_ent_local_idx = buildLocalEntitiesMap(usedProducts);
|
||||
|
||||
//
|
||||
// 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 )
|
||||
// usedCtxEntities
|
||||
|
||||
cout << rs->procEntitiesToStr(usedProducts) << endl;
|
||||
|
||||
ctx_ent_local_idx = buildLocalEntitiesMap(usedCtxEntities);
|
||||
// cout << rs->procEntitiesToStr(usedCtxEntities) << endl;
|
||||
}
|
||||
|
||||
BDD SymRS::encEntity_raw(Entity entity, bool succ) const
|
||||
|
||||
8
symrs.hh
8
symrs.hh
@@ -238,6 +238,11 @@ class SymRS
|
||||
EntitiesForProc usedProducts;
|
||||
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(Entity entity) const
|
||||
{
|
||||
@@ -296,6 +301,8 @@ class SymRS
|
||||
void encodeInitStatesForCtxAut(void);
|
||||
void encodeInitStatesNoCtxAut(void);
|
||||
void mapStateToAct(void);
|
||||
LocalIndicesForProcEntities buildLocalEntitiesMap(const EntitiesForProc
|
||||
&procEnt);
|
||||
void mapProcEntities(void);
|
||||
void encode(void);
|
||||
|
||||
@@ -307,7 +314,6 @@ class SymRS
|
||||
|
||||
size_t getCtxAutStateEncodingSize(void);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#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<Entity, unsigned int> EntiesToLocalIndex;
|
||||
typedef std::map<Process, EntiesToLocalIndex> LocalIndicesForProcEntities;
|
||||
|
||||
struct ReactionCond {
|
||||
Entities rctt;
|
||||
Entities inhib;
|
||||
|
||||
Reference in New Issue
Block a user