sbmlsim.fit.runner

Module for running parameter optimizations.

The optimization can run either run serial or in a parallel version.

The parallel optimization uses multiprocessing, i.e. the parallel runner starts processes on the n_cores which run optimization problems.

How multiprocessing works, in a nutshell:

Process() spawns (fork or similar on Unix-like systems) a copy of the original program. The copy communicates with the original to figure out that

  1. it’s a copy and

  2. it should go off and invoke the target= function (see below).

At this point, the original and copy are now different and independent, and can run simultaneously.

Since these are independent processes, they now have independent Global Interpreter Locks (in CPython) so both can use up to 100% of a CPU on a multi-cpu box, as long as they dont contend for other lower-level (OS) resources. That’s the “multiprocessing” part.

Module Contents

Functions

run_optimization(problem, size = 5, algorithm = OptimizationAlgorithmType.LEAST_SQUARE, residual = ResidualType.ABSOLUTE, loss_function = LossFunctionType.LINEAR, weighting_curves = None, weighting_points = WeightingPointsType.NO_WEIGHTING, seed = None, variable_step_size = True, relative_tolerance = 1e-06, absolute_tolerance = 1e-06, n_cores = 1, serial = False, **kwargs)

Run optimization in parallel.

worker(kwargs)

Worker for running optimization problem.

_run_optimization_serial(problem, size = 5, algorithm = OptimizationAlgorithmType.LEAST_SQUARE, residual = ResidualType.ABSOLUTE, loss_function = LossFunctionType.LINEAR, weighting_curves = None, weighting_points = WeightingPointsType.NO_WEIGHTING, seed = None, variable_step_size = True, relative_tolerance = 1e-06, absolute_tolerance = 1e-06, **kwargs)

Run the given optimization problem in a serial fashion.

Attributes

logger

lock

sbmlsim.fit.runner.logger[source]
sbmlsim.fit.runner.lock[source]
sbmlsim.fit.runner.run_optimization(problem, size=5, algorithm=OptimizationAlgorithmType.LEAST_SQUARE, residual=ResidualType.ABSOLUTE, loss_function=LossFunctionType.LINEAR, weighting_curves=None, weighting_points=WeightingPointsType.NO_WEIGHTING, seed=None, variable_step_size=True, relative_tolerance=1e-06, absolute_tolerance=1e-06, n_cores=1, serial=False, **kwargs)[source]

Run optimization in parallel.

The runner executes the given OptimizationProblem and returns the OptimizationResults. The size defines the repeated optimizations of the problem. Every repeat uses different initial values.

To get access to the optimization problem this has to be initialized with the arguments of the runner.

Parameters
Returns

OptimizationResult

Return type

sbmlsim.fit.result.OptimizationResult

sbmlsim.fit.runner.worker(kwargs)[source]

Worker for running optimization problem.

Return type

sbmlsim.fit.result.OptimizationResult

sbmlsim.fit.runner._run_optimization_serial(problem, size=5, algorithm=OptimizationAlgorithmType.LEAST_SQUARE, residual=ResidualType.ABSOLUTE, loss_function=LossFunctionType.LINEAR, weighting_curves=None, weighting_points=WeightingPointsType.NO_WEIGHTING, seed=None, variable_step_size=True, relative_tolerance=1e-06, absolute_tolerance=1e-06, **kwargs)[source]

Run the given optimization problem in a serial fashion.

This function should not be called directly, but the ‘run_optimization’ should be used for executing simulations. See run_optimization for more detailed documentation.

Parameters
Returns

OptimizationResult

Return type

sbmlsim.fit.result.OptimizationResult