GillespieIntegrator::GillespieIntegrator(ExecutableModel* m, const SimulateOptions* o) : model(m), timeScale(1.0), stoichScale(1.0), stoichRows(0), stoichCols(0), stoichData(0), seed(defaultSeed()) // default value for mersene twister { if (o) { this->options = *o; } nReactions = model->getNumReactions(); reactionRates = new double[nReactions]; reactionRatesBuffer = new double[nReactions]; stateVectorSize = model->getStateVector(0); stateVector = new double[stateVectorSize]; stateVectorRate = new double[stateVectorSize]; floatingSpeciesStart = stateVectorSize - model->getNumIndFloatingSpecies(); assert(floatingSpeciesStart >= 0); // get rows and columns model->getStoichiometryMatrix(&stoichRows, &stoichCols, 0); stoichData = new double[stoichRows * stoichCols]; // fill stoichData model->getStoichiometryMatrix(&stoichRows, &stoichCols, &stoichData); setEngineSeed(seed); }
void GillespieIntegrator::resetSettings() { Solver::resetSettings(); // Set default integrator settings. addSetting("seed", defaultSeed(), "Seed", "Set the seed into the random engine. (ulong)", "(ulong) Set the seed into the random engine."); addSetting("variable_step_size",false, "Variable Step Size", "Perform a variable time step simulation. (bool)", "(bool) Enabling this setting will allow the integrator to adapt the size of each time step. This will result in a non-uniform time column."); addSetting("initial_time_step", 0.0, "Initial Time Step", "Specifies the initial time step size. (double)", "(double) Specifies the initial time step size."); addSetting("minimum_time_step", 0.0, "Minimum Time Step", "Specifies the minimum absolute value of step size allowed. (double)", "(double) The minimum absolute value of step size allowed."); addSetting("maximum_time_step", 0.0, "Maximum Time Step", "Specifies the maximum absolute value of step size allowed. (double)", "(double) The maximum absolute value of step size allowed."); addSetting("nonnegative", false, "Non-negative species only", "Prevents species amounts from going negative during a simulation. (bool)", "(bool) Enforce non-negative species constraint."); }