-
-
Notifications
You must be signed in to change notification settings - Fork 100
Closed
Description
In MTK and various SciML packages commonly to have e.g. parameter sets on the form of maps, e.g.:
using ModelongToolkit
@parameters p1 p2
x0 = [p1 => 0.0, p2 => 0.0]
Many of these packages also use SciML/Optimization to e.g. find optimal parameter sets. It would be useful if SciML/Optimization could accept these objects in their runs, e.g.
using ModelongToolkit, Optimization, OptimizationOptimJL
@parameters p1 p2
rosenbrock(x, p) = (1.0 - x[2][1])^2 + 100.0 * (x[2][2] - x[2][1]^2)^2
x0 = [p1 => 0.0, p2 => 0.0]
prob = OptimizationProblem(rosenbrock, x0, [])
sol = solve(prob, NelderMead())
Currently, one have to extract the various values manually, but this seems burdensome and also prone to potentially causing errors.
I have tried to create an OptimiationSystem
, but
using Optimization, OptimizationOptimJL
@parameters p1 p2
rosenbrock(x, p) = (1.0 - x[2][1])^2 + 100.0 * (x[2][2] - x[2][1]^2)^2
@named sys = OptimizationSystem(rosenbrock, [p1, p2], [])
sys = complete(sys)
x0 = [p1 => 0.0, p2 => 0.0]
prob = OptimizationProblem(sys, x0, [])
gives a
ERROR: MethodError: no method matching collect_constants!(::Vector{SymbolicUtils.BasicSymbolic}, ::typeof(rosenbrock))
The function `collect_constants!` exists, but no method is defined for this combination of argument types.
Metadata
Metadata
Assignees
Labels
No labels