FSMSADF::RandomGraph Class Reference
#include <generate.h>
Detailed Description
RandomGraph Generate a random FSM-based SADF graph.
Constructor & Destructor Documentation
FSMSADF::RandomGraph::RandomGraph | ( | ) |
RandomGraph() Constructor.
References autoConcurrencyDegree, avgDegree, avgExecTime, avgIterCnt, avgStateSize, avgTokenSize, execTime, initialTokenProp, mapChance, maxDegree, maxExecTime, maxIterCnt, maxStateSize, maxTokenSize, minDegree, minExecTime, minIterCnt, minStateSize, minTokenSize, nrActors, nrProcTypes, nrScenarioGraphs, nrScenarios, stateSize, stronglyConnected, throughputConstraint, throughputScaleFactor, tokenSize, unifiedActorProperties, varDegree, varExecTime, varIterCnt, varStateSize, and varTokenSize.
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().
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().
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().
void FSMSADF::RandomGraph::assignProperties | ( | Graph * | g | ) | [private] |
assignProperties() Assign random properties to the graph and its scenario graphs.
References a, assignActorProperties(), assignChannelProperties(), assignThroughputConstraint(), c, FSMSADF::ScenarioGraph::getActors(), FSMSADF::ScenarioGraph::getChannels(), FSMSADF::GraphComponent::getName(), FSMSADF::Scenario::getScenarioGraph(), FSMSADF::Graph::getScenarioGraphs(), FSMSADF::Graph::getScenarios(), randomProcessorTypes(), and unifiedActorProperties.
Referenced by generateGraph().
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().
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().
void FSMSADF::RandomGraph::assignThroughputConstraint | ( | Graph * | g | ) | [private] |
References autoConcurrencyDegree, FSMSADF::Graph::clone(), FSMSADF::GraphComponent::getId(), FSMSADF::GraphComponent::getParent(), FSMSADF::modelAutoConcurrencyInGraph(), mtRand, MTRand::rand(), FSMSADF::throughputAnalysisWithScenarioTransitions(), throughputConstraint, throughputScaleFactor, and CFraction::value().
Referenced by assignProperties().
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().
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().
createFSM() Create a fully-connected FSM.
References FSMSADF::FSM::addState(), FSMSADF::FSMtransition::connect(), FSMSADF::GraphComponent::getId(), FSMSADF::Graph::getScenarios(), FSMSADF::FSM::getStates(), randomState(), FSMSADF::Graph::setFSM(), FSMSADF::FSM::setInitialState(), FSMSADF::GraphComponent::setName(), and FSMSADF::FSMstate::setScenario().
Referenced by createGraph().
Graph * FSMSADF::RandomGraph::createGraph | ( | ) | [private] |
createGraph() Create a random graph.
References assignRatesAndInitialTokens(), createFSM(), createScenario(), createScenarioGraph(), g, FSMSADF::Graph::getScenarioGraphs(), FSMSADF::Graph::getScenarios(), nrScenarioGraphs, nrScenarios, and FSMSADF::GraphComponent::setName().
Referenced by generateGraph().
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().
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().
ScenarioGraph * FSMSADF::RandomGraph::createScenarioGraph | ( | Graph * | g | ) | [private] |
createScenarioGraph() Create a random scenario graph in graph g.
References FSMSADF::Graph::addScenarioGraph(), createActor(), createChannel(), FSMSADF::Port::getActor(), FSMSADF::ScenarioGraph::getActors(), FSMSADF::GraphComponent::getId(), FSMSADF::GraphComponent::getName(), FSMSADF::Graph::getScenarioGraphs(), isStronglyConnected(), mtRand, nrActors, MTRand::rand(), FSMSADF::Actor::removePort(), FSMSADF::GraphComponent::setName(), FSMSADF::ScenarioGraph::setType(), and stronglyConnected.
Referenced by createGraph().
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().
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().
Graph * FSMSADF::RandomGraph::generateGraph | ( | ) |
generateGraph() Create a random graph.
References assignProperties(), createGraph(), and g.
Referenced by FSMSADF::ToolGenerate::generateRandomGraph().
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().
void FSMSADF::RandomGraph::initializeFromXML | ( | CNode * | settingsNode | ) |
initializeFromXML() Initialize the random graph generator from the XML node.
References autoConcurrencyDegree, avgDegree, avgExecTime, avgIterCnt, avgStateSize, avgTokenSize, CGetAttribute(), CGetChildNode(), CHasChildNode(), execTime, initialTokenChannelProp, initialTokenProp, mapChance, maxDegree, maxExecTime, maxIterCnt, maxStateSize, maxTokenSize, minDegree, minExecTime, minIterCnt, minStateSize, minTokenSize, nrActors, nrProcTypes, nrScenarioGraphs, nrScenarios, stateSize, stronglyConnected, throughputConstraint, throughputScaleFactor, tokenSize, unifiedActorProperties, varDegree, varExecTime, varIterCnt, varStateSize, and varTokenSize.
Referenced by FSMSADF::ToolGenerate::generateRandomGraph().
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().
randomChannel() The function returns a random channel in the list.
References ASSERT, mtRand, and MTRand::randInt().
Referenced by findCycles(), and selectInitialTokenChannels().
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().
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().
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().
randomState() The function returns a randomly selected FSM state.
References ASSERT, mtRand, and MTRand::randInt().
Referenced by createFSM().
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().
Member Data Documentation
Referenced by assignThroughputConstraint(), initializeFromXML(), and RandomGraph().
Referenced by createActor(), initializeFromXML(), and RandomGraph().
Referenced by assignActorProperties(), initializeFromXML(), and RandomGraph().
Referenced by assignRatesAndInitialTokens(), initializeFromXML(), and RandomGraph().
Referenced by assignActorProperties(), initializeFromXML(), and RandomGraph().
Referenced by assignChannelProperties(), initializeFromXML(), and RandomGraph().
Referenced by assignActorProperties(), initializeFromXML(), and RandomGraph().
Referenced by initializeFromXML(), and selectInitialTokenChannels().
Referenced by assignInitialTokensToChannels(), initializeFromXML(), and RandomGraph().
Referenced by initializeFromXML(), RandomGraph(), and randomProcessorTypes().
Referenced by createActor(), initializeFromXML(), and RandomGraph().
Referenced by assignActorProperties(), initializeFromXML(), and RandomGraph().
Referenced by assignRatesAndInitialTokens(), initializeFromXML(), and RandomGraph().
Referenced by assignActorProperties(), initializeFromXML(), and RandomGraph().
Referenced by assignChannelProperties(), initializeFromXML(), and RandomGraph().
Referenced by initializeFromXML(), and RandomGraph().
Referenced by initializeFromXML(), and RandomGraph().
Referenced by assignRatesAndInitialTokens(), initializeFromXML(), and RandomGraph().
Referenced by initializeFromXML(), and RandomGraph().
Referenced by initializeFromXML(), and RandomGraph().
MTRand FSMSADF::RandomGraph::mtRand [private] |
Referenced by assignActorProperties(), assignChannelProperties(), assignInitialTokensToChannels(), assignRatesAndInitialTokens(), assignThroughputConstraint(), createActor(), createScenarioGraph(), randomChannel(), randomPort(), randomProcessorTypes(), randomScenarioGraph(), randomState(), and selectInitialTokenChannels().
Referenced by createScenarioGraph(), initializeFromXML(), and RandomGraph().
Referenced by initializeFromXML(), RandomGraph(), and randomProcessorTypes().
Referenced by createGraph(), initializeFromXML(), and RandomGraph().
Referenced by createGraph(), initializeFromXML(), and RandomGraph().
Referenced by assignActorProperties(), initializeFromXML(), and RandomGraph().
Referenced by createScenarioGraph(), initializeFromXML(), and RandomGraph().
Referenced by assignThroughputConstraint(), initializeFromXML(), and RandomGraph().
Referenced by assignThroughputConstraint(), initializeFromXML(), and RandomGraph().
Referenced by assignChannelProperties(), initializeFromXML(), and RandomGraph().
Referenced by assignProperties(), initializeFromXML(), and RandomGraph().
Referenced by createActor(), initializeFromXML(), and RandomGraph().
Referenced by assignActorProperties(), initializeFromXML(), and RandomGraph().
Referenced by assignRatesAndInitialTokens(), initializeFromXML(), and RandomGraph().
Referenced by assignActorProperties(), initializeFromXML(), and RandomGraph().
Referenced by assignChannelProperties(), initializeFromXML(), and RandomGraph().
The documentation for this class was generated from the following files: