While using Fmincon and obtaining unknown values is it possible to apply equality constraints for only 3rd and 4th element of the array and not the whole array containing 5 elements?

is it possible to minimize this fuction with the following constraints
Function : X(1)^1+X(2)^0.5+X(3)^4+X(4)^0.12+X(5)^-1
Constraints : X(3)=0 , X(4)=0 , X(2)<3

1 Comment

If those are your only constraints, then the problem is unbounded. I can push the function to -Inf just by setting X=[-Inf,0,0,0,1]

Sign in to comment.

 Accepted Answer

Use the lb and ub constraints. Set lb equal to ub equal to 0 for positions 3 and 4. Set ub location 2 to 3*(1-eps). Set all other lb to -inf and all other ub to +inf

2 Comments

eps is the smallest number such that 1-eps is different from 1 in floating point, the nearest you can get to 1 without being 1. When you multiply it by 3 you get the number that is the closest you can get to 3 without being 3 (or possibly the second closest, I would have to analyze further). The largest representable number that is less than 3.
Using this is necessary because the bounds are not lb < x < ub and are instead lb <= x <= ub. You cannot easily directly represent < 3 but you can express <= the closest number to 3.

Sign in to comment.

More Answers (0)

Products

Release

R2017a

Community Treasure Hunt

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

Start Hunting!