API references
DataFrames.DataFrame
— MethodDataFrame(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:
HetaSimulator.FitResult
— Typestruct 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.
HetaSimulator.MCResult
— Typestruct 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.
HetaSimulator.Model
— Typestruct 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}.
HetaSimulator.Platform
— Typestruct 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).
HetaSimulator.Scenario
— Typestruct 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)
HetaSimulator.Scenario
— MethodScenario(
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 typeModel
tspan
: time span for the ODE problemmeasurements
:Vector
of measurements. Default is emptyVector{AbstractMeasurementPoint}
observables
: names of output observables. Overwrites default model's values. Default isnothing
tags
:group
:parameters
:Vector
ofPair
s containing parameters' names and values. Overwrites default model's values. Default is empty vector.events_active
:Vector
ofPair
s containing events' names and true/false values. Overwrites default model's values. Default is emptyVector{Pair}
events_save
:Tuple
orVector{Tuple}
marking whether to save solution before and after event. Default is(true,true)
for all eventssaveat
: time points, where solution should be saved. Defaultnothing
values stands for saving solution at timepoints reached by the solversave_scope
: should scope be saved together with solution. Default istrue
HetaSimulator.SimResult
— Typestruct 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.
HetaSimulator.add_measurements!
— Methodadd_measurements!(
platform::Platform,
df::DataFrame;
kwargs...
)
Adds measurements to Scenario
Arguments:
platform
: platform ofPlatform
typedf
:DataFrame
with measurements, typically obtained withread_measurements
functionsubset
: subset of measurements which will be added to theScenario
. DefaultPair{Symbol, Symbol}[]
adds all measurements from thedf
HetaSimulator.add_measurements!
— Methodadd_measurements!(
scenario::Scenario,
df::DataFrame;
kwargs...
)
Adds measurements to Scenario
Arguments:
scenario
: simulation scenario of typeScenario
df
:DataFrame
with measurements, typically obtained withread_measurements
functionsubset
: subset of measurements which will be added to theScenario
. DefaultPair{Symbol, Symbol}[]
adds all measurements from thedf
HetaSimulator.add_scenarios!
— Methodadd_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 ofPlatform
typedf
:DataFrame
with scenarios setup, typically obtained withread_scenarios
functionsubset
: subset of scenarios which will be added to theplatform
. DefaultPair{Symbol, Symbol}[]
adds all scenarios from thedf
HetaSimulator.estimator
— Methodfunction 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 ofPlatform
typeparameters_fitted
: optimization parameters and their initial valuesscenarios
: vector of scenarios identifiers of typeSymbol
. Default isnothing
kwargs...
: other arguments supported byestimator
, see base method.
HetaSimulator.estimator
— Methodfunction 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 typeScenario
parameters_fitted
: DataFrame with optimization parameters setup and their initial values, seeread_parameters
kwargs...
: other arguments supported byestimator
, see base method.
HetaSimulator.estimator
— Methodfunction 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 typeScenario
parameters_fitted
: optimization parameters and their initial valueskwargs...
: other arguments supported byestimator
, see base method.
HetaSimulator.estimator
— Methodfunction 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 typeScenario
parameters_fitted
: parameters and their nominal values that will be used as defaultparameters
: paramters, which overwrite bothModel
andScenario
parameters. Default isnothing
alg
: ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())reltol
: relative tolerance. Default is 1e-6abstol
: relative tolerance. Default is 1e-8parallel_type
: parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()kwargs...
: other ODE solver related arguments supported bySciMLBase.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.
HetaSimulator.fit
— Methodfit(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 ofPlatform
typeparameters_fitted
: optimization parameters and their initial valuesscenarios
: vector of scenarios identifiers of typeSymbol
. Default isnothing
kwargs...
: other ODE solver andfit
related arguments supported byfit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
HetaSimulator.fit
— Methodfit(
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 typeScenario
parameters_fitted
: DataFrame with optimization parameters setup and their initial values, seeread_parameters
kwargs...
: other ODE solver andfit
arguments supported byfit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
HetaSimulator.fit
— Methodfit(
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 typeScenario
parameters_fitted
: optimization parameters and their initial valueskwargs...
: other ODE solver andfit
related arguments supported byfit(scenario_pairs::Vector{<:Pair}, parameters_fitted::Vector{<:Pair}
HetaSimulator.fit
— Methodfit(
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 typeScenario
parameters_fitted
: optimization parameters and their initial valuesparameters
: parameters, which overwrite bothModel
andScenario
parameters. Default isnothing
alg
: ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())reltol
: relative tolerance. Default is 1e-6abstol
: relative tolerance. Default is 1e-8parallel_type
: parallel setup. See SciML docs for details. Default is no parallelism: EnsembleSerial()ftol_abs
: absolute tolerance on function value. SeeNLopt.jl
docs for details. Default is0.0
ftol_rel
: relative tolerance on function value. SeeNLopt.jl
docs for details. Default is1e-4
xtol_rel
: relative tolerance on optimization parameters. SeeNLopt.jl
docs for details. Default is0.0
xtol_abs
: absolute tolerance on optimization parameters. SeeNLopt.jl
docs for details. Default is0.0
fit_alg
: fitting algorithm. SeeNLopt.jl
docs for details. Default is:LN_NELDERMEAD
maxeval
: maximum number of function evaluations. SeeNLopt.jl
docs for details. Default is1e4
maxtime
: maximum optimization time (in seconds). SeeNLopt.jl
docs for details. Default is0
lbounds
: lower parameters bounds. SeeNLopt.jl
docs for details. Default isfill(0.0, length(parameters_fitted))
ubounds
: upper parameters bounds. SeeNLopt.jl
docs for details. Default isfill(Inf, length(parameters_fitted))
scale
: scale of the parameters (supports:lin, :direct, :log, :log10
) to be used during fitting. Default isfill(: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
HetaSimulator.heta
— Methodheta(;version::Bool=false, help::Bool=false)
Run heta
command in console.
Arguments:
version
:true
if only heta-compiler version is requiredhelp
:true
if CLI help wanted
HetaSimulator.heta_build
— Methodheta_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 directorydeclaration
: path to declaration file. Default is"platform"
units_check
: if set totrue
units will be checked for the consistancylog_mode
: log mode. Default is"error"
debug
: turn on debug mode. Default isfalse
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
HetaSimulator.heta_help
— Methodheta_help(command::String)
Display help for heta-compiler CLI
Arguments:
command
: command to display
HetaSimulator.heta_init
— Methodheta_init(dir::String; force::Bool=false, silent::Bool=false)
Run initialization of the platform
Argument:
dir
: platform directoryforce
: iftrue
then replace files and directoriessilent
: iftrue
use default options without prompt
HetaSimulator.heta_version
— Methodheta_version()
Display heta-compiler version
HetaSimulator.load_jlmodel
— Methodload_jlmodel(
model_jl::AbstractString;
rm_out::Bool = false
)
Loads prebuild julia model without Platform
Arguments:
model_jl
: path to Julia model filerm_out
: should the file with Julia model be removed after the model is loaded. Default isfalse
HetaSimulator.load_jlplatform
— Methodload_jlplatform(
model_jl::AbstractString;
rm_out::Bool = false
)
Loads prebuild julia model as part of Platform
Arguments:
model_jl
: path to Julia model filerm_out
: should the file with Julia model be removed after the model is loaded. Default isfalse
HetaSimulator.load_platform
— Methodload_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 directoryrm_out
: should the file with Julia model be removed after the model is loaded. Default istrue
dist_dir
: directory path, where to write distributives to. Default is"."
- kwargs : other arguments supported by
heta_build
HetaSimulator.mc!
— Methodmc!(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 typeMCResult
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)
HetaSimulator.mc
— Methodmc(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 typeScenario
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)
HetaSimulator.mc
— Methodmc(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 typeScenario
parameters_variation
: parameters variation setupnum_iter
: number of Monte-Carlo iterationsverbose
: print iteration progress. Default isfalse
progress_bar
: show progress bar. Default isfalse
alg
: ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())reltol
: relative tolerance. Default is 1e-3abstol
: relative tolerance. Default is 1e-6output_func
: the function determines what is saved from the solution to the output array. Defaults to saving the solution itselfreduction_func
: this function determines how to reduce the data in each batch. Defaults to appending the data from the batchesparallel_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
HetaSimulator.mc
— Methodmc(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 typeScenario
parameters_variation
: parameters variation setupnum_iter
: number of Monte-Carlo iterations- kwargs : other solver related arguments supported by
mc(scenario_pairs::Vector{<:Pair}, parameters_variation::Vector, num_iter::Int64)
HetaSimulator.mc
— Methodmc(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 ofPlatform
typeparameters_variation
: parameters variation setupnum_iter
: number of Monte-Carlo iterations- kwargs : other solver related arguments supported by
mc(scenario_pairs::Vector{<:Pair}, parameters_variation::Vector, num_iter::Int64)
HetaSimulator.mc
— Methodmc(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 typeScenario
parameters_variation
: parameters variation setupnum_iter
: number of Monte-Carlo iterationsverbose
: print iteration progress. Default isfalse
progress_bar
: show progress bar. Default isfalse
alg
: ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())reltol
: relative tolerance. Default is 1e-3abstol
: relative tolerance. Default is 1e-6output_func
: the function determines what is saved from the solution to the output array. Defaults to saving the solution itselfreduction_func
: this function determines how to reduce the data in each batch. Defaults to appending the data from the batchesparallel_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
HetaSimulator.read_mcvecs
— Methodread_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
HetaSimulator.read_measurements
— Functionread_measurements(filepath::String, sheet=1; kwargs...)
Reads table file with measurements to DataFrame
Arguments:
filepath
: path to table file. Supports ".csv" and ".xlsx" filessheet
: number of sheet in case of ".xlsx" file. Default is1
- kwargs... : other arguments supported by
CSV.File
orXLSX.readtable
HetaSimulator.read_parameters
— Methodread_parameters(filepath::String; kwargs...)
Reads parameters csv file and output DataFrame
Arguments:
filepath
: path to valid parameters csv file
HetaSimulator.read_scenarios
— Functionread_scenarios(filepath::String, sheet=1; kwargs...)
Reads table file with scenarios to DataFrame
Arguments:
filepath
: path to table file. Supports ".csv" and ".xlsx" filessheet
: number of sheet in case of ".xlsx" file. Default is1
- kwargs : other arguments supported by
CSV.File
orXLSX.readtable
HetaSimulator.save_as_heta
— Methodsaveasheta(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.
HetaSimulator.save_results
— Methodsave_results(filepath::String, sim::AbstractResult)
Save results as csv file
Arguments:
filepath
: path and name of the file to write tosim
: simulation results ofAbstractResult
type
HetaSimulator.sim
— Methodsim(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 ofPlatform
typescenarios
:Vector
containing names of scenarios included in platform. Default valuenothing
stands for all scenarios in the platformkwargs...
: other kwargs supported bysim(scenario_pairs::Vector{Pair})
HetaSimulator.sim
— Methodsim(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 typeScenario
- kwargs : other kwargs supported by
sim(scenario_pairs::Vector{Pair})
HetaSimulator.sim
— Methodsim(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 typeScenario
parameters
: parameters overwrite bothModel
andScenario
parameters. Default is empty vector.alg
: ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())reltol
: relative tolerance. Default is 1e-3abstol
: relative tolerance. Default is 1e-6kwargs...
: other solver related arguments supported by SciMLBase.solve. See SciML docs for details
HetaSimulator.sim
— Methodsim(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 typeScenario
parameters
: parameters, which overwrite bothModel
andScenario
parameters. Default is empty vector.alg
: ODE solver. See SciML docs for details. Default is AutoTsit5(Rosenbrock23())reltol
: relative tolerance. Default is 1e-3abstol
: relative tolerance. Default is 1e-6parallel_type
: type of multiple simulations parallelism. Default is no parallelism. See SciML docs for detailskwargs...
: other solver related arguments supported by SciMLBase.solve. See SciML docs for de #updateinitvalues(scni.prob, scni.initfunc, parametersnt) tails