DiaDes  0.1
DIAgnosis of Discrete-Event System
Component.hh
Go to the documentation of this file.
1 #ifndef __DIADES__AUTOMATA__COMPONENT__HH
2 #define __DIADES__AUTOMATA__COMPONENT__HH
3 
4 #include <sstream>
5 #include <string>
6 #include <set>
7 #include <unordered_set>
8 #include <unordered_map>
9 #include <list>
10 #include <vector>
11 #include <diades/utils/Loggable.hh>
12 #include <boost/archive/text_oarchive.hpp>
13 #include <boost/archive/text_iarchive.hpp>
14 #include <boost/serialization/vector.hpp>
15 #include <boost/serialization/set.hpp>
16 #include <boost/serialization/map.hpp>
19 #include <diades/graph/Graph.hh>
20 #include <diades/graph/NodeMap.hh>
22 #include <diades/graph/EdgeMap.hh>
23 #include <diades/automata/Event.hh>
25 
26 
27 namespace Diades
28 {
29  namespace Automata
30  {
31 
32  using Diades::Utils::Msg;
35 
36 
47 
56  class Component: public Loggable {
57 
58  public:
59  static const string defaultComponentName;
60  static string typeName() { return "Automata::Component"; }
62 
63 
64  public:
65  typedef Component * Pointer;
66  typedef const Component * ConstPointer;
69  typedef list<Transition>::const_iterator EventTransitionIterator;
70  typedef unordered_set<State>::const_iterator InitialStateIterator;
73  typedef set<Event>::const_iterator EventIterator;
74  typedef unordered_set<Transition>::const_iterator OutputEventTransitionIterator;
75  typedef unordered_set<Transition>::const_iterator InputEventTransitionIterator;
76  typedef unordered_set<State>::const_iterator LabelledStateIterator;
77  typedef std::string StateLabel;
78 
79  protected:
81  unordered_set<State> _initial;
84  private:
85  string _name;
86  int _id;
87  set<Event> _events;
88  set<Event> _faultyEvents;
89  set<Event> _normalEvents;
90  vector< Diades::Graph::NodeMap< unordered_set<Transition> > > _transitionsWithTarget;
91  vector< Diades::Graph::NodeMap< unordered_set<Transition> > > _transitionsWithSource;
92  vector< unordered_set<State> > _sourceWithEvent;
93  vector< unordered_set<State> > _targetWithEvent;
94  vector< list<Transition> > _transitionsWithEvent;
97  unordered_map< StateLabel,State > _stateOfLabel;
99  public:
100 // template<class Archive>
101 // void serialize(Archive & ar, const unsigned int version)
102 // {
103 // ar & _behav;
104 // ar & _initial;
105 // ar & _isInitial;
106 // ar & _name;
107 // ar & _id;
108 // ar & _events;
109 // ar & _faultyEvents;
110 // ar & _normalEvents;
111 // ar & _transitionsWithTarget;
112 // ar & _transitionsWithSource;
113 // ar & _sourceWithEvent;
114 // ar & _targetWithEvent;
115 // ar & _transitionsWithEvent;
116 // ar & _eventOfTransition;
117 // ar & _labelOfState;
118 // ar & _stateOfLabel;
119 // }
120 
121 
122 
123  public:
124  ConstPointer getPointer() const { return this; }
125  Pointer getPointer() { return this; }
126 
127  /*********************************************************************/
128  /* GENERAL MANAGEMENT */
129  /*********************************************************************/
133  Component():_behav(),
134  _initial(),
135  _isInitial(),
136  _name(defaultComponentName),
137  _id(),
138  _events(),
139  _faultyEvents(),
140  _normalEvents(),
141  _transitionsWithTarget(),
142  _transitionsWithSource(),
143  _sourceWithEvent(),
144  _targetWithEvent(),
145  _eventOfTransition(),
146  _labelOfState(),
147  _stateOfLabel()
148  {
149  _eventOfTransition.init(_behav);
150  _labelOfState.init(_behav);
151  _isInitial.init(_behav,0);
152  }
153 
158  Component(const Component & component);
159 
163  virtual ~Component();
164 
165 
173  bool operator==(const Component & component) const {
174  return this == &component;
175  }
176 
177 
185  bool operator!=(const Component & component) const {
186  return !(*this == component);
187  }
188 
189 
190 
194  virtual void clear();
195 
196 
200  int id() const { return _id; }
201 
202 
203 
208  void setId(int identifier) { _id = identifier; }
209 
210 
211 
215  Graph::Graph & behaviour() { return _behav; }
216 
220  const Graph::Graph & behaviour() const { return _behav; }
221 
222 
226  bool isEmpty() const
227  {
228  return (_behav.empty());
229  }
230 
236  bool isValid() const { return !isEmpty() && name() != defaultComponentName; }
237 
238 
239  /*********************************************************************/
240  /* NAME MANAGEMENT */
241  /*********************************************************************/
242 
246  void setName(const string & name)
247  {
248  require(Exception, !name.empty(), "setName: invalid name");
249  _name = name;
250  ensure(Exception, !_name.empty(), "setName");
251  }
252 
256  const string & name() const {
257  ensure(Exception, !_name.empty(), "name");
258  return _name;
259  }
260  /********************************************************************/
261 
262 
263 
264 
265 
266 
267  /*********************************************************************/
268  /* EVENT MANAGEMENT */
269  /*********************************************************************/
277  void insertEvent(const Event & event);
278 
279 
284  unsigned numberOfEvents() const
285  {
286  return _events.size();
287  }
288 
296  void insertEvent(EventIterator start, EventIterator end);
297 
298 
304  const Event & getEvent(Transition t) const {
305  require(Exception,t.valid(),"getEvent: invalid transition");
306  require(Exception,&t.owner() == &_behav,"getEvent: the transition does not belong to this component");
307  ensure(Exception,_eventOfTransition[t].isValid(),"getEvent returns an invalid event");
308  return _eventOfTransition[t];
309  }
310 
318  const set<Event> & events() const
319  {
320  return _events;
321  }
322 
323 
328  EventIterator eventBegin() const
329  {
330  return _events.begin();
331  }
332 
333 
338  EventIterator eventEnd() const
339  {
340  return _events.end();
341  }
342 
343 
348  bool containsEvent(const Event & e) const
349  {
350  require(Exception,e.isValid(),"containsEvent: invalid event");
351  return _events.find(e) != _events.end();
352  }
353 
354 
355 
361  void setFaulty(const Event & e)
362  {
363  require(Exception,containsEvent(e),"setFaulty: the event does not exist in the component");
364  _normalEvents.erase(e);
365  _faultyEvents.insert(e);
366  }
367 
368 
373  bool isFaulty(const Event & e) const
374  {
375  return _faultyEvents.find(e) != _faultyEvents.end();
376  }
377 
378 
386  const set<Event> & faultyEvents() const
387  {
388  return _faultyEvents;
389  }
390 
391 
396  EventIterator faultyEventBegin() const
397  {
398  return _faultyEvents.begin();
399  }
400 
401 
406  EventIterator faultyEventEnd() const
407  {
408  return _faultyEvents.end();
409  }
410 
411 
412 
418  void setNormal(const Event & e)
419  {
420  require(Exception,containsEvent(e),"setNormal: the event does not exist in the component");
421  _faultyEvents.erase(e);
422  _normalEvents.insert(e);
423  }
424 
429  bool isNormal(const Event & e) const
430  {
431  return _normalEvents.find(e) != _normalEvents.end();
432  }
433 
441  const set<Event> & normalEvents() const
442  {
443  return _normalEvents;
444  }
445 
446 
451  EventIterator normalEventBegin() const
452  {
453  return _normalEvents.begin();
454  }
455 
456 
461  EventIterator normalEventEnd() const
462  {
463  return _normalEvents.end();
464  }
465 
466 
467 
468 
477  void replaceEvent(const Event & e1, const Event & e2);
478 
479 
480  /********************************************************************/
481 
482 
483 
484 
485 
486 
487 
488  /*******************************************************************/
489  /* STATE MANAGEMENT */
490  /*********************************************************************/
491 
492 
497  State newState();
498 
499 
500 
501 
502 
503 
513  State newState(const StateLabel & label);
514 
515 
521  const StateLabel & getLabel(State state) const
522  {
523  require(Exception,state.valid(),"getLabel: invalid state");
524  require(Exception,&state.owner() == &_behav,"getLabel: the state does not belong to this component");
525  return _labelOfState[state];
526  }
527 
528 
534  State getState(const StateLabel & label) const
535  {
536  unordered_map< StateLabel, State >::const_iterator it;
537  it = _stateOfLabel.find(label);
538  require(Exception,it != _stateOfLabel.end(),"getState: no such a state");
539  return it->second;
540  }
541 
542 
548  void deleteState(State state);
549 
556  void deleteState(StateIterator start, StateIterator end);
557 
558 
563  unsigned numberOfStates() const {
564  return _behav.numberOfNodes();
565  }
566 
567 
568 
572  StateIterator stateBegin() const {
573  return _behav.nodeBegin();
574  }
575 
579  StateIterator stateEnd() const {
580  return _behav.nodeEnd();
581  }
582 
583 
589  void setInitial(State state) {
590  if(state.valid() && (&state.owner() == &_behav))
591  {
592  _initial.insert(state);
593  _isInitial[state] = 1;
594  }
595  }
596 
597 
603  void unsetInitial(State state) {
604  if(state.valid() && (&state.owner() == &_behav))
605  {
606  _initial.erase(state);
607  _isInitial[state] = 0;
608  }
609  }
610 
616  {
617  _initial.insert(stateBegin(),stateEnd());
618  _isInitial.initValue(stateBegin(),stateEnd(),1);
619  }
620 
626  {
627  _isInitial.initValue(stateBegin(),stateEnd(),0);
628  _initial.clear();
629  }
630 
631 
638  InitialStateIterator initialStateBegin() const {
639  return _initial.begin();
640  }
641 
648  InitialStateIterator initialStateEnd() const {
649  return _initial.end();
650  }
651 
652 
659  unsigned numberOfInitialStates() const
660  {
661  return _initial.size();
662  }
663 
664 
672  bool isInitial(State state) const {
673  return (state.valid()) && (&state.owner() == &_behav) && (_isInitial[state] == 1);
674  }
675 
676 
685  virtual void mergeInfoStates(const vector<const Component *> & components, const vector<State> & states, State currentState);
686 
687 
688  /*******************************************************************/
689 
690 
691 
692 
693 
694  /*******************************************************************/
695  /* TRANSITION MANAGEMENT */
696  /*********************************************************************/
697 
698  public:
709  Transition newTransition(State source, State target, Event event);
710 
711 
712 
723  Transition newTransition(const StateLabel & source, const StateLabel & target, Event event);
724 
725 
726 
727 
728 
733  void deleteTransition(Transition t);
734 
735 
736 
742  void deleteTransition(TransitionIterator start, TransitionIterator end);
743 
749  void deleteTransition(EventTransitionIterator start, EventTransitionIterator end);
750 
751 
757  LabelledStateIterator beginOfSourceStateOfEvent(const Event & e) const {
758  require(Exception, _events.find(e) != _events.end(),
759  "beginOfSourceStateOfEvent: the event does not belong to the component");
760  return _sourceWithEvent[e.id()].begin();
761  }
762 
763 
769  LabelledStateIterator endOfSourceStateOfEvent(const Event & e) const {
770  require(Exception, _events.find(e) != _events.end(),
771  "endOfSourceStateOfEvent: the event does not belong to the component");
772  return _sourceWithEvent[e.id()].end();
773  }
774 
775 
776 
782  LabelledStateIterator beginOfTargetStateOfEvent(const Event & e) const {
783  require(Exception, _events.find(e) != _events.end(),
784  "beginOfTargetStateOfEvent: the event does not belong to the component");
785  return _targetWithEvent[e.id()].begin();
786  }
787 
788 
794  LabelledStateIterator endOfTargetStateOfEvent(const Event & e) const {
795  require(Exception, _events.find(e) != _events.end(),
796  "endOfTargetStateOfEvent: the event does not belong to the component");
797  return _targetWithEvent[e.id()].end();
798  }
799 
800 
806  EventTransitionIterator eventTransitionBegin(const Event & e) const {
807  require(Exception, _events.find(e) != _events.end(),
808  "eventTransitionBegin: the event does not belong to the component");
809  return _transitionsWithEvent[e.id()].begin();
810  }
811 
817  EventTransitionIterator eventTransitionEnd(const Event & e) const {
818  require(Exception, _events.find(e) != _events.end(),
819  "eventTransitionEnd: the event does not belong to the component");
820  return _transitionsWithEvent[e.id()].end();
821  }
822 
823 
824 
832  OutputEventTransitionIterator outputEventTransitionBegin(State s, Event e) const {
833  require(Exception, e.isValid(), "outputEventTransitionBegin: the event is invalid");
834  require(Exception, _events.find(e) != _events.end(),
835  Msg("outputEventTransitionBegin: the event '%1%' does not belong to the component") % e);
836  require(Exception,s.valid(),"outputEventTransitionBegin: invalid state");
837  require(Exception,&s.owner() == &_behav,"outputEventTransitionBegin: the state does not belong to this component");
838  return _transitionsWithSource[e.id()][s].begin();
839  }
840 
841 
842 
850  OutputEventTransitionIterator outputEventTransitionEnd(State s, Event e) const {
851  require(Exception, _events.find(e) != _events.end(),
852  Msg("outputEventTransitionEnd: the event '%1%' does not belong to the component")% e);
853  require(Exception,s.valid(),"outputEventTransitionEnd: invalid state");
854  require(Exception,&s.owner() == &_behav,"outputEventTransitionEnd: the state does not belong to this component");
855  return _transitionsWithSource[e.id()][s].end();
856  }
857 
858 
859 
867  InputEventTransitionIterator inputEventTransitionBegin(State s, Event e) const {
868  require(Exception, _events.find(e) != _events.end(),
869  Msg("inputEventTransitionBegin: the event '%1%' does not belong to the component") % e);
870  require(Exception,s.valid(),"inputEventTransitionBegin: invalid state");
871  require(Exception,&s.owner() == &_behav,"inputEventTransitionBegin: the state does not belong to this component");
872  return _transitionsWithTarget[e.id()][s].begin();
873  }
874 
875 
876 
884  InputEventTransitionIterator inputEventTransitionEnd(State s, Event e) const {
885  require(Exception, _events.find(e) != _events.end(),
886  Msg("inputEventTransitionEnd: the event '%1%' does not belong to the component")% e);
887  require(Exception,s.valid(),"inputEventTransitionEnd: invalid state");
888  require(Exception,&s.owner() == &_behav,"inputEventTransitionEnd: the state does not belong to this component");
889  return _transitionsWithTarget[e.id()][s].end();
890  }
891 
892 
893 
897  TransitionIterator transitionBegin() const {
898  return _behav.edgeBegin();
899  }
900 
904  TransitionIterator transitionEnd() const {
905  return _behav.edgeEnd();
906  }
907 
913  OutputTransitionIterator outputTransitionBegin(State s) const
914  {
915  require(Exception, s.valid(), "outputTransitionBegin: the state is not valid");
916  require(Exception, &s.owner() == &_behav, "outputTransitionBegin: the state does not belong to the component");
917  return s.outEdgeBegin();
918  }
919 
925  OutputTransitionIterator outputTransitionEnd(State s) const {
926  require(Exception, s.valid(), "outputTransitionEnd: the state is not valid");
927  require(Exception, &s.owner() == &_behav, "outputTransitionEnd: the state does not belong to the component");
928  return s.outEdgeEnd();
929  }
930 
936  InputTransitionIterator inputTransitionBegin(State s) const {
937  require(Exception, s.valid(), "inputTransitionBegin: the state is not valid");
938  require(Exception, &s.owner() == &_behav, "inputTransitionBegin: the state does not belong to the component");
939  return s.inEdgeBegin();
940  }
941 
942 
948  InputTransitionIterator inputTransitionEnd(State s) const {
949  require(Exception, s.valid(), "inputTransitionEnd: the state is not valid");
950  require(Exception, &s.owner() == &_behav, "inputTransitionEnd: the state does not belong to the component");
951  return s.inEdgeEnd();
952  }
953 
958  unsigned numberOfTransitions() const {
959  return _behav.numberOfEdges();
960  }
961 
962 
963  /*********************************************************************/
964  /* ALGORITHMS FOR DEBUGGING */
965  /*********************************************************************/
966 
972  bool sanityCheck(string & log) const;
973 
974 
975 
976  /*********************************************************************/
977  /* ALGORITHMS FOR DETERMINISM */
978  /*********************************************************************/
979 
980  protected:
981 
992  virtual void determine(const Component * comp, const unordered_set<State> & acceptors,
993  unordered_set<State> & newAcceptors);
994 
1000  virtual void determine(const Component * comp);
1001 
1002 
1003 
1004  public:
1005 
1011  bool isDeterministic() const;
1012 
1013 
1014 
1015 
1016 
1017 
1018 
1019  /*********************************************************************/
1020  /* ALGORITHMS FOR PROJECTION */
1021  /*********************************************************************/
1022  public:
1023 
1035  virtual bool project(const Component * comp,
1036  const set<Event> & projectedEvents);
1037 
1051  virtual bool project(const Component * comp,
1052  const set<Event> & projectedEvents,
1053  unordered_map<Diades::Automata::State,unordered_set<Diades::Automata::State> > & dictionary);
1054 
1069  virtual bool project(const Component * comp,
1070  const set<Event> & projectedEvents,
1071  const unordered_set<State> & acceptors,
1072  unordered_set<State> & newAcceptors);
1073 
1074 
1075  private:
1076 
1077 
1091  void reachableStates(const BeliefState & bs, Event event,
1092  const set<Event> & projectedEvents,
1093  BeliefState & nextBs) const;
1094 
1112  void reachableStates(const BeliefState & bs, Event event,
1113  const set<Event> & projectedEvents,
1114  BeliefState & nextBs, const unordered_set<State> & acceptors, bool & presenceOfAcceptors) const;
1115 
1116 
1117  /*********************************************************************/
1118  /* ALGORITHMS FOR MINIMISATION */
1119  /*********************************************************************/
1120 
1121  public:
1122 
1135  bool minimize();
1136 
1153  bool minimize(unordered_set<State> & acceptors);
1154 
1155 
1163  bool isComplete() const;
1164 
1165 
1166  private:
1167 
1168 
1179  State mergeStates(BeliefState & states);
1180 
1181 
1182 
1187  void nerodePartition(vector < BeliefState * > & partition) const;
1188 
1189 
1197  void nerodePartition(const unordered_set<State> & acceptors,
1198  vector< BeliefState * > & partition);
1199 
1200 
1221  void splitPartition(const BeliefState * bigQ0,
1222  const BeliefState * bigQ1,
1223  Event littleA,
1224  BeliefState * bigQ0prime,
1225  BeliefState * bigQ0MinusbigQ0prime) const;
1226 
1236  void splitPartition2(const BeliefState * bigQ0,
1237  const BeliefState * bigQ1,
1238  Event littleA,
1239  BeliefState * bigQ0prime,
1240  BeliefState * bigQ0MinusbigQ0prime, State sinkState) const;
1241 
1242 
1243 
1244  /*********************************************************************/
1245  /* IMPORT/EXPORT MANAGEMENT */
1246  /*********************************************************************/
1247 
1248  public:
1255  virtual bool import(const string & filename);
1256 
1257 
1264  virtual bool component2dot(const string & fileName) const;
1265 
1266 
1272  virtual bool exportDesCompModel(const string & filename) const;
1273 
1274  public:
1275 
1276 
1298  virtual bool importDesCompModel(const string & filename);
1299 
1320  virtual bool importDesCompModel(istream & stream);
1321 
1322 
1323 
1324 
1325  protected:
1326 
1331  virtual bool parseDesCompName(istream & stream);
1332 
1333 
1338  virtual bool parseDesCompStates(istream & stream);
1339 
1344  virtual bool parseDesCompFaultyEvents(istream & stream);
1345 
1350  virtual bool parseDesCompNormalEvents(istream & stream);
1351 
1357  virtual bool parseDesCompObservableEvents(istream & stream);
1358 
1359 
1365  virtual bool parseDesCompMaskedEvents(istream & stream,
1366  unsigned number,
1367  map< string, set<string> > & maskEvents);
1368 
1373  virtual bool parseDesCompTransitions(istream & stream);
1374 
1375  };
1376 
1377 
1380  template<typename InputIterator>
1381  inline void deleteTransition(Component & comp, InputIterator first, InputIterator last)
1382  {
1383  for(; first!= last; ++first)
1384  {
1385  comp.deleteTransition(*first);
1386  }
1387  }
1388 
1389  template<typename InputIterator>
1390  inline void deleteState(Component & comp, InputIterator first, InputIterator last)
1391  {
1392  for(; first!= last; ++first)
1393  {
1394  comp.deleteState(*first);
1395  }
1396  }
1397 
1398 
1399  template<typename InputIterator,typename Predicate>
1400  inline void deleteState(Component & comp, InputIterator first, InputIterator last, Predicate pred)
1401  {
1402  for(; first!= last; ++first)
1403  {
1404  if(pred(*first))
1405  {
1406  comp.deleteState(*first);
1407  }
1408  }
1409  }
1410 
1411 
1412  struct GetEvent: public unary_function<Transition,Event>
1413  {
1414  const Component & _comp;
1415  GetEvent(const Component & component):_comp(component){}
1416  const Event & operator()(Transition t) const
1417  {
1418  return _comp.getEvent(t);
1419  }
1420  };
1421 
1422 
1424  {
1425  typedef enum{NonPredecessor,Predecessor} Status;
1427  NonPredecessorFunctor(NodeMap<Status> * mapPredecessor):_map(mapPredecessor){}
1428  bool operator()(State s) const
1429  {
1430  return (*_map)[s]==NonPredecessor;
1431  }
1432  };
1433 
1434 
1441  template<typename InputIterator>
1442  inline void purgeNonPredecessors(Component & comp, InputIterator first, InputIterator last)
1443  {
1444  typedef NonPredecessorFunctor::Status Status;
1445  NodeMap<Status> status(comp.behaviour(),comp.numberOfStates(), Status::NonPredecessor);
1446  list<State> states;
1447  states.insert(states.end(),first,last);
1448  for(; first!= last; ++first)
1449  {
1450  status[*first]= Status::Predecessor;
1451  }
1452  while(!states.empty())
1453  {
1454  State current = states.front();
1455  states.pop_front();
1457  it != comp.inputTransitionEnd(current);
1458  ++it)
1459  {
1460  if(status[it->source()] == Status::NonPredecessor)
1461  {
1462  status[it->source()] = Status::Predecessor;
1463  states.push_back(it->source());
1464  }
1465  }
1466  }
1467  deleteState(comp,comp.stateBegin(),comp.stateEnd(),NonPredecessorFunctor(&status));
1468  }
1469 
1470  };
1471 };
1472 
1473 
1474 
1475 #endif
virtual bool component2dot(const string &fileName) const
bool containsEvent(const Event &e) const
Definition: Component.hh:348
Graph::Graph & behaviour()
Definition: Component.hh:215
NodeIterator initValue(NodeIterator begin, NodeIterator end, ConstReference value)
Definition: NodeMap.hh:354
bool sanityCheck(string &log) const
set< Event > _faultyEvents
Definition: Component.hh:88
const Component * ConstPointer
Definition: Component.hh:66
virtual bool parseDesCompFaultyEvents(istream &stream)
bool isInitial(State state) const
Definition: Component.hh:672
virtual bool parseDesCompMaskedEvents(istream &stream, unsigned number, map< string, set< string > > &maskEvents)
Diades::Graph::EdgeMap< Event > _eventOfTransition
Definition: Component.hh:95
unsigned numberOfEvents() const
Definition: Component.hh:284
Diades::Utils::Exception< Component > Exception
Definition: Component.hh:61
OutputEventTransitionIterator outputEventTransitionBegin(State s, Event e) const
Definition: Component.hh:832
Diades::Graph::Edge Transition
Definition: Component.hh:46
virtual bool parseDesCompStates(istream &stream)
GraphIterator< Edge > EdgeIterator
Definition: GraphInt.hh:143
Diades::Graph::NodeMap< int > _isInitial
Definition: Component.hh:82
void setNormal(const Event &e)
Definition: Component.hh:418
void setId(int identifier)
Definition: Component.hh:208
static const string defaultComponentName
Definition: Component.hh:59
EventIterator faultyEventBegin() const
Definition: Component.hh:396
EdgeSizeType numberOfEdges() const
Definition: GraphInt.hh:323
StateIterator stateBegin() const
Definition: Component.hh:572
void init(Graph &g, SizeType capacity=0, ValueType dflt=ValueType())
Definition: NodeMap.hh:315
Loggable class.
bool operator!=(const Component &component) const
Definition: Component.hh:185
bool isFaulty(const Event &e) const
Definition: Component.hh:373
Definition: Run.cc:88
NodeIterator nodeEnd()
Definition: GraphInt.hh:538
void splitPartition2(const BeliefState *bigQ0, const BeliefState *bigQ1, Event littleA, BeliefState *bigQ0prime, BeliefState *bigQ0MinusbigQ0prime, State sinkState) const
const StateLabel & getLabel(State state) const
Definition: Component.hh:521
EventTransitionIterator eventTransitionEnd(const Event &e) const
Definition: Component.hh:817
vector< unordered_set< State > > _targetWithEvent
Definition: Component.hh:93
virtual bool parseDesCompObservableEvents(istream &stream)
#define ensure(Exception, expr, message)
Definition: Assertion.hh:98
const set< Event > & faultyEvents() const
Definition: Component.hh:386
StateIterator stateEnd() const
Definition: Component.hh:579
vector< list< Transition > > _transitionsWithEvent
Definition: Component.hh:94
Diades::Graph::NodeMap< StateLabel > _labelOfState
Definition: Component.hh:96
const Component & _comp
Definition: Component.hh:1414
LabelledStateIterator endOfSourceStateOfEvent(const Event &e) const
Definition: Component.hh:769
EdgeIterator edgeEnd()
Definition: GraphInt.hh:574
InputTransitionIterator inputTransitionBegin(State s) const
Definition: Component.hh:936
OutputEventTransitionIterator outputEventTransitionEnd(State s, Event e) const
Definition: Component.hh:850
StIndexes states
Definition: Run.cc:266
void reachableStates(const BeliefState &bs, Event event, const set< Event > &projectedEvents, BeliefState &nextBs) const
TransitionIterator transitionEnd() const
Definition: Component.hh:904
unordered_set< State >::const_iterator LabelledStateIterator
Definition: Component.hh:76
void deleteState(State state)
unordered_set< State >::const_iterator InitialStateIterator
Definition: Component.hh:70
EdgeIterator edgeBegin()
Definition: GraphInt.hh:565
virtual bool parseDesCompName(istream &stream)
InitialStateIterator initialStateEnd() const
Definition: Component.hh:648
bool isNormal(const Event &e) const
Definition: Component.hh:429
Diades::Graph::NodeIterator StateIterator
Definition: Component.hh:67
EventIterator faultyEventEnd() const
Definition: Component.hh:406
const Event & operator()(Transition t) const
Definition: Component.hh:1416
void deleteTransition(Transition t)
InputEventTransitionIterator inputEventTransitionEnd(State s, Event e) const
Definition: Component.hh:884
unsigned numberOfInitialStates() const
Definition: Component.hh:659
virtual bool importDesCompModel(const string &filename)
LabelledStateIterator endOfTargetStateOfEvent(const Event &e) const
Definition: Component.hh:794
void setName(const string &name)
Definition: Component.hh:246
set< Event > _normalEvents
Definition: Component.hh:89
const string & name() const
Definition: Component.hh:256
static string typeName()
the name by default
Definition: Component.hh:60
unsigned numberOfTransitions() const
Definition: Component.hh:958
ConstPointer getPointer() const
Definition: Component.hh:124
const set< Event > & normalEvents() const
Definition: Component.hh:441
GraphIterator< Node > NodeIterator
Definition: GraphInt.hh:139
InputTransitionIterator inputTransitionEnd(State s) const
Definition: Component.hh:948
InitialStateIterator initialStateBegin() const
Definition: Component.hh:638
void setInitial(State state)
Definition: Component.hh:589
unsigned numberOfStates() const
Definition: Component.hh:563
bool isValid() const
Definition: Event.hh:172
State getState(const StateLabel &label) const
Definition: Component.hh:534
list< Transition >::const_iterator EventTransitionIterator
Definition: Component.hh:69
void init(Graph &g, SizeType capacity=0, ValueType dflt=ValueType())
Definition: EdgeMap.hh:314
EventIterator normalEventBegin() const
Definition: Component.hh:451
#define require(Exception, expr, message)
Definition: Assertion.hh:90
LabelledStateIterator beginOfSourceStateOfEvent(const Event &e) const
Definition: Component.hh:757
Diades::Graph::OutEdgeIterator OutputTransitionIterator
Definition: Component.hh:72
EventTransitionIterator eventTransitionBegin(const Event &e) const
Definition: Component.hh:806
Namespace of the Diades project.
void splitPartition(const BeliefState *bigQ0, const BeliefState *bigQ1, Event littleA, BeliefState *bigQ0prime, BeliefState *bigQ0MinusbigQ0prime) const
const Graph::Graph & behaviour() const
Definition: Component.hh:220
EventIterator eventBegin() const
Definition: Component.hh:328
vector< Diades::Graph::NodeMap< unordered_set< Transition > > > _transitionsWithSource
Definition: Component.hh:91
virtual bool project(const Component *comp, const set< Event > &projectedEvents)
virtual bool parseDesCompNormalEvents(istream &stream)
OutputTransitionIterator outputTransitionBegin(State s) const
Definition: Component.hh:913
Definition: Run.cc:83
State mergeStates(BeliefState &states)
list< Edge >::iterator OutEdgeIterator
Definition: Edge.hh:314
EventIterator normalEventEnd() const
Definition: Component.hh:461
NonPredecessorFunctor(NodeMap< Status > *mapPredecessor)
Definition: Component.hh:1427
Diades::Graph::Graph _behav
Definition: Component.hh:80
Diades::Utils::Log log(Log::Level level, const char *msg)
Definition: Loggable.hh:89
LabelledStateIterator beginOfTargetStateOfEvent(const Event &e) const
Definition: Component.hh:782
Diades::Graph::InEdgeIterator InputTransitionIterator
Definition: Component.hh:71
TransitionIterator transitionBegin() const
Definition: Component.hh:897
unordered_set< Transition >::const_iterator OutputEventTransitionIterator
Definition: Component.hh:74
const Event & getEvent(Transition t) const
Definition: Component.hh:304
Diades::Graph::EdgeIterator TransitionIterator
Definition: Component.hh:68
void purgeNonPredecessors(Component &comp, InputIterator first, InputIterator last)
Definition: Component.hh:1442
virtual bool exportDesCompModel(const string &filename) const
void insertEvent(const Event &event)
vector< unordered_set< State > > _sourceWithEvent
Definition: Component.hh:92
EventIterator eventEnd() const
Definition: Component.hh:338
set< Event >::const_iterator EventIterator
Definition: Component.hh:73
bool empty() const
Definition: GraphInt.hh:332
vector< Diades::Graph::NodeMap< unordered_set< Transition > > > _transitionsWithTarget
Definition: Component.hh:90
Diades::Graph::Node State
Definition: BeliefState.hh:36
void unsetInitial(State state)
Definition: Component.hh:603
list< Edge >::iterator InEdgeIterator
Definition: Edge.hh:313
Transition newTransition(State source, State target, Event event)
NodeIterator nodeBegin()
Definition: GraphInt.hh:529
unordered_map< StateLabel, State > _stateOfLabel
Definition: Component.hh:97
boost::format Msg
Definition: Verbose.hh:42
bool operator==(const Component &component) const
Definition: Component.hh:173
const set< Event > & events() const
Definition: Component.hh:318
unordered_set< Transition >::const_iterator InputEventTransitionIterator
Definition: Component.hh:75
void nerodePartition(vector< BeliefState * > &partition) const
void replaceEvent(const Event &e1, const Event &e2)
virtual void mergeInfoStates(const vector< const Component *> &components, const vector< State > &states, State currentState)
virtual bool parseDesCompTransitions(istream &stream)
NodeSizeType numberOfNodes() const
Definition: GraphInt.hh:314
void setFaulty(const Event &e)
Definition: Component.hh:361
GetEvent(const Component &component)
Definition: Component.hh:1415
OutputTransitionIterator outputTransitionEnd(State s) const
Definition: Component.hh:925
unordered_set< State > _initial
Definition: Component.hh:81
InputEventTransitionIterator inputEventTransitionBegin(State s, Event e) const
Definition: Component.hh:867
virtual void determine(const Component *comp, const unordered_set< State > &acceptors, unordered_set< State > &newAcceptors)