#include <generate.h>

Collaboration diagram for FSMSADF::RandomGraph:

List of all members.

Public Member Functions

 RandomGraph ()
 ~RandomGraph ()
GraphgenerateGraph ()
void initializeFromXML (CNode *settingsNode)

Public Attributes

bool stronglyConnected
uint nrScenarioGraphs
uint nrActors
double avgDegree
double varDegree
double minDegree
double maxDegree
double avgIterCnt
double varIterCnt
double minIterCnt
double maxIterCnt
double initialTokenChannelProp
double initialTokenProp
uint nrScenarios
uint nrProcTypes
double mapChance
bool unifiedActorProperties
bool execTime
double avgExecTime
double varExecTime
double minExecTime
double maxExecTime
bool stateSize
double avgStateSize
double varStateSize
double minStateSize
double maxStateSize
bool tokenSize
double avgTokenSize
double varTokenSize
double minTokenSize
double maxTokenSize
bool throughputConstraint
uint autoConcurrencyDegree
double throughputScaleFactor

Private Member Functions

GraphcreateGraph ()
ScenarioGraphcreateScenarioGraph (Graph *g)
ChannelcreateChannel (ScenarioGraph *sg, Ports &inPorts, Ports &outPorts)
ActorcreateActor (ScenarioGraph *sg, Ports &inPorts, Ports &outPorts)
PortcreatePort (Actor *a, const Port::PortType type)
void assignRatesAndInitialTokens (Graph *g)
Channels selectInitialTokenChannels (ScenarioGraph *sg)
void getChannelsBetweenActors (Actor *a, Actor *b, Channels &channels)
void assignInitialTokensToChannels (Channels &initialTokenchannels, RepetitionVector &repVec)
void assignRatesToPorts (ScenarioGraph *sg, Scenario *s, RepetitionVector &repVec)
void findCycles (Actor *p, Actor *a, map< Actor *, uint > &color, map< Actor *, Actor * > &parent, Channels &channels)
void dfsStronglyConnected (Actor *a, vector< bool > &visit, bool reverseChannels)
bool isStronglyConnected (ScenarioGraph *sg)
ScenariocreateScenario (Graph *g)
FSMcreateFSM (Graph *g)
void assignProperties (Graph *g)
void assignActorProperties (Actor *a, Scenarios &scenarios, CStrings &processorTypes)
void assignChannelProperties (Channel *c, Scenarios &scenarios)
void assignThroughputConstraint (Graph *g)
Ports::iterator randomPort (Ports &p)
ChannelrandomChannel (Channels &c)
ScenarioGraphrandomScenarioGraph (ScenarioGraphs &s)
FSMstaterandomState (FSMstates &s)
CStrings randomProcessorTypes ()

Private Attributes

MTRand mtRand

Detailed Description

RandomGraph Generate a random FSM-based SADF graph.


Constructor & Destructor Documentation

FSMSADF::RandomGraph::~RandomGraph (  ) 

~RandomGraph() Desctructor.


Member Function Documentation

void FSMSADF::RandomGraph::assignActorProperties ( Actor a,
Scenarios scenarios,
CStrings processorTypes 
) [private]

assignActorProperties() Assign actor properties to actor a in the scenarios listed in scenarios to the listed processor types.

References avgExecTime, avgStateSize, execTime, maxExecTime, maxStateSize, mtRand, MTRand::randNorm(), FSMSADF::Actor::setDefaultProcessorType(), FSMSADF::Actor::setExecutionTimeOfScenario(), FSMSADF::Actor::setStateSizeOfScenario(), stateSize, varExecTime, and varStateSize.

Referenced by assignProperties().

Here is the call graph for this function:

void FSMSADF::RandomGraph::assignChannelProperties ( Channel c,
Scenarios scenarios 
) [private]

assignChannelProperties() Assign channel properties to channel c in the scenarios listed in scenarios.

References avgTokenSize, maxTokenSize, mtRand, MTRand::randNorm(), FSMSADF::Channel::setTokenSizeOfScenario(), tokenSize, and varTokenSize.

Referenced by assignProperties().

Here is the call graph for this function:

void FSMSADF::RandomGraph::assignInitialTokensToChannels ( Channels initialTokenchannels,
RepetitionVector repVec 
) [private]

assignInitialTokensToChannels() Assign initial tokens to the initialTokenChannels. The minimal number of tokens placed in a channel is the number of tokens needed to complete one iteration of the destination actor of each channel. The number of firings of the destination actor in one iteration is taken from the repetition vector repVec.

References c, FSMSADF::Channel::getDstActor(), FSMSADF::GraphComponent::getId(), FSMSADF::Channel::getInitialTokens(), FSMSADF::Channel::getSrcActor(), initialTokenProp, mtRand, MTRand::rand(), and FSMSADF::Channel::setInitialTokens().

Referenced by assignRatesAndInitialTokens().

Here is the call graph for this function:

void FSMSADF::RandomGraph::assignRatesAndInitialTokens ( Graph g  )  [private]

assignRatesAndInitialTokens() The function assigns randomly selected rates to all ports of all scenario graphs. The function also assigns initial tokens to the channels in the scenario graphs. Sufficiently many tokens are added to the graphs to ensure a deadlock-free execution. Furthermore, it holds that the rates on a channel with initial tokens is constant within all scenarios in which this channel appears. When a rate zero is assigned to a channel c in a scenario, then a new scenario graph is created for this scenario. The channel c will be removed from this new scenario graph. Note that the number of scenario graphs may have increased after this function. The number of scenarios does not change.

References a, assignInitialTokensToChannels(), assignRatesToPorts(), avgIterCnt, c, FSMSADF::ScenarioGraph::getActors(), FSMSADF::Channel::getDstActor(), FSMSADF::GraphComponent::getId(), FSMSADF::Scenario::getScenarioGraph(), FSMSADF::Graph::getScenarioGraphs(), FSMSADF::Graph::getScenarios(), FSMSADF::Channel::getSrcActor(), maxIterCnt, minIterCnt, mtRand, MTRand::randNorm(), selectInitialTokenChannels(), and varIterCnt.

Referenced by createGraph().

Here is the call graph for this function:

void FSMSADF::RandomGraph::assignRatesToPorts ( ScenarioGraph sg,
Scenario s,
RepetitionVector repVec 
) [private]

assignRatesToPorts() The function assigns rate to the ports of the actors of the scenario graph under scenario s. The rates are computed from the repetition vector entries of the actors.

References c, FSMSADF::ScenarioGraph::getChannels(), FSMSADF::Channel::getDstActor(), FSMSADF::Channel::getDstPort(), FSMSADF::GraphComponent::getId(), FSMSADF::Channel::getSrcActor(), FSMSADF::Channel::getSrcPort(), and FSMSADF::Port::setRateOfScenario().

Referenced by assignRatesAndInitialTokens().

Here is the call graph for this function:

Actor * FSMSADF::RandomGraph::createActor ( ScenarioGraph sg,
Ports inPorts,
Ports outPorts 
) [private]

createActor () Create an actor with unconnected ports in the scenario graph. The newly created ports are added to inPorts and outPorts.

References a, avgDegree, FSMSADF::ScenarioGraph::createActor(), createPort(), FSMSADF::GraphComponent::getId(), FSMSADF::Actor::getPorts(), FSMSADF::Port::In, maxDegree, mtRand, FSMSADF::Port::Out, MTRand::randNorm(), FSMSADF::GraphComponent::setName(), FSMSADF::Actor::setType(), and varDegree.

Referenced by createScenarioGraph().

Here is the call graph for this function:

Channel * FSMSADF::RandomGraph::createChannel ( ScenarioGraph sg,
Ports inPorts,
Ports outPorts 
) [private]

createChannel() Create a channel between a randomly selected input port and a randomly selected output port.

References c, FSMSADF::Channel::connectDst(), FSMSADF::Channel::connectSrc(), FSMSADF::ScenarioGraph::createChannel(), FSMSADF::ScenarioGraph::getChannels(), FSMSADF::GraphComponent::getId(), pi, randomPort(), and FSMSADF::GraphComponent::setName().

Referenced by createScenarioGraph().

Here is the call graph for this function:

Graph * FSMSADF::RandomGraph::createGraph (  )  [private]
Port * FSMSADF::RandomGraph::createPort ( Actor a,
const Port::PortType  type 
) [private]

createPort() Create a port on the actor.

References FSMSADF::Actor::createPort(), FSMSADF::GraphComponent::getId(), and FSMSADF::GraphComponent::setName().

Referenced by createActor().

Here is the call graph for this function:

Scenario * FSMSADF::RandomGraph::createScenario ( Graph g  )  [private]

createScenario() Create a random scenario and associate it with a randomly selected scenario graph.

References FSMSADF::Graph::addScenario(), FSMSADF::GraphComponent::getId(), FSMSADF::Graph::getScenarioGraphs(), FSMSADF::Graph::getScenarios(), randomScenarioGraph(), FSMSADF::GraphComponent::setName(), and FSMSADF::Scenario::setScenarioGraph().

Referenced by createGraph().

Here is the call graph for this function:

void FSMSADF::RandomGraph::dfsStronglyConnected ( Actor a,
vector< bool > &  visit,
bool  reverseChannels 
) [private]

