
examples.split.mlrj2 Maven / Gradle / Ivy
//constants
k1 : 0.1;
//functions
// count the number of A within the given solution
countA :: sol -> num;
countA [] = 0;
countA x + xs = a + countA(xs) where a = (if (name(x) == 'A') then amount(x) else 0);
// split the given solution into two equally divided parts
split :: sol -> tuple;
split [] = <[],[]>;
split x + xs =
where l = toInt(amount(x)/2.0), // half amount and cut decimal places
r = amount(x) - l,
= split(xs);
//species
Cell()[];
A();
//initial solution
>>INIT[1 Cell[100 A]];
//reaction rules
Cell[sol?]:c -> Cell[a] + Cell[b] @ if (countA(sol?) < 10) then 0 else k1 * #c where = split(sol?);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy