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

#include <Trace.hh>

Public Types

typedef Diades::Utils::Exception< TraceException
 
- Public Types inherited from Diades::Automata::Component
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

 Trace ()
 
bool extract (const Component &comp, const ObservableMask &mask, const vector< Event > &observations)
 
void extract (const Component &comp, Event event, bool presence)
 
void extract (const Trace &trace, const Trace &projection, const set< Event > &projectedEvents)
 
void extractObservableTrace (const ObservableComponent &comp, Event event, bool presence)
 
void extractAllObservableTraces (const ObservableComponent &comp)
 
bool project (const Trace &trace, const set< Event > &projectedEvents)
 
bool intersection (const Trace &trace1, const Trace &trace2)
 
bool substract (const Trace &trace1, const Trace &trace2)
 
bool complement (const Trace &trace, const set< Event > &events)
 
bool compose (const Trace &trace1, const Trace &trace2, const set< Event > &events)
 
State makeComplete ()
 
bool isFinite (list< set< Event > > &combinations) const
 
bool isContinuationFinite () const
 
State initialState () const
 
bool isAcceptor (State state) const
 
void setAcceptor (State state)
 
void setNonAcceptor (State state)
 
unordered_set< State >::const_iterator beginOfAcceptorStates () const
 
unordered_set< State >::const_iterator endOfAcceptorStates () const
 
void makeAllAcceptors ()
 
void makeAllNonAcceptors ()
 
const unordered_set< State > & acceptors () const
 
virtual void mergeInfoStates (const vector< const Component *> &components, const vector< State > &states, State currentState)
 
void clear ()
 
void trace2dot (const string &filename) const
 
- Public Member Functions inherited from Diades::Automata::Component
ConstPointer getPointer () const
 
Pointer getPointer ()
 
 Component ()
 
 Component (const Component &component)
 
virtual ~Component ()
 
bool operator== (const Component &component) const
 
bool operator!= (const Component &component) const
 
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
 
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 ()
 _status = 1 acceptor, non-acceptor otherwise More...
 
- Static Public Member Functions inherited from Diades::Automata::Component
static string typeName ()
 the name by default More...
 

Private Member Functions

void pruneSpuriousStates ()
 
void extractUnobservableBehaviours (const Component &comp, const ObservableMask &mask, const unordered_map< State, State > &sources, unordered_map< State, State > &targets, unsigned level)
 
bool extractBehaviours (const Component &comp, const ObservableMask &mask, const unordered_map< State, State > &sources, const Event &obs, unordered_map< State, State > &targets, unsigned level)
 
void computeTrace (const Component &comp, Event event, bool presence)
 

Private Attributes

unordered_set< State_acceptors
 
Diades::Graph::NodeMap< int > _status
 set of acceptor states More...
 

Additional Inherited Members

- Static Public Attributes inherited from Diades::Automata::Component
static const string defaultComponentName
 
- Protected Member Functions inherited from Diades::Automata::Component
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 inherited from Diades::Automata::Component
Diades::Graph::Graph _behav
 
unordered_set< State_initial
 
Diades::Graph::NodeMap< int > _isInitial
 

Detailed Description

This class implements the notion of traces. It is a component whose states have a status. Traces are used to compute languages over the component behaviours

Definition at line 19 of file Trace.hh.

Member Typedef Documentation

◆ Exception

Definition at line 29 of file Trace.hh.

Constructor & Destructor Documentation

◆ Trace()

Diades::Automata::Trace::Trace ( )

default constructor

Member Function Documentation

◆ acceptors()

const unordered_set<State>& Diades::Automata::Trace::acceptors ( ) const
inline
Returns
the set of acceptors

Definition at line 402 of file Trace.hh.

References _acceptors, mergeInfoStates(), and states.

◆ beginOfAcceptorStates()

unordered_set<State>::const_iterator Diades::Automata::Trace::beginOfAcceptorStates ( ) const
inline
Returns
a start-iterator on the acceptor states

Definition at line 340 of file Trace.hh.

◆ clear()

void Diades::Automata::Trace::clear ( )
inlinevirtual

◆ complement()

bool Diades::Automata::Trace::complement ( const Trace trace,
const set< Event > &  events 
)

Trace complementation.

Parameters
tracethe Trace to complement
eventsthe events for the complemetation
Returns
true if success, false otherwise (see log for problems)
Precondition
the events of trace are included in events The Trace "trace" is a language L1. The set of events 'events' generate a language L2 The complement of "trace" is a Trace that represents the language L2 \ L1. If L2 \ L1 is empty, return the empty Trace

