DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Diades::Automata::Component Class Reference

#include <Component.hh>

Public Types

typedef Diades::Utils::Exception< ComponentException
 
typedef ComponentPointer
 
typedef const ComponentConstPointer
 
typedef Diades::Graph::NodeIterator StateIterator
 
typedef Diades::Graph::EdgeIterator TransitionIterator
 
typedef list< Transition >::const_iterator EventTransitionIterator
 
typedef unordered_set< State >::const_iterator InitialStateIterator
 
typedef Diades::Graph::InEdgeIterator InputTransitionIterator
 
typedef Diades::Graph::OutEdgeIterator OutputTransitionIterator
 
typedef set< Event >::const_iterator EventIterator
 
typedef unordered_set< Transition >::const_iterator OutputEventTransitionIterator
 
typedef unordered_set< Transition >::const_iterator InputEventTransitionIterator
 
typedef unordered_set< State >::const_iterator LabelledStateIterator
 
typedef std::string StateLabel
 

Public Member Functions

ConstPointer getPointer () const
 
Pointer getPointer ()
 
 Component ()
 
 Component (const Component &component)
 
virtual ~Component ()
 
bool operator== (const Component &component) const
 
bool operator!= (const Component &component) const
 
virtual void clear ()
 
int id () const
 
void setId (int identifier)
 
Graph::Graphbehaviour ()
 
const Graph::Graphbehaviour () const
 
bool isEmpty () const
 
bool isValid () const
 
void setName (const string &name)
 
const string & name () const
 
void insertEvent (const Event &event)
 
unsigned numberOfEvents () const
 
void insertEvent (EventIterator start, EventIterator end)
 
const EventgetEvent (Transition t) const
 
const set< Event > & events () const
 
EventIterator eventBegin () const
 
EventIterator eventEnd () const
 
bool containsEvent (const Event &e) const
 
void setFaulty (const Event &e)
 
bool isFaulty (const Event &e) const
 
const set< Event > & faultyEvents () const
 
EventIterator faultyEventBegin () const
 
EventIterator faultyEventEnd () const
 
void setNormal (const Event &e)
 
bool isNormal (const Event &e) const
 
const set< Event > & normalEvents () const
 
EventIterator normalEventBegin () const
 
EventIterator normalEventEnd () const
 
void replaceEvent (const Event &e1, const Event &e2)
 
State newState ()
 
State newState (const StateLabel &label)
 
const StateLabelgetLabel (State state) const
 
State getState (const StateLabel &label) const
 
void deleteState (State state)
 
void deleteState (StateIterator start, StateIterator end)
 
unsigned numberOfStates () const
 
StateIterator stateBegin () const
 
StateIterator stateEnd () const
 
void setInitial (State state)
 
void unsetInitial (State state)
 
void setAllInitialStates ()
 
void clearAllInitialStates ()
 
InitialStateIterator initialStateBegin () const
 
InitialStateIterator initialStateEnd () const
 
unsigned numberOfInitialStates () const
 
bool isInitial (State state) const
 
virtual void mergeInfoStates (const vector< const Component *> &components, const vector< State > &states, State currentState)
 
Transition newTransition (State source, State target, Event event)
 
Transition newTransition (const StateLabel &source, const StateLabel &target, Event event)
 
void deleteTransition (Transition t)
 
void deleteTransition (TransitionIterator start, TransitionIterator end)
 
void deleteTransition (EventTransitionIterator start, EventTransitionIterator end)
 
LabelledStateIterator beginOfSourceStateOfEvent (const Event &e) const
 
LabelledStateIterator endOfSourceStateOfEvent (const Event &e) const
 
LabelledStateIterator beginOfTargetStateOfEvent (const Event &e) const
 
LabelledStateIterator endOfTargetStateOfEvent (const Event &e) const
 
EventTransitionIterator eventTransitionBegin (const Event &e) const
 
EventTransitionIterator eventTransitionEnd (const Event &e) const
 
OutputEventTransitionIterator outputEventTransitionBegin (State s, Event e) const
 
OutputEventTransitionIterator outputEventTransitionEnd (State s, Event e) const
 
InputEventTransitionIterator inputEventTransitionBegin (State s, Event e) const
 
InputEventTransitionIterator inputEventTransitionEnd (State s, Event e) const
 
TransitionIterator transitionBegin () const
 
TransitionIterator transitionEnd () const
 
OutputTransitionIterator outputTransitionBegin (State s) const
 
OutputTransitionIterator outputTransitionEnd (State s) const
 
InputTransitionIterator inputTransitionBegin (State s) const
 
InputTransitionIterator inputTransitionEnd (State s) const
 
unsigned numberOfTransitions () const
 
bool sanityCheck (string &log) const
 
bool isDeterministic () const
 
virtual bool project (const Component *comp, const set< Event > &projectedEvents)
 
virtual bool project (const Component *comp, const set< Event > &projectedEvents, unordered_map< Diades::Automata::State, unordered_set< Diades::Automata::State > > &dictionary)
 
virtual bool project (const Component *comp, const set< Event > &projectedEvents, const unordered_set< State > &acceptors, unordered_set< State > &newAcceptors)
 
bool minimize ()
 
bool minimize (unordered_set< State > &acceptors)
 
bool isComplete () const
 
virtual bool import (const string &filename)
 
virtual bool component2dot (const string &fileName) const
 
virtual bool exportDesCompModel (const string &filename) const
 
virtual bool importDesCompModel (const string &filename)
 
virtual bool importDesCompModel (istream &stream)
 
- Public Member Functions inherited from Diades::Utils::Loggable
 Loggable ()
 
 Loggable (const string &loggerName)
 
 Loggable (Logger &logger)
 
void changeLogger (const string &newLoggerName)
 
void changeLogger (Logger &newLogger)
 
Diades::Utils::Log log (Log::Level level, const char *msg)
 

Static Public Member Functions

static string typeName ()
 the name by default More...
 

Static Public Attributes

static const string defaultComponentName
 

Protected Member Functions

virtual void determine (const Component *comp, const unordered_set< State > &acceptors, unordered_set< State > &newAcceptors)
 
virtual void determine (const Component *comp)
 
virtual bool parseDesCompName (istream &stream)
 
virtual bool parseDesCompStates (istream &stream)
 
virtual bool parseDesCompFaultyEvents (istream &stream)
 
virtual bool parseDesCompNormalEvents (istream &stream)
 
virtual bool parseDesCompObservableEvents (istream &stream)
 
virtual bool parseDesCompMaskedEvents (istream &stream, unsigned number, map< string, set< string > > &maskEvents)
 
virtual bool parseDesCompTransitions (istream &stream)
 

Protected Attributes

Diades::Graph::Graph _behav
 
unordered_set< State_initial
 
Diades::Graph::NodeMap< int > _isInitial
 

Private Member Functions

void reachableStates (const BeliefState &bs, Event event, const set< Event > &projectedEvents, BeliefState &nextBs) const
 
void reachableStates (const BeliefState &bs, Event event, const set< Event > &projectedEvents, BeliefState &nextBs, const unordered_set< State > &acceptors, bool &presenceOfAcceptors) const
 
State mergeStates (BeliefState &states)
 
void nerodePartition (vector< BeliefState * > &partition) const
 
void nerodePartition (const unordered_set< State > &acceptors, vector< BeliefState * > &partition)
 
void splitPartition (const BeliefState *bigQ0, const BeliefState *bigQ1, Event littleA, BeliefState *bigQ0prime, BeliefState *bigQ0MinusbigQ0prime) const
 
void splitPartition2 (const BeliefState *bigQ0, const BeliefState *bigQ1, Event littleA, BeliefState *bigQ0prime, BeliefState *bigQ0MinusbigQ0prime, State sinkState) const
 

Private Attributes

string _name
 
int _id
 
set< Event_events
 
set< Event_faultyEvents
 
set< Event_normalEvents
 
vector< Diades::Graph::NodeMap< unordered_set< Transition > > > _transitionsWithTarget
 
vector< Diades::Graph::NodeMap< unordered_set< Transition > > > _transitionsWithSource
 
vector< unordered_set< State > > _sourceWithEvent
 
vector< unordered_set< State > > _targetWithEvent
 
vector< list< Transition > > _transitionsWithEvent
 
Diades::Graph::EdgeMap< Event_eventOfTransition
 
Diades::Graph::NodeMap< StateLabel_labelOfState
 
unordered_map< StateLabel, State_stateOfLabel
 

Detailed Description

A Component is the smallest part of the distributed discrete event system. A Component has a name, an identifier. The behaviour of the component is encoded with help of a Graph. The initial state of the component may be known or not.

Todo:
Management of the id (not initialised apparently, but also not used)

Definition at line 56 of file Component.hh.

Member Typedef Documentation

◆ ConstPointer

Definition at line 66 of file Component.hh.

◆ EventIterator

typedef set<Event>::const_iterator Diades::Automata::Component::EventIterator

Definition at line 73 of file Component.hh.

◆ EventTransitionIterator

Definition at line 69 of file Component.hh.

◆ Exception

Definition at line 61 of file Component.hh.

◆ InitialStateIterator

typedef unordered_set<State>::const_iterator Diades::Automata::Component::InitialStateIterator

Definition at line 70 of file Component.hh.

◆ InputEventTransitionIterator

Definition at line 75 of file Component.hh.

◆ InputTransitionIterator

Definition at line 71 of file Component.hh.

◆ LabelledStateIterator

typedef unordered_set<State>::const_iterator Diades::Automata::Component::LabelledStateIterator

Definition at line 76 of file Component.hh.

◆ OutputEventTransitionIterator

Definition at line 74 of file Component.hh.

◆ OutputTransitionIterator

Definition at line 72 of file Component.hh.

◆ Pointer

Definition at line 65 of file Component.hh.

◆ StateIterator

Definition at line 67 of file Component.hh.

◆ StateLabel

Definition at line 77 of file Component.hh.

◆ TransitionIterator

Definition at line 68 of file Component.hh.

Constructor & Destructor Documentation

◆ Component() [1/2]

Diades::Automata::Component::Component ( )
inline

Default constructor: create an invalid component

Definition at line 133 of file Component.hh.

References Diades::Graph::EdgeMap< T >::init(), Diades::Graph::NodeMap< T >::init(), and ~Component().

◆ Component() [2/2]

Diades::Automata::Component::Component ( const Component component)

Copy contructor

Parameters
componentthe component to copy

◆ ~Component()

virtual Diades::Automata::Component::~Component ( )
virtual

Destructor

Referenced by Component().

Member Function Documentation

◆ beginOfSourceStateOfEvent()

LabelledStateIterator Diades::Automata::Component::beginOfSourceStateOfEvent ( const Event e) const
inline

State iterator on states that are the sources of a given event

Parameters
ean Event
Returns
a forward iterator (begin)
Precondition
the event e must belong to the Component

Definition at line 757 of file Component.hh.

References Diades::Automata::Event::id(), and require.

◆ beginOfTargetStateOfEvent()

LabelledStateIterator Diades::Automata::Component::beginOfTargetStateOfEvent ( const Event e) const
inline

State iterator on states that are the targets of a given event

Parameters
ean Event
Returns
a forward iterator (begin)
Precondition
the event must belong to the Component

Definition at line 782 of file Component.hh.

References Diades::Automata::Event::id(), and require.

◆ behaviour() [1/2]

Graph::Graph& Diades::Automata::Component::behaviour ( )
inline

◆ behaviour() [2/2]

const Graph::Graph& Diades::Automata::Component::behaviour ( ) const
inline
Returns
the underlying behaviour

Definition at line 220 of file Component.hh.

References _behav.

◆ clear()

virtual void Diades::Automata::Component::clear ( )
virtual

◆ clearAllInitialStates()

void Diades::Automata::Component::clearAllInitialStates ( )
inline

unset any potential initial state

Definition at line 625 of file Component.hh.

References Diades::Graph::NodeMap< T >::initValue(), stateBegin(), and stateEnd().

◆ component2dot()

virtual bool Diades::Automata::Component::component2dot ( const string &  fileName) const
virtual

Component export to dot file

Parameters
fileNameexported file
Returns
true if the export has succeded, false otherwise. the string log contains the reasons of the error if the export has failed

Reimplemented in Diades::Automata::ObservableComponent.

Referenced by MealyEncodingV1(), MooreEncoding(), and numberOfTransitions().

◆ containsEvent()

bool Diades::Automata::Component::containsEvent ( const Event e) const
inline
Returns
true if the event is in the Component
Precondition
e is valid

Definition at line 348 of file Component.hh.

References Diades::Automata::Event::isValid(), and require.

Referenced by setFaulty(), and setNormal().

◆ deleteState() [1/2]

void Diades::Automata::Component::deleteState ( State  state)
Parameters
statea State Delete the state in the Component
Precondition
'state' must be part of the Component

Referenced by Diades::Automata::deleteState(), getState(), MealyEncodingV1(), MooreEncoding(), and Diades::Automata::purgeNonPredecessors().

◆ deleteState() [2/2]

void Diades::Automata::Component::deleteState ( StateIterator  start,
StateIterator  end 
)
Parameters
startStateIterator
endStateIterator Delete the states in the range [start,end) in the Component
Precondition
[start,end) must be part of the Component

◆ deleteTransition() [1/3]

void Diades::Automata::Component::deleteTransition ( Transition  t)

Transition deletion

Parameters
ta Transition to delete
Precondition
t must belong to the Component

Referenced by Diades::Automata::deleteTransition(), and isInitial().

◆ deleteTransition() [2/3]

void Diades::Automata::Component::deleteTransition ( TransitionIterator  start,
TransitionIterator  end 
)

Transition deletions

Parameters
startTransIterator
endTransIterator
Precondition
[start, end) must belong to the Component

◆ deleteTransition() [3/3]

void Diades::Automata::Component::deleteTransition ( EventTransitionIterator  start,
EventTransitionIterator  end 
)

Transition deletions

Parameters
startTransitionEventIterator
endTransitionEventIterator
Precondition
[start, end) must belong to the Component

◆ determine() [1/2]

virtual void Diades::Automata::Component::determine ( const Component comp,
const unordered_set< State > &  acceptors,
unordered_set< State > &  newAcceptors 
)
protectedvirtual

Determination of the Component comp The current Component is the result of the determination

Parameters
compComponent to determine
acceptorsacceptors of comp
newAcceptorsacceptors corresponding to the acceptors in comp but that are from the current determined Component.
Postcondition
newAcceptors contains a new set of acceptors from the current Component
isDeterministic()

Referenced by numberOfTransitions().

◆ determine() [2/2]

virtual void Diades::Automata::Component::determine ( const Component comp)
protectedvirtual

Determination of the Component comp The current Component is the result of the determination

Postcondition
isDeterministic()

◆ endOfSourceStateOfEvent()

LabelledStateIterator Diades::Automata::Component::endOfSourceStateOfEvent ( const Event e) const
inline

State iterator on states that are the sources of a given event

Parameters
ean Event
Returns
a forward iterator (end)
Precondition
the event must belong to the Component

Definition at line 769 of file Component.hh.

References Diades::Automata::Event::id(), and require.

◆ endOfTargetStateOfEvent()

LabelledStateIterator Diades::Automata::Component::endOfTargetStateOfEvent ( const Event e) const
inline

State iterator on states that are the targets of a given event

Parameters
ean Event
Returns
a forward iterator (end)
Precondition
the event must belong to the Component

Definition at line 794 of file Component.hh.

References Diades::Automata::Event::id(), and require.

◆ eventBegin()

EventIterator Diades::Automata::Component::eventBegin ( ) const
inline

Event iterator

Returns
a forward iterator on the events (begin)

Definition at line 328 of file Component.hh.

Referenced by generateRandomComponent(), Diades::Automata::getEvents(), and main().

◆ eventEnd()

EventIterator Diades::Automata::Component::eventEnd ( ) const
inline

Event iterator

Returns
a forward iterator on the events (end)

Definition at line 338 of file Component.hh.

Referenced by generateRandomComponent(), Diades::Automata::getEvents(), and main().

◆ events()

const set<Event>& Diades::Automata::Component::events ( ) const
inline

◆ eventTransitionBegin()

EventTransitionIterator Diades::Automata::Component::eventTransitionBegin ( const Event e) const
inline

Transition iterator

Parameters
ean Event
Returns
a forward iterator (begin)
Precondition
the event must belong to the Component

Definition at line 806 of file Component.hh.

References Diades::Automata::Event::id(), and require.

Referenced by component2Orange().

◆ eventTransitionEnd()

EventTransitionIterator Diades::Automata::Component::eventTransitionEnd ( const Event e) const
inline

Transition iterator

Parameters
ean Event
Returns
a forward iterator (end)
Precondition
the event must belong to the Component

Definition at line 817 of file Component.hh.

References Diades::Automata::Event::id(), and require.

Referenced by component2Orange().

◆ exportDesCompModel()

virtual bool Diades::Automata::Component::exportDesCompModel ( const string &  filename) const
virtual

Component export to the model file "des_comp"

Parameters
filenamename of an oldmodel file
Returns
true if the export has succeeded

Reimplemented in Diades::Automata::ObservableComponent.

Referenced by MealyEncodingV1(), and numberOfTransitions().

◆ faultyEventBegin()

EventIterator Diades::Automata::Component::faultyEventBegin ( ) const
inline

Event iterator

Returns
a forward iterator on the faulty events (begin)

Definition at line 396 of file Component.hh.

◆ faultyEventEnd()

EventIterator Diades::Automata::Component::faultyEventEnd ( ) const
inline

Event iterator

Returns
a forward iterator on the faulty events (end)

Definition at line 406 of file Component.hh.

◆ faultyEvents()

const set<Event>& Diades::Automata::Component::faultyEvents ( ) const
inline
Returns
the set of faulty events

Definition at line 386 of file Component.hh.

References _faultyEvents.

◆ getEvent()

const Event& Diades::Automata::Component::getEvent ( Transition  t) const
inline

◆ getLabel()

const StateLabel& Diades::Automata::Component::getLabel ( State  state) const
inline

◆ getPointer() [1/2]

ConstPointer Diades::Automata::Component::getPointer ( ) const
inline

mapping StateLabel -> State

Definition at line 124 of file Component.hh.

◆ getPointer() [2/2]

Pointer Diades::Automata::Component::getPointer ( )
inline

Definition at line 125 of file Component.hh.

◆ getState()

State Diades::Automata::Component::getState ( const StateLabel label) const
inline
Parameters
'label'a StateLabel
Returns
the State associated to the 'label'
Precondition
the state must exists

Definition at line 534 of file Component.hh.

References deleteState(), and require.

Referenced by getStartingStates().

◆ id()

int Diades::Automata::Component::id ( ) const
inline
Returns
the identifier of the component

Definition at line 200 of file Component.hh.

References _id.

◆ import()

virtual bool Diades::Automata::Component::import ( const string &  filename)
virtual

Component import from a file

Parameters
filenamename of a file containing a model
Returns
true if the import has succeeded. The importing mode depends on the filename suffix (i.e. lafmodels or other types)

Referenced by initialiseModelFromDesComp(), and initialiseModelFromSdmdl().

◆ importDesCompModel() [1/2]

virtual bool Diades::Automata::Component::importDesCompModel ( const string &  filename)
virtual

Component import from an des_comp file

Parameters
filenamename of a des_comp file
Returns
true if the import has succeeded Format of the file to import:
*  name
*  number of states
*  initialstate state2 ... stateN
*  number of failure events
*  fail1 { obs1 obs2 @ }...failM
*  number of normal events
*  norm1 { obs1 obs2 @ }... normP { obs1 obs2 @ }
*  number of observable events
*  obs1 ... obsT
*  number of transitions
*  statei -> statej event
*  ...
*  

Referenced by exportBackwardToDot(), exportToDot(), main(), and numberOfTransitions().

◆ importDesCompModel() [2/2]

virtual bool Diades::Automata::Component::importDesCompModel ( istream &  stream)
virtual

Component import from an des_comp file

Parameters
filenamename of a des_comp file
Returns
true if the import has succeeded Format of the file to import:
*  name
*  number of states
*  initialstate state2 ... stateN
*  number of failure events
*  fail1 { obs1 obs2 @ }...failM
*  number of normal events
*  norm1 { obs1 obs2 @ }... normP { obs1 obs2 @ }
*  number of observable events
*  obs1 ... obsT
*  number of transitions
*  statei -> statej event
*  ...
*  

◆ initialStateBegin()

InitialStateIterator Diades::Automata::Component::initialStateBegin ( ) const
inline

◆ initialStateEnd()

InitialStateIterator Diades::Automata::Component::initialStateEnd ( ) const
inline

◆ inputEventTransitionBegin()

InputEventTransitionIterator Diades::Automata::Component::inputEventTransitionBegin ( State  s,
Event  e 
) const
inline

Transition iterator on the input transitions of a given state labelled with a given event

Parameters
sa State
ean Event
Returns
a forward iterator (begin)
Precondition
the state must belong to the Component
the event must belong to the Component

Definition at line 867 of file Component.hh.

References _behav, Diades::Automata::Event::id(), and require.

Referenced by Diades::Automata::ComposableModel::inputEventTransitionBegin().

◆ inputEventTransitionEnd()

InputEventTransitionIterator Diades::Automata::Component::inputEventTransitionEnd ( State  s,
Event  e 
) const
inline

Transition iterator on the input transitions of a given state labelled with a given event

Parameters
sa State
ean Event
Returns
a forward iterator (end)
Precondition
the state must belong to the Component
the event must belong to the Component

Definition at line 884 of file Component.hh.

References _behav, Diades::Automata::Event::id(), and require.

Referenced by Diades::Automata::ComposableModel::inputEventTransitionEnd().

◆ inputTransitionBegin()

InputTransitionIterator Diades::Automata::Component::inputTransitionBegin ( State  s) const
inline

Input transition iterator

Parameters
sState
Precondition
s.valid() and s is a state of the current Component
Returns
a forward iterator on the input transitions of s (begin)

Definition at line 936 of file Component.hh.

References _behav, and require.

Referenced by exportBackwardToDot(), printStatistics(), and Diades::Automata::purgeNonPredecessors().

◆ inputTransitionEnd()

InputTransitionIterator Diades::Automata::Component::inputTransitionEnd ( State  s) const
inline

Input transition iterator

Parameters
sState
Precondition
s.valid() and s is a state of the current ElementaryModule
Returns
a forward iterator on the input transitions of s (end)

Definition at line 948 of file Component.hh.

References _behav, and require.

Referenced by exportBackwardToDot(), printStatistics(), and Diades::Automata::purgeNonPredecessors().

◆ insertEvent() [1/2]

void Diades::Automata::Component::insertEvent ( const Event event)

Insert the event if not already inserted. If not already inserted the inserted event is considered as normal. To change it as faulty use setFaulty(event) turned to be normal

Parameters
eventan Event

Referenced by MealyEncoding(), MealyEncodingV1(), MooreEncoding(), name(), and numberOfEvents().

◆ insertEvent() [2/2]

void Diades::Automata::Component::insertEvent ( EventIterator  start,
EventIterator  end 
)

Insert the range of events if not already inserted If not already inserted the inserted event is considered as normal. To change it as faulty use setFaulty(event)

Parameters
startEventIterator
endEventIterator

◆ isComplete()

bool Diades::Automata::Component::isComplete ( ) const

Check completeness. The Component is seen as a finite state automaton (not necessarily deterministic) and we check that any transition label of the TransitionSystem is a label of, at least, one output transition of every state

Returns
true if the Component is complete

Referenced by numberOfTransitions().

◆ isDeterministic()

bool Diades::Automata::Component::isDeterministic ( ) const

Check determinism

Returns
true if the Component is deterministic

Referenced by numberOfTransitions().

◆ isEmpty()

bool Diades::Automata::Component::isEmpty ( ) const
inline
Returns
true if the component is empty

Definition at line 226 of file Component.hh.

References Diades::Graph::Graph::empty().

Referenced by isValid().

◆ isFaulty()

bool Diades::Automata::Component::isFaulty ( const Event e) const
inline
Parameters
eventthe event
Returns
true if the event is faulty in the component

Definition at line 373 of file Component.hh.

◆ isInitial()

bool Diades::Automata::Component::isInitial ( State  state) const
inline
Parameters
statea State
Returns
true if state is an initial state of the Component

Definition at line 672 of file Component.hh.

References _behav, deleteTransition(), mergeInfoStates(), newTransition(), and states.

◆ isNormal()

bool Diades::Automata::Component::isNormal ( const Event e) const
inline
Parameters
eventthe event
Returns
true if the event is normal in the component

Definition at line 429 of file Component.hh.

◆ isValid()

bool Diades::Automata::Component::isValid ( ) const
inline
Returns
true if the component is valid A Component is valid if it is not empty and its name is not the default one

Definition at line 236 of file Component.hh.

References defaultComponentName, isEmpty(), and name().

Referenced by getEvent(), and Diades::Automata::ComposableModel::valid().

◆ mergeInfoStates()

virtual void Diades::Automata::Component::mergeInfoStates ( const vector< const Component *> &  components,
const vector< State > &  states,
State  currentState 
)
virtual

Merge information about states when synchronising

Parameters
componentsThe set of components that are synchronising
statesThe configuration of states
currentStateThe corresponding state in the current Component currentState = (components[0]->state[0],..., components[n]->state[n])

Reimplemented in Diades::Automata::Trace.

Referenced by isInitial().

◆ mergeStates()

State Diades::Automata::Component::mergeStates ( BeliefState states)
private

State merge

Parameters
statesa set of states to merge
Returns
a state (merge of the states in 'states') Modify the Component so that a state is created resulting from the syntactic merge of the states in 'states'. Every input/output transition from 'states' has a representative as an input/output transition in the resulting state.
Postcondition
the set of states is empty !!

Referenced by numberOfTransitions().

◆ minimize() [1/2]

bool Diades::Automata::Component::minimize ( )

Minimize the Component Application of the minimization algorithm to create the minimal deterministic automata that represents the language of the current Component Note that the language is the prefix-closed language recognised by the current Component when we consider that every state of the Component is acceptor

Returns
true if the minimisation has succeeded, false otherwise (see log for details)
Precondition
isDeterminitic()
Postcondition
isDeterministic() && isMinimal()

Referenced by numberOfTransitions().

◆ minimize() [2/2]

bool Diades::Automata::Component::minimize ( unordered_set< State > &  acceptors)

Minimize the Component Application of the minimization algorithm to create the minimal determinitic automata that represents the language of the current Component

Parameters
acceptorsset of acceptor states (from a language point of view)

Note that if acceptors is empty, the language is the prefix-closed language recognised by the current Component when we consider that every state of the Component is an acceptor

Returns
true if the minimisation has succeeded, false otherwise (see log for details)
Precondition
isDeterminitic()
Postcondition
isDeterministic() && isMinimal()

◆ name()

const string& Diades::Automata::Component::name ( ) const
inline

◆ nerodePartition() [1/2]

void Diades::Automata::Component::nerodePartition ( vector< BeliefState * > &  partition) const
private

Nerode partition (for minimization)

Parameters
partitionwill contain the nerode partition of the Component (required for the minimization of the Component)

Referenced by numberOfTransitions().

◆ nerodePartition() [2/2]

void Diades::Automata::Component::nerodePartition ( const unordered_set< State > &  acceptors,
vector< BeliefState * > &  partition 
)
private

Nerode partition

Parameters
acceptorsset of acceptor states
partitionwill contain the nerode partition of the Component (required for the minimization of the Component) (consider that acceptors is the set of acceptor states of the Component for the minimization)

◆ newState() [1/2]

State Diades::Automata::Component::newState ( )

Create a new State in the component

Returns
the State

Referenced by getSynchronisedInteraction(), MealyEncoding(), MealyEncodingV1(), MooreEncoding(), and normalEventEnd().

◆ newState() [2/2]

State Diades::Automata::Component::newState ( const StateLabel label)

Create a new State in the component

Parameters
labelthe associated StateLabel of the state
Returns
the State associated with the StateLabel label
Precondition
label must not be empty
Postcondition
if a State associated with the StateLabel label is present in the Component, no new State is created, the present one is returned.

◆ newTransition() [1/2]

Transition Diades::Automata::Component::newTransition ( State  source,
State  target,
Event  event 
)
Parameters
sourcea State of the Component
targeta State of the Component
eventan Event If the event is not yet in the component, the event is set to be normal, use setFaulty to change this
Returns
the transition labeled with the Event event whose source is 'source' and target is 'target'
Precondition
source and target must belong to the Component
event must be valid
Postcondition
no transition is created if such a transition already exists

Referenced by isInitial(), MealyEncoding(), MealyEncodingV1(), and MooreEncoding().

◆ newTransition() [2/2]

Transition Diades::Automata::Component::newTransition ( const StateLabel source,
const StateLabel target,
Event  event 
)
Parameters
sourcea StateLabel
targeta StateLabel
eventan Event, if the event is not yet in the component, the event is set to be normal, use setFaulty to change this
Returns
the transition labelled with the Event event whose source is 'source' and target is 'target'
Precondition
event must be valid
the StateLabel must not be empty
Postcondition
no transition is created if such a transition already exists

◆ normalEventBegin()

EventIterator Diades::Automata::Component::normalEventBegin ( ) const
inline

Event iterator

Returns
a forward iterator on the normal events (begin)

Definition at line 451 of file Component.hh.

◆ normalEventEnd()

EventIterator Diades::Automata::Component::normalEventEnd ( ) const
inline

Event iterator

Returns
a forward iterator on the normal events (end)

Definition at line 461 of file Component.hh.

References newState(), and replaceEvent().

◆ normalEvents()

const set<Event>& Diades::Automata::Component::normalEvents ( ) const
inline
Returns
the set of normal events

Definition at line 441 of file Component.hh.

References _normalEvents.

◆ numberOfEvents()

unsigned Diades::Automata::Component::numberOfEvents ( ) const
inline

Number of events

Returns
the number of events

Definition at line 284 of file Component.hh.

References insertEvent(), and start.

Referenced by main().

◆ numberOfInitialStates()

unsigned Diades::Automata::Component::numberOfInitialStates ( ) const
inline
Returns
the number of initial states in this Component

Definition at line 659 of file Component.hh.

Referenced by Diades::Automata::initialStateSelection(), main(), and Diades::Automata::randomSimulate().

◆ numberOfStates()

unsigned Diades::Automata::Component::numberOfStates ( ) const
inline

◆ numberOfTransitions()

unsigned Diades::Automata::Component::numberOfTransitions ( ) const
inline

◆ operator!=()

bool Diades::Automata::Component::operator!= ( const Component component) const
inline

Equality operator

Parameters
componentthe Component to compare
Returns
true if and only if the current Component is NOT THE SAME Component 'component' (no duplication of components, pointer inequality)

Definition at line 185 of file Component.hh.

References clear().

◆ operator==()

bool Diades::Automata::Component::operator== ( const Component component) const
inline

Equality operator

Parameters
componentthe Component to compare
Returns
true if and only if the current Component is the SAME Component 'component' (no duplication of components, pointer equality)

Definition at line 173 of file Component.hh.

◆ outputEventTransitionBegin()

OutputEventTransitionIterator Diades::Automata::Component::outputEventTransitionBegin ( State  s,
Event  e 
) const
inline

Transition iterator on the output transitions of a given state labelled with a given event

Parameters
sa State
ean Event
Returns
a forward iterator (begin)
Precondition
the state must belong to the Component
the event must belong to the Component

Definition at line 832 of file Component.hh.

References _behav, Diades::Automata::Event::id(), Diades::Automata::Event::isValid(), and require.

Referenced by export2Hydiag(), MealyEncoding(), MealyEncodingV1(), MooreEncoding(), and Diades::Automata::ComposableModel::outputEventTransitionBegin().

◆ outputEventTransitionEnd()

OutputEventTransitionIterator Diades::Automata::Component::outputEventTransitionEnd ( State  s,
Event  e 
) const
inline

Transition iterator on the output transitions of a given state labelled with a given event

Parameters
sa State
ean Event
Returns
a forward iterator (end)
Precondition
the state must belong to the Component
the event must belong to the Component

Definition at line 850 of file Component.hh.

References _behav, Diades::Automata::Event::id(), and require.

Referenced by export2Hydiag(), MealyEncoding(), MealyEncodingV1(), MooreEncoding(), and Diades::Automata::ComposableModel::outputEventTransitionEnd().

◆ outputTransitionBegin()

OutputTransitionIterator Diades::Automata::Component::outputTransitionBegin ( State  s) const
inline

Output transition iterator

Parameters
sState
Precondition
s.valid() and s is a state of the current Component
Returns
a forward iterator on the output transitions of s (begin)

Definition at line 913 of file Component.hh.

References _behav, and require.

Referenced by Diades::Automata::FaultDiagnosis::componentDiagnose(), exportToDot(), Diades::Automata::FaultDiagnosis::globalModelDiagnose(), Diades::Automata::interactiveSimulation(), MooreEncoding(), Diades::Automata::ComposableModel::outputTransitionBegin(), printStatistics(), and Diades::Automata::randomSimulateState().

◆ outputTransitionEnd()

OutputTransitionIterator Diades::Automata::Component::outputTransitionEnd ( State  s) const
inline

Output transition iterator

Parameters
sState
Precondition
s.valid() and s is a state of the current Component
Returns
a forward iterator on the output transitions of s (end)

Definition at line 925 of file Component.hh.

References _behav, and require.

Referenced by Diades::Automata::FaultDiagnosis::componentDiagnose(), exportToDot(), Diades::Automata::FaultDiagnosis::globalModelDiagnose(), Diades::Automata::interactiveSimulation(), MooreEncoding(), Diades::Automata::ComposableModel::outputTransitionEnd(), printStatistics(), and Diades::Automata::randomSimulateState().

◆ parseDesCompFaultyEvents()

virtual bool Diades::Automata::Component::parseDesCompFaultyEvents ( istream &  stream)
protectedvirtual
Parameters
streamthe input stream parse the faulty events of the component in a des_comp file

Reimplemented in Diades::Automata::ObservableComponent.

Referenced by numberOfTransitions().

◆ parseDesCompMaskedEvents()

virtual bool Diades::Automata::Component::parseDesCompMaskedEvents ( istream &  stream,
unsigned  number,
map< string, set< string > > &  maskEvents 
)
protectedvirtual
Parameters
streamthe input stream
numberthe number of expected events parse a set of masked events of the component in a des_comp file

Referenced by numberOfTransitions().

◆ parseDesCompName()

virtual bool Diades::Automata::Component::parseDesCompName ( istream &  stream)
protectedvirtual
Parameters
streamthe input stream parse the name of the component in a des_comp file

Referenced by numberOfTransitions().

◆ parseDesCompNormalEvents()

virtual bool Diades::Automata::Component::parseDesCompNormalEvents ( istream &  stream)
protectedvirtual
Parameters
streamthe input stream parse the normal events of the component in a des_comp file

Reimplemented in Diades::Automata::ObservableComponent.

Referenced by numberOfTransitions().

◆ parseDesCompObservableEvents()

virtual bool Diades::Automata::Component::parseDesCompObservableEvents ( istream &  stream)
protectedvirtual
Parameters
streamthe input stream parse the observable events of the component in a des_comp file here an observable event is just consider as a normal event

