You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a question regarding the integration of OMLT and Pyomo. We want to optimize a hybrid system of equations, where the system is represented by traditional ODEs and one auxiliary function is represented by a neural network (NN). To illustrate the idea, please see the toy example below.
Suppose we want to optimize the system below using a combined representation: a neural network represents sqrt( h(t) ), while the rest of the system is described by an ODE (see below). The idea is to use OMLT and Pyomo to manipulate the input Qin(t) so that after some time, the height h(t) reaches a predefined value at a specified time x.
We noticed in the OMLT documentation that the package is primarily intended for machine learning models. However, we would like to ask if there is a trick or workaround to run this type of hybrid case with Pyomo. If not, is there any other package available that supports this type of hybrid representation within Pyomo? Our real system is currently implemented in Pyomo, and for that reason, we would like to continue working within the Pyomo framework.
Thank you very much for your time and support.
Regards,
David, Diego, and Bruno
Toy example:
dtdh=( Qin(t)− k * sqrt(h(t)) ) / A
where:
h(t) is the height of the liquid at time t,
Qin(t) is the inflow rate (control input),
A is the cross-sectional area of the tank,
kh(t) represents the outflow according to Torricelli’s Law,
k is a constant related to the valve characteristics and gravitational effects.
P.S. here is a typical error encountered when attempting to include a neural network in the OMLT and Pyomo formulation (Colab):
RuntimeError: Cannot iterate over AbstractOrderedScalarSet 'inputs_set' before it has been constructed (initialized): 'iter' is an attribute on an Abstract component and cannot be accessed until the component has been fully constructed (converted to a Concrete component) using AbstractModel.create_instance() or inputs_set.construct().
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Dear Community,
We hope everything is well with you.
We have a question regarding the integration of OMLT and Pyomo. We want to optimize a hybrid system of equations, where the system is represented by traditional ODEs and one auxiliary function is represented by a neural network (NN). To illustrate the idea, please see the toy example below.
Suppose we want to optimize the system below using a combined representation: a neural network represents sqrt( h(t) ), while the rest of the system is described by an ODE (see below). The idea is to use OMLT and Pyomo to manipulate the input Qin(t) so that after some time, the height h(t) reaches a predefined value at a specified time x.
We noticed in the OMLT documentation that the package is primarily intended for machine learning models. However, we would like to ask if there is a trick or workaround to run this type of hybrid case with Pyomo. If not, is there any other package available that supports this type of hybrid representation within Pyomo? Our real system is currently implemented in Pyomo, and for that reason, we would like to continue working within the Pyomo framework.
Thank you very much for your time and support.
Regards,
David, Diego, and Bruno
Toy example:
dtdh=( Qin(t)− k * sqrt(h(t)) ) / A
where:
h(t) is the height of the liquid at time t,
Qin(t) is the inflow rate (control input),
A is the cross-sectional area of the tank,
kh(t) represents the outflow according to Torricelli’s Law,
k is a constant related to the valve characteristics and gravitational effects.
P.S. here is a typical error encountered when attempting to include a neural network in the OMLT and Pyomo formulation (Colab):
hybrid_nn_ode_control_colab-2.ipynb.zip
RuntimeError: Cannot iterate over AbstractOrderedScalarSet 'inputs_set' before it has been constructed (initialized): 'iter' is an attribute on an Abstract component and cannot be accessed until the component has been fully constructed (converted to a Concrete component) using AbstractModel.create_instance() or inputs_set.construct().
Beta Was this translation helpful? Give feedback.
All reactions