◆ compose()

bool Diades::Automata::Trace::compose ( const Trace trace1,
const Trace trace2,
const set< Event > &  events 
)

Trace composition

Parameters
trace1First Trace
trace2Second Trace
eventsSet of event to synchronise
Returns
true if success, false otherwise (see log for problems) Compose the traces trace1 and trace2 on the events in 'events'

◆ computeTrace()

void Diades::Automata::Trace::computeTrace ( const Component comp,
Event  event,
bool  presence 
)
private

Creation of the trace of event 'event'

Parameters
componenta Component
eventan Event
presencetype of the Trace Compute the Trace of the event 'event'. Every event sequence recognised by the Trace is a sequence S of the Component. If presence is true, then S neccessarily contains the Event "event". If presence is not true then S does not contain the Event "event". Here the trace is represented as a regular language L by the minimal deterministic automaton MDA(L) (this automation is theoretically unique)

◆ endOfAcceptorStates()

unordered_set<State>::const_iterator Diades::Automata::Trace::endOfAcceptorStates ( ) const
inline
Returns
an end-iterator on the acceptor states

Definition at line 355 of file Trace.hh.

◆ extract() [1/3]

bool Diades::Automata::Trace::extract ( const Component comp,
const ObservableMask mask,
const vector< Event > &  observations 
)

Trace extraction

Parameters
compa Component
maskan observable mask of this component.
observationsa sequence of observations.

Compute the set of traces of the component comp that can produce the sequence of observations based on the given obserable mask, return true if such traces exist.

◆ extract() [2/3]

void Diades::Automata::Trace::extract ( const Component comp,
Event  event,
bool  presence 
)

Trace extraction

Parameters
compa Component
eventan Event
presenceis the event is present or not
Returns
the Trace that gathers all the possible traces of comp in which the event occurs (if presence is true) or in which the event does not occur (if presence is false) Here the Trace is represented as a regular language L by the minimal deterministic automaton MDA(L) (this automation is theoretically unique)

◆ extract() [3/3]

void Diades::Automata::Trace::extract ( const Trace trace,
const Trace projection,
const set< Event > &  projectedEvents 
)

Trace extraction

Parameters
tracea Trace
projectionanother Trace that is composed of events in 'projectedEvents'.
projectedEventsset of events that should included in the set of events of the Trace 'trace'
Returns
the traces extracted from the Trace 'trace' such that their projection on the set 'projectedEvents' belongs to the traces 'projection'. Here the Trace is represented as a regular language L by the minimal deterministic automaton MDA(L) (this automation is theoretically unique)

◆ extractAllObservableTraces()

void Diades::Automata::Trace::extractAllObservableTraces ( const ObservableComponent comp)
Parameters
compan ObservableComponent
Returns
the Trace that gathers all the possible traces of comp Here the Trace is represented as a regular language L by the minimal deterministic automaton MDA(L) (this automation is theoretically unique). The Trace is partially observable, which means that the ObservableMask of the ObservableComponent has been applied.

◆ extractBehaviours()

bool Diades::Automata::Trace::extractBehaviours ( const Component comp,
const ObservableMask mask,
const unordered_map< State, State > &  sources,
const Event obs,
unordered_map< State, State > &  targets,
unsigned  level 
)
private

◆ extractObservableTrace()

void Diades::Automata::Trace::extractObservableTrace ( const ObservableComponent comp,
Event  event,
bool  presence 
)

Partially Observable Trace extraction

Parameters
compan ObservableComponent
eventan Event
presenceis the event is present or not
Returns
the Trace that gathers all the possible traces of comp in which the event occurs (if presence is true) or in which the event does not occur (if presence is false) Here the Trace is represented as a regular language L by the minimal deterministic automaton MDA(L) (this automation is theoretically unique). The Trace is partially observable, which means that the ObservableMask of the ObservableComponent has been applied. The Event event can be either an unobservable Event of comp or an observable Event of the ObservableMask.

◆ extractUnobservableBehaviours()

void Diades::Automata::Trace::extractUnobservableBehaviours ( const Component comp,
const ObservableMask mask,
const unordered_map< State, State > &  sources,
unordered_map< State, State > &  targets,
unsigned  level 
)
private

◆ initialState()

