|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tenua.simulator.AbstractDataGenerator tenua.simulator.Mechanism
public class Mechanism
a class that simulates a set of chemical reactions
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface tenua.simulator.DataGenerator |
---|
DataGenerator.Listener |
Field Summary | |
---|---|
static java.lang.String |
CHEMICAL_RATES
|
static java.lang.String |
OUTPUTS
|
static java.lang.String |
PARAMETERS
|
static java.lang.String |
RATE_CONSTANTS
|
static java.lang.String |
SPECIES
|
static java.lang.String |
TIME_CONSTANTS
|
Constructor Summary | |
---|---|
Mechanism(java.util.Hashtable variableNames,
Expression calculations,
Expression derivativeCalculations,
SymbolTable st,
bsh.Interpreter interpreter)
Creates a new instance of Mechanism |
Method Summary | |
---|---|
DoubleBean |
doubleBean(java.lang.String name)
creates a #util.DoubleBean for a variable |
java.lang.Object |
eval(java.lang.String s)
executes a string in the mechanism's interpreter. |
java.lang.Object |
get(java.lang.String name)
returns the value of a variable in this mechanism or its script interpreter. |
int |
getCount()
Get the number of times the simulation has been run with goSimulate() since creation. |
double |
getInitial(java.lang.String name)
returns the initial value of a variable in this mechanism. |
double |
getLatest(java.lang.String name)
returns the most recently determined value of a variable in this mechanism. |
java.lang.Object |
getMemento()
returns the current state of the simulation. |
java.lang.String |
getMinimizer()
returns the name of the current minimization algorithm. |
java.lang.String |
getSolver()
returns the name of the current ODE solver. |
void |
goSimulate()
actually runs the simulation; called by the interpreter |
void |
goVarying(int n,
java.lang.String[] names)
runs the simulation while varying a given list of variables, multiple times. |
void |
goVarying(java.lang.String[] names)
runs the simulation while varying a given list of variables. |
void |
put(java.lang.String name,
double d)
assigns a value to a variable |
void |
put(java.lang.String name,
java.lang.Object o)
assigns a value to a variable |
void |
putInitial(java.lang.String name,
double d)
assigns a value to use for the initial value for a variable. |
void |
putLatest(java.lang.String name,
double d)
assigns a value to a variable. |
void |
renameOutput(int i,
java.lang.String newName)
Renames an output datum. |
void |
resetVariables()
Resets all the variables' initial values to their default values. |
void |
setMinimizer(java.lang.String name)
Set the minimization algorithm. |
void |
setSolver(java.lang.String name)
set the ODE solver to use. |
void |
start(java.lang.Object memento)
generates data by calling script() in the
interpreter, which generally calls goSimulate() . |
java.util.List |
variableNames(java.lang.String listName)
returns a List of the names of all the variables defined of a given type. |
Methods inherited from class tenua.simulator.AbstractDataGenerator |
---|
addListener, getNames, removeListener, run |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TIME_CONSTANTS
public static final java.lang.String SPECIES
public static final java.lang.String RATE_CONSTANTS
public static final java.lang.String CHEMICAL_RATES
public static final java.lang.String PARAMETERS
public static final java.lang.String OUTPUTS
Constructor Detail |
---|
public Mechanism(java.util.Hashtable variableNames, Expression calculations, Expression derivativeCalculations, SymbolTable st, bsh.Interpreter interpreter)
Method Detail |
---|
public void start(java.lang.Object memento)
script()
in the
interpreter, which generally calls goSimulate()
.
start
in interface DataGenerator
start
in class AbstractDataGenerator
memento
- the VariableMemento to use. If null, ignoredpublic void goSimulate() throws java.lang.InterruptedException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InterruptedException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
public void goVarying(java.lang.String[] names)
names
- the array of variable names to vary
On return, the initial variables will be set such that the variables
named minimize the script function called fitFunction()
,
which should return a double.public void goVarying(int n, java.lang.String[] names) throws bsh.EvalError
names
- the array of variable names to vary
On return, the initial variables will be set such that the variables
named minimize the script function called fitFunction()
,
which should return a double. Also, a double array
parameters
is created in the interpreter
such that parameters[i][j]
is the value of
the j
th variable after the i
th run.
Also, double arrays mean
, stddev
and
stddev1
are created, such than mean[j]
is the mean of the j
th variable in all the runs,
stddev[j]
is the standard deviation, and
stddev1[j]
is the standard deviation assuming
that parameters[0]
is the true value of the
variables. This would be the case if the first run fit to the
actual data and the other runs fit to simulated or selected data.
bsh.EvalError
public void renameOutput(int i, java.lang.String newName)
i
- the index of the output to changenewName
- the name to change to
Does nothing if the name is not foundpublic java.lang.Object getMemento()
getMemento
in interface DataGenerator
getMemento
in class AbstractDataGenerator
public java.lang.String getSolver()
public void setSolver(java.lang.String name)
name
- the name of the ODE solver
java.lang.IllegalArgumentException
- if the name is undefinedpublic java.lang.String getMinimizer()
public void setMinimizer(java.lang.String name)
goVarying
if the name is invalid.
name
- the name of the minimizerpublic DoubleBean doubleBean(java.lang.String name)
#util.DoubleBean
for a variable
name
- the name of the variable
java.lang.IllegalArgumentException
- if name is not a variable
java.lang.ClassCastException
- if name does not evaluate to a numberpublic java.lang.Object get(java.lang.String name) throws java.lang.IllegalArgumentException
name
- the name of the variable to search for
java.lang.IllegalArgumentException
- if name is not foundpublic double getInitial(java.lang.String name) throws java.lang.IllegalArgumentException
name
- the name of the variable to search for
java.lang.IllegalArgumentException
- if name is not foundpublic double getLatest(java.lang.String name) throws java.lang.IllegalArgumentException
name
- the name of the variable to search for
java.lang.IllegalArgumentException
- if name is not foundpublic void put(java.lang.String name, double d)
name
- the name of the variable to seach ford
- the value to assign. For mechanism variables,
uses the most recent memento if we are running; otherwise the initial memento.
Any name not defined in the mechanism is assumed to be defined in the script interpreter.
java.lang.IllegalArgumentException
- if name is not foundpublic void put(java.lang.String name, java.lang.Object o)
name
- the name of the variable to seach foro
- the value to assign. For mechanism variables,
uses the most recent memento if we are running; otherwise the initial memento.
Any name not defined in the mechanism is assumed to be defined in the script interpreter.
java.lang.IllegalArgumentException
- if name is not found, or a non-number is assigned
to a mechanism variable.public void putInitial(java.lang.String name, double d)
name
- the name of the variable to seach ford
- the value to assign.
Uses the initial memento.
java.lang.IllegalArgumentException
- if name is not foundpublic void putLatest(java.lang.String name, double d)
name
- the name of the variable to seach ford
- the value to assign.
Uses the most recent memento
java.lang.IllegalArgumentException
- if name is not foundpublic void resetVariables()
public java.util.List variableNames(java.lang.String listName)
listName
- the type of variable to return
public java.lang.Object eval(java.lang.String s)
s
- the String to evaluate
public int getCount()
goSimulate()
since creation.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |