Validation Module

Core module

class troppo.validation.core.ContextSpecificModelSimulator(model_simulator: ConstraintBasedModelSimulator, scenarios: Optional[dict] = None, post_process=None)[source]

Bases: object

Class for simulating a model under different contexts.

Parameters

model_simulatorConstraintBasedModelSimulator

The model simulator to use

scenariosdict, optional

The scenarios to simulate, by default None

post_processfunction, optional

The post-processing function to use, by default None

simulate(contexts: dict, simulation_function, objective_coefficients: dict, minimize: bool, **kwargs) dict[source]

Simulate the model under the given contexts.

Parameters

contexts: dict

The contexts to simulate under

simulation_function: function

The simulation function to use

objective_coefficients: dict

The objective coefficients to use

minimize: bool

Whether to minimize or maximize the objective

kwargs: dict

The keyword arguments to pass to the simulation function

Returns

dict : The simulation results

troppo.validation.core.default_post_processing_func(x: tuple) tuple[source]

Default post-processing function for the ContextSpecificModelSimulator class.

Parameters

xtuple

The tuple to post-process

Returns

tuple : The post-processed tuple