Ejemplo n.º 1
0
# Sabaody
# Copyright 2018 J Kyle Medley
from __future__ import print_function, division, absolute_import

from roadrunner import RoadRunner, Logger
Logger.disableConsoleLogging()
Logger.setLevel(Logger.LOG_FATAL)

from params import getDefaultParamValues, getUpperBound, getLowerBound
from b2problem import B2_UDP

from pygmo import island as pg_island, problem, rosenbrock, simulated_annealing, de, mp_island
from math import sqrt


def benchmark_loading_time():
    import arrow
    time_start = arrow.utcnow()
    r = RoadRunner('../../../../../sbml/b2.xml')
    delta_t = arrow.utcnow() - time_start
    print('Loading time:', delta_t)

def benchmark_simulated_annealing():
    island = pg_island(
        algo=simulated_annealing(Ts=1.,Tf=.01),
        prob=problem(B2_UDP(getLowerBound(),getUpperBound(),'../../../../../sbml/b2.xml')),
        size=10)

    N = 10
    import arrow
    time_start = arrow.utcnow()
Ejemplo n.º 2
0
from roadrunner import RoadRunner, Logger

#Logger.setLevel(Logger.LOG_DEBUG) # too verbose
Logger.setLevel(Logger.LOG_WARNING)

# Load model

rr = RoadRunner('/tmp/tx.sbml')
#rr = RoadRunner('/tmp/tx-reduced.sbml')
#rr = RoadRunner('/tmp/antsbml.xml')

# Simulate model
results = rr.simulate(0, 10, 30, integrator='gillespie')

print(results)

# Write results to temp file
with open('/tmp/sim_res.csv', 'w') as f:
    f.write(str(results))

# Plot
rr.plot()