API references

DataFrames.DataFrameMethod
DataFrame(s::Simulation; 
  vars=observables(s), parameters_output::Vector{Symbol}=Symbol[], iter::Union{Int,Nothing}=nothing)

Converts simulation results of type SimResult, MCResult, etc to DataFrame.

Example: DataFrame(s)

Arguments:

  • s : simulation results of type SimResult, MCResult or Vector containing them
  • parameters_output : parameters provided as kwarg parameters to sim or mc functions, which should be included in DataFrame. Default is empty
  • iter : Int iteration id, which should be included in DataFrame. Default is nothing
source
HetaSimulator.FitResultType
struct FitResult{L<:Real, I}
  obj::L
  optim::Vector{Pair{Symbol,Float64}}
  status::Symbol
  numevals::I
end

Result of fit.

Use optim method to get optimal values.

Use object method to get optimal objective function.

Use status to get status.

The optimal parameters can be saved in heta file, see save_as_heta method.

source
HetaSimulator.MCResultType
struct MCResult{S,C} <: AbstractResult
  sim::S
  saveat::Bool
  scenario::C
end

Structure storing results of [mc]{@ref} method applied for one Scenario.

To convert into tabular format, use DataFrame method.

The base visulaization can be done with plot method.

source
HetaSimulator.ModelType
struct Model{IF,OF,EV,SG,EA, MM} <: AbstractModel
  init_func::IF
  ode_func::OF
  events::EV
  saving_generator::SG
  records_output::AbstractVector{Pair{Symbol,Bool}}
  constants::NamedTuple
  events_active::EA
  mass_matrix::MM
end

Structure storing core properties of ODE model. This represent the content of one namespace from a Heta platform.

To get list of model content use methods: constants(model), records(model), switchers(model).

To get the default model options use methods: events_active(model), events_save(model), observables(model). These values can be rewritten by a [Scenario]{@ref}.

source
HetaSimulator.PlatformType
struct Platform{M,C}
  models::Dict{Symbol,M}     # dictionary storing Models
  scenarios::Dict{Symbol,C} # dictionary storing Scenarios
end

The main storage representing a modeling platform. Typically HetaSimulator works with one platform object which can include several models and scenarios.

Usually a Platform is created based on Heta formatted files using [load_platform]{@ref}.

