as such you cannot formulate this problem with acados. If the function \kappa is convex, you might include the KKT conditions of the low-level problem instead.
I know how to formulate the KKT conditions of the nested minimization, as a function of βsβ.
How should I set up the ACADOS formulation?
I was thinking of using an algebraic variable for βsβ, is it the right way to go?
Sorry to bother you, Iβm still facing issues here.
The KKT conditions of the problem are \frac{\partial \kappa}{\partial s}(s*)=0 s \in ]0,1[
So my initial guess was to add in the constraints of the model s \in ]0,1[, \frac{\partial \kappa}{\partial s}(s,z)=0 and \kappa(s,z) \leq 0
Doing so, I change the integrator type to IRK to handle algebraic variables, but the value of s does not seem to evolve and is stuck at 0, leading to an error status 4 (because the constraints are not met)
When trying to use the variable s as an input of the system as suggested here, i get the same issue, the variable is stuck at 0, even if I set initial conditions.
If the lower-level problem includes constraints, things get more complicated: you will need to include both s and a multiplier \lambda as additional variables and the corresponding KKT conditions are no longer smooth due to the complementarity condition. If you formulate this problem exactly you will end up with a mathematical program with complementarity constraints which is in general very challenging to solve.
In general acados cannot handle this type of problems. Depending on how simple/difficult the lower-level optimization is and depending on how important it is for you to solve the lower level problem exactly, you might want to try to reformulate the constraint s \in [0,1] with penalty terms such that you end up with an unconstrained problem again.