Message Boards Message Boards

0
|
1409 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Inner + Outer optimization: is a killer-performance routine?

Posted 11 months ago

Dear All,
I am trying to implement a nested optimization routine for a complex problem for which the optimization variables may become more than 10. Before moving forward, I am trying to check this routine in a very simple scenario with just two variables (see code below).
It seems the code actually works but, when comparing with a single-optimization routine solving the same problem, it seems that the requierd time increase significantly (single optimization routine: 0.022 seconds; nested routine: 39 seconds). Am I missing something? What are the situations where a nested optimization may be useful (rather than solving with a single optimization run with more variables)?
Thank you very much

(*Objective function*)
f[x_, y_] := Sin[x + y] + Cos[x - y]

(*Single optimization routine*)
NMinimize[{f[x, y], 0 <= x <= 2 && 0 <= y <= 2}, {x, 
   y}] // AbsoluteTiming

(*Nested optimization routine*)
(*Inner optimization*)
innerOptimization[x_?NumericQ] := 
 NMinimize[{f[x, y], 0 <= y <= 2}, y][[1]]

(*Outer optimization*)
outerOptimization := NMinimize[{innerOptimization[x], 0 <= x <= 2}, x]

(*Perform the optimization*)
result = outerOptimization // AbsoluteTiming

(*Print the optimal values*)
optimalX = x //. result[[2, 2]]
optimalY = y /. Last[NMinimize[{f[optimalX, y], 0 <= y <= 2}, y]]
POSTED BY: Fabio Rondelli

With the nested form you can only move one variable at a time. This is fine for bilevel optimization such as min-max problems. It is quite inefficient for a simple multivariate optimization.

That stated, one speed improvement might be to use the local optimizer FindMinValue instead of NMinimize.

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract