op_observercomputation.cpp
Go to the documentation of this file.
8 output control consistency (OCC) and local control consistency (LCC) are provided. See for example
46 void calculateDynamicSystemClosedObs(const Generator& rGen, EventSet& rHighAlph, Generator& rGenDyn)
48 OP_DF("calculateDynamicSystemClosedObs(" << rGen.Name() << "," << rHighAlph.Name() << "," << rGenDyn.Name() << ")");
55 rGenDyn.InjectAlphabet(rHighAlph); // all high-level events are contained in the alphabet of rGenDyn
81 OP_DF("calculateDynamicSystemClosedObs: loop over all states; current state: " << rGen.StateName(*stateSetIt)
95 // insert the exit state and the high-level event with the reachable entry state into the exitStates set
104 // compute locally reachable states for current entry state and insert it into entryStateToLocalReach
111 // after this loop we have the set of exit states in exitStates and a map from entry states to their
121 // We compute the local backward reach of each exit state and find the corresponding entry states in
135 // loop over all pairs (Ev,X2) of current exit state and insert transitions from all states in the
161 OP_DF("calculateDynamicSystemObs(" << rGen.Name() << "," << rHighAlph.Name() << "," << rGenDyn.Name() << ")");
175 OP_DF("calculateDynamicSystemObs: loop over all states; current state: " << rGen.StateName(*stateSetIt)
197 OP_DF("calculateDynamicSystemMSA(" << rGen.Name() << "," << rHighAlph.Name() << "," << rGenDyn.Name() << ")");
221 OP_DF("calculateDynamicSystemMSA: loop over all states; current state: " << rGen.StateName(*stateSetIt)
225 // if all forward transitions lead to marked states, all states that have been reached are states where msa holds
232 // if all backward transitions lead to marked states, all states that have been reached are states where msa holds
237 // otherwise, msa is violated for the current state. Then, msa-transitions are introduced to all states
252 bool recursiveCheckMSAForward(const Generator& rGen, const EventSet& rHighAlph, Idx currentState, StateSet& rDoneStates){
278 bool recursiveCheckMSABackward(const Generator& rGen, const TransSetX2EvX1& rRevTransSet, const EventSet& rHighAlph, Idx currentState, StateSet& rDoneStates){
303 void calculateDynamicSystemLCC(const Generator& rGen, const EventSet& rControllableEvents, const EventSet& rHighAlph, Generator& rGenDyn){
304 OP_DF("calculateDynamicSystemLCC(" << rGen.Name() << "," << rControllableEvents.Name() << "," << rHighAlph.Name() << "," << rGenDyn.Name() << ")");
312 // labels for transitions for states with uncontrollable successor strings in the dynamic system
320 std::string eventname = ( rGenDyn.EventSymbolTablep())->UniqueSymbol(SymbolTable::GlobalEventSymbolTablep()->Symbol(*eIt) + "LCCLabel");
333 OP_DF("calculateDynamicSystemLCC: loop over all states; current state: " << rGen.StateName(*sIt)
342 // if the event is an uncontrollable high-level event, it is inserted for the current exit state
354 // after this loop, we have the set of exit states with their outgoing uncontrollable high-level events.
355 // Now we compute the backwards reachable state via uncontrollable strings to determine all states where lcc holds
365 // transitions are introduced to all states that are reachable via strings including one high-level event
377 // loop over all states reachable via strings with one high-level event (these states are already encoded
387 void recursiveCheckLCC(const TransSetX2EvX1& rRevTransSet, const EventSet& rControllableEvents, const EventSet& rHighAlph, Idx currentState, StateSet& rDoneStates){
398 // if the transition is uncontrollable, an uncontrollable string has been found -> LCC is fulfilled
401 // if the event is an uncontrollable low-level event, we go backward along uncontrollable transitions
408 // the end of the loop is reached, if no more uncontrollable event has been found from the current state
462 Int calcNaturalObserverLCC(const Generator& rGen, const EventSet& rControllableEvents, EventSet& rHighAlph){
513 Int calcMSAObserverLCC(const Generator& rGen, const EventSet& rControllableEvents, EventSet& rHighAlph){
540 void ExtendHighAlphabet(const Generator& rGen, EventSet& rHighAlph, map<Idx,Idx>& rMapStateToPartition){
576 map<Idx,map<Idx,pair<StateSet,IndexSet> > > eventStatesMap; // (coset, event, exit states, goal cosets)
606 // if there is more than one goal coset, the current event introduces nondeterminism in the current coset
614 // All outgoing transitions for any coset are determined. Now, the localViolatingEvents are added
617 // Only if there were no local violating events added to the high-level alphabet, the nondeterministic transitions are checked (Modification with respect to Lei Feng's algorithm)
631 if(nondeterministicStates[fIt->first].empty() == true) // no need to split if there are no nondeterministic states
654 bool CheckSplit(const Generator& rGen, const EventSet& rSplitAlphabet, const vector<pair<StateSet, Idx> >& rNondeterministicStates, Idx entryState){
658 // check if for any of the nondeterministic state sets, more than one state appears in the local accessible reach
687 void calcAbstAlphClosed(System& rGenObs, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Idx,set<Idx > > & rMapRelabeledEvents) {
688 OP_DF("calcAbstAlphClosed(" << rGenObs.Name() << "," << "rHighAlph, rNewHighAlph, rMapRelabeledEvents)");
693 // the controllable events that have been changed by the called function are set in the System cGenObs
697 // calcAbstAlphClosed(rGenObs, rControllableEvents, rHighAlph, rNewHighAlph, rMapRelabeledEvents)
698 void calcAbstAlphClosed(Generator& rGenObs, EventSet& rControllableEvents, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Idx,set<Idx > > & rMapRelabeledEvents) {
699 OP_DF("calcAbstAlphClosed(" << rGenObs.Name() << "," << "rControllableEvents, rHighAlph, rNewHighAlph, rMapRelabeledEvents)");
708 if(rMapRelabeledEvents.find(rtIt->first.Ev) == rMapRelabeledEvents.end() ){// if the event does not exist, yet, a nex element in the map is created
710 if(rGenObs.Alphabet().Exists(rtIt->second) )// FIXME: there seem to be relabeled transitions that do not exist
714 if(rGenObs.Alphabet().Exists(rtIt->second) )// FIXME: there seem to be relabeled transitions that do not exist
721 void calcAbstAlphClosed(Generator& rGenObs, EventSet& rControllableEvents, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Transition,Idx>& rMapChangedTrans)
723 OP_DF("calcAbstAlphClosed(" << rGenObs.Name() << ", rControllableEvents, rHighAlph, rNewHighAlph, rMapChangedTRans)");
737 // observer algorithm: In each step, a dynamic system is computed that fulfills the one-step observer condition.
738 // Iterative application of the bisimulation algorithm and the relabeling procedure yields an automaton rGenObs
739 // that, together with the new high-level alphabet rNewHighAlph fulfills the observer condition.
745 name = ("./Automata/Plots/" + rGenObs.Name() + "DynamicSystem_" + ToStringInteger(iterationCount));
756 name = ("./Automata/Plots/" + rGenObs.Name() + "Bisimulation_" + ToStringInteger(iterationCount));
762 // and relabel transitions in rGenObs if necessary. The high-level alphabet is modified accordingly
763 done=relabel(rGenObs, rControllableEvents, rNewHighAlph, newPartitions, mapStateToPartition, mapChangedTransReverse, rMapChangedTrans, mapRelabeledEvents);
769 void calcAbstAlphObs(System& rGenObs, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Idx,set<Idx > > & rMapRelabeledEvents) {
770 OP_DF("calcAbstAlphObs(" << rGenObs.Name() << "," << "rHighAlph, rNewHighAlph, rMapRelabeledEvents)");
775 // the controllable events that have been changed by the called function are set in the System cGenObs
780 void calcAbstAlphObs(Generator& rGenObs, EventSet& rControllableEvents, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Idx,set<Idx > > & rMapRelabeledEvents) {
781 OP_DF("calcAbstAlphObs(" << rGenObs.Name() << "," << "rControllableEvents, rHighAlph, rNewHighAlph, rMapRelabeledEvents)");
790 if(rMapRelabeledEvents.find(rtIt->first.Ev) == rMapRelabeledEvents.end() ){// if the event does not exist, yet, a nex element in the map is created
792 if(rGenObs.Alphabet().Exists(rtIt->second) )// FIXME: there seem to be relabeled transitions that do not exist
796 if(rGenObs.Alphabet().Exists(rtIt->second) )// FIXME: there seem to be relabeled transitions that do not exist
803 void calcAbstAlphObs(Generator& rGenObs, EventSet& rControllableEvents, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Transition,Idx>& rMapChangedTrans)
805 OP_DF("calcAbstAlphObs(" << rGenObs.Name() << ", rControllableEvents, rHighAlph, rNewHighAlph, rMapChangedTRans)");
819 // observer algorithm: In each step, a dynamic system is computed that fulfills the one-step observer condition.
820 // Iterative application of the bisimulation algorithm and the relabeling procedure yields an automaton rGenObs
821 // that, together with the new high-level alphabet rNewHighAlph fulfills the observer condition.
828 name = ("./Automata/Plots/" + rGenObs.Name() + "DynamicSystem_" + ToStringInteger(iterationCount));
839 name = ("./Automata/Plots/" + rGenObs.Name() + "Bisimulation_" + ToStringInteger(iterationCount));
845 // and relabel transitions in rGenObs if necessary. The high-level alphabet is modified accordingly
846 done=relabel(rGenObs, rControllableEvents, rNewHighAlph, newPartitions, mapStateToPartition, mapChangedTransReverse, rMapChangedTrans, mapRelabeledEvents);
852 void calcAbstAlphMSA(System& rGenObs, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Idx,set<Idx > > & rMapRelabeledEvents) {
853 OP_DF("calcAbstAlphMSA(" << rGenObs.Name() << "," << "rHighAlph, rNewHighAlph, rMapRelabeledEvents)");
858 // the controllable events that have been changed by the called function are set in the System cGenObs
863 void calcAbstAlphMSA(Generator& rGenObs, EventSet& rControllableEvents, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Idx,set<Idx > > & rMapRelabeledEvents) {
864 OP_DF("calcAbstAlphMSA(" << rGenObs.Name() << "," << "rControllableEvents, rHighAlph, rNewHighAlph, rMapRelabeledEvents)");
873 if(rMapRelabeledEvents.find(rtIt->first.Ev) == rMapRelabeledEvents.end() ){// if the event does not exist, yet, a nex element in the map is created
875 if(rGenObs.Alphabet().Exists(rtIt->second) )// FIXME: there seem to be relabeled transitions that do not exist
879 if(rGenObs.Alphabet().Exists(rtIt->second) )// FIXME: there seem to be relabeled transitions that do not exist
886 void calcAbstAlphMSA(Generator& rGenObs, EventSet& rControllableEvents, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Transition,Idx>& rMapChangedTrans)
888 OP_DF("calcAbstAlphMSA(" << rGenObs.Name() << ", rControllableEvents, rHighAlph, rNewHighAlph, rMapChangedTRans)");
902 // observer algorithm: In each step, a dynamic system is computed that fulfills the one-step observer condition.
903 // Iterative application of the bisimulation algorithm and the relabeling procedure yields an automaton rGenObs
904 // that, together with the new high-level alphabet rNewHighAlph fulfills the observer condition.
911 name = ("./Automata/Plots/" + rGenObs.Name() + "DynamicSystem_" + ToStringInteger(iterationCount));
922 name = ("./Automata/Plots/" + rGenObs.Name() + "Bisimulation_" + ToStringInteger(iterationCount));
928 // and relabel transitions in rGenObs if necessary. The high-level alphabet is modified accordingly
929 done=relabel(rGenObs, rControllableEvents, rNewHighAlph, newPartitions, mapStateToPartition, mapChangedTransReverse, rMapChangedTrans, mapRelabeledEvents);
935 // void calcAbstAlphObsOCC(System& rGenObs, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Idx,set<Idx > > & rMapRelabeledEvents){
936 // OP_DF("calcAbstAlphObsOCC(" << rGenObs.Name() << "," << "rHighAlph, rNewHighAlph, rMapRelabeledEvents)");
937 // // The controllable events are separated from the System. All functions that are successively
950 // if(rGenObs.Alphabet().Exists(rtIt->second) )// FIXME: there seem to be relabeled transitions that do not exist
953 // if(rGenObs.Alphabet().Exists(rtIt->second) )// FIXME: there seem to be relabeled transitions that do not exist
957 // // the controllable events that have been changed by the called function are set in the System cGenObs
961 // // calcAbstAlphObsOCC(rGenObs, rControllableEvents, rHighAlph, rNewHighAlph, rMapChangedTrans)
962 // void calcAbstAlphObsOCC(Generator& rGenObs, EventSet& rControllableEvents, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Transition,Idx>& rMapChangedTrans)
964 // OP_DF("calcAbstAlphObsOCC(" << rGenObs.Name() << ", rControllableEvents, rHighAlph, rNewHighAlph, rMapChangedTRans)");
978 // // observer algorithm: In each step, a dynamic system is computed that fulfills the one-step observer condition
980 // // Iterative application of the bisimulation algorithm and the relabeling procedure yields an automaton rGenObs
981 // // that, together with the new high-level alphabet rNewHighAlph fulfills the observer condition and OCC.
987 // name = ("./Automata/Plots/" + rGenObs.Name() + "DynamicSystem_" + ToStringInteger(iterationCount));
997 // name = ("./Automata/Plots/" + rGenObs.Name() + "Bisimulation_" + ToStringInteger(iterationCount));
1003 // // and relabel transitions in rGenObs if necessary. The high-level alphabet is modified accordingly
1004 // done=relabel(rGenObs, rControllableEvents, rNewHighAlph, newPartitions, mapStateToPartition, mapChangedTransReverse, rMapChangedTrans, mapRelabeledEvents);
1009 void calculateDynamicSystemObsOCC(const Generator& rGen, EventSet& rControllableEvents, EventSet& rHighAlph, Generator& rGenDyn){
1010 OP_DF("calculateDynamicSystemObsOCC(" << rGen.Name() << "," << rControllableEvents.Name() << "," << rHighAlph.Name() << "," << rGenDyn.Name() << ")");
1017 rGenDyn.InjectAlphabet(rHighAlph); // all high-level events are contained in the alphabet of rGenDyn
1030 map<Idx, map<Idx, bool> > exitLocalStatesMap; // map from each exit state to locally backward reachable states and a boolean that is false if there exists an uncontrollable path to the exit state
1031 map<Idx, StateSet> entryLocalStatesMap; // map from entry states to locally forward reachable states
1039 OP_DF("calculateDynamicSystemObsOCC: loop over all states; current state: " << rGen.StateName(*stIt)
1045 // which states can be reached on a controllable/uncontrollable path -> store in exitLocalStatesMap
1046 // in this case, also determine the corresponding entry states and compute their locally reachable states
1055 // if the local reach for the connected entry state has not been computed, yet, insert it in the
1063 // if the current state is an exit state, compute the backward local reach with the controllability properties of the
1067 exitLocalStatesMap[*stIt][*stIt] = false; // the exit state is reachable from the exit state via an uncontrollable path
1069 backwardReachabilityObsOCC(tset_X2EvX1, rControllableEvents, rHighAlph, *stIt, *stIt, false, exitLocalStatesMap, doneStates);
1074 // the generator rGenDyn is constructed by connecting all exit and entry states with their local state sets
1084 // go over all entry states reachable from the current exit state (via all feasible high-level events)
1088 OP_DF("calculateDynamicSystemObsOCC: insert transitions for the high-level event" << rGen.EventName(tsIt->Ev) << "[" << tsIt->Ev << "]");
1100 rGenDyn.SetTransition(lcIt->first,tsIt->Ev,*stIt); // insert a transition for each local state combination
1101 if( controllable || lcIt->second ){ // insert an clabel transition if the local path is controllable or the high-level event is controllable
1115 void forwardReachabilityObs(const Generator& rGen, const EventSet& rHighAlph, Idx lowState, Idx mLabel, Generator& rGenDyn) {
1116 OP_DF("forwardReachabilityObs(" << rGen.Name() << "," << rHighAlph.Name() << "," << lowState << "," << rGenDyn.EventName(mLabel) << "," << rGenDyn.Name() << ")");
1124 // algorithm: the locally reachable states from lowState are evaluated. If a reachable state is marked,
1161 // backwardReachabilityObsOCC(rTransSetX2EvX1, rControllableEvents, rHighAlph, exitState, currentState, controllablePath, rExitLocalStatesMap, rDoneStates)
1162 void backwardReachabilityObsOCC(const TransSetX2EvX1& rTransSetX2EvX1, const EventSet& rControllableEvents, const EventSet& rHighAlph, Idx exitState, Idx currentState, bool controllablePath, map<Idx, map<Idx, bool> >& rExitLocalStatesMap, StateSet& rDoneStates){
1163 OP_DF("backwardReachabilityObsOCC(rTransSetX2EvX1," << rControllableEvents.Name() << "," << rHighAlph.Name() << "," << exitState << "," << currentState << "," << controllablePath << ",rExitLocalStatesMap, rDoneStates)");
1164 // go along all backward transitions. Discard the goal state if it is reached via a high-level event or if it is in the rDoneStates and
1172 // we iterate over all backward transitions of the currentState to establish backward reachability
1174 // states reachable via a high-level event are not in the local backward reach and the controllability property of the current exitState does not change
1176 // if the state has not been visited, yet, the controllability of the current path are set in the rExitLocalStatesMap
1179 // the path is controllable if the current transition has a controllable event or the path was already controllable
1183 backwardReachabilityObsOCC(rTransSetX2EvX1, rControllableEvents, rHighAlph, exitState, tsIt->X1, currentControllablePath, rExitLocalStatesMap, rDoneStates);
1185 else{ // for an existing state, the controllability value can change from uncontrollable to controllable (if
1186 // a new controllable path has been found). It is important to note, that the OCC condition implies that
1187 // if there is one controllable path, then the the state is flagged controllable except for the case of the
1190 if(rExitLocalStatesMap[exitState][tsIt->X1] != currentControllablePath && currentControllablePath == true){
1192 // as the controllabiity attribute of the current state changed it is subject to a new backward reachability
1193 backwardReachabilityObsOCC(rTransSetX2EvX1, rControllableEvents, rHighAlph, exitState, tsIt->X1, true, rExitLocalStatesMap, rDoneStates);
1201 void calcAbstAlphObsLCC(System& rGenObs, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Idx,set<Idx > > & rMapRelabeledEvents){
1202 OP_DF("calcAbstAlphObsLCC(" << rGenObs.Name() << "," << "rHighAlph, rNewHighAlph, rMapRelabeledEvents)");
1223 // the controllable events that have been changed by the called function are set in the System cGenObs
1228 void calcAbstAlphObsLCC(Generator& rGenObs, EventSet& rControllableEvents, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Transition,Idx>& rMapChangedTrans)
1230 OP_DF("calcAbstAlphObsLCC(" << rGenObs.Name() << ", rControllableEvents, rHighAlph, rNewHighAlph, rMapChangedTRans)");
1244 // observer algorithm: In each step, a dynamic system is computed that fulfills the one-step observer condition
1246 // Iterative application of the bisimulation algorithm and the relabeling procedure yields an automaton rGenObs
1247 // that, together with the new high-level alphabet rNewHighAlph fulfills the observer condition and LCC.
1255 name = ("./Automata/Plots/" + rGenObs.Name() + "DynamicSystem_" + ToStringInteger(iterationCount));
1265 name = ("./Automata/Plots/" + rGenObs.Name() + "Bisimulation_" + ToStringInteger(iterationCount));
1271 // and relabel transitions in rGenObs if necessary. The high-level alphabet is modified accordingly
1272 done=relabel(rGenObs, rControllableEvents, rNewHighAlph, newPartitions, mapStateToPartition, mapChangedTransReverse, rMapChangedTrans, mapRelabeledEvents);
1278 void calcAbstAlphMSALCC(System& rGenObs, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Idx,set<Idx > > & rMapRelabeledEvents){
1279 OP_DF("calcAbstAlphMSALCC(" << rGenObs.Name() << "," << "rHighAlph, rNewHighAlph, rMapRelabeledEvents)");
1300 // the controllable events that have been changed by the called function are set in the System cGenObs
1305 void calcAbstAlphMSALCC(Generator& rGenObs, EventSet& rControllableEvents, EventSet& rHighAlph, EventSet& rNewHighAlph, map<Transition,Idx>& rMapChangedTrans)
1307 OP_DF("calcAbstAlphMSALCC(" << rGenObs.Name() << ", rControllableEvents, rHighAlph, rNewHighAlph, rMapChangedTRans)");
1321 // observer algorithm: In each step, a dynamic system is computed that fulfills the one-step observer condition
1323 // Iterative application of the bisimulation algorithm and the relabeling procedure yields an automaton rGenObs
1324 // that, together with the new high-level alphabet rNewHighAlph fulfills the observer condition and LCC.
1332 name = ("./Automata/Plots/" + rGenObs.Name() + "DynamicSystem_" + ToStringInteger(iterationCount));
1342 name = ("./Automata/Plots/" + rGenObs.Name() + "Bisimulation_" + ToStringInteger(iterationCount));
1348 // and relabel transitions in rGenObs if necessary. The high-level alphabet is modified accordingly
1349 done=relabel(rGenObs, rControllableEvents, rNewHighAlph, newPartitions, mapStateToPartition, mapChangedTransReverse, rMapChangedTrans, mapRelabeledEvents);
1355 void calculateDynamicSystemObsLCC(const Generator& rGen, EventSet& rControllableEvents, EventSet& rHighAlph, Generator& rGenDyn){
1356 OP_DF("calculateDynamicSystemObsLCC(" << rGen.Name() << "," << rControllableEvents.Name() << "," << rHighAlph.Name() << "," << rGenDyn.Name() << ")");
1375 map<Idx, map<Idx, bool> > exitLocalStatesMap; // map from each exit state to locally backward reachable states and a boolean that is false if there exists an uncontrollable path to the exit state
1376 map<Idx, StateSet> entryLocalStatesMap; // map from entry states to locally forward reachable states
1384 OP_DF("calculateDynamicSystemObsLCC: loop over all states; current state: " << rGen.StateName(*stIt)
1390 // which states can be reached on a controllable/uncontrollable path -> store in exitLocalStatesMap
1391 // in this case, also determine the corresponding entry states and compute their locally reachable states
1400 // if the local reach for the connected entry state has not been computed, yet, insert it in the
1408 // if the current state is an exit state, compute the backward local reach with the controllability properties of the
1412 exitLocalStatesMap[*stIt][*stIt] = false; // the exit state is reachable from the exit state via an uncontrollable path
1414 backwardReachabilityObsLCC(tset_X2EvX1, rControllableEvents, rHighAlph, *stIt, *stIt, false, exitLocalStatesMap, doneStates);
1419 // the generator rGenDyn is constructed by connecting all exit and entry states with their local state sets
1429 // go over all entry states reachable from the current exit state (via all feasible high-level events)
1433 OP_DF("calculateDynamicSystemObsLCC: insert transitions for the high-level event" << rGen.EventName(tsIt->Ev) << "[" << tsIt->Ev << "]");
1445 rGenDyn.SetTransition(lcIt->first,tsIt->Ev,*stIt); // insert a transition for each local state combination
1446 if( !(controllable || lcIt->second) ){ // insert an uclabel transition if the local path is uncontrollable
1459 // backwardReachabilityObsLCC(crTransSetX2EvX1, rControllableEvents, rHighAlph, exitState, currentState, controllablePath, rExitLocalStatesMap, rDoneStates)
1460 void backwardReachabilityObsLCC(const TransSetX2EvX1& rTransSetX2EvX1, const EventSet& rControllableEvents, const EventSet& rHighAlph, Idx exitState, Idx currentState, bool controllablePath, map<Idx, map<Idx, bool> >& rExitLocalStatesMap, StateSet& rDoneStates){
1461 OP_DF("backwardReachabilityObsOCC(rTransSetX2EvX1," << rControllableEvents.Name() << "," << rHighAlph.Name() << "," << exitState << "," << currentState << "," << controllablePath << ",rExitLocalStatesMap, rDoneStates)");
1462 // go along all backward transitions. Discard the goal state if it is reached via a high-level event or if it is in the rDoneStates and
1470 // we iterate over all backward transitions of the currentState to establish backward reachability
1472 // states reachable via a high-level event are not in the local backward reach and the controllability property of the current exitState does not change
1474 // if the state has not been visited, yet, the controllability of the current path are set in the rExitLocalStatesMap
1477 // the path is uncontrollable if the current transition has an uncontrollable event or the path was already uncontrollable
1481 backwardReachabilityObsLCC(rTransSetX2EvX1, rControllableEvents, rHighAlph, exitState, tsIt->X1, currentControllablePath, rExitLocalStatesMap, rDoneStates);
1483 else{ // for an existing state, the controllability value can change from controllable to uncontrollable (if
1484 // a new uncontrollable path has been found). It is important to note, that the LCC condition implies that
1485 // if there is one uncontrollable path, then the state is flagged uncontrollable except for the case of the
1488 if(rExitLocalStatesMap[exitState][tsIt->X1] != currentControllablePath && currentControllablePath == false){
1490 // as the controllabiity attribute of the current state changed it is subject to a new backward reachability
1491 backwardReachabilityObsLCC(rTransSetX2EvX1, rControllableEvents, rHighAlph, exitState, tsIt->X1, false, rExitLocalStatesMap, rDoneStates);
1498 // relabel(rGenRelabel, rControllableEvents, rHighAlph, rNewPartitions, rMapStateToPartition, rMapChangedTransReverse, rMapChangedTrans, rMapRelabeledEvents)
1499 bool relabel(Generator& rGenRelabel, EventSet& rControllableEvents, EventSet& rHighAlph, vector<Idx>& rNewPartitions, map<Idx,Idx>& rMapStateToPartition, map<Transition,Transition>& rMapChangedTransReverse, map<Transition,Idx>& rMapChangedTrans, map<Idx, EventSet>& rMapRelabeledEvents)
1502 OP_DF("relabel(" << rGenRelabel.Name() << "," << rControllableEvents.Name() << "," << rHighAlph.Name() << ", rNewPartition, rMapStateToPartition, rMapChangedTransReverse, rMapChangedTrans, rMapRelabeledEvents)");
1525 // algorithm: The relabeling according to the state partition as computed by the bisimulation algorithm is
1526 // performed. A high-level transitions is relebaled with a new event, if a transition with the same event leads
1527 // from the same coset to a different coset (non-determinism in the projected automaton). A low-level transition
1528 // is relabeled if it connects different cosets (corresponds to unobservable transition betweeen cosets). The
1529 // also has build-in procedures to take care that as few new event labels as possible are introduced.
1544 // In the first case, there exists no entry for this transition in mapRelabel. Hence, this is the
1552 // Otherwise, there exists an entry for the current event leaving the current X1-coset. It has to be
1553 // verified if the transition goes to the same coset as the previously found transitions or not.
1556 // check if a transition with the same event has already been found that enters the same X2-coset. If
1558 if(mapRelabel[indexX1Partition][tIt->Ev].find(indexX2Partition) != mapRelabel[indexX1Partition][tIt->Ev].end())
1562 OP_DF("relabel: the same event leading to the same X2-coset has already been relabeld before. The current transition is relabeld correspondingly");
1565 newPair.second = Transition(tIt->X1,mapRelabel[indexX1Partition][tIt->Ev][indexX2Partition],tIt->X2);
1569 OP_DF("relabel: There already exists a high-level transition from the current X1-coset to the same X2-coset and the current transition ist labeled with the same event. No relabeling necessary");
1618 std::string eventName = ( rGenRelabel.EventSymbolTablep())->UniqueSymbol(rGenRelabel.EventSymbolTablep()->Symbol(tIt->Ev) + "newHLevent_1");
1626 OP_DF("relabel: No event that can be reused could be found. The new event " << rGenRelabel.EventName(newLabel) << " was created");
1649 std::string eventName = ( rGenRelabel.EventSymbolTablep())->UniqueSymbol(rGenRelabel.EventSymbolTablep()->Symbol(tIt->Ev) + "newHLevent_1");
1693 // a transition with the same original event tIt->Ev leaving the X1-coset has been found before
1694 // and it entered a different X2-coset. Check if one of them was relabeled with lsIt. If yes, then lsIt can
1696 if(mapRelabel[indexX1Partition][tIt->Ev].find(indexX2Partition) == mapRelabel[indexX1Partition][tIt->Ev].end())
1716 newPair.second = Transition(tIt->X1,mapRelabel[indexX1Partition][tIt->Ev][indexX2Partition],tIt->X2);
1718 OP_DF("relabel: A transition to same X2-coset has already been found and relabeled before; the current transition is also labeled with " << rGenRelabel.EventName(mapRelabel[indexX1Partition][tIt->Ev][indexX2Partition]));
1731 OP_DF("relabele: Low level event " << rGenRelabel.EventName(tIt->Ev) << " is relabeled with " << rGenRelabel.EventName(*lsIt) << " which can be reused");
1740 std::string eventName = ( rGenRelabel.EventSymbolTablep())->UniqueSymbol(rGenRelabel.EventSymbolTablep()->Symbol(tIt->Ev) + "newHLevent_1"); //??
1748 OP_DF("relabel: No label could be reused, and the new event " << rGenRelabel.EventName(newLabel) << " was created");
1767 // It is possible that events need not be relabeled. For example, if all occurrences of a low-level event have to
1768 // be relabeled and added to the high-level alphabet, it is possible to just add the original low-level event
1769 // to the high-level alphabet without any relabeling. Note that this information is only available after all
1783 OP_DF("relabel: Checking transition X1=" << rGenRelabel.StateName(etSetIt->first->X1)<< " ["<<etSetIt->first->X1
1784 << "] Ev=" << rGenRelabel.EventName(oldEvent) << " X2=" << rGenRelabel.StateName(etSetIt->first->X2)
1785 << " [" << etSetIt->first->X2 << "] which shall be relabeled with event " << rGenRelabel.EventName(newEvent));
1786 // check if the original event is a low-level event and if there is an event left that has not been relabeled. If all events are relabeled, then at least one label can be replaced by the original event label.
1787 if(notRelabeledLowEvents.find(oldEvent) == notRelabeledLowEvents.end() && !rHighAlph.Exists(oldEvent))
1791 // if a low-level event has been relabeled, the automaton under investigation is not the desired quotient automaton, yet.
1793 // if newEvent is the first new event created for relabeling oldEvent, the relabeling is discarded
1797 // if newEvent is the only event created for relabeling oldEvent, delete newEvent from rGenRelabel
1811 // find predecessor of newEvent in map rMapRelabeledEvents[oldEvent] and use that event for relabeling
1823 // as the relabeling of oldEvent is discarded, it is removed from the map of relebeled events and
1826 // mofidy alphabet of rGenRelabel and the abstraction alphabet by inserting the new high-level events and deleting the not needed new event labels.
1839 rControllableEvents.Erase(*setIt); // controllable event is erased if it does not exist anymore. Schmidt 10/07
1843 // check if quotient automaton is deterministic and free of unobservable transitions, i.e., no transitions are relabeled and no low-level events are declared as high-level events
1857 // if the current relabeled transition has already been relabeled in a previous step of the observer algorithm, the original transition is found in the rMapChangedTransReverse map.
1864 OP_DF("relabel: The transition X1= " << rGenRelabel.SStr((etSetIt->first)->X1) << " Ev=" << rGenRelabel.EStr((etSetIt->first)->Ev) << " X2= " << rGenRelabel.SStr((etSetIt->first)->X2) << " has already been relabeled in a former iteration step. The original transition was " << rGenRelabel.SStr(originalTrans.X1) << " Ev=" << rGenRelabel.EStr(originalTrans.Ev) << " X2= " << rGenRelabel.SStr(originalTrans.X2) << "; the new label is " << rGenRelabel.EStr((etSetIt->second).Ev));
1866 // the current relabeled transition is simply inserted in the rMapChangedTrans map with its original transition if it is the first relabeling.
1872 << " Ev=" << rGenRelabel.EStr((etSetIt->first)->Ev) << " X2= " << rGenRelabel.SStr((etSetIt->first)->X2) << " new label is " << rGenRelabel.EStr((etSetIt->second).Ev));
1884 void insertRelabeledEvents(System& rGenPlant, const map<Idx,set<Idx> >& rMapRelabeledEvents, Alphabet& rNewEvents) {
1907 void insertRelabeledEvents(Generator& rGenPlant, const map<Idx,set<Idx> >& rMapRelabeledEvents, EventSet& rNewEvents) {
1939 void insertRelabeledEvents(Generator& rGenPlant, const map<Idx,set<Idx> >& rMapRelabeledEvents) {
1963 void insertRelabeledEvents(Generator& rGenPlant, const EventRelabelMap& rMapRelabeledEvents, EventSet& rNewEvents) {
1991 bool EventRelabelMap::DoEqual(const EventRelabelMap& rOther) const { return mMap==rOther.mMap;}
libFAUDES 2.24g --- 2014.09.15 --- c++ api documentaion by doxygen |