Custom Problem
MCBB.CustomProblem
— TypeCustomProblem
Structure that emulates some of the fields/behaviour of DEProblem
subtypes from DifferentialEquations
. The results are supposed to be a (Ndim x Nt)-array.
Fields:
f
: Problem function, signature:(u0, p, tspan) -> results
u0::AbstractArray
: Initial conditionsp
: Parameterstspan
: Time Span
DiffEqBase.solve
— Methodsolve(prob::CustomProblem)
Solves/runs the system/experiment with the initial conditions and parameters that were set during construction of prob
.
MCBB.CustomSolution
— TypeCustomSolution
Solution type of CustomProblem
. Contains the solution as an abstract array and the problem. Can be index like an array.
Fields:
sol::AbstractArray
: Solution as an Array (1d (N_t
-long Array) or 2d (N_dim
xN_t
s)-sized Array)prob::CustomProblem
: Problem that was solved to get the solution
DiffEqBase.solve
— Methodsolve(prob::CustomMonteCarloProblem; num_monte::Int=100)
Solves the CustomMonteCarloProblem
num_monte
-times.
TO-DO: parallelization!!!!
MCBB.CustomMonteCarloProblem
— TypeCustomMonteCarloProblem
Structure similar to DifferentialEquations
's MonteCarloProblem
but for problems that can not be solved with DifferentialEquations
. The fields emululate those of EnsembleProblem
:
prob::CustomProblem
: The base problem that should be solvedprob_func::Function
: same as forEnsembleProblem
: A function(prob, i, repeat) -> new_problem
that returns the i-th problem that should be solvedeval_func::Function
: same as forEnsembleProblem
: A function(sol, i) -> (results, repeat)
that evaluated the i-th solution
DiffEqBase.solve
— Methodsolve(prob::CustomMCBBProblem)
Solves the CustomMCBBProblem
.
MCBB.CustomMCBBProblem
— TypeCustomMCBBProblem <: MCBBProblem
Structure similar to DEMCBBProblem
but for problems that can not be solved with DifferentialEquations
as a backend.
Note that its supertypes are MCBBProblem
and myMCProblem
, but not any of the DifferentialEquations abstract problem types. Many functions that work on DEMCBBProblem
work on CustomMCBBProblem
as well as they are defined for MCBBProblem
.
The struct has the following fields:
p
:CustomMonteCarloProblem
to be solved, part of DifferentialEquationsN_mc
: Number of (Monte Carlo) runs to be solvedrel_transient_time
: Only after this time (relative to the total integration time) the solutions are evaluatedic
: ($N_{mc} \times N_{dim_{ic}}$)-Matrix containing initial conditions for each run.par
: ($N_{mc} \times N_{par}$)-Matrix containing parameter values for each run.par_var
:ParameterVar
, information about how the parameters are varied, seeParameterVar
Constructors
It has the same constructors as DEMCBBProblem
just with a CustomProblem
instead of an DEProblem
.
MCBB.CustomMCBBSolution
— TypeCustomMCBBSolution <: MCBBSol
Type that stores the solutions of a CustomMCBBProblem
. Is returned by the corresponding solve
routine.
Its fields are:
sol
: solution of theCustomMonteCarloProblem
N_mc
: number of solutions saved / Monte Carlo trials runsN_t
: number of time steps for each solutionsN_dim
: sytem dimensionN_meas
: number of measures used, ``N{meas} = N{meas{dim}} + N{meas_{global}}N_meas_dim
: number of measures that are evalauted for every dimension seperatlyN_meas_global
: number of measures that are evalauted globallyN_meas_matrix
: number of measures that are evalauted globally and return matricessolve_command
: A function that solves one individual run/trial with the same settings as where used to, for theCustomProblem
type this is trivial (its the fieldf
) but this field is here so thatCustomMCBBSolution
is compatible withDEMCBBSol
Note, in case N_dim==1
=> N_meas_global == 0
and N_meas_dim == N_meas
LinearAlgebra.normalize
— Methodnormalize(sol::CustomMCBBSolution, k::AbstractArray)
Returns a copy of sol
with the solutions normalized to be in range [0,1]. It is possible to only select that some of the measures are normalized by providing an array with the indices of the measures that should be normalized, e.g. [1,2]
for measure 1 and measure 2 to be normalized.
normalize(sol::DEMCBBSol)
If no extra array is provided, all measures are normalized.