State Diades::Automata::Trace::initialState ( ) const
inline
Returns
the initial state of the Trace

Definition at line 263 of file Trace.hh.

References Diades::Automata::Component::initialStateBegin().

◆ intersection()

bool Diades::Automata::Trace::intersection ( const Trace trace1,
const Trace trace2 
)

Intersection of two Trace objects: generate the trace that gathers the words that belongs to both traces

Parameters
trace1first Trace
trace2second Trace
Returns
true if success, false otherwise (see log for problems)
Postcondition
isMinimal()

◆ isAcceptor()

bool Diades::Automata::Trace::isAcceptor ( State  state) const
inline
Parameters
statea State of the Trace
Returns
true if it is an accpetor State of the current Trace

Definition at line 282 of file Trace.hh.

References Diades::Automata::Component::behaviour(), and require.

◆ isContinuationFinite()

bool Diades::Automata::Trace::isContinuationFinite ( ) const
Returns
true if for any word in the trace, its continution in the Trace is finite.

◆ isFinite()

bool Diades::Automata::Trace::isFinite ( list< set< Event > > &  combinations) const
Parameters
combinations
Returns
true if the trace is finite. Is the trace is not finite return a set of events, that, if removed, would make the trace finite
Todo:
improve the returned combinations

◆ makeAllAcceptors()

void Diades::Automata::Trace::makeAllAcceptors ( )
inline

Make all the states as acceptor states

Definition at line 368 of file Trace.hh.

References setAcceptor(), Diades::Automata::Component::stateBegin(), and Diades::Automata::Component::stateEnd().

◆ makeAllNonAcceptors()

void Diades::Automata::Trace::makeAllNonAcceptors ( )
inline

Make all the states as non-acceptor states

Definition at line 384 of file Trace.hh.

References setNonAcceptor(), Diades::Automata::Component::stateBegin(), and Diades::Automata::Component::stateEnd().

◆ makeComplete()

State Diades::Automata::Trace::makeComplete ( )

Completeness Make the trace like a monitor by completing with a hole state to which events that are not considered in the Trace force to to go to that state. This is used by SpecialisedActiveDiagnoser.

Returns
the created state used for the completion, or a null state otherwise

◆ mergeInfoStates()

virtual void Diades::Automata::Trace::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 from Diades::Automata::Component.

Referenced by acceptors().

◆ project()

bool Diades::Automata::Trace::project ( const Trace trace,
const set< Event > &  projectedEvents 
)

Projection of the Trace trace The current Trace is the result of the projection of trace over the set of events projectedEvents

Parameters
compComponent to project
projectedEventsset of projected events
Returns
true if success, false otherwise
Postcondition
isMinimal()

◆ pruneSpuriousStates()

void Diades::Automata::Trace::pruneSpuriousStates ( )
private

◆ setAcceptor()

void Diades::Automata::Trace::setAcceptor ( State  state)
inline

Set the state to be an acceptor state

Parameters
statea State

Definition at line 299 of file Trace.hh.

References Diades::Automata::Component::behaviour(), and require.

Referenced by makeAllAcceptors().

◆ setNonAcceptor()

void Diades::Automata::Trace::setNonAcceptor ( State  state)
inline

Set the state to be a non acceptor state

Parameters
statea State

Definition at line 319 of file Trace.hh.

References Diades::Automata::Component::behaviour(), and require.

Referenced by makeAllNonAcceptors().

◆ substract()

bool Diades::Automata::Trace::substract ( const Trace trace1,
const Trace trace2 
)

Substraction of two Trace objects: generate the trace that gathers the words of the first trace minus the words of the second trace if trace2 includes trace1 then the empty trace is computed

Parameters
trace1first Trace
trace2second Trace
Returns
true if success, false otherwise (see log for problems)
Postcondition
isMinimal()

◆ trace2dot()

void Diades::Automata::Trace::trace2dot ( const string &  filename) const

Export to dot

Referenced by clear().

◆ typeName()

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

_status = 1 acceptor, non-acceptor otherwise

Definition at line 26 of file Trace.hh.

Member Data Documentation

◆ _acceptors

unordered_set<State> Diades::Automata::Trace::_acceptors
private

Definition at line 21 of file Trace.hh.

Referenced by acceptors().

◆ _status

Diades::Graph::NodeMap<int> Diades::Automata::Trace::_status
private

set of acceptor states

Definition at line 22 of file Trace.hh.


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