Issue about "the same lower bound and upper bound" in 'fmincon'
3 views (last 30 days)
Show older comments
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
on 22 Jul 2019
Did you do this for all your constraints, including the linear ones A*x<=b, Aeq*x=beq ?
Answers (1)
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
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.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!