Reimplemented in Diades::Automata::ObservableComponent.

Referenced by numberOfTransitions().

◆ parseDesCompStates()

virtual bool Diades::Automata::Component::parseDesCompStates ( istream &  stream)
protectedvirtual
Parameters
streamthe input stream parse the states of the component in a des_comp file

Referenced by numberOfTransitions().

◆ parseDesCompTransitions()

virtual bool Diades::Automata::Component::parseDesCompTransitions ( istream &  stream)
protectedvirtual
Parameters
streamthe input stream parse the transitions of the component in a des_comp file,

Referenced by numberOfTransitions().

◆ project() [1/3]

virtual bool Diades::Automata::Component::project ( const Component comp,
const set< Event > &  projectedEvents 
)
virtual

Projection of the Component comp The current Component is the result of the projection of comp over the set of events projectedEvents In the projection, events are considered to be normal, update with setFaulty if required

Parameters
compComponent to project
projectedEventsset of projected events
Returns
true if the projection has succeded
Postcondition
success => isMinimal() && failure => empty()

Referenced by numberOfTransitions().

◆ project() [2/3]

virtual bool Diades::Automata::Component::project ( const Component comp,
const set< Event > &  projectedEvents,
unordered_map< Diades::Automata::State, unordered_set< Diades::Automata::State > > &  dictionary 
)
virtual

Projection of the Component comp The current ObservableComponent is the result of the projection of comp over the set of events projectedEvents. In the projection, events are considered to be normal, update with setFaulty if required

Parameters
compObservableComponent to project
projectedEventsset of projected events
dictionarythe dictionnary that associates to each state of the abstracted component the set of states of the original component.
Returns
true if the projection has succeded
Postcondition
success => isDeterministic() && failure => empty()

◆ project() [3/3]

virtual bool Diades::Automata::Component::project ( const Component comp,
const set< Event > &  projectedEvents,
const unordered_set< State > &  acceptors,
unordered_set< State > &  newAcceptors 
)
virtual

Projection of the Component comp The current Component is the result of the projection of comp over the set of codes projectedCodes

Parameters
tSysComponent to project
projectedEventsset of projected events In the projection, events are considered to be normal, update with setFaulty if required
acceptorsacceptors of Comp
newAcceptorsacceptors corresponding to the acceptors in Comp but that are from the current projected Component.
Returns
true if the projection has succeded
Postcondition
success => isMinimal(newAcceptors) && failure => empty()

◆ reachableStates() [1/2]

void Diades::Automata::Component::reachableStates ( const BeliefState bs,
Event  event,
const set< Event > &  projectedEvents,
BeliefState nextBs 
) const
private

Reachable states

Parameters
bsa BeliefState
eventan Eventt
projectedEventsset of projected events
nextBsnext BeliefState Compute the BeliefState nextBs containing all the states s' such that there exists a transition sequence from a state s of bs to state s' ending with a transition labeled with the Event 'event'. No transition before the last one is labeled with an Event from the set 'projectedCodes'
Precondition
nextBs.isEmpty()

Referenced by numberOfTransitions().

◆ reachableStates() [2/2]

void Diades::Automata::Component::reachableStates ( const BeliefState bs,
Event  event,
const set< Event > &  projectedEvents,
BeliefState nextBs,
const unordered_set< State > &  acceptors,
bool &  presenceOfAcceptors 
) const
private

Reachable states

Parameters
bsa BeliefState
eventan Event
projectedEventsset of projected events
nextBsnext BeliefState
acceptorsacceptor States
acceptorPresencepresenceOfAcceptors Compute the BeliefState nextBs containing all the states s' such that there exists a transition sequence from a state s of bs to state s' ending with a transition labeled with the Event 'event'. No transition before the last one is labeled with an Event from the set 'projectedEvents'. If during the search, the algorithm finds out a state that is an acceptor then presenceOfAcceptors is set to true;
Precondition
nextBs.isEmpty()

◆ replaceEvent()

void Diades::Automata::Component::replaceEvent ( const Event e1,
const Event e2 
)

Event replacement, if e2 is not inserted yet, it will be inserted and considered as normal. Use setFaulty(e2) if you want to change that

Parameters
e1Event to replace
e2Event that replace
Postcondition
e1 does not belong to the current Component any longer

Referenced by normalEventEnd().

◆ sanityCheck()

bool Diades::Automata::Component::sanityCheck ( string &  log) const
Parameters
logsome pieces of information returned by sanityCheck
Returns
true if the current Component is not corrupted

Referenced by numberOfTransitions().

◆ setAllInitialStates()

void Diades::Automata::Component::setAllInitialStates ( )
inline

set all the states as possible initial states

Definition at line 615 of file Component.hh.

References Diades::Graph::NodeMap< T >::initValue(), stateBegin(), and stateEnd().

◆ setFaulty()

void Diades::Automata::Component::setFaulty ( const Event e)
inline
Parameters
eventthe event to set faulty
Precondition
event must be inserted first Set the event to be faulty

Definition at line 361 of file Component.hh.

References containsEvent(), and require.

◆ setId()

void Diades::Automata::Component::setId ( int  identifier)
inline

set the identifier of the component

Parameters
identifierthe new identifier

Definition at line 208 of file Component.hh.

◆ setInitial()

void Diades::Automata::Component::setInitial ( State  state)
inline

Set the state as a possible initial state

Parameters
statea State of the Component

Definition at line 589 of file Component.hh.

References _behav.

Referenced by getSynchronisedInteraction(), MealyEncoding(), MealyEncodingV1(), and MooreEncoding().

◆ setName()

void Diades::Automata::Component::setName ( const string &  name)
inline

set the name of the Component

Parameters
namethe new name of the Component

Definition at line 246 of file Component.hh.

References ensure, name(), and require.

Referenced by MealyEncoding(), MealyEncodingV1(), and MooreEncoding().

◆ setNormal()

void Diades::Automata::Component::setNormal ( const Event e)
inline
Parameters
eventthe event to set normal
Precondition
event must be inserted first Set the event to be normal

Definition at line 418 of file Component.hh.

References containsEvent(), and require.

◆ splitPartition()

void Diades::Automata::Component::splitPartition ( const BeliefState bigQ0,
const BeliefState bigQ1,
Event  littleA,
BeliefState bigQ0prime,
BeliefState bigQ0MinusbigQ0prime 
) const
private

Split two partition elements according to the splittable property (minimization)

Parameters
bigQOa BeliefState
bigQ1a BeliefState
littleAan Event
bigQ0primea BeliefState result of the split
bigQ0MinusbigQ0primea BeliefState result of the split

Do the split as follows. 1) If the states of Q0 always have an output transition labelled with a that goes to a state of Q1 then Q0 is not splittable and bigQ0prime bigQ0MinusbigQ0prime are empty belief states 2) If the states of Q0 always have an output transition labelled with a that goes to a state NOT in Q1 then Q0 is not splittable and bigQ0prime bigQ0MinusbigQ0prime are empty belief states 3) Otherwise it is splittable and bigQ0prime contains the states of Q0 that satify case 1 and bigQ0MinusbigQ0prime are the one that satisfies case 2

Note that bigQ1 may be equal to 0 which means that Q1 = {sink_state}. The sink_state is not explicitly represented in the Component

Referenced by numberOfTransitions().

◆ splitPartition2()

void Diades::Automata::Component::splitPartition2 ( const BeliefState bigQ0,
const BeliefState bigQ1,
Event  littleA,
BeliefState bigQ0prime,
BeliefState bigQ0MinusbigQ0prime,
State  sinkState 
) const
private

this version of splitPartition is used when there exist acceptors

Parameters
bigQOa BeliefState
bigQ1a BeliefState
littleAan Event
bigQ0primea BeliefState result of the split
bigQ0MinusbigQ0primea BeliefState result of the split
sinkStatesink state (the way to implicitely represents a complete DFA

Referenced by numberOfTransitions().

◆ stateBegin()

StateIterator Diades::Automata::Component::stateBegin ( ) const
inline

◆ stateEnd()

StateIterator Diades::Automata::Component::stateEnd ( ) const
inline

◆ transitionBegin()

TransitionIterator Diades::Automata::Component::transitionBegin ( ) const
inline

Transition iterator

Returns
a forward iterator (begin)

Definition at line 897 of file Component.hh.

References Diades::Graph::Graph::edgeBegin().

Referenced by exportToDesComp(), and main().

◆ transitionEnd()

TransitionIterator Diades::Automata::Component::transitionEnd ( ) const
inline

Transition iterator

Returns
a forward iterator (end)

Definition at line 904 of file Component.hh.

References Diades::Graph::Graph::edgeEnd().

Referenced by exportToDesComp(), and main().

◆ typeName()

static string Diades::Automata::Component::typeName ( )
inlinestatic

the name by default

Definition at line 60 of file Component.hh.

◆ unsetInitial()

void Diades::Automata::Component::unsetInitial ( State  state)
inline

Set the state as a possible initial state

Parameters
statea State of the Component

Definition at line 603 of file Component.hh.

References _behav.

Member Data Documentation

◆ _behav

Diades::Graph::Graph Diades::Automata::Component::_behav
protected

◆ _eventOfTransition

Diades::Graph::EdgeMap< Event > Diades::Automata::Component::_eventOfTransition
private

Definition at line 95 of file Component.hh.

◆ _events

set<Event> Diades::Automata::Component::_events
private

identifier of the component

Definition at line 87 of file Component.hh.

Referenced by events().

◆ _faultyEvents

set<Event> Diades::Automata::Component::_faultyEvents
private

Events

Definition at line 88 of file Component.hh.

Referenced by faultyEvents().

◆ _id

int Diades::Automata::Component::_id
private

name of the component

Definition at line 86 of file Component.hh.

Referenced by id().

◆ _initial

unordered_set<State> Diades::Automata::Component::_initial
protected

behaviour of the component

Definition at line 81 of file Component.hh.

◆ _isInitial

Diades::Graph::NodeMap<int> Diades::Automata::Component::_isInitial
protected

possible initial states of the Component

Definition at line 82 of file Component.hh.

◆ _labelOfState

Diades::Graph::NodeMap< StateLabel > Diades::Automata::Component::_labelOfState
private

Definition at line 96 of file Component.hh.

◆ _name

string Diades::Automata::Component::_name
private

== 1 <=> is Initial

Definition at line 85 of file Component.hh.

Referenced by name().

◆ _normalEvents

set<Event> Diades::Automata::Component::_normalEvents
private

Definition at line 89 of file Component.hh.

Referenced by normalEvents().

◆ _sourceWithEvent

vector< unordered_set<State> > Diades::Automata::Component::_sourceWithEvent
private

Definition at line 92 of file Component.hh.

◆ _stateOfLabel

unordered_map< StateLabel,State > Diades::Automata::Component::_stateOfLabel
private

Information on a state

Definition at line 97 of file Component.hh.

◆ _targetWithEvent

vector< unordered_set<State> > Diades::Automata::Component::_targetWithEvent
private

Definition at line 93 of file Component.hh.

◆ _transitionsWithEvent

vector< list<Transition> > Diades::Automata::Component::_transitionsWithEvent
private

Definition at line 94 of file Component.hh.

◆ _transitionsWithSource

vector< Diades::Graph::NodeMap< unordered_set<Transition> > > Diades::Automata::Component::_transitionsWithSource
private

Definition at line 91 of file Component.hh.

◆ _transitionsWithTarget

vector< Diades::Graph::NodeMap< unordered_set<Transition> > > Diades::Automata::Component::_transitionsWithTarget
private

Definition at line 90 of file Component.hh.

◆ defaultComponentName

const string Diades::Automata::Component::defaultComponentName
static

Definition at line 59 of file Component.hh.

Referenced by isValid().


The documentation for this class was generated from the following file: