You are here

Iterations

Dear all

I have a rather easy question to pose.
I am creating a forest gap dynamics simulator and I have to include a ‘way’ of doing iterations lets say 40-50 (i.e the same ‘’randomised per iteration’’ model running for 40 times). I think that this could be done by using different time steps but as I have already 2 time steps in my model (monthly and annual) I don’t want increase the complexity.
I would appreciate any ideas.
Regards
Nikos

Forums: 

There are several ways of doing iterative calculations in Simile. In the current version, you can have an array variable or submodel in which the values for each instance are derived from those of the last instance, with some boundary condition for the first. This requires a circular chain of influences, which Simile would normally detect as a problem, so you have to mark one of them as not requiring its source to be evaluated before it can be used as a parameter.

You can define functions in Tcl and c++ to be included in the model's equations. These functions can of course incorporate iterative algorithms (though they cannot maintain their state from one invocation to the next).

As you suggest, you can define a shorter time step for a submodel in which a process occurs, and make sure that nothing changes on this time step once the iterative process is complete.

As if these weren't enough, the forthcoming version 4 will also allow an explicit iterative submodel, defined by a new 'alarm clock' component. In this case the submodel's contents are evaluated repeatedly till the alarm clock condition is met, each time step.

Please ask if you'd like more help with any of these methods.

--Jasper

I may be off the mark here but, if your model is not too big and you just want to run the same model 40 times with different (randomised) intial parameterisation, would could wrap your main model in a multiple-instance submodel (40 instances). The intitial values for each instance could include a random element.

You can calculate descriptive statistics on the desktop.

Jonathan.

Jaspert, Jonathan

Thank both of you

I ‘ll try both ideas (although not quite sure about how to apply jaspert’s) and let you know.
Nikos