-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Hi,
I am trying to use a finalize_solution inside MPC.continuation(...) .
I assume that whenever the function put in for finalize_solution returns true, it is accepted and the solution will be calculated; if it returns false, it is rejected.
In my function, I want to check several things. First, I am checking if all variables are positive. Secondly, I want to constrain the calculation to certain parameter ranges.
function boundary_finalizer(u, p)
# Check dynamical variables > 0
if any(x -> x <= 0, u)
return false
end
# Read parameters from p
γ = getproperty(p, :γ)
n = getproperty(p, :n)
ε_glu = getproperty(p, :ε_glu)
@info "Called finalizer (accept) γ=$(γ), n=$(n), ε_glu=$(ε_glu)"
# Check parameter ranges
if !(0.01 <= γ <= 3.5) || !(0.01 <= n <= 1.0) || !(1e-7 <= ε_glu <= 0.2)
return false
end
return true # all conditions met
end
When I access the parameters in this manner, they remain constant during the calculation of all charts. How can I access the actual parameters on the current chart?
Metadata
Metadata
Assignees
Labels
No labels