TreeAge Pro


TreeObj.MonteCarlo
v1.0
TreeObj - Object Overview
TreeAge Pro - Table of Contents

TreeAge Pro Interactive - Table of Contents

Documentation Home
TreeAge Website Home
  
Syntax: Function MonteCarlo (mcParams as Object) as Object
Description: This method runs a Monte Carlo simulation at the currently-selected node.
Return value:  Returns a MonteOutput object.
Remarks:  The parameters of the analysis are input by filling in the properties of the MonteParams object which is passed in to this method.

The value of lastError is set by this method. If it is zero, the analysis succeeded; otherwise, it will be an error code. Also, the "valid" property of the returned object will be set to false if any error occurs.

Also, this method sets the calcTime property to the number of milliseconds required to perform the analysis.

Note that you can use the function MonteOutput.TimeElapsed method to determine if the simulation is complete.

Sample code: 
Dim mcParams as New MonteParams, mcOutput as MonteOutput 
Dim cStats as BasicStats, eStats as BasicStats, err as Long
Dim grph as GraphObj, gOpts as New GraphicOptions
...
'--- prepare and run the simulation
mcParams.trials = 10 Set mcOutput = tree.MonteCarlo(mcParams) err = tree.lastError '--- one type of graphical output (basic CE scatter plot)
Set grph = mcOutput.CreateGraph (mc_scatter_ce, 0, "") gOpts.filename = "c:\monte.bmp" err = grph.SaveGraphic (gOpts) tree.Associate (gOpts.filename) '--- statistical output (not shown to user yet)
Set cStats = mcOutput.GetStatsByStrategy (ce_cost, 1, 0.1) Set eStats = mcOutput.GetStatsByStrategy (ce_eff, 1, 0.1)
See also: MonteOutput
MonteParams
lastError
Error codes
calcTime
MonteOutput.TimeElapsed