Issue about "the same lower bound and upper bound" in 'fmincon'

6 views (last 30 days)
Hey, everyone, I have a confusion about the lower bound and upper bound in 'fmincon'. My optimization problem can be described as below:
where and are two endogenous variables, and is the objective function.
I need to do the following two optimizations
1.Both and are endogenous, using 'fmincon' to solve out the optimized and
2.Given , using 'fmincon' to solve out the optimized
For the optimization problem 2, I tried the following two methods to do it:
(1) Setting the same lower and upper bound for x2 (which is 1 here), and using 'fmincon' to solve out the optimal x1 and x2;
(2) Substituting into the objective function and constraint conditions firslty, and use 'fmincon' to solve out the optimized .
However, the value of optimized under these two methods are different. Which method should I use here?
I check the link https://www.mathworks.com/help/optim/ug/iterations-can-violate-constraints.html which states that 'If you set a lower bound equal to an upper bound, iterations can violate these constraints.'. Does it mean that the method (1) is wrong?
Your comments are appreciated.
  3 Comments
Matt J
Matt J on 22 Jul 2019
Did you do this for all your constraints, including the linear ones A*x<=b, Aeq*x=beq ?
sxj
sxj on 22 Jul 2019
Thanks for your comments, Torsten and Matt.
The differences are shown as below where I choose the value of objective and endogenous variables in method (1) as reference point. Besides, there are actually four endogenous variables in my problem where I should solve out the optimal ones respectively.
Differences for the value of objective: -0.0023, 2.5349e-04,7.1896e-05,1.5973e-04
Percentage differences for the value of optimized x: -3.82%, 2.81%, -1.16%, 0.62%
Since I need to do sensitive test in which I test how the change of parameters affect the optimized values, it would be import to see which method should be used.
There is no linear constraints but non-linear constraints in my problem. I have already substitute the value of into the constraints when I use method 2.

Sign in to comment.

Answers (1)

Matt J
Matt J on 22 Jul 2019
Edited: Matt J on 22 Jul 2019
No, it is not wrong. It probably means you have multiple solutions or that the differences are merely floating point noise. You should check the objective function value at each solution to be sure.
Neither method 1 and 2 are generally the most efficient, however. The efficient way is to derive a simpler objective function in which x1 is the only input. For example, if your original objective function were,
f=@(x) (x(1)+2*x(2)+3).^2;
the efficient approach when x2=1 would be to simplify this to,
x2=1;
c=2*x2+3;
f=@(x1) (x1+c).^2;
This way, you avoid doing extra arithmetic with x2 every time fmincon calls your objective.
  5 Comments
Matt J
Matt J on 22 Jul 2019
I can't really evaluate any of that without seeing the objective and running it myself. What was the objective value at the initial point? If it was 10000 then a difference of 0.0023 doesn't seem significant.
sxj
sxj on 22 Jul 2019
The objective value at the initial point is 9.1347e+03, and the objective value under the two methods are 9.222e+3 and 9.2012e+3 respectively. -0.0023 = (9.2012e+3-9.222e+3)/9.222e+3 measures the difference between the two method in which I choose one of them as the reference point.
The code contains several subfunction, I have to adjust a little for you to run it if it is neccessary.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!