dfsStronglyConnected() Perform DFS from this actor. All actors visisted in the DFS are marked in the visit variable with true.

References FSMSADF::Port::getChannel(), FSMSADF::Channel::getDstActor(), FSMSADF::GraphComponent::getId(), FSMSADF::Actor::getPorts(), FSMSADF::Channel::getSrcActor(), and FSMSADF::Port::getType().

Referenced by isStronglyConnected().

Here is the call graph for this function:

void FSMSADF::RandomGraph::findCycles ( Actor p,
Actor a,
map< Actor *, uint > &  color,
map< Actor *, Actor * > &  parent,
Channels initialTokenchannels 
) [private]

findCycles() The function performs a DFS on the scenario graph. This DFS is performed by a recursive call to the findCycles function. The parent actor of this call is the actor p. Actor a is the current actor from which the DFS is continued. The maps color and parent indicate respectively the visit status and parent of the actors. Channels contains a list of channels which are part of a cycle. When discovering a cycle, a random channel on the cycle is added to this list. From this point onwards it is assumed that this channel is no longer part of the graph.

References c, FSMSADF::Port::getChannel(), getChannelsBetweenActors(), FSMSADF::Channel::getDstActor(), FSMSADF::Actor::getPorts(), FSMSADF::Channel::getSrcActor(), FSMSADF::Port::getType(), randomChannel(), and v.

Referenced by selectInitialTokenChannels().

Here is the call graph for this function:

Graph * FSMSADF::RandomGraph::generateGraph (  ) 

generateGraph() Create a random graph.

References assignProperties(), createGraph(), and g.

Referenced by FSMSADF::ToolGenerate::generateRandomGraph().

Here is the call graph for this function:

void FSMSADF::RandomGraph::getChannelsBetweenActors ( Actor a,
Actor b,
Channels channels 
) [private]

getChannelsBetweenActors() The function adds the channels which go directly from actor a to actor b to the list channels.

References c, FSMSADF::Port::getChannel(), FSMSADF::Channel::getDstActor(), FSMSADF::Actor::getPorts(), and FSMSADF::Port::getType().

Referenced by findCycles(), and selectInitialTokenChannels().

Here is the call graph for this function:

bool FSMSADF::RandomGraph::isStronglyConnected ( ScenarioGraph sg  )  [private]

isStronglyConnected() The function returns true if the scenario graph is stronly connected, otherwise it returns false.

References dfsStronglyConnected(), and FSMSADF::ScenarioGraph::getActors().

Referenced by createScenarioGraph().

Here is the call graph for this function:

Channel * FSMSADF::RandomGraph::randomChannel ( Channels c  )  [private]

randomChannel() The function returns a random channel in the list.

References ASSERT, mtRand, and MTRand::randInt().

Referenced by findCycles(), and selectInitialTokenChannels().

Here is the call graph for this function:

Ports::iterator FSMSADF::RandomGraph::randomPort ( Ports p  )  [private]

randomPort() The function returns an iterator to a random port in the list.

References ASSERT, mtRand, and MTRand::randInt().

Referenced by createChannel().

Here is the call graph for this function:

CStrings FSMSADF::RandomGraph::randomProcessorTypes (  )  [private]

randomProcessorTypes() The function returns a list of randomly selected processor types.

References mapChance, mtRand, nrProcTypes, and MTRand::rand().

Referenced by assignProperties().

Here is the call graph for this function:

ScenarioGraph * FSMSADF::RandomGraph::randomScenarioGraph ( ScenarioGraphs s  )  [private]

randomScenarioGraph() The function returns random scenario graph in the list.

References ASSERT, mtRand, and MTRand::randInt().

Referenced by createScenario().

Here is the call graph for this function:

FSMstate * FSMSADF::RandomGraph::randomState ( FSMstates s  )  [private]

randomState() The function returns a randomly selected FSM state.

References ASSERT, mtRand, and MTRand::randInt().

Referenced by createFSM().

Here is the call graph for this function:

Channels FSMSADF::RandomGraph::selectInitialTokenChannels ( ScenarioGraph sg  )  [private]

selectInitialTokenChannels() The function selects a random set of channels on which initial tokens can be stored. It is guaranteed that at least one channel is selected from each cycle in the graph.

References a, c, color, findCycles(), FSMSADF::ScenarioGraph::getActors(), FSMSADF::ScenarioGraph::getChannels(), getChannelsBetweenActors(), FSMSADF::Channel::getDstActor(), FSMSADF::Channel::getSrcActor(), initialTokenChannelProp, mtRand, MTRand::rand(), and randomChannel().

Referenced by assignRatesAndInitialTokens().

Here is the call graph for this function:


Member Data Documentation


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