
examples.virus.mlrj2 Maven / Gradle / Ivy
//constants
a1:1;
//functions
// add a virus to a cell with probability 0.1
addVirus :: species -> num -> sol;
addVirus x 0.0 = [];
addVirus x n = s + addVirus(x, n-1)
where s = if ((name(x) == 'Cell') && (unif(0,1) < 0.1))
then 1(name(x))(att(x))[sub(x) + Virus]
else 1(name(x))(att(x))[sub(x)];
addAll :: sol -> sol;
addAll [] = [];
addAll x + xs = addVirus(x, amount(x)) + addAll(xs);
//species
A();
B();
Virus();
Cell()[];
Root()[];
//initial solution
>>INIT[Root[10 Cell[10 A + 0B]]];
//reaction rules
A:a -> B @#a*a1;
B:b -> A @#b*a1;
Root[sol?] -> Root[addAll(sol?)] @ 1;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy