iteration example?
Closed this issue · 1 comments
I'm trying to do a structured SIR model, and MASTER doesn't recognise my code. Here is a snippet:
<reaction spec='Reaction' rate="0.005">
<iteration spec='Iteration'>
<range spec='Range' variableName="i" from="0" to="9"/>
</iteration>
S[i]:1 + I[i]:2 -> I[i]:2 + I[i]:2
</reaction>
I can't find any example code that has this in, and looking at the documentation, it is clear that range is a child of iteration, but I don't know the relationship between iteration and reaction.
Hi Simon, I went hunting for these tags ("iteration" and "range"), and it turns out that the only reference to these are in a couple of orphaned wiki pages: they were part of an older system for constructing sets of reactions that has subsequently been deprecated and removed. The current system is described in the documentation for the Reaction element. Examples include Diffusion1D.xml and Diffusion2D.xml. A structured stochastic logistic population dynamics example also exists in StructuredStochasticLogisticTreeSampled.xml.
Basically, the idea with the current system is that you can omit explicitly specifying the range: any variable in a location index will automatically range over the entire allowable range of values. So, assuming you've defined S and I to be population types with the appropriate dimensions, you should be able to replace your existing code with:
<reaction spec='Reaction' rate="0.005">
S[i]:1 + I[i]:2 -> I[i]:2 + I[i]:2
</reaction>
You can use predicates and rate multipliers (as shown in the diffusion and stochastic logistic examples) to help set up migration reactions between different locations.
I'm very sorry for the confusion caused by the out-of date documentation - the orphaned pages have been removed.