To get the platform content use methods: models(platform), `scenarios(platform).

source
HetaSimulator.ScenarioType

struct Scenario{F,P,M} <: AbstractScenario init_func::F prob::P measurements::M tags::AbstractVector{Symbol} group::Union{Symbol,Nothing} parameters::NamedTuple end

Type representing simulation conditions, i.e. model variant with updated parameters and outputs.

To get the internal properties use methods: tspan(scenario), parameters(scenario), measurements(scenario)

source
HetaSimulator.ScenarioMethod
Scenario(
  model::Model,
  tspan;
  measurements::Vector{AbstractMeasurementPoint}=AbstractMeasurementPoint[],
  observables::Union{Nothing,Vector{Symbol}}=nothing,
  parameters::Vector{Pair{Symbol,Float64}} = Pair{Symbol,Float64}[],
  events_active::Union{Nothing, Vector{Pair{Symbol,Bool}}} = Pair{Symbol,Bool}[],
  events_save::Union{Tuple,Vector{Pair{Symbol, Tuple{Bool, Bool}}}} = (true,true),
  saveat::Union{Nothing,AbstractVector} = nothing,

  save_scope::Bool = true,
)

Builds simulation scenario of type Scenario

Example: Scenario(model, (0., 200.))

Arguments:

  • model : model of type Model

  • tspan : time span for the ODE problem

  • measurements : Vector of measurements. Default is empty Vector{AbstractMeasurementPoint}

  • observables : names of output observables. Overwrites default model's values. Default is nothing

  • tags :

  • group :

  • parameters : Vector of Pairs containing parameters' names and values. Overwrites default model's values. Default is empty vector.

  • events_active : Vector of Pairs containing events' names and true/false values. Overwrites default model's values. Default is empty Vector{Pair}

  • events_save : Tuple or Vector{Tuple} marking whether to save solution before and after event. Default is (true,true) for all events

  • saveat : time points, where solution should be saved. Default nothing values stands for saving solution at timepoints reached by the solver

  • save_scope : should scope be saved together with solution. Default is true

source
HetaSimulator.SimResultType
struct SimResult{S, C<:Scenario} <: AbstractResult
  sim::S
  scenario::C 
end

Structure storing results from [sim]{@ref} method applied for one [Scenario]{@ref}.

To get the content use methods: status(results), times(results), vals(results), parameters(results), observables(results).

The results can be transformed using DataFrame method or visualized using plot method.

source
HetaSimulator.add_measurements!Method
add_measurements!(
  platform::Platform,
  df::DataFrame;
  kwargs...
)

Adds measurements to Scenario

Arguments:

  • platform : platform of Platform type
  • df : DataFrame with measurements, typically obtained with read_measurements function
  • subset : subset of measurements which will be added to the Scenario. Default Pair{Symbol, Symbol}[] adds all measurements from the df
source
HetaSimulator.add_measurements!Method
add_measurements!(
  scenario::Scenario,
  df::DataFrame;
  kwargs...
)

Adds measurements to Scenario

Arguments:

  • scenario : simulation scenario of type Scenario
  • df : DataFrame with measurements, typically obtained with read_measurements function
  • subset : subset of measurements which will be added to the Scenario. Default Pair{Symbol, Symbol}[] adds all measurements from the df
source
HetaSimulator.add_scenarios!Method
add_scenarios!(
  platform::Platform,
  df::DataFrame;
  subset::AbstractVector{P} = Pair{Symbol, Symbol}[]
) where P <: Pair{Symbol, Symbol}

Adds a new Scenario to the Platform

Arguments:

  • platform : platform of Platform type
  • df : DataFrame with scenarios setup, typically obtained with read_scenarios function
  • subset : subset of scenarios which will be added to the platform. Default Pair{Symbol, Symbol}[] adds all scenarios from the df
source
HetaSimulator.estimatorMethod
function estimator(
  platform::Platform,
  parameters_fitted;
  scenarios::Union{AbstractVector{Symbol}, Nothing} = nothing, # all if nothing
  kwargs... 
)

Generates likelihood estimator function for parameter identification and analysis. It is the interface for Platform. See more detailes in base estimator method.

Arguments:

  • platform : platform of Platform type
  • parameters_fitted : optimization parameters and their initial values
  • scenarios : vector of scenarios identifiers of type Symbol. Default is nothing
  • kwargs... : other arguments supported by estimator, see base method.
source
HetaSimulator.estimatorMethod
function estimator(
  scenario_pairs::AbstractVector{Pair{Symbol, C}},
  parameters_fitted::DataFrame;
  kwargs...
) where C<:AbstractScenario

Generates likelihood estimator function for parameter identification and analysis. It is the interface for parameters from DataFrame. See more detailes in base estimator method.

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : DataFrame with optimization parameters setup and their initial values, see read_parameters
  • kwargs... : other arguments supported by estimator, see base method.
source
HetaSimulator.estimatorMethod
function estimator(
  scenarios::AbstractVector{C},
  parameters_fitted;
  kwargs...
) where {C<:AbstractScenario}

Generates likelihood estimator function for parameter identification and analysis. It is the interface for scenarios in vector. See more detailes in base estimator method.

Arguments:

  • scenarios : vector of scenarios of type Scenario
  • parameters_fitted : optimization parameters and their initial values
  • kwargs... : other arguments supported by estimator, see base method.
source
HetaSimulator.estimatorMethod
function estimator(
  scenario_pairs::AbstractVector{Pair{Symbol, C}},
  parameters_fitted::Vector{Pair{Symbol,Float64}};
  parameters::Union{Nothing, Vector{P}}=nothing,
  alg=DEFAULT_ALG,
  reltol=DEFAULT_FITTING_RELTOL,
  abstol=DEFAULT_FITTING_ABSTOL,
  parallel_type=EnsembleSerial(),
  kwargs... # other arguments to sim
) where {C<:AbstractScenario, P<:Pair}

Generates likelihood estimator function for parameter identification and analysis. It corresponds to -2ln(L) as a function depending on parameter set.

Example: estimator([:x=>scn2, :y=>scn3, :z=>scn4], [:k1=>0.1,:k2=>0.2,:k3=>0.3])

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : parameters and their nominal values that will be used as default
  • parameters : paramters, which overwrite both Model and Scenario parameters. Default is nothing
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-6
  • abstol : relative tolerance. Default is 1e-8
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • kwargs... : other ODE solver related arguments supported by SciMLBase.solve. See SciML docs for details

Returns:

function(x:Vector{Float64}=last.(parameters_fitted))

The method returns anonimous function which depends on parameters vector in the same order as in parameters_fitted. This function is ready to be passed to optimizer routine or identifiability analysis.

source
HetaSimulator.fitMethod
fit(platform::Platform,
  parameters_fitted;
  scenarios::Union{AbstractVector{Symbol}, Nothing} = nothing,
  kwargs...
) where C<:AbstractScenario

Fit parameters to experimental measurements. Returns FitResult type.

Example:

fit(platform, [:k1=>0.1,:k2=>0.2,:k3=>0.3];scenarios=[:scn2,:scn3])

Arguments:

  • platform : platform of Platform type
  • parameters_fitted : optimization parameters and their initial values
  • scenarios : vector of scenarios identifiers of type Symbol. Default is nothing
  • kwargs... : other ODE solver and fit related arguments supported by fit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
source
HetaSimulator.fitMethod
fit(
  scenario_pairs::AbstractVector{Pair{Symbol, C}},
  parameters_fitted::DataFrame;
  kwargs...
) where C<:AbstractScenario

Fit parameters to experimental measurements. Returns FitResult type.

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : DataFrame with optimization parameters setup and their initial values, see read_parameters
  • kwargs... : other ODE solver and fit arguments supported by fit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
source
HetaSimulator.fitMethod
fit(
  scenarios::AbstractVector{C},
  parameters_fitted;
  kwargs...
) where C<:AbstractScenario

Fit parameters to experimental measurements. Returns FitResult type.

Example:

fit([scn2, scn3, scn4], [:k1=>0.1,:k2=>0.2,:k3=>0.3])

Arguments:

  • scenarios : vector of scenarios of type Scenario
  • parameters_fitted : optimization parameters and their initial values
  • kwargs... : other ODE solver and fit related arguments supported by fit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
source
HetaSimulator.fitMethod
fit(
  scenario_pairs::AbstractVector{Pair{Symbol, C}},
  parameters_fitted::Vector{Pair{Symbol,Float64}};
  parameters::Union{Nothing, Vector{P}}=nothing,
  alg=DEFAULT_ALG,
  reltol=DEFAULT_FITTING_RELTOL,
  abstol=DEFAULT_FITTING_ABSTOL,
  parallel_type=EnsembleSerial(),
  ftol_abs = 0.0,
  ftol_rel = 1e-4, 
  xtol_rel = 0.0,
  xtol_abs = 0.0, 
  fit_alg = :LN_NELDERMEAD,
  maxeval = 10000,
  maxtime = 0.0,
  lbounds = fill(0.0, length(parameters_fitted)),
  ubounds = fill(Inf, length(parameters_fitted)),
  scale = fill(:lin, length(parameters_fitted)),
  progress::Symbol = :minimal,
  kwargs... 
) where {C<:AbstractScenario, P<:Pair}

Fit parameters to experimental measurements. Returns FitResult type.

Example: fit([:x=>scn2, :y=>scn3, :z=>scn4], [:k1=>0.1,:k2=>0.2,:k3=>0.3])

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_fitted : optimization parameters and their initial values
  • parameters : parameters, which overwrite both Model and Scenario parameters. Default is nothing
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-6
  • abstol : relative tolerance. Default is 1e-8
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • ftol_abs : absolute tolerance on function value. See NLopt.jl docs for details. Default is 0.0
  • ftol_rel : relative tolerance on function value. See NLopt.jl docs for details. Default is 1e-4
  • xtol_rel : relative tolerance on optimization parameters. See NLopt.jl docs for details. Default is 0.0
  • xtol_abs : absolute tolerance on optimization parameters. See NLopt.jl docs for details. Default is 0.0
  • fit_alg : fitting algorithm. See NLopt.jl docs for details. Default is :LN_NELDERMEAD
  • maxeval : maximum number of function evaluations. See NLopt.jl docs for details. Default is 1e4
  • maxtime : maximum optimization time (in seconds). See NLopt.jl docs for details. Default is 0
  • lbounds : lower parameters bounds. See NLopt.jl docs for details. Default is fill(0.0, length(parameters_fitted))
  • ubounds : upper parameters bounds. See NLopt.jl docs for details. Default is fill(Inf, length(parameters_fitted))
  • scale : scale of the parameters (supports :lin, :direct, :log, :log10) to be used during fitting. Default is fill(:lin, length(parameters_fitted)). :direct value is a synonym of :lin.
  • progress : progress mode display. One of three values: :silent, :minimal, :full. Default is :minimal
  • kwargs... : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.hetaMethod
heta(;version::Bool=false, help::Bool=false)

Run heta command in console.

Arguments:

  • version: true if only heta-compiler version is required
  • help: true if CLI help wanted
source
HetaSimulator.heta_buildMethod
heta_build(
  target_dir::AbstractString;
  declaration::String = "platform",
  units_check::Bool = false,
  log_mode::String = "error",
  debug::Bool = false
  dist_dir::String = "dist",
  meta_dir::String = "meta",
  source::String = "index.heta",
  type::String = "heta"
  export::String = nothing
)

Builds the models from Heta-based platform

See heta comiler docs for details: https://hetalang.github.io/#/heta-compiler/cli-references?id=running-build-with-cli-options

Arguments:

  • target_dir : path to a Heta platform directory
  • declaration : path to declaration file. Default is "platform"
  • units_check : if set to true units will be checked for the consistancy
  • log_mode : log mode. Default is "error"
  • debug : turn on debug mode. Default is false
  • dist_dir : directory path, where to write distributives to. Default is "dist"
  • meta_dir : meta directory path. Default is "meta"
  • source : path to the main heta module. Default is "index.heta"
  • type : type of the source file. Default is "heta"
  • export : export the model to the specified format: Julia,JSON, {format:SBML,version:L3V1},JSON
source
HetaSimulator.heta_initMethod
heta_init(dir::String; force::Bool=false, silent::Bool=false)

Run initialization of the platform

Argument:

  • dir: platform directory
  • force: if true then replace files and directories
  • silent: if true use default options without prompt
source
HetaSimulator.load_jlmodelMethod
load_jlmodel(  
  model_jl::AbstractString; 
  rm_out::Bool = false
)

Loads prebuild julia model without Platform

Arguments:

  • model_jl : path to Julia model file
  • rm_out : should the file with Julia model be removed after the model is loaded. Default is false
source
HetaSimulator.load_jlplatformMethod
load_jlplatform(  
  model_jl::AbstractString; 
  rm_out::Bool = false
)

Loads prebuild julia model as part of Platform

Arguments:

  • model_jl : path to Julia model file
  • rm_out : should the file with Julia model be removed after the model is loaded. Default is false
source
HetaSimulator.load_platformMethod
load_platform(  
  target_dir::AbstractString;
  rm_out::Bool = true, 
  dist_dir::String = ".",
  source::String = "index.heta",
  type::String = "heta",
  kwargs...
)

Converts heta model to Julia and outputs Platform type.

See heta comiler docs for details: https://hetalang.github.io/#/heta-compiler/cli-references?id=running-build-with-cli-options

Arguments:

  • target_dir : path to a Heta platform directory
  • rm_out : should the file with Julia model be removed after the model is loaded. Default is true
  • dist_dir : directory path, where to write distributives to. Default is "."
  • kwargs : other arguments supported by heta_build
source
HetaSimulator.mc!Method
mc!(mcres::M; 
  success_status::Vector{Symbol}=[:Success,:Terminated]
  kwargs...
) where M <: Union{MCResult, Vector{MCResult}, Vector{Pair}}

Re-run failed Monte-Carlo simulations with single Scenario. Updates MCResult type.

Example: mc!(mcres)

Arguments:

  • mcres : Monte-Carlo result of type MCResult
  • success_status : Vector of success statuses. Default is [:Success,:Terminated]
  • kwargs : other solver related arguments supported by mc(scenario::Scenario, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(scenario::Scenario,
  parameters_variation::DataFrame,
  num_iter::Int;
  kwargs...
)

Run Monte-Carlo simulations with single scenario Scenario. Returns MCResult type.

Example: mc(scn1, DataFrame(k2=rand(3),k3=rand(3)), 1000)

Arguments:

  • scenario : simulation scenario of type Scenario
  • parameters_variation : DataFrame with pre-generated parameters.
  • num_iter : number of Monte-Carlo iterations
  • kwargs : other solver related arguments supported by mc(scenario::Scenario, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(scenario_pairs::Vector{<:Pair},
  parameters_variation::Vector{<:Pair},
  num_iter::Int64;
  verbose=false,
  alg=DEFAULT_ALG,
  reltol=DEFAULT_SIMULATION_RELTOL,
  abstol=DEFAULT_SIMULATION_ABSTOL,
  parallel_type=EnsembleSerial(),
  kwargs...
)

Run Monte-Carlo simulations with single Scenario. Returns Vector{MCResult} type.

Example: mc([:c1=>scn1,:c2=>scn2], [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • verbose : print iteration progress. Default is false
  • progress_bar : show progress bar. Default is false
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • output_func : the function determines what is saved from the solution to the output array. Defaults to saving the solution itself
  • reduction_func : this function determines how to reduce the data in each batch. Defaults to appending the data from the batches
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • kwargs : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.mcMethod
mc(scenario_pairs::Vector{<:AbstractScenario},
  parameters_variation::Vector{<:Pair},
  num_iter::Int64;
  kwargs...
)

Run Monte-Carlo simulations with single scenario. Returns Vector{MCResult} type.

Example: mc([scn1,scn2], [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • scenario_pairs : vector of scenarios of type Scenario
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • kwargs : other solver related arguments supported by mc(scenario_pairs::Vector{<:Pair}, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(platform::Platform, 
  parameters_variation::Vector{<:Pair},
  num_iter::Int64;
  kwargs...
)

Run Monte-Carlo simulations with single Scenario. Returns Vector{MCResult} type.

Example: mc(platform, [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • platform : platform of Platform type
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • kwargs : other solver related arguments supported by mc(scenario_pairs::Vector{<:Pair}, parameters_variation::Vector, num_iter::Int64)
source
HetaSimulator.mcMethod
mc(scenario::Scenario,
  parameters_variation::Vector{<:Pair},
  num_iter::Int;
  verbose=false,
  alg=DEFAULT_ALG,
  reltol=DEFAULT_SIMULATION_RELTOL,
  abstol=DEFAULT_SIMULATION_ABSTOL,
  parallel_type=EnsembleSerial(),
  kwargs...
)

Run Monte-Carlo simulations with single Scenario. Returns MCResult type.

Example: mc(scenario, [:k2=>Normal(1e-3,1e-4), :k3=>Uniform(1e-4,1e-2)], 1000)

Arguments:

  • scenario : simulation scenario of type Scenario
  • parameters_variation : parameters variation setup
  • num_iter : number of Monte-Carlo iterations
  • verbose : print iteration progress. Default is false
  • progress_bar : show progress bar. Default is false
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • output_func : the function determines what is saved from the solution to the output array. Defaults to saving the solution itself
  • reduction_func : this function determines how to reduce the data in each batch. Defaults to appending the data from the batches
  • parallel_type : parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()
  • kwargs : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.read_mcvecsMethod
read_mcvecs(filepath::String)

Read table with pre-generated parameters for Monte-Carlo simulations. Typically used for virtual patients simulations

Arguments:

  • filepath: path to the file with pre-generated parameters
source
HetaSimulator.read_measurementsFunction
read_measurements(filepath::String, sheet=1; kwargs...)

Reads table file with measurements to DataFrame

Arguments:

  • filepath : path to table file. Supports ".csv" and ".xlsx" files
  • sheet : number of sheet in case of ".xlsx" file. Default is 1
  • kwargs... : other arguments supported by CSV.File or XLSX.readtable
source
HetaSimulator.read_parametersMethod

read_parameters(filepath::String; kwargs...)

Reads parameters csv file and output DataFrame

Arguments:

  • filepath : path to valid parameters csv file
source
HetaSimulator.read_scenariosFunction
read_scenarios(filepath::String, sheet=1; kwargs...)

Reads table file with scenarios to DataFrame

Arguments:

  • filepath : path to table file. Supports ".csv" and ".xlsx" files
  • sheet : number of sheet in case of ".xlsx" file. Default is 1
  • kwargs : other arguments supported by CSV.File or XLSX.readtable
source
HetaSimulator.save_as_hetaMethod

saveasheta(filepath::String, fr::FitResult)

Save fitting results in the Heta-formatted file.

Arguments

  • filepath : file to save. The ".heta" extension is usually used.
  • fr : fitting results.
source
HetaSimulator.save_resultsMethod
save_results(filepath::String, sim::AbstractResult)

Save results as csv file

Arguments:

  • filepath: path and name of the file to write to
  • sim: simulation results of AbstractResult type
source
HetaSimulator.simMethod
sim(platform::Platform; 
  scenarios::Union{AbstractVector{Symbol}, AbstractVector{InvertedIndex{Symbol}}, Nothing} = nothing,
  kwargs...) where {C<:AbstractScenario}

Simulate scenarios included in platform. Returns Vector{Pair}.

Example: sim(platform)

Arguments:

  • platform : platform of Platform type
  • scenarios : Vector containing names of scenarios included in platform. Default value nothing stands for all scenarios in the platform
  • kwargs... : other kwargs supported by sim(scenario_pairs::Vector{Pair})
source
HetaSimulator.simMethod
sim(scenarios::AbstractVector{C}; kwargs...) where {C<:AbstractScenario}

Simulate multiple scenarios. Returns Vector{Pair}.

Example: sim([scn1, scn2, scn3])

Arguments:

  • scenarios : Vector containing names and scenarios of type Scenario
  • kwargs : other kwargs supported by sim(scenario_pairs::Vector{Pair})
source
HetaSimulator.simMethod
sim(scenario::Scenario; 
  parameters::Vector{P}=Pair{Symbol, Float64}[],
  alg=DEFAULT_ALG, 
  reltol=DEFAULT_SIMULATION_RELTOL,
  abstol=DEFAULT_SIMULATION_ABSTOL,
  kwargs...)

Simulate single Scenario. Returns SimResult type.

Example: Scenario(model, (0., 200.); saveat = [0.0, 150.]) |> sim

Arguments:

  • scenario : simulation scenario of type Scenario
  • parameters : parameters overwrite both Model and Scenario parameters. Default is empty vector.
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • kwargs... : other solver related arguments supported by SciMLBase.solve. See SciML docs for details
source
HetaSimulator.simMethod
sim(scenario_pairs::Vector{P}; 
  parameters::Vector{Pair{Symbol, Float64}}=Pair{Symbol, Float64}[],
  alg=DEFAULT_ALG, 
  reltol=DEFAULT_SIMULATION_RELTOL, 
  abstol=DEFAULT_SIMULATION_ABSTOL,
  parallel_type=EnsembleSerial(),
  kwargs...) where P<:Pair

Simulate multiple scenarios. Returns Vector{Pair}.

Example: sim([:x => scn1, :y=>scn2, :z=>scn3])

Arguments:

  • scenario_pairs : vector of pairs containing names and scenarios of type Scenario
  • parameters : parameters, which overwrite both Model and Scenario parameters. Default is empty vector.
  • alg : ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())
  • reltol : relative tolerance. Default is 1e-3
  • abstol : relative tolerance. Default is 1e-6
  • parallel_type : type of multiple simulations parallelism. Default is no parallelism. See SciML docs for details
  • kwargs... : other solver related arguments supported by SciMLBase.solve. See SciML docs for de #updateinitvalues(scni.prob, scni.initfunc, parametersnt) tails
source