I did not know that keyword (I looked for the documentation on varmap_to_vars
and could not find that in what I found). In the cases were I have the parameter map p
as described. That will be really helpful. Thanks a lot.
However, in this case p
does not exist yet. So nothing to put into defaults
(if I understand your example correctly).
So I guess the question is can I get p
(the input map) from parameters(sys)
and prob.p
, which contain the two vectors that could create that?
This:
prob.p[156] = 157
does work, but requires me to now the order of the parameter vector (which I don’t do all the time, since the equations change between variation of models. Most of the time the parameter list stays in the same order, but not when I replace a simple model for a more complex one.
Something like:
prob.p[:p156] = 157
or (in my case):
prob.p[:AV.c1] = 0.75
where AV
is the component, and c1
is the parameter to be changed, would be what I’m after.
Edit:
I just realised that my (seemingly obvious) idea to switch from a parameter file, which has all parameters as global parameters that are then used in the creation of the model (so no globals within the model functions themselves) to a parameter map of the model parameters, wouldn’t be practical, since I use the different parameters (with the same valuse, so only defined once) in different models.
So I’d need separate maps for different models, since MTK/DifferentialEquations doesn’t like unused parameters in the maps.
My models have between 80 and several hundred parameters. But
- most of them will stay at their sane defaults, which are set in the functions that create the equations
- others will be set once at the
@named
component creation (from those global parameter variables) and then stay the same
- a varying subset will be defined as the optimisation/tuning parameters.
I want to avoid having to create p
with all of these hundreds of lines (error prone) and have a p
that only contains the last set.
So I was wondering if there is a function like that already (like the default
parameter I didn’t know about) or if I need to hack one together myself.
If there isn’t I’d put a feature request on github, and possibly have a go myself to implement it properly.