|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jabm.init.SpringSimulationFactory
net.sourceforge.jabm.init.RandomVariateInitialiser
public class RandomVariateInitialiser
A simulation factory which initialises the values of pre-specified Spring bean properties by drawing randomly from the specified probability distribution. The bean properties are designated as random variates by creating a configuration file which specifies the mapping between each variate and its corresponding distribution.
Currently the following distributions are supported.
N | Normal distribution |
U | Uniform distribution |
The parameters of the distribution are specified in brackets after the abbreviation. For example the following configuration:
agent.epsilon = U(0.2, 0.5)
agent.wealth = N(200.0, 10.0)
specifies that the agent's epsilon parameter is uniformly distributed between 0.2 and 0.5 and the agent's wealth is normally distributed with mean 200 and standard deviation 10.
Properties
,
AbstractDistribution
![]() |
![]() |
![]() |
![]() |
Field Summary | |
---|---|
protected java.lang.String |
configFileName
|
protected java.lang.Object |
configFileNamePrefix
|
protected EventScheduler |
eventScheduler
|
protected java.util.HashMap<java.lang.String,java.lang.String> |
expressionBindings
|
protected cern.jet.random.engine.RandomEngine |
prng
|
Constructor Summary | |
---|---|
RandomVariateInitialiser()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
java.lang.Number |
evaluate(java.lang.String expression,
java.util.Properties variateBindings)
|
protected void |
fireEvent(java.lang.String variableName,
java.lang.Number value)
|
java.lang.String |
getConfigFileName()
|
java.lang.Object |
getConfigFileNamePrefix()
|
EventScheduler |
getEventScheduler()
|
cern.jet.random.engine.RandomEngine |
getPrng()
|
Simulation |
initialise(SimulationController simulationController)
|
bsh.Interpreter |
initialiseBeanShell(java.util.Properties variateBindings)
|
void |
parseConfigFile()
|
void |
setConfigFileName(java.lang.String configFileName)
The name of the configuration file which specifies which bean properties are to be treated as random variates and their corresponding distribution. |
void |
setConfigFileNamePrefix(java.lang.Object configFileNamePrefix)
|
void |
setEventScheduler(EventScheduler eventScheduler)
If this property is set then the initialiser will fire a RandomVariateInitialisedEvent each time a random variate is initialised. |
void |
setPrng(cern.jet.random.engine.RandomEngine prng)
The pseudo-random number generator to be used for drawing all variates drawn by this initialiser. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object configFileNamePrefix
protected java.lang.String configFileName
protected cern.jet.random.engine.RandomEngine prng
protected java.util.HashMap<java.lang.String,java.lang.String> expressionBindings
protected EventScheduler eventScheduler
Constructor Detail |
---|
public RandomVariateInitialiser()
Method Detail |
---|
public Simulation initialise(SimulationController simulationController)
initialise
in interface SimulationFactory
initialise
in class SpringSimulationFactory
public void parseConfigFile() throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public java.lang.Number evaluate(java.lang.String expression, java.util.Properties variateBindings)
public bsh.Interpreter initialiseBeanShell(java.util.Properties variateBindings) throws bsh.EvalError
bsh.EvalError
protected void fireEvent(java.lang.String variableName, java.lang.Number value)
public java.lang.String getConfigFileName()
public void setConfigFileName(java.lang.String configFileName)
configFileName
- Properties
public cern.jet.random.engine.RandomEngine getPrng()
public void setPrng(cern.jet.random.engine.RandomEngine prng)
prng
- public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public EventScheduler getEventScheduler()
public void setEventScheduler(EventScheduler eventScheduler)
eventScheduler
- The scheduler used to manage the event queue.RandomVariateInitialisedEvent
,
EventScheduler
public java.lang.Object getConfigFileNamePrefix()
public void setConfigFileNamePrefix(java.lang.Object configFileNamePrefix)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |