|
Hi! I'm evaluating InfiniteOpt to model our chemical process. I've got an ODE problem where the control signal is a step function (i.e. changing the operating conditions requires physical intervention and is done once a week), and I'd like to figure out the optimal value of that control signal at each steps (i.e. MPC). That sounds like something that should be easy to do in InfiniteOpt, but I'm new to JuMP so it's not immediately obvious. Should one use @finite_parameter for such a thing? Another question: if I'm reading the MathOptAI documentation right, one can now use machine learning models inside JuMP/InfiniteOpt, but the training still has to be done outside the model, right? It's not possible to do the Scientific ML thing of fitting an ML model embedded inside a set of ODEs, minimizing the RMSE between the prediction of the ODE and the data points? |
Replies: 3 comments 11 replies
|
Hi @cstjean, To better help you with the step functions, can you provide some more details? What are the time horizon and step size you have in mind? How many times will you be able to update the control variable? I suspect, we can model this using domain restrictions, but I can provide more specific instructions with some more info (a small toy example formulation would be even better). Yes, we can embed ML models in InfiniteOpt via MathOptAI. And we can train them using https://lanl-ansi.github.io/MathOptAI.jl/stable/api/#MathOptAI.replace_weights_with_variables. Just keep in mind that training these directly can be computationally expensive. We are currently developing some efficient ways to handle this though. |
|
I had more time to study today and review the documentation. Starting from your suggestions:
My previous question:
I can now answer: I was trying to implement both your A) and B) suggestions at the same time, but that's not a good idea. A and B are conflicting, hence the Domain restriction approachI tried to make the domain restriction approach work better today (see the code from my previous post), as it already works about 50% of the time for small problems. One discovery is that while the final solution's input signal correctly looks like this:
If I interrupt the optimization early on, it looks like this:
I had naively hoped that the equality constraints over the first plateau's for E in 1:N_electro
for i in 1:N_steps
@constraint(m, I[E] == I_plateau[E, i],
DomainRestriction(ino(t_step_change[i]..t_step_change[i+1]), t))
end
endwould be recognized as such by the solver, and that it would have somehow eliminated the redundant variables as a preprocessing step, optimizing just one variable per plateau instead of N variables. Unfortunately, that is not the case, so the problem becomes exponentially more difficult for the solver. Is there any way that I can fix that? Should I use a different solver?
|





Thanks for the info, states with significantly different time scales typically presents an interesting challenge. Strategically placing collocation points would certainly help. Some ways to handle the step inputs would include: