Closed carldlaird closed 1 year ago
I gave this some thought a while back. My idea was if you had and external block that calculated like y1 and y2 and you basically had to calculate them together, you could cache the results for a set of inputs. So like if y1(x) is called first, y2 would be calculated along the way and cached. Then when y2(x) is called it would load up the cached value. I did play with this system a bit with external property function calls and it can work. The nice (or not nice) thing is that is still just the plain old ExternalFucntion interface, and it's up to whoever writes the function to figure out the caching.
The pyomo team has also discussed the possibility of having an "external block" instead of an external function that would support the multi-input / multi-output behavior. We have not gone beyond just a cursory conversation, but it might be a reasonable model for this situation.
Yeah, an external block would be great. I just couldn't figure out how it would work. As far as I can tell something like that wouldn't be supported through the ASL interface.
I think this was completed with the addition of ExternalGreyBoxModel
in PyNumero
.
In many cases, external black-box simulations that we want to include in Pyomo models are multi-input/multi-output. The current interface for ExternalFunction supports multi-input/single-output. I believe that a more natural representation for multi-input/multi-output is an "ExternalBlock" with well-defined inputs and outputs.
I would like to schedule a design discussion to discuss this possibility.