问题
As an openmdao 1.x problem handles only one driver and as optimizers are still supposed to be drivers, how a multi-level formulation could be implemented? Should I use two problems? Should I call an optimizer directly within a solve_nonlinear component method? Thanks.
回答1:
There have been some changes, and Problem
is no longer a system. The best way to do this now is to create a Component
that contains the sub-problem, tells it when to run, and passes data in and out. See example here:
How to use nested problems in OpenMDAO 1.x?
回答2:
The planned way to handle this is going to be to use nested Problem instances. This is not implemented yet in the problem class, but it very easy to implement by hand.
All you would need to do is define your own solve_nonlinear method in a SubClass of Problem. if you're going to use analytic derivatives you would also need to implement a Jacobian and apply_linear methods as well and do use post-optimiality sensitivities if you had nested optimizers. Or you could force finite difference to happen in the containing parent group.
Your solve_linear will take in params, unknowns, and resids dictionaries and passes the relevant variables down into the problems vector. Essentially, the framework was designed to not know if you're using nested problems. The top level framework thinks that the inner one is just a regular component.
来源:https://stackoverflow.com/questions/32612456/how-to-setup-multi-level-mdo-formulation-with-openmdao-1-x