|
|
||||||
|
cfl_bisimcta.cpp
Go to the documentation of this file.
46 std::ostringstream cfl_line; cfl_line << msg << std::endl; faudes::ConsoleOut::G()->Write(cfl_line.str(),0,0,0);} }
49 std::ostringstream cfl_line; cfl_line << msg << std::endl; faudes::ConsoleOut::G()->Write(cfl_line.str(),0,0,0);} }
54 // ****************************************************************************************************************************
55 // ****************************************************************************************************************************
57 // ****************************************************************************************************************************
58 // ****************************************************************************************************************************
63 * The following class implements a basic normal bisimulation partition algorithms and derives a class
64 * for partitioning w.r.t. delayed bisimulation and weak bisimulation . All these algorithms are introduced
67 * from Stefan Blom and Simona Orzan (see ref. of cited paper). Besides, the current paper uses topological
68 * sorted states to avoid computing saturated transitions explicitly when computing delayed and weak bisimulation.
70 * IMPORTANT NOTE: both algorithms for delayed and weak bisimulation requires tau-loop free automaton. This shall
76 BisimulationCTA(const Generator &rGen, const std::vector<StateSet> &rPrePartition) : mGen(&rGen), mPrePartition(rPrePartition){}
92 std::vector< std::set<Idx> > cafter; // cafter by event (the std::set<Idx> is the set of c-values)
93 std::vector< Idx > evs; // active event set, only for pre-partition. (indicates "delayed" active ev in case of daleyd- or weak-bisim)
100 std::vector<State> mStates; // vector of all states [starting with 1 -- use min-index for debugging]
140 /*! state prepartition with original state idx (the same as state label as in cited paper). Empty for trivial prepartition. */
181 * Derived from Bisimulation class. We implement the "two-pass change-tracking" algorithm from the cited paper.
185 AbstractBisimulationCTA (const Generator& rGen, const Idx& rSilent, const Idx& rTaskFlag, const std::vector<StateSet>& rPrePartition)
293 // ****************************************************************************************************************************
294 // ****************************************************************************************************************************
296 // ****************************************************************************************************************************
297 // ****************************************************************************************************************************
339 else if (rFlag == 2){ // in case for observed transition (flag == 2), add non-silent transition to silent successor
465 // initialize c value. c = 1 if no prepartition; c = (index of prepartion) + 1 if prepartition defined
473 throw Exception("EncodeData:: ", "invalide prepartition. State "+ ToStringInteger(*sit) + "is not allocated.", 100);
578 // sort affected nodes by cafter (line 27. Note in cited paper line 27, it says sort "NOT" affected nodes.
579 // this shall be a typo since all unaffected nodes in this class shall have the same cafter, as their
585 eqclass.splice(eqclass.begin(),eqclass_aff);// hook the sorted eqclass_aff again to the front of eqclass
587 // delete the largest set of states with the same cafter (line 28). c_value of these states are preserved
589 std::vector<std::set<Idx>> maxCafter; // cafter corresponding to most states in the current class
674 mAlphSize = mGen->Alphabet().Size(); // Note the difference with BisimulationCTA::EncodeData(). Index 0 is for silent event
699 throw Exception("DelayedBisimulationCTA::EncodeData(): ", "input automaton shall not have tau loop. Please factor"
726 std::vector<Idx>::const_iterator eit = mStates[smap[tit->X2]].evs.begin(); // the state smap[tit->X2] must have been encoded
736 // initialize c value. c = 1 if no prepartition; c = (index of prepartion) + 1 if prepartition defined
744 throw Exception("EncodeData:: ", "invalide prepartition. State "+ ToStringInteger(*sit) + "is not allocated.", 100);
783 void AbstractBisimulationCTA::MarkTauStarAffected(std::vector<bool> &rAffected, const Idx& rState){
825 std::vector<Idx>::const_iterator suctauit = mStates[stateit].suc[0].begin(); // iterate over tau successors
856 mAffected[affectedit] = 1; // no need to mark all taupred of affectedit as they are all in taustarpred
870 mStates[stateit].cafter[0].insert(mStates[*tausucit].cafter[0].begin(),mStates[*tausucit].cafter[0].end());
882 mStates[stateit].cafter[sucevit].insert(mStates[*sucstateit].cafter[0].begin(),mStates[*sucstateit].cafter[0].end());
888 std::vector<Idx>::const_iterator sucstateit = mStates[stateit].suc[0].begin(); // iterate over tau-succesor states
890 mStates[stateit].cafter[sucsucevit].insert(mStates[*sucstateit].cafter[sucsucevit].begin(),mStates[*sucstateit].cafter[sucsucevit].end());
930 void ComputeBisimulationCTA(const Generator& rGen, std::list<StateSet>& rResult, const std::vector<StateSet>& rPrePartition){
935 void ComputeDelayedBisimulationCTA(const Generator& rGen, const EventSet &rSilent, std::list<StateSet>& rResult){
944 else throw Exception("ComputeDelayedBisimulationCTA:","silent alphabet can contain at most one event", 100);
948 void ComputeBisimulationCTA(const Generator& rGen, const EventSet &rSilent, std::list<StateSet>& rResult, const std::vector<StateSet>& rPrePartition){
956 else throw Exception("ComputeDelayedBisimulationCTA:","silent alphabet can contain at most one event", 100);
960 void ComputeWeakBisimulationCTA(const Generator& rGen, const EventSet &rSilent, std::list<StateSet>& rResult){
969 else throw Exception("ComputeWeakBisimulation::","silent alphabet can contain at most one event", 100);
972 void ComputeWeakBisimulation(const Generator& rGen, const EventSet &rSilent, std::list<StateSet>& rResult, const std::vector<StateSet>& rPrePartition){
980 else throw Exception("ComputeWeakBisimulationCTA::","silent alphabet can contain at most one event", 100);
984 const Generator& rGen, const EventSet& rSilent, std::list<StateSet>& rResult, const Idx& rFlag, const std::vector<StateSet>& rPrePartition){
995 else throw Exception("ComputeAbstractBisimulationSatCTA::","silent alphabet can contain at most one event", 100);
999 void ComputeDelayedBisimulationSatCTA(const Generator& rGen, const EventSet& rSilent, std::list<StateSet>& rResult){
1004 void ComputeWeakBisimulationSatCTA(const Generator& rGen, const EventSet& rSilent, std::list<StateSet>& rResult){
1009 void ComputeDelayedBisimulationSatCTA(const Generator& rGen, const EventSet& rSilent, std::list<StateSet>& rResult, const std::vector<StateSet>& rPrePartition){
1013 void ComputeWeakBisimulationSatCTA(const Generator& rGen, const EventSet& rSilent, std::list<StateSet>& rResult, const std::vector<StateSet>& rPrePartition){
Bisimulation relations. The DelayedBisimulation class Derived from Bisimulation class. We implement the "two-pass change-trac... Definition: cfl_bisimcta.cpp:183 void ComputeChangedDelayedAfters(void) ComputeChangedDelayedAfters see Fig. 10 of cited paper. Definition: cfl_bisimcta.cpp:793 virtual void ComputePartition(std::list< StateSet > &rResult) BisimulationPartition wrapper. Definition: cfl_bisimcta.cpp:916 void ComputeChangedObservedAfters(void) ComputeChangedObservedAfters see Fig. 12 of cited paper. Definition: cfl_bisimcta.cpp:838 const Idx mTaskFlag mTaskFlag flag for task: mTaskFlag == 1: delayed bisimulation mTaskFlag == 2: weak bisimulation Definition: cfl_bisimcta.cpp:203 void ComputeAbstractBisimulation() ComputeDelayedBisimulation perform the overall iteration based on different task flag value,... Definition: cfl_bisimcta.cpp:897 void MarkTauStarAffected(std::vector< bool > &rAffected, const Idx &rState) MarkTauAffected perform a recursive Depth-First-Search to mark all tau* predecessors as affected base... Definition: cfl_bisimcta.cpp:783 AbstractBisimulationCTA(const Generator &rGen, const Idx &rSilent, const Idx &rTaskFlag, const std::vector< StateSet > &rPrePartition) Definition: cfl_bisimcta.cpp:185 virtual void EncodeData(void) EncodeData basic preparation for bisimulation NOTE: this function is virtual since derived classes,... Definition: cfl_bisimcta.cpp:672 The Bisimulation class The following class implements a basic normal bisimulation partition algorithm... Definition: cfl_bisimcta.cpp:74 virtual ~BisimulationCTA()=default const std::vector< StateSet > mPrePartition Definition: cfl_bisimcta.cpp:141 void RefineChanged(void) RefineChanged refine equivalence classes contained affected nodes in the last iteration (see Fig.... Definition: cfl_bisimcta.cpp:551 virtual void ComputePartition(std::list< StateSet > &rResult) BisimulationPartition wrapper. Definition: cfl_bisimcta.cpp:661 virtual void EncodeData(void) EncodeData encode source generator into vector-form data structures to accelerate the iteration. Definition: cfl_bisimcta.cpp:432 void FirstStepApproximation(void) FirstStepApproximation (see Fig. 2 (b) in cited paper) Prepartition states according to their active ... Definition: cfl_bisimcta.cpp:502 void GenerateResult(std::list< StateSet > &rResult) GenerateResult generate partition result w.r.t. original state indices (without trivial classes) Definition: cfl_bisimcta.cpp:644 void ComputeBisimulation(void) ComputeBisimulation perform the overall iteration. Definition: cfl_bisimcta.cpp:631 BisimulationCTA(const Generator &rGen, const std::vector< StateSet > &rPrePartition) Definition: cfl_bisimcta.cpp:76 void ComputeChangedAfters(void) ComputeChangedAfters Compute changed afters of each affected state. (see Fig 5. in cited paper) Affec... Definition: cfl_bisimcta.cpp:525 TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator Iterator on transition. Definition: cfl_transset.h:269 The TopoSort class perform a topological sort on states of a given automaton. if s1 is before s2 in t... Definition: cfl_bisimcta.cpp:262 TopoSort(const Generator &rGen, const EventSet &rEvs) Definition: cfl_bisimcta.cpp:374 StateSet::Iterator StatesBegin(void) const Iterator to Begin() of state set. Definition: cfl_generator.cpp:1057 const TransSet & TransRel(void) const Return reference to transition relation. Definition: cfl_generator.cpp:1888 bool SetTransition(Idx x1, Idx ev, Idx x2) Add a transition to generator by indices. Definition: cfl_generator.cpp:1626 const EventSet & Alphabet(void) const Return const reference to alphabet. Definition: cfl_generator.cpp:1878 EventSet ActiveEventSet(Idx x1) const Return active event set at state x1. Definition: cfl_generator.cpp:1938 TransSet::Iterator TransRelBegin(void) const Iterator to Begin() of transition relation. Definition: cfl_generator.cpp:1067 EventSet::Iterator AlphabetBegin(void) const Iterator to Begin() of alphabet. Definition: cfl_generator.cpp:1047 StateSet::Iterator StatesEnd(void) const Iterator to End() of state set. Definition: cfl_generator.cpp:1062 TransSet::Iterator TransRelEnd(void) const Iterator to End() of transition relation. Definition: cfl_generator.cpp:1072 void InjectTransRel(const TransSet &rNewtransrel) Set transition relation without consistency check (no attributes) Definition: cfl_generator.cpp:1588 EventSet::Iterator AlphabetEnd(void) const Iterator to End() of alphabet. Definition: cfl_generator.cpp:1052 virtual void InsertSet(const TBaseSet &rOtherSet) Insert elements given by rOtherSet. Definition: cfl_baseset.h:1987 void ExtendTransRel(Generator &rGen, const EventSet &rSilent, const Idx &rFlag) ExtendTransRel perform transition saturation w.r.t. silent evs. Two different saturation modes are se... Definition: cfl_bisimcta.cpp:308 void InstallSelfloops(Generator &rGen, const EventSet &rEvs) InstallSelfloops install selfloops on all states of given event set. intended to install silent event... Definition: cfl_bisimcta.cpp:357 void ComputeAbstractBisimulationSatCTA(const Generator &rGen, const EventSet &rSilent, std::list< StateSet > &rResult, const Idx &rFlag, const std::vector< StateSet > &rPrePartition) ComputeAbstractBisimulationSatCTA saturation and change-tracking based partition algorithm for either... Definition: cfl_bisimcta.cpp:983 void ComputeWeakBisimulation(const Generator &rGen, const EventSet &rSilent, std::list< StateSet > &rResult, const std::vector< StateSet > &rPrePartition) Definition: cfl_bisimcta.cpp:972 bool topoSort(const Generator &rGen, const EventSet &rEvs, std::list< Idx > &result) topoSort wrapper for topological sortation rEvs is the set of events which will be considered while s... Definition: cfl_bisimcta.cpp:419 void ComputeBisimulationCTA(const Generator &rGen, std::list< StateSet > &rResult) ComputeBisimulationCTA basic bisimulation partition algorithm based on change-tracking algorithm. Definition: cfl_bisimcta.cpp:924 void ComputeWeakBisimulationCTA(const Generator &rGen, const EventSet &rSilent, std::list< StateSet > &rResult) ComputeWeakBisimulationCTA weak bisimulation (aka observation eq) partition based on change-tracking ... Definition: cfl_bisimcta.cpp:960 void ComputeDelayedBisimulationCTA(const Generator &rGen, const EventSet &rSilent, std::list< StateSet > &rResult) Definition: cfl_bisimcta.cpp:935 void ComputeWeakBisimulationSatCTA(const Generator &rGen, const EventSet &rSilent, std::list< StateSet > &rResult) ComputeWeakBisimulationSatCTA weak bisimulation (aka observation eq) partition based on change-tracki... Definition: cfl_bisimcta.cpp:1004 void ComputeDelayedBisimulationSatCTA(const Generator &rGen, const EventSet &rSilent, std::list< StateSet > &rResult) ComputeDelayedBisimulationSatCTA delayed bisimulation partition based on change-tracking algorithm an... Definition: cfl_bisimcta.cpp:999 std::vector< std::set< Idx > > cafter Definition: cfl_bisimcta.cpp:92 std::vector< std::vector< Idx > > suc Definition: cfl_bisimcta.cpp:90 Definition: cfl_bisimcta.cpp:264 libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen |