Issue about "the same lower bound and upper bound" in 'fmincon'
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Matt J
2019-7-22
Did you do this for all your constraints, including the linear ones A*x<=b, Aeq*x=beq ?
回答(1 个)
Matt J
2019-7-22
编辑:Matt J
2019-7-22
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 个评论
Matt J
2019-7-22
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!