RandomTrans Class Reference#include <RandomTrans.h>
Inheritance diagram for RandomTrans:
[legend]List of all members.
Detailed Description
A transition that fires immediately, randomly choosing one destination node to activate.
This class should be extended in the following way:
setHistoryLength(int n) to maintain a history of recent choices that are not to be reused, i.e., drawing without replacement
Definition at line 16 of file RandomTrans.h.
|
Public Member Functions |
| RandomTrans (StateNode *destination, float weight=1) |
| constructor
|
| RandomTrans (const std::string &name, StateNode *destination, float weight=1) |
| constructor
|
virtual void | addDestination (StateNode *destination) |
| Add a destination node with an optional weight.
|
void | addDestination (StateNode *destination, float weight) |
virtual void | fire () |
Protected Member Functions |
| RandomTrans (const std::string &classname, const std::string &instancename, StateNode *destination, float weight=1) |
| constructor, only to be called by subclasses (which need to specify their own classname)
|
Private Member Functions |
void | addWeight (float weight) |
| adds a weight entry to the back of the queue
|
Private Attributes |
std::vector< float > | weights |
| the probably of selection for each source
|
Constructor & Destructor Documentation
RandomTrans::RandomTrans |
( |
StateNode * |
destination, |
|
|
float |
weight = 1 |
|
) |
|
|
RandomTrans::RandomTrans |
( |
const std::string & |
name, |
|
|
StateNode * |
destination, |
|
|
float |
weight = 1 |
|
) |
|
|
RandomTrans::RandomTrans |
( |
const std::string & |
classname, |
|
|
const std::string & |
instancename, |
|
|
StateNode * |
destination, |
|
|
float |
weight = 1 |
|
) |
[protected] |
|
|
constructor, only to be called by subclasses (which need to specify their own classname)
Definition at line 19 of file RandomTrans.cc. |
Member Function Documentation
void RandomTrans::addDestination |
( |
StateNode * |
destination, |
|
|
float |
weight |
|
) |
|
|
virtual void RandomTrans::addDestination |
( |
StateNode * |
destination |
) |
[inline, virtual] |
|
void RandomTrans::addWeight |
( |
float |
weight |
) |
[private] |
|
void RandomTrans::fire |
( |
|
) |
[virtual] |
|
|
Firing this type of transition activates one destination node at random, instead of all nodes.
Reimplemented from Transition.
Definition at line 34 of file RandomTrans.cc. |
Member Data Documentation
The documentation for this class was generated from the following files:
|