trick.
\". For example:
*
* @code
* variable0 = trick.MonteVarCalculated("ball.obj.state.input.mass")
* variable1 = trick.MonteVarFile("ball.obj.state.input.position[0]", "RUN_monte/values.txt", 2)
* variable2 = trick.MonteVarFixed("ball.obj.state.input.position[1]", 5)
* variable3 = trick.MonteVarRandom("ball.obj.state.input.velocity[0]", trick.MonteVarRandom.GAUSSIAN, "", trick.MonteVarRandom.NO_ENGINE)
* variable3.set_seed(1)
* variable3.set_sigma(0.6667)
* variable3.set_mu(4.0)
* variable3.set_min(-4.0)
* variable3.set_max(4.0)
* variable3.set_sigma_range(0) # integer argument, default is 1. 0 turns limit feature off.
* variable3.set_min_is_relative(True) # default true. When True, set_min value is relative to mean mu
* variable3.set_max_is_relative(True) # default true. When True, set_max value is relative to mean mu
* @endcode
*
* Calling a C++ function in the input file is not as simple as prepending it with \"trick.
\". To add a variable
* in the input file, use the following syntax:
*
* @code
* trick_mc.mc.add_variable(variable0)
* trick_mc.mc.add_variable(variable1)
* trick_mc.mc.add_variable(variable2)
* variable3.set_seed(0)
* trick_mc.mc.add_variable(variable3)
* @endcode
*
* Note that it is necessary to assign the result of the constructor to a local variable in the input file. While it may
* be tempting to combine the calls into one line such as:
*
* @code trick_mc.mc.add_variable(trick.MonteVarFixed("ball.obj.state.input.position[1]", 5) @endcode
*
* this will generally result in a run-time error since the Python input processor will free the memory allocated for the
* variable after leaving the scope of the constructor if it is not locally assigned.
*
* Variables can also be added from jobs of type "monte_master_pre"
or "monte_master_post"
while
* the Monte Carlo is running. Note that new variables will effect only runs that have yet to be dispatched.
*
* @subsection LEVEL3 Distributed Monte Carlo
*
* To run Monte Carlo distributed across a network, you simply need to add_slave to the input file for each slave.
*
* C++: Trick::MonteCarlo::add_slave"monte_master_pre"
or "monte_master_post"
* while the Monte Carlo is running.
*
* @section LEVEL3 Output
* Data logged for each run is stored in a RUN_
directory within a
* MONTE_
directory on the machine that processed the run. Existing directories and files will be
* overwritten. These directories are not cleaned out by subsequent Monte Carlos. So, for instance, if the user runs a Monte
* Carlo with 1000 runs, and then reruns the same Monte Carlo with 500 runs, the first 500 RUN_*
directories
* will contain data from the second Monte Carlo, while the last 500 will still exist and contain data from the first Monte
* Carlo. The following files are Monte Carlo specific:
*
* - MONTE_Trick Job | Description | *
---|---|
monte_master_init * | This class job runs within the master. It is run before tasking any slaves to run. This class job only runs once. |
monte_master_pre |
* This class job runs within the master. These jobs run right before dispatching a simulation run to a slave. Within * this job, you may modify inputs before the slave receives them. This is one area where you may place intelligence. * This class job runs cyclically before each and every run. |
monte_master_post |
* This class job runs within the master. These jobs run right after a slave reports back that it has completed running * the simulation. This type job is the place to receive results from the slave simulation. Results from slave to master * are sent via a Trick communication device (socket). The connection to the slave is already in place, you only need to * tc_read() the results. These results are used by the master_post and master_pre jobs for intelligently deciding the * next set of inputs for the slave. This class job runs cyclically after each and every slave run. |
monte_master_shutdown |
* This class job runs within the master. Once all slaves have cranked through all inputs desired by the master, the master's * shutdown class jobs are run. These are run only once at the very end. |
monte_slave_init |
* This class job runs within the slave. These jobs are run before the slave fork()s off the simulation with the inputs * passed in by the master and before the RUN directories are created. These jobs run once. |
monte_slave_pre |
* This class job runs within the slave's child. These jobs run after the slave fork()s off the simulation with the inputs * passed in by the master. These jobs run every time the slave runs the simulation. |
monte_slave_post |
* This class job runs within the slave's child. It is responsible for passing simulation results back to the master. Trick will * automatically create a connection from the slave to the master. You only need to tc_write() the results. These jobs run * every time the child runs the simulation (during shutdown). |
monte_slave_shutdown |
* This class jobs runs within the slave. After the master cuts off communication with the slave, the slave realizes it is * no longer needed for any service. It then runs its shutdown class jobs. Then terminates itself. |