DiaDes  0.1
DIAgnosis of Discrete-Event System
Typedefs | Enumerations | Functions | Variables
DesGenerate.cc File Reference
#include <iostream>
#include <sstream>
#include <string>
#include <map>
#include <list>
#include <cmath>
#include <diades/utils/Random.hh>
#include <diades/utils/Verbose.hh>
#include <diades/utils/Log.hh>
#include <diades/utils/Selection.hh>
#include <diades/graph/ConstNodeMap.hh>
#include <diades/automata/Event.hh>
#include <diades/automata/Topology.hh>
#include <diades/automata/TopologyMap.hh>
#include <diades/automata/ObservableComponent.hh>
#include <diades/automata/SynchronisationRules.hh>
#include <diades/automata/ComposableModel.hh>
#include <diades/automata/SyncRulesLoad.hh>
#include "CmdInterface.hh"

Go to the source code of this file.

Typedefs

typedef Diades::Graph::ConstNodeMap< EventConnectionMap
 global variable to globally index the generated events More...
 
typedef Diades::Graph::ConstNodeMap< ObservableComponent * > ComponentNodeMap
 
typedef Diades::Graph::ConstNodeMap< map< Topology::Connection, Event > > SharedEventNodeMap
 

Enumerations

enum  Option {
  OUTPUT =0, VERBOSE =1, EVENTS =2, NOTEVENTS =3,
  HELP =4, STATEABSTRACTIONS = 5, EVENT = 0, HELP = 1,
  OUTPUT =0, HELP = 0, EVENTS = 1, EVENTNB = 2,
  STATES = 3, STATENB = 4, TRANSITIONS = 5, TRANSITIONNB = 6,
  OBSERVABLES = 7, OBSERVABLENB = 8, UNOBSERVABLES = 9, UNOBSERVABLENB =10,
  INITIALSTATES = 11, INITIALSTATENB = 12, NAME = 13, STATISTICS = 14,
  STATEMIN = 0, STATEMAX = 1, OBSMIN = 2, OBSMAX = 3,
  EVTMIN = 4, EVTMAX = 5, SEED = 6, DIRNAME = 7,
  LATEXFILENAME = 8, TOPOLOGYFILENAME = 9, OBSINTERACTIONMIN = 10, OBSINTERACTIONMAX = 11,
  NODEBEHAVIOUR = 12, HELP = 13, OUTPUTDEGREEMAX = 14, PETRINET = 15,
  STATISTICS =0, HELP =1, FAULTS = 2, NOFAILURES =0,
  FAILURES =1, OBSERVABLES =2, HDFILE =3, DOTFILE =4,
  CPPFILE =5, WITHSILENTCLOSURE =6, HELP =7, FAULTMAX =0,
  SEED =1, HELP =2, HELP =0, FAULTS = 0,
  ALGORITHMS = 1, HELP = 0, EVENTS = 1, TIMEDEVENTS = 2,
  OBSERVATIONS = 3, TIMEDOBSERVATIONS = 4, FAULTS = 5, OBSMIN = 0,
  OBSMAX = 1, TIMEMIN = 2, TIMEMAX = 3, NOEVT = 4,
  SEED = 5, XML = 6, GENERATEFAULTS = 7, HELP = 8,
  INTERACTIVE = 9, PTALOG = 10, NBSIM = 11, HELP =0,
  COMPONENTS =0, EVENTS =1, NUMBER =2, CONNECTIONWITHEVENT =3,
  HELP =4
}
 

Functions

vector< string > fileExtensions (numberOfFileExtensions)
 
vector< string > options (numberOfOptions)
 
vector< bool > isSet (numberOfOptions, false)
 
void initialiseOptions ()
 
void makeComponentComplete (unsigned outputDegreeMax, Selection< Event > &eventSelection, ObservableComponent &result)
 
Transition getTransitionFromInteractiveCurrentState (const ObservableComponent &interaction, State currentInteractingState, const Event &eventCurrentNode, map< Event, Topology::Connection > &mappingCurrentSideToInteraction, map< Topology::Connection, Event > &mappingConnectionToInteraction, const set< Event > &constrainedEvents)
 
void generateTransitionSystem (const Topology &topology, const Node &node, SharedEventNodeMap &sharedEventOfNode, const ObservableComponent &interaction, set< Node >::const_iterator first, set< Node >::const_iterator last, unsigned numberOfStates, unsigned outputDegreeMax, ObservableComponent &result)
 
void defineObservableMask (unsigned obsMin, unsigned obsMax, unsigned obsInteractionMin, unsigned obsInteractionMax, const set< Event > &interactiveEvents, const set< Event > &nonInteractiveEvents, ObservableComponent &result)
 
void generateNonInteractiveEvents (const Topology &topology, Topology::Node node, unsigned evtMin, unsigned evtMax, unsigned obsMin, unsigned obsInteractionMax, ObservableComponent &result, set< Event > &nonInteractiveEvents)
 
void generateRandomComponent (const Topology &topology, const Node &node, SharedEventNodeMap &sharedEventOfNode, const ObservableComponent &interaction, set< Node >::const_iterator first, set< Node >::const_iterator last, unsigned stateMin, unsigned stateMax, unsigned obsMin, unsigned obsMax, unsigned evtMin, unsigned evtMax, unsigned obsInteractionMin, unsigned obsInteractionMax, unsigned outputDegreeMax, ObservableComponent *result)
 
void initialiseSynchronisationRules (const Topology &topology, set< Node >::const_iterator first, set< Node >::const_iterator last, SharedEventNodeMap &sharedEventOfNode, const Diades::Graph::ConstNodeMap< pair< string, ObservableComponent *> > &projection, ParametrizedSynchronisation &synchronisation)
 
ObservableComponentgetSynchronisedInteraction (const Topology &topology, const Node &node, SharedEventNodeMap &sharedEventOfNode, const Diades::Graph::ConstNodeMap< pair< string, ObservableComponent *> > &projection, set< Node >::const_iterator first, set< Node >::const_iterator last)
 
void getOutputProjection (const Topology &topology, const Node &node, SharedEventNodeMap &sharedEventOfNode, const ObservableComponent &component, const set< Node > &nonGeneratedNeighbours, pair< string, ObservableComponent *> &result)
 
void propagateConstrainedInteractions (const Topology &topology, Topology::Node node, Diades::Graph::ConstNodeMap< int > &visitedNodes, set< Topology::Node > &generatedNeighbours, set< Topology::Node > &nonGeneratedNeighbours, list< Topology::Node > &nodesToVisit)
 
void writeComponent (const ObservableComponent &component, const string &dirName)
 
bool checkEventConsistency (const Topology &topology, unsigned evtMax, unsigned obsInteractionMin)
 
void generateSharedEvents (const Topology &topology, ComponentNodeMap &componentOfNode, SharedEventNodeMap &sharedEventOfNode, Topology::Node fixedTopoNode)
 
void generateBehaviour (const Topology &topology, unsigned stateMin, unsigned stateMax, unsigned evtMin, unsigned evtMax, unsigned obsMin, unsigned obsMax, unsigned obsInteractionMin, unsigned obsInteractionMax, ComponentNodeMap &componentOfNode, SharedEventNodeMap &sharedEventOfNode, string dirName, Node fixedTopoNode, unsigned outputDegreeMax)
 
