필터 지우기
필터 지우기

Optimization of function with constraints having products of variables

조회 수: 6 (최근 30일)
shaunaksinha
shaunaksinha 2018년 2월 15일
댓글: shaunaksinha 2018년 2월 25일
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
John D'Errico
John D'Errico 2018년 2월 16일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jeff Miller
Jeff Miller 2018년 2월 15일
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
Jeff Miller
Jeff Miller 2018년 2월 17일
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.
shaunaksinha
shaunaksinha 2018년 2월 25일
Thank you Torsten and Jeff! I apologize for the delay in getting back.
I tried Torsten's method and used it with fminunc. But the solution I'm getting is not what I expect (I know the right answer).
Now I plan to use fmincon with a constraint (p_i>0) since I figured that my optimal solution must satisfy this constraint.
As to Jeff's question on why I'm using the p_i variables instead of the level 0 variables, it's because most of the level 0 variables appear as products. For example p1 = E*b1. And I thought that using the p_i variables was a cleaner way to code the optimization function. However, I'm now going to code the function using the level 0 variables themselves since you say that fmincon() might give better results. I will get back as soon as I have tried these steps. Thank you!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by