0

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.

relf
  • 139
  • 1
  • 6

2 Answers2

2

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?

Community
  • 1
  • 1
Kenneth Moore
  • 2,167
  • 1
  • 9
  • 13
1

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.

Justin Gray
  • 5,605
  • 1
  • 11
  • 16
  • Oh you point me to the fact that a problem **is a** system (not sure it is mentionned anywhere except in the code)! So indeed we can use nested problems and solve_nonlinear method. Thanks. – relf Sep 17 '15 at 16:31
  • Hi, I have a doubt regarding this answer - Do we define the solve_nonlinear in Problem subclass or the root of the said subclass since it's solve_nonlinear is originally a function defined in Component and Group, so method overloading should only work for their sub classes. Kindly provide an example definition of such nested class, if possible. Thanks. – Divya Manglam Feb 09 '16 at 09:58