Optimization of function with constraints having products of variables
3 views (last 30 days)
Show older comments
Hello,
I have a constrained optimization problem with an objective function involving 8 design variables (p1 to p8). I have 2 constraints that look like so:
p2 = -p4*p7 -- (i)
p3 = p6*p4 -- (ii)
I have been trying to formulate the problem using fmincon() in MATLAB but have not been successful so far in formulating the constraints as Aeq*x=beq. Could someone help me out please.
Thank you!
1 Comment
John D'Errico
on 16 Feb 2018
Of course you cannot create products of variables in a set of LINEAR constraints. While you could create nonlinear equality constraints that do this, it will simply make the problem more complex for no good reason.
Jeff gave the correct solution. There is no need to have p2 and p3 as unknowns in the first place. They are directly computed from the other variables.
Answers (1)
Jeff Miller
on 15 Feb 2018
From your two constraints, it looks like p2 and p3 are completely determined by the other variables. If so, just optimize the six variables (p1, p4-p8). You can compute p2 and p3 inside the objective function, so you don't need the optimizer to know about them at all.
4 Comments
Jeff Miller
on 17 Feb 2018
Shaunak, I don't understand everything you said, but a few comments:
(1) I agree with Torsten's suggestion; this seems like one way to accomplish your goal.
(2) Just to clarify, w0 would have only 6 elements, not 8 (maybe you already understood this). So, fmincon would be adjusting 6 "free" parameters, and you would compute the p1-p8 needed for your equation from those 6.
As a minimal example, you might have a system that involves 3 parameters, p1, p2, and p3, where p3=p1+p2. In that case you would only let fmincon adjust 2 parameters (most naturally p1 and p2), and then you would compute p3 within your objective function. (Or, as Torsten suggests, just replace p3 with (p1+p2) everywhere in the objective function.)
(3) I wonder why you aren't estimating your level 0 variables directly? From your comment, it sounds like you are computing p1-p8 from these level 0 variables. So, why not let fmincon optimize the level 0 variables directly? Each time fmincon gives a set of level 0 variables to your objective function, you would first compute p1-p8 and then use those to compute to-be-minimized error score. Maybe this cannot be done in your situation, but it seems like the most direct approach if it can be done.
Bottom line: Try to rewrite your objective function to take as few parameters as possible, and just let fmincon adjust those. Even if there are more "true parameters" in the real system, fmincon will do a better job, and faster, if you ask it to adjust the smallest possible number of parameters.
See Also
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!