void generateLatexComponents (const Topology &topology, SharedEventNodeMap &sharedEventOfNode, const ComponentNodeMap &componentOfNode, ofstream &latexfile)
 
void generateLatexEventIndex (const Topology &topology, SharedEventNodeMap &sharedEventOfNode, const ComponentNodeMap &componentOfNode, ofstream &latexfile)
 
void generateLatexEpilog (ofstream &latexfile)
 
void generateLatexTopology (const Topology &topology, SharedEventNodeMap &sharedEventOfNode, ofstream &latexfile)
 
void generateLatexPreamble (const Topology &topology, unsigned stateMin, unsigned stateMax, unsigned evtMin, unsigned evtMax, unsigned obsMin, unsigned obsMax, unsigned obsInteractionMin, unsigned obsInteractionMax, unsigned seed, unsigned outputDegreeMax, const string &fixedNode, const string &behaviourFileName, map< string, string > &assignedConnections, const ComponentNodeMap &componentOfNode, SharedEventNodeMap &sharedEventOfNode, const string &filename, ofstream &latexfile)
 
void generateLatexFile (const Topology &topology, unsigned stateMin, unsigned stateMax, unsigned evtMin, unsigned evtMax, unsigned obsMin, unsigned obsMax, unsigned obsInteractionMin, unsigned obsInteractionMax, unsigned seed, unsigned outputDegreeMax, const string &fixedNode, const string &behaviourFileName, map< string, string > &assignedConnections, const ComponentNodeMap &componentOfNode, SharedEventNodeMap &sharedEventOfNode, const string &filename)
 
void exportTopologyMap (const Topology &topology, SharedEventNodeMap &sharedEventOfNode, const ComponentNodeMap &componentOfNode, const string &mapTopoFileNameDest)
 
void generateStates (ObservableComponent &result, unsigned numberOfStates, vector< Node > &indexState)
 
void generateTriggerableEvents (unsigned numberOfUnusedEventPerState, unsigned numberOfTrans, Component::EventIterator first, Component::EventIterator last, unsigned nbEvents, set< Event > &newSelection, set< Event > &unusedEvents)
 
void makeComponentFullyConsistent (ObservableComponent &result, const Node &node, SharedEventNodeMap &sharedEventOfNode, const ObservableComponent &interaction, map< Event, Topology::Connection > &mappingInteractionToCurrentSide, map< Event, Topology::Connection > &mappingCurrentSideToInteraction, EdgeMap< int > &triggeredTransition, NodeMap< set< State > > &stateMapping, unsigned outputDegreeMax, Selection< Event > &eventSelection)
 
void propagateInteractingStates (ObservableComponent &result, const Node &node, SharedEventNodeMap &sharedEventOfNode, map< Event, Topology::Connection > &mappingInteractionToCurrentSide, const ObservableComponent &interaction, State state, State correspondingState, NodeMap< set< State > > &stateMapping)
 
void printDebugStartVisit (const Topology &topology, Topology::Node node)
 
void printDebugProjectionOnGeneratedNeighbours (const set< Topology::Node > &generatedNeighbours, const Diades::Graph::NodeMap< pair< string, ObservableComponent *> > &projection)
 
void printDebugLaw (const ParametrizedSynchronisation &synchronisation)
 
int main (int argc, char **argv)
 
void logDetailsBeforeCallingGenerateTransitionSystem (const Topology &topology, const Node &node, SharedEventNodeMap &sharedEventOfNode, const ObservableComponent &interaction, set< Node >::const_iterator first, set< Node >::const_iterator last, unsigned numberOfStates, unsigned outputDegreeMax, ObservableComponent &result)
 
void initConstrainedConnectionMappings (const Topology &topology, const Node &node, SharedEventNodeMap &sharedEventOfNode, set< Node >::const_iterator first, set< Node >::const_iterator last, map< Event, Topology::Connection > &mappingInteractionToCurrentSide, map< Topology::Connection, Event > &mappingConnectionToInteraction, map< Event, Topology::Connection > &mappingCurrentSideToInteraction, set< Event > &constrainedEvents)
 
unsigned getNumberOfTransitions (const Selection< Event > &eventSelection, const set< Event > &constrainedEvents, const set< Event > &constrainedTriggerableEvents, unsigned numberOfAdmissibleEvents, unsigned numberOfStatesToVisit, unsigned outputDegreeMax, bool &mustUseNewEvent)
 
void generateTriggerableEvents (unsigned nbTransitions, Selection< Event > &eventSelection, const vector< unsigned > &admissibleEventIndexes, unsigned numberOfNonPreviouslySelectedButAdmissibleEvents, bool mustUseNewEvent, set< Event > &selectedEvents)
 
void getSelectedEvents (const ObservableComponent &interaction, State currentInteractingState, map< Event, Topology::Connection > &mappingInteractionToCurrentSide, map< Event, Topology::Connection > &mappingCurrentSideToInteraction, map< Topology::Connection, Event > &mappingConnectionToInteraction, Selection< Event > &eventSelection, const set< Event > &constrainedEvents, const set< Topology::Connection > &constrainedConnections, unsigned numberOfVisitedStates, ObservableComponent &result, unsigned outputDegreeMax, set< Event > &selectedEvents)
 
bool makeMinimalRequirement (unsigned outputDegreeMax, Selection< Event > &eventSelection, vector< State > &candidates, ObservableComponent &result)
 

Variables

unsigned numberOfOptions = 16
 
unsigned numberOfFileExtensions = 0
 
string description = "Usage: dd-generate\n\t --help |\n\t [--topo topologyFileName.topo]\n\t [--seed randomSeed]\n\t [--evtMin nbEvtMin]\n\t [--evtMax nbEvtMax]\n\t [--obsMin nbObsMin]\n\t [--obsMax nbObsMax]\n\t [--stateMin nbStateMin]\n\t [--stateMax nbStateMax]\n\t [--latex latexFileName]\n\t [--outputdir dirName]\n\t [--obsInteractionMin nbObsIntMin]\n\t [--obsInteractionMax nbObsIntMax]\n\t [--nodeBehaviour node=file.descomp ci=ej ck=el ...]]\n\t [--outputDegreeMax outDeg]\n\t [--petrinet]\n\n\n Generate a distributed discrete-event system that has the topology\n defined in the file topologyFileName.topo. The generator uses\n a random generator of number that can be initialised with the\n seed 'randomSeed'. If not provided, the seed is the starting time\n of each run of the program. As far as the behaviour of a component\n is concerned, the number of generated states is between nbStateMin\n and nbStateMax. The number of event is between nbEvtMin and nbEvtMax\n as long as it is compatible with the topology. The number of\n observable events is between nbObsMin and nbObsMax. The generated model\n consists of a set of files written in the directory 'dirName'. The\n model generator also generates a document in latex format for documentation\n purposes (if the option is set). The parameters --obsInteractionMin\n and --obsInteractionMax states the possible numbers of observable interactions.\n The --nodeBehaviour parameters states that one (and only one) of the node\n called 'node' has the predefined behaviour described in 'file.descomp'. \nConstraints like 'ci=sj' assert that the component 'node' implements the\n connection 'ci' of the topology with the iteractive event 'sj'.\n The option '--outputDegreeMax' rules the maximal number of transitions\n (i.e. events) that are the output of one state. If the --petrinet option is set, the distributed system is generated as a 1-bounded petri net. "
 
unsigned eventNumber = 0
 

Detailed Description

This file is the main file of the command des_generate

Usage:  des_generate
--help |
[--topo topologyFileName.topo]
[--seed randomSeed]
[--evtMin       nbEvtMin]
[--evtMax    nbEvtMax]
[--obsMin       nbObsMin]
[--obsMax    nbObsMax]
[--stateMin  nbStateMin]
[--stateMax  nbStateMax]
[--latex  latexFileName]
[--outputdir dirName]
[--obsInteractionMin nbObsIntMin]
[--obsInteractionMax nbObsIntMax]
[--nodeBehaviour node=file.descomp ci=ej ck=el ...]
[--outputDegreeMax outDeg]
[--petrinet]

Generate a distributed discrete-event system that has the topology
defined in the file topologyFileName.topo. The generator uses
a random generator of number that can be initialised with the
seed 'randomSeed'. If not provided, the seed is the starting time
of each run of the program. As far as the behaviour of a component
is concerned, the number of generated states is between nbStateMin
and nbStateMax. The number of event is between nbEvtMin and nbEvtMax
as long as it is compatible with the topology. The number of
observable events is between nbObsMin and nbObsMax. The generated model
consists of a set of files written in the directory 'dirName'. The
model generator also generates a document in latex format for documentation
purposes (if the option is set). The parameters --obsInteractionMin
and --obsInteractionMax states the possible numbers of observable interactions.
The --nodeBehaviour parameters states that one (and only one) of the node
called 'node' has the predefined behaviour described in 'file.descomp'.
Constraints like 'ci=sj' assert that the component 'node' implements the
connection 'ci' of the topology with the iteractive event 'sj'.
The option '--outputDegreeMax' rules the maximal number of transitions
(i.e. events) that are the output of one state. If the --petrinet option
is set, the distributed system is generated as a 1-bounded petri net. 
Author
Yannick Pencole - LAAS CNRS
Version
0.1
Todo:
fix the problem with the cliques greater than 2

Definition in file DesGenerate.cc.

Typedef Documentation

◆ ComponentNodeMap

Definition at line 125 of file DesGenerate.cc.

◆ ConnectionMap

global variable to globally index the generated events

Definition at line 124 of file DesGenerate.cc.

◆ SharedEventNodeMap

Definition at line 126 of file DesGenerate.cc.

Enumeration Type Documentation

◆ Option

enum Option
Enumerator
OUTPUT 
VERBOSE 
EVENTS 
NOTEVENTS 
HELP 
STATEABSTRACTIONS 
EVENT 
HELP 
OUTPUT 
HELP 
EVENTS 
EVENTNB 
STATES 
STATENB 
TRANSITIONS 
TRANSITIONNB 
OBSERVABLES 
OBSERVABLENB 
UNOBSERVABLES 
UNOBSERVABLENB 
INITIALSTATES 
INITIALSTATENB 
NAME 
STATISTICS 
STATEMIN 
STATEMAX 
OBSMIN 
OBSMAX 
EVTMIN 
EVTMAX 
SEED 
DIRNAME 
LATEXFILENAME 
TOPOLOGYFILENAME 
OBSINTERACTIONMIN 
OBSINTERACTIONMAX 
NODEBEHAVIOUR 
HELP 
OUTPUTDEGREEMAX 
PETRINET 
STATISTICS 
HELP 
FAULTS 
NOFAILURES 
FAILURES 
OBSERVABLES 
HDFILE 
DOTFILE 
CPPFILE 
WITHSILENTCLOSURE 
HELP 
FAULTMAX 
SEED 
HELP 
HELP 
FAULTS 
ALGORITHMS 
HELP 
EVENTS 
TIMEDEVENTS 
OBSERVATIONS 
TIMEDOBSERVATIONS 
FAULTS 
OBSMIN 
OBSMAX 
TIMEMIN 
TIMEMAX 
NOEVT 
SEED 
XML 
GENERATEFAULTS 
HELP 
INTERACTIVE 
PTALOG 
NBSIM 
HELP 
COMPONENTS 
EVENTS 
NUMBER 
CONNECTIONWITHEVENT 
HELP 

Definition at line 81 of file DesGenerate.cc.

Function Documentation

◆ checkEventConsistency()

bool checkEventConsistency ( const Topology topology,
unsigned  evtMax,
unsigned  nbObsIntMin 
)

Check whether the maximum number of Event allowed for this generation is at least greater that the number of shared events that are required to implement at least the topology.

Parameters
topologythe Topology
evtMaxthe maximum number of events allowed for this generation*
nbObsIntMinthe minimum number of observable interactions allowed for this generation
Returns
true if evtMax is at least greater that the number of shared events that are required implement the topology AND if nbObsIntMin is lower than the number of interactive events on each component.

Definition at line 1150 of file DesGenerate.cc.

References Diades::Automata::Topology::connectivity(), Diades::Automata::Topology::nodeBegin(), and Diades::Automata::Topology::nodeEnd().

Referenced by main().

◆ defineObservableMask()

void defineObservableMask ( unsigned  obsMin,
unsigned  obsMax,
unsigned  obsInteractionMin,
unsigned  obsInteractionMax,
const set< Event > &  interactiveEvents,
const set< Event > &  nonInteractiveEvents,
ObservableComponent result 
)

Defintion of the observable mask of a component to generate

Parameters
obsMinthe minimal number of generated observations
obsMaxthe maximal number of generated observations
obsInteractionMinthe minimal number of generated observable interactions
obsInteractionMaxthe maximal number of generated observable interactions
interactiveEventsthe set of interactive events of the component
nonInteractiveEventsthe set of non-interactive events of the component
resultthe generated result

Definition of the observable mask of a component to generate

Parameters
obsMinthe minimal number of generated observations
obsMaxthe maximal number of generated observations
obsInteractionMinthe minimal number of generated observable interactions
obsInteractionMaxthe maximal number of generated observable interactions
interactiveEventsthe set of interactive events of the component
nonInteractiveEventsthe set of non-interactive events of the component
resultthe generated result

Definition at line 3160 of file DesGenerate.cc.

Referenced by generateRandomComponent().

◆ exportTopologyMap()

void exportTopologyMap ( const Topology topology,
SharedEventNodeMap sharedEventOfNode,
const ComponentNodeMap componentOfNode,
const string &  mapTopoFileNameDest 
)

Export the topology mapping that has been generated

Parameters
topologythe current Topology
sharedEventOfNodethe current shared event mapping
componentOfNodethe current node mapping
mapTopoFileNameDestthe name of the file to write

Definition at line 2894 of file DesGenerate.cc.

Referenced by main().

◆ fileExtensions()

vector<string> fileExtensions ( numberOfFileExtensions  )

Referenced by main().

◆ generateBehaviour()

void generateBehaviour ( const Topology topology,
unsigned  stateMin,
unsigned  stateMax,
unsigned  evtMin,
unsigned  evtMax,
unsigned  obsMin,
unsigned  obsMax,
unsigned  obsInteractionMin,
unsigned  obsInteractionMax,
ComponentNodeMap componentOfNode,
SharedEventNodeMap sharedEventOfNode,
string  dirName,
Node  fixedTopoNode,
unsigned  outputDegreeMax 
)

Generation of the behaviour associated to a given Topology

Parameters
topologythe given Topology
stateMinthe minimum number of states to generate per Component
stateMaxthe maximum number of states to generate per Component
evtMinthe minimum number of events to generate per Component
evtMaxthe maximum number of events to generate per Component
obsMinthe minimum number of observable events to generate per Component
obsMaxthe maximum number of observable events to generate per Component
obsInteractionMinthe minimum number of observable interactions to generate per Component
obsInteractionMaxthe maximum number of observable interactions to generate per Component
componentOfNodethe returned association between topology nodes and generated components
sharedEventOfNodethe returned association between topology connections and generated events
dirNamethe name of the output directory for writing the components ("des_comp" + "dot" formats)
fixedTopoNodea Node that contains a predefined behaviour if it exists, an invalid node otherwise
outputDegreeMaxthe maximal number of output transitions from a given state
Principle of the algorithm:
The generation of each component relies on a breadth-first exploration of the Topology. First, one Node of the Topology is selected and generated. Then one of its neighbour is selected and generated and so on in a BFS manner. Before each generation, two sets are initialised. The set inputs contains the set of nodes already generated that are the neighbours of the current Node. The set outputs contains the set of nodes that are not generated yet but are neighbour of the current Node. Any Node of inputs being already generated, they impose an interaction language with the current Node. That is the reason why the interaction languages of these nodes are composed first to get the interaction language of the current Node consistent with the previously generated nodes. Given the interaction language, the current node is then generated and then an interaction language between the current node and the nodes of outputs is created.
Selection of one Node 'node0' of the Topology
for every Node 'node' in BFS('node0') do
'inputs' = neighbours of 'n' already generated
'outputs' = neighbours of 'n' not generated
'interaction' = interaction language coming from the nodes of 'inputs' via the table 'projection'
generation of node 'n' consistent with 'interaction'
'projection[node]' = interaction language that must be consistent with the nodes of 'outputs'
endfor

Definition at line 1282 of file DesGenerate.cc.

References debug, generateRandomComponent(), getOutputProjection(), getSynchronisedInteraction(), Diades::Automata::Topology::graph(), Diades::Automata::Topology::nodeBegin(), Diades::Automata::Topology::nodeEnd(), printDebugProjectionOnGeneratedNeighbours(), printDebugStartVisit(), propagateConstrainedInteractions(), Diades::Graph::Node::valid(), and writeComponent().

Referenced by main().

◆ generateLatexComponents()

void generateLatexComponents ( const Topology topology,
SharedEventNodeMap sharedEventOfNode,
const ComponentNodeMap componentOfNode,
ofstream &  latexfile 
)

Write the description of the generated components in to the LaTex file

Parameters
topologythe current Topology
sharedEventOfNodethe current shared event mapping
componentOfNodethe current node mapping
latexfilethe LaTeX file stream

Definition at line 2750 of file DesGenerate.cc.

References states.

◆ generateLatexEpilog()

void generateLatexEpilog ( ofstream &  latexfile)

Write the end of the latex file

Parameters
latexfileLaTeX file stream

Definition at line 2879 of file DesGenerate.cc.

◆ generateLatexEventIndex()

void generateLatexEventIndex ( const Topology topology,
SharedEventNodeMap sharedEventOfNode,
const ComponentNodeMap componentOfNode,
ofstream &  latexfile 
)

Definition at line 3452 of file DesGenerate.cc.

◆ generateLatexFile()

void generateLatexFile ( const Topology topology,
unsigned  stateMin,
unsigned  stateMax,
unsigned  evtMin,
unsigned  evtMax,
unsigned  obsMin,
unsigned  obsMax,
unsigned  obsInteractionMin,
unsigned  obsInteractionMax,
unsigned  seed,
unsigned  outputDegreeMax,
const string &  fixedNode,
const string &  behaviourFileName,
map< string, string > &  assignedConnections,
const ComponentNodeMap componentOfNode,
SharedEventNodeMap sharedEventOfNode,
const string &  filename 
)

Write the LaTeX file

Parameters
topologythe current Topology
stateMinthe minimal number of generated states
stateMaxthe maximal number of generated states
evtMinthe minimal number of generated events
evtMaxthe maximal number of generated events
obsMinthe minimal number of generated observations
obsMaxthe maximal number of generated observations
obsInteractionMinthe minimal number of generated observable interactions
obsInteractionMaxthe maximal number of generated observable interactions
componentOfNodethe current component-node mapping
sharedEventOfNodethe current shared event mapping
filenamethe name of the LaTeX file to write

Definition at line 2562 of file DesGenerate.cc.

Referenced by main().

◆ generateLatexPreamble()

void generateLatexPreamble ( const Topology topology,
unsigned  stateMin,
unsigned  stateMax,
unsigned  evtMin,
unsigned  evtMax,
unsigned  obsMin,
unsigned  obsMax,
unsigned  obsInteractionMin,
unsigned  obsInteractionMax,
unsigned  seed,
unsigned  outputDegreeMax,
const string &  fixedNode,
const string &  behaviourFileName,
map< string, string > &  assignedConnections,
const ComponentNodeMap componentOfNode,
SharedEventNodeMap sharedEventOfNode,
const string &  filename,
ofstream &  latexfile 
)

Write the preamble + introduction of the LaTeX file

Parameters
topologythe current Topology
stateMinthe minimal number of generated states
stateMaxthe maximal number of generated states
evtMinthe minimal number of generated events
evtMaxthe maximal number of generated events
obsMinthe minimal number of generated observations
obsMaxthe maximal number of generated observations
obsInteractionMinthe minimal number of generated observable interactions
obsInteractionMaxthe maximal number of generated observable interactions
componentOfNodethe current component-node mapping
sharedEventOfNodethe current shared event mapping
filenamethe name of the LaTeX file to write
latexfilethe resulting LaTeX file stream

Definition at line 2620 of file DesGenerate.cc.

References states.

◆ generateLatexTopology()

void generateLatexTopology ( const Topology topology,
SharedEventNodeMap sharedEventOfNode,
ofstream &  latexfile 
)

Write the description of the current Topology in the LaTeX file

Parameters
topologythe current Topology
sharedEventOfNodethe current shared event mapping
latexfilethe LaTeX file stream

Definition at line 2707 of file DesGenerate.cc.

◆ generateNonInteractiveEvents()

void generateNonInteractiveEvents ( const Topology topology,
Topology::Node  node,
unsigned  evtMin,
unsigned  evtMax,
unsigned  obsMin,
unsigned  obsInteractionMax,
ObservableComponent result,
set< Event > &  nonInteractiveEvents 
)

Generation of the non interactive events of a component to generate

Parameters
topologythe current Topology
nodethe node to generate
evtMinthe minimal number of generated events
evtMaxthe maximal number of generated events
obsMinthe minimal number of generated observations
obsInteractionMaxthe maximal number of generated observable interactions
resultthe generated result
nonInteractiveEventsthe generated set of non interactive events

Here the component result already contains result->numberOfEvents() interactive events (including 0 events) . so we need to generate non interactive events such that the whole number of events is between [evtMin, evtMax]. Note also that there must be at least obsMin - obsInteractionMin non interactive events, as in the case only obsInteractionMin interactive events are set to be observable, obsMin - obsInteractionMin non interactive events must then be available to be set observable as well.

Definition at line 3091 of file DesGenerate.cc.

Referenced by generateRandomComponent().

◆ generateRandomComponent()

void generateRandomComponent ( const Topology topology,
const Node node,
SharedEventNodeMap sharedEventOfNode,
const ObservableComponent interaction,
set< Node >::const_iterator  first,
set< Node >::const_iterator  last,
unsigned  stateMin,
unsigned  stateMax,
unsigned  obsMin,
unsigned  obsMax,
unsigned  evtMin,
unsigned  evtMax,
unsigned  obsInteractionMin,
unsigned  obsInteractionMax,
unsigned  outputDegreeMax,
ObservableComponent result 
)

Generation of a component randomly

Parameters
topologythe current Topology
nodethe Node to generate
sharedEventOfNodethe current shared event mapping
interactionthe interactive beheaviour that must be consistent with the generated result
firstthe iterator on the first neighbour (if it exists) of the current Node that is already generated
lastthe iterator on the item after the last neighbour of the current Node that is already generated
stateMinthe minimal number of generated states
stateMaxthe maximal number of generated states
obsMinthe minimal number of generated observations
obsMaxthe maximal number of generated observations
evtMinthe minimal number of generated events
evtMaxthe maximal number of generated events
obsInteractionMinthe minimal number of generated observable interactions
obsInteractionMaxthe maximal number of generated observable interactions
outputDegreeMaxthe maximal number of output transitions from a given state
resultthe generated result
Principle of this method:
Generate randomly the events of the component, the observations, the number of states and then cal the full transition system generator

Definition at line 1640 of file DesGenerate.cc.

References always_require, defineObservableMask(), Diades::Automata::Component::eventBegin(), Diades::Automata::Component::eventEnd(), and generateNonInteractiveEvents().

Referenced by generateBehaviour().

◆ generateSharedEvents()

void generateSharedEvents ( const Topology topology,
ComponentNodeMap componentOfNode,
SharedEventNodeMap sharedEventOfNode,
Topology::Node  fixedTopoNode 
)

Generation of the shared events

Parameters
topologythe given topology
componentOfNodethe (empty) components associated the nodes of the Topology
sharedEventOfNodethe result of the generation. For each node, an Event is created for each Connection involved by the Node
fixedTopoNodethe topology Node that is already fixed if it exists

Definition at line 1193 of file DesGenerate.cc.

References always_assertion, eventNumber, Diades::Automata::Event::getEvent(), Diades::Automata::Topology::getNodeName(), Diades::Automata::Event::isValid(), Diades::Automata::Topology::nodeBegin(), Diades::Automata::Topology::nodeConnectionBegin(), Diades::Automata::Topology::nodeConnectionEnd(), Diades::Automata::Topology::nodeEnd(), and Diades::Automata::Event::setNickname().

Referenced by main().

◆ generateStates()

void generateStates ( ObservableComponent result,
unsigned  numberOfStates,
vector< Node > &  indexState 
)

Generator of states

Parameters
resultthe generated result
numberOfStatesnumber of states to generate
indexStateassociation between each generated state and an index.
principle of the algorithm:
Generate the states in result and set an initial state. Fill the data structure unreachedStates and indexState. The label of the state is "qi" where i is an integer from [0,numberOfStates-1]. The format of this label has been kindly recommended by Dr Alban Grastien.

Definition at line 1697 of file DesGenerate.cc.

◆ generateTransitionSystem()

void generateTransitionSystem ( const Topology topology,
const Node node,
SharedEventNodeMap sharedEventOfNode,
const ObservableComponent interaction,
set< Node >::const_iterator  first,
set< Node >::const_iterator  last,
unsigned  numberOfStates,
unsigned  outputDegreeMax,
ObservableComponent result 
)

Random generation of a transition system

Parameters
topologythe current Topology
nodethe node to generate
sharedEventOfNodethe current shared event mapping
interactionthe interaction model the node must comply with
firstiterator on the first neighbour of 'node' already generated
lastiterator on the item after the last neighbour of 'node' already generated
numberOfStatesthe number of states to generate in 'node' (generated by generateStates)
outputDegreeMaxthe maximal number of output transitions from a given state
resultthe result of the generation
Principle of the algorithm:
First it calls generateStates to generate 'numberOfStates' states. Then starting from the initial state it calls generateTriggerableEvents to determine the number of events to trigger from the current state. Then find a selection of potential target states. In order to end the algorithm, try to always select first an unreached states, that will ensure that each state is reachable at least by one transition path from the initial state. The Transition generation follows the interaction model to guarantee that the projection of the generated node to the set of event involving connections with the components of [first,last( matches exactly the interaction model. In order to ensure the interaction model is fully covered, it finally calls makeComponentFullyConsistent.
See also
generateStates generateTriggerableEvents makeComponentFullyConsistent

Definition at line 2092 of file DesGenerate.cc.

◆ generateTriggerableEvents() [1/2]

void generateTriggerableEvents ( unsigned  numberOfUnusedEventPerState,
unsigned  numberOfTrans,
Component::EventIterator  first,
Component::EventIterator  last,
unsigned  nbEvents,
set< Event > &  newSelection,
set< Event > &  unusedEvents 
)

◆ generateTriggerableEvents() [2/2]

void generateTriggerableEvents ( unsigned  nbTransitions,
Selection< Event > &  eventSelection,
const vector< unsigned > &  admissibleEventIndexes,
unsigned  numberOfNonPreviouslySelectedButAdmissibleEvents,
bool  mustUseNewEvent,
set< Event > &  selectedEvents 
)

Generation of the set of triggerable events for the current generated stage

Parameters
nbTransitionsnumber of transitions to trigger
eventSelectionthe set of available events (already selected in previous step or not)
admissibleEventIndexesThe set of admissible event (indexes) as triggers in the current state
numberOfNonPreviouslySelectedButAdmissibleEventsno comment
mustUseNewEventIs the use of non previoulsy selected events necessary.
selectedEventsthe result as a set of events
Principle of the algorithm:
First we randomly select nbTransitions events for the set admissibleEventIndexes. If among this selection there is only events already present in the model and if mustUseNewEvent is true then modify the selection to put a new event in the selection randomly chosen.

Definition at line 1880 of file DesGenerate.cc.

◆ getNumberOfTransitions()

unsigned getNumberOfTransitions ( const Selection< Event > &  eventSelection,
const set< Event > &  constrainedEvents,
const set< Event > &  constrainedTriggerableEvents,
unsigned  numberOfAdmissibleEvents,
unsigned  numberOfStatesToVisit,
unsigned  outputDegreeMax,
bool &  mustUseNewEvent 
)

Compute the number of transitions to generate for the current generated state

Parameters
eventSelectionthe set of available events (already selected in previous step or not)
constrainedEventsthe set of events involved with an event in the interaction model
constrainedTriggerableEventsthe set of events that are constrained but can be triggered in the current state
numberOfAdmissibleEventsThe number of admissible event as triggers in the current state
numberOfStatesToVisitThe number of states that are still required to generate
outputDegreeMaxThe maximal output degree of the current state
mustUseNewEventset to be true if a new event (not selected before) must be selected at this stage.
Returns
the number of transitions to generate for the current generated state
Principle of the algorithm:
First compute the number of triggerable events that are not already output of a previous generated state. As any event must be present in the generated model, it is necessary to ensure they will be all used in the end. In order to do so, if a number of events are still not present in the generated model at this stage, the probability of inserting at least one such an event is computed. This probability depends on the number of states not generated yet and the number of events not present yet. The less number of non-generated states, the higher the probability is. Once the probability is setup, a random experience is made to check whether such an event must or not be triggered in the current state.

Definition at line 1827 of file DesGenerate.cc.

◆ getOutputProjection()

void getOutputProjection ( const Topology topology,
const Node node,
SharedEventNodeMap sharedEventOfNode,
const ObservableComponent component,
const set< Node > &  nonGeneratedNeighbours,
pair< string, ObservableComponent *> &  result 
)
Parameters
topologythe current Topology
nodethe current Node of the Topology
sharedEventOfNodethe current shared event mapping
componentthe generated component associated to the Node node
nonGeneratedNeighboursthe set of nodes that are not generated yet and that are the neighbour of the Node 'node'
resulta ObservableComponent whose behaviour is the interactive behaviour of the generated component with respect to the event of the neighbours contained in nonGeneratedNeighbours

Definition at line 1439 of file DesGenerate.cc.

References always_ensure, always_require, Diades::Automata::Topology::cliqueBegin(), Diades::Automata::Topology::cliqueEnd(), Diades::Automata::Topology::getNodeName(), Diades::Automata::Topology::nodeConnectionBegin(), Diades::Automata::Topology::nodeConnectionEnd(), Diades::Utils::Identifier::str(), and toStream().

Referenced by generateBehaviour().

◆ getSelectedEvents()

void getSelectedEvents ( const ObservableComponent interaction,
State  currentInteractingState,
map< Event, Topology::Connection > &  mappingInteractionToCurrentSide,
map< Event, Topology::Connection > &  mappingCurrentSideToInteraction,
map< Topology::Connection, Event > &  mappingConnectionToInteraction,
Selection< Event > &  eventSelection,
const set< Event > &  constrainedEvents,
const set< Topology::Connection > &  constrainedConnections,
unsigned  numberOfVisitedStates,
ObservableComponent result,
unsigned  outputDegreeMax,
set< Event > &  selectedEvents 
)
Parameters
interactionthe interaction model the node must comply with
currentInteractingStatethe state in the interaction model associated to the current generated state
mappingInteractionToCurrentSidethe mapping interactiveModel.event -> connection
mappingCurrentSideToInteractionthe mapping generatedModel.event -> connection
mappingConnectionToInteraction,themapping connection-> interactiveModel.event
eventSelectionevents already selected or not
constrainedEventsthe set of events that are constrained due to the presence of an interaction model
constrainedConnectionsthe set of Connections involved in out transitions of currentInteractingState
numberOfVisitedStatesthe number of states already visited in a previous step
resultthe node that is being generated
outputDegreeMaxthe maximal output degree
selectedEventsthe resulting selection of events.

Definition at line 1956 of file DesGenerate.cc.

◆ getSynchronisedInteraction()

ObservableComponent * getSynchronisedInteraction ( const Topology topology,
const Node node,
SharedEventNodeMap sharedEventOfNode,
const Diades::Graph::ConstNodeMap< pair< string, ObservableComponent *> > &  projection,
set< Node >::const_iterator  first,
set< Node >::const_iterator  last 
)
Parameters
topologythe Topology
nodethe Node about to be generated
sharedEventOfNodethe Topology/Event mapping
projectionthe current generated projections on interactive events
firstthe iterator on the first neighbour (if it exists) of the current Node that is already generated
lastthe iterator on the item after the last neighbour of the current Node that is already generated
Precondition
first != last
Returns
the interaction language produced by first...last-1 that will be the base of the current Node generation. The generated behaviour will be consistent with this interaction language.
Principle of the algorithm:
This algorithm works only if first != last. Every Node in [first,last( has always been generated. The idea is to compute the synchronised product of their output interaction and project it to the set of events that are involved in the connection with the Node to generate.
Bug:
not sure yet that the synchronised product will never be empty, which is the requirement for the whole generation algorithm to work.
Parameters
topologythe Topology
nodethe Node about to be generated
sharedEventOfNodethe Topology/Event mapping
projectionthe current generated projections on interactive events
firstthe iterator on the first neighbour (if it exists) of the current Node that is already generated
lastthe iterator on the item after the last neighbour of the current Node that is already generated
Returns
the interaction language produced by first...last-1 that will be the base of the current Node generation. The generated behaviour will be consistent with this interaction language.
Principle of the algorithm:
This algorithm works only if first != last. Every Node in [first,last( has always been generated. The idea is to compute the synchronised product of their output interaction and project it to the set of events that are involved in the connection with the Node to generate.
Bug:
not sure yet that the synchronised product will never be empty, which is the requirement for the whole generation algorithm to work.

Definition at line 1518 of file DesGenerate.cc.

References Diades::Automata::Topology::cliqueBegin(), Diades::Automata::Topology::cliqueEnd(), debug, Diades::Automata::Topology::getNodeName(), initialiseSynchronisationRules(), Diades::Automata::Component::newState(), Diades::Automata::Topology::nodeConnectionBegin(), Diades::Automata::Topology::nodeConnectionEnd(), Diades::Automata::Component::numberOfTransitions(), printDebugLaw(), Diades::Automata::ObservableComponent::project(), Diades::Automata::Component::setInitial(), and Diades::Utils::Identifier::str().

Referenced by generateBehaviour().

◆ getTransitionFromInteractiveCurrentState()

Transition getTransitionFromInteractiveCurrentState ( const ObservableComponent interaction,
State  currentInteractingState,
const Event eventCurrentNode,
map< Event, Topology::Connection > &  mappingCurrentSideToInteraction,
map< Topology::Connection, Event > &  mappingConnectionToInteraction,
const set< Event > &  constrainedEvents 
)
Parameters
interactionthe interaction model the node must comply with
currentInteractingStatethe interacting state source of the transition to be looked for
eventCurrentNodethe event (current node side) whose corresponding event in the interaction model is the event of the transition to be looked for
mappingCurrentSideToInteractionthe mapping generatedModel.event -> connection
mappingConnectionToInteractionthe mapping connection -> interactiveModel.event
Returns
the transition of the interaction model whose source currentInteractingState, whose associated event is the one connected to 'eventCurrentNode', an invalid transition if such a transition does not exist
Bug:
clique <= 2 only

Definition at line 3302 of file DesGenerate.cc.

◆ initConstrainedConnectionMappings()

void initConstrainedConnectionMappings ( const Topology topology,
const Node node,
SharedEventNodeMap sharedEventOfNode,
set< Node >::const_iterator  first,
set< Node >::const_iterator  last,
map< Event, Topology::Connection > &  mappingInteractionToCurrentSide,
map< Topology::Connection, Event > &  mappingConnectionToInteraction,
map< Event, Topology::Connection > &  mappingCurrentSideToInteraction,
set< Event > &  constrainedEvents 
)

Initialisation of the connection mappings for a given node in a given topology

Parameters
topologythe current Topology
nodethe node to generate
sharedEventOfNodethe current shared event mapping
firstiterator on the first neighbour of 'node' already generated
lastiterator on the item after the last neighbour of 'node' already generated
mappingInteractionToCurrentSidethe mapping interactiveModel.event -> connection
mappingConnectionToInteractionthe mapping connection -> interactiveModel.event
mappingCurrentSideToInteractionthe mapping generatedModel.event -> connection
constrainedEventsthe set of events that are constrained due to the presence of an interaction model
Bug:
do not work with clique strictly greater than 2
Todo:
need to fix this by fixing sharedEventOfNode to deal with partial synchronised events from the clique

Definition at line 1772 of file DesGenerate.cc.

◆ initialiseOptions()

void initialiseOptions ( )

◆ initialiseSynchronisationRules()

void initialiseSynchronisationRules ( const Topology topology,
set< Node >::const_iterator  first,
set< Node >::const_iterator  last,
SharedEventNodeMap sharedEventOfNode,
const Diades::Graph::ConstNodeMap< pair< string, ObservableComponent *> > &  projection,
ParametrizedSynchronisation synchronisation 
)

Create the synchronisation law that synchronises the interactive projections of [first,last(

Parameters
topologythe Topology
firstthe iterator on the first neighbour (if it exists) of the current Node that is already generated
lastthe iterator on the item after the last neighbour of the current Node that is already generated
sharedEventOfNodethe Topology/Event mapping
projectionthe current generated projections on interactive events
synchronisationthe resulting synchronisation

Definition at line 3032 of file DesGenerate.cc.

Referenced by getSynchronisedInteraction().

◆ isSet()

vector<bool> isSet ( numberOfOptions  ,
false   
)

Referenced by main().

◆ logDetailsBeforeCallingGenerateTransitionSystem()

void logDetailsBeforeCallingGenerateTransitionSystem ( const Topology topology,
const Node node,
SharedEventNodeMap sharedEventOfNode,
const ObservableComponent interaction,
set< Node >::const_iterator  first,
set< Node >::const_iterator  last,
unsigned  numberOfStates,
unsigned  outputDegreeMax,
ObservableComponent result 
)

Log some details before calling generateTransitionSystem (debug only)

Parameters
topologythe current Topology
nodethe node to generate
sharedEventOfNodethe current shared event mapping
interactionthe interaction model the node must comply with
firstiterator on the first neighbour of 'node' already generated
lastiterator on the item after the last neighbour of 'node' already generated
numberOfStatesthe number of states to generate in 'node' (generated by generateStates)
outputDegreeMaxthe maximal number of output transitions from a given state
resultthe result of the generation
See also
generateTransitionSystem

Definition at line 1726 of file DesGenerate.cc.

◆ main()

int main ( int  argc,
char **  argv 
)

Main function of the program des_generate

Basically, this function analyses the parameters to initiate the generation Then it calls the generator of shared events, then the generator of behaviours Write the results in output files.

Parameters
argcthe number of parameters
argvthe list of parameters
Returns
0 if success

Definition at line 524 of file DesGenerate.cc.

References Diades::Automata::ObservableMask::addMask(), Diades::Automata::Topology::addNode(), always_assertion, checkEventConsistency(), Diades::Automata::Topology::cliqueBegin(), Diades::Automata::Topology::cliqueEnd(), Diades::Automata::Topology::connectionBegin(), Diades::Automata::Topology::connectionEnd(), Diades::Automata::Topology::connectivity(), current, debug, description, DIRNAME, EVTMAX, EVTMIN, exportTopologyMap(), fileExtensions(), generateBehaviour(), generateLatexFile(), generateSharedEvents(), Diades::Automata::Topology::getConnectionLabel(), Diades::Automata::Event::getEvent(), Diades::Automata::Topology::getNodeName(), Diades::Automata::Topology::graph(), HELP, Diades::Automata::Topology::import(), initialiseOptions(), initialiseRandomGenerator(), Diades::Utils::initialiseSeed(), Diades::Automata::ObservableMask::isIdentifiable(), isSet(), LATEXFILENAME, Diades::Automata::Event::nickname(), Diades::Automata::Topology::nodeBegin(), NODEBEHAVIOUR, Diades::Automata::Topology::nodeConnectionBegin(), Diades::Automata::Topology::nodeConnectionEnd(), Diades::Automata::Topology::nodeEnd(), OBSINTERACTIONMAX, OBSINTERACTIONMIN, OBSMAX, OBSMIN, options(), OUTPUTDEGREEMAX, PETRINET, Diades::CmdInterface::printCommandLineError(), printUsage(), Diades::Automata::Topology::save(), Diades::Utils::saveAllLogs(), SEED, Diades::Utils::selectNValues(), Diades::Automata::Event::setNickname(), setVerboseLevel(), STATEMAX, STATEMIN, Diades::Utils::Identifier::str(), TOPOLOGYFILENAME, Diades::Utils::VbDebug, and Diades::Utils::VbOutput.

◆ makeComponentComplete()

void makeComponentComplete ( unsigned  outputDegreeMax,
Selection< Event > &  eventSelection,
ObservableComponent result 
)

Make the component compatible with in the case that not all the events were utilized during the classical generation of the component. To complete the model, some transitions are added randomly with the missing events

Parameters
outputDegreeMaxthe maximal number of output transitions from a given state
eventSelectionevents already selected or not
resultthe node that is being generated

Definition at line 3409 of file DesGenerate.cc.

◆ makeComponentFullyConsistent()

void makeComponentFullyConsistent ( ObservableComponent result,
const Node node,
SharedEventNodeMap sharedEventOfNode,
const ObservableComponent interaction,
map< Event, Topology::Connection > &  mappingInteractionToCurrentSide,
map< Event, Topology::Connection > &  mappingCurrentSideToInteraction,
EdgeMap< int > &  triggeredTransition,
NodeMap< set< State > > &  stateMapping,
unsigned  outputDegreeMax,
Selection< Event > &  eventSelection 
)

Complete the generation of component in order to make it fully consistent with the interaction model

Parameters
resultthe result of the generation
nodethe node to generate
sharedEventOfNodethe current shared event mapping
interactionthe interaction model the node must comply with
mappingInteractionToCurrentSideassociation between an interactive event (neighbour side) and the underlying connection
mappingCurrentSideToInteractionassociation between an interactive event (node side) and the underlying connection
triggeredTransitiontransition mapping of interaction model that states whether a given transition of the interaction has been taken into account for the generation of the behaviour of the current node.
stateMappingmapping between the state of the generated model and some corresponding states in the interaction model.
eventSelectionused to guarantee that any event type will be used at least once.
Principle of the algorithm:
The result is almost generated. The problem is that some transitions of interaction may not have their correpsondance in result yet (triggeredTransition[t] = 0) so we complete the model to have full correspondance by adding some transitions in the result. For such a transition, the idea is to find some source state in the generated model as a potential candidate to trigger such a transition and a potential target. If a couple (source,target) has been found, either a transition already exist and we propagate this information (it means that by luck, a previous generation already created a transition compatible with the missing transition), or no transition found and then a new transition is added between source and target. The information is propagated with propagateInteractingStates.
Todo:
really make an algorithm more reliable than that. but no TIME!!!

bof mode

Definition at line 2327 of file DesGenerate.cc.

◆ makeMinimalRequirement()

bool makeMinimalRequirement ( unsigned  outputDegreeMax,
Selection< Event > &  eventSelection,
vector< State > &  candidates,
ObservableComponent result 
)

Make the component compatible with in the case that not all the events were utilized during the classical generation of the component. To complete the model, some transitions are added randomly with the missing events. The modification are the minimal ones

Parameters
outputDegreeMaxthe maximal number of output transitions from a given state
eventSelectionevents already selected or not
resultthe node that is being generated
Returns
true if sucess, if not it means there is no solution, it violates some conditions a warning message is displayed
Todo:
change the algorithm by inserting one transition for each event at the begininng of the generation

Definition at line 3349 of file DesGenerate.cc.

◆ options()

vector<string> options ( numberOfOptions  )

Referenced by initialiseOptions(), and main().

◆ printDebugLaw()

void printDebugLaw ( const ParametrizedSynchronisation synchronisation)

Definition at line 3071 of file DesGenerate.cc.

Referenced by getSynchronisedInteraction().

◆ printDebugProjectionOnGeneratedNeighbours()

void printDebugProjectionOnGeneratedNeighbours ( const set< Topology::Node > &  generatedNeighbours,
const Diades::Graph::NodeMap< pair< string, ObservableComponent *> > &  projection 
)

Definition at line 3006 of file DesGenerate.cc.

Referenced by generateBehaviour().

◆ printDebugStartVisit()

void printDebugStartVisit ( const Topology topology,
Topology::Node  node 
)

FUNCTIONS FOR DEBUG ONLY

Definition at line 2997 of file DesGenerate.cc.

Referenced by generateBehaviour().

◆ propagateConstrainedInteractions()

void propagateConstrainedInteractions ( const Topology topology,
Topology::Node  node,
Diades::Graph::ConstNodeMap< int > &  visitedNodes,
set< Topology::Node > &  generatedNeighbours,
set< Topology::Node > &  nonGeneratedNeighbours,
list< Topology::Node > &  nodesToVisit 
)

Determine in the neighbourhood of 'node' which node is already generated and not generated. In case some nodes are not in the pool of node to visit, insert them in the pool.

Parameters
topologythe Topology
nodethe current node to generate
visitedNodesthe status of the nodes in the topology updated if some neighbours has not been visited yet
generatedNeighboursthe resulting neighbours that are generated
nonGeneratedNeighboursthe resulting neighbours that are not generated
nodesToVisitthe pool of nodes to visit, updated with unvisited neighbours.

Definition at line 2950 of file DesGenerate.cc.

Referenced by generateBehaviour().

◆ propagateInteractingStates()

void propagateInteractingStates ( ObservableComponent result,
const Node node,
SharedEventNodeMap sharedEventOfNode,
map< Event, Topology::Connection > &  mappingInteractionToCurrentSide,
const ObservableComponent interaction,
State  state,
State  correspondingState,
NodeMap< set< State > > &  stateMapping 
)
Parameters
resultthe result of the generation
nodethe node to generate
sharedEventOfNodethe current shared event mapping
mappingInteractionToCurrentSideassociation between an interactive event (neighbour side) and the underlying connection
interactionthe interaction model the node must comply with
statethe state target of the interactive transition just added by makeComponentFullyConsistent
correspondingStatethe state of the interaction model, target of the added interactive transition just taken into account by makeComponentFullyConsistent
stateMappingmapping between the state of the generated model and some corresponding states in the interaction model.
Principle of the algorithm:
Here we just inserted the fact that the state 'state' has a new corresponding state 'correspondingState' in the interaction model. This new information must be propagated to the successors of 'state'. It is a BFS on (result||interaction) starting from (state,correspondingState)

Definition at line 2492 of file DesGenerate.cc.

◆ writeComponent()

void writeComponent ( const ObservableComponent component,
const string &  dirName 
)

Write the component into a file in a given directory

Parameters
componentthe component
direNamthe directory name

Definition at line 2925 of file DesGenerate.cc.

Referenced by generateBehaviour().

Variable Documentation

◆ description

string description = "Usage: dd-generate\n\t --help |\n\t [--topo topologyFileName.topo]\n\t [--seed randomSeed]\n\t [--evtMin nbEvtMin]\n\t [--evtMax nbEvtMax]\n\t [--obsMin nbObsMin]\n\t [--obsMax nbObsMax]\n\t [--stateMin nbStateMin]\n\t [--stateMax nbStateMax]\n\t [--latex latexFileName]\n\t [--outputdir dirName]\n\t [--obsInteractionMin nbObsIntMin]\n\t [--obsInteractionMax nbObsIntMax]\n\t [--nodeBehaviour node=file.descomp ci=ej ck=el ...]]\n\t [--outputDegreeMax outDeg]\n\t [--petrinet]\n\n\n Generate a distributed discrete-event system that has the topology\n defined in the file topologyFileName.topo. The generator uses\n a random generator of number that can be initialised with the\n seed 'randomSeed'. If not provided, the seed is the starting time\n of each run of the program. As far as the behaviour of a component\n is concerned, the number of generated states is between nbStateMin\n and nbStateMax. The number of event is between nbEvtMin and nbEvtMax\n as long as it is compatible with the topology. The number of\n observable events is between nbObsMin and nbObsMax. The generated model\n consists of a set of files written in the directory 'dirName'. The\n model generator also generates a document in latex format for documentation\n purposes (if the option is set). The parameters --obsInteractionMin\n and --obsInteractionMax states the possible numbers of observable interactions.\n The --nodeBehaviour parameters states that one (and only one) of the node\n called 'node' has the predefined behaviour described in 'file.descomp'. \nConstraints like 'ci=sj' assert that the component 'node' implements the\n connection 'ci' of the topology with the iteractive event 'sj'.\n The option '--outputDegreeMax' rules the maximal number of transitions\n (i.e. events) that are the output of one state. If the --petrinet option is set, the distributed system is generated as a 1-bounded petri net. "

Definition at line 97 of file DesGenerate.cc.

Referenced by main().

◆ eventNumber

unsigned eventNumber = 0

Definition at line 120 of file DesGenerate.cc.

Referenced by generateSharedEvents().

◆ numberOfFileExtensions

unsigned numberOfFileExtensions = 0

Definition at line 89 of file DesGenerate.cc.

◆ numberOfOptions

unsigned numberOfOptions = 16

Definition at line 88 of file DesGenerate.cc.