Can I use Optimization tool like fmincon or ga etc if I have constraint optimization problem that optimization variable cannot be within a range inside upper and lower limit?

1 view (last 30 days)
Can I use Optimization tool like fmincon or ga etc if I have constraint optimization problem that optimization variable cannot be within a range inside upper and lower limit? I have an optimization problem with optimization variable x bounded to Lower_limit < x < Upper_Limit. But I have some constraint on x that x cannot be between inter_limit2 and inter_limit3. where Lower_limit < inter_limit2 < inter_limit3 < Upper_Limit.
Example : suppose I am solving an optimization problem where x should be within 1 and 10 or 29 and 99. The feasible space for x is from 1 to 10 and 29 to 99.
Any help?

Accepted Answer

Matt J
Matt J on 22 Mar 2019
Edited: Matt J on 22 Mar 2019
Example : suppose I am solving an optimization problem where x should be within 1 and 10 or 29 and 99. The feasible space for x is from 1 to 10 and 29 to 99.
This can be expressed using the mixed integer linear constraints,
28*b+1 <= x <= 89*b+10
where b is an additional unknown binary variable that you must include in your design vector. Since only ga and intlinprog support mixed integer constraints, you would have to use whichever of those is applicable to your objective function.

More Answers (1)

Walter Roberson
Walter Roberson on 21 Mar 2019
You could use the nonlinear constraints for that, but it is unlikely to work at all well.
Instead, run the problem once for each combination of disjoint ranges, and pick the best overall solution.
  5 Comments
Walter Roberson
Walter Roberson on 11 Apr 2020
Edited: Walter Roberson on 28 Apr 2020
Cute, but that will not work in practice.
fmincon searches around trying to find a feasible point. Once it finds one, it tries to maintain feasibility (or "not much outside feasible"). Suppose for example it was at 9 and found it was feasible, then it might possibly in the early stages try (for example) 10.1 and discover that it is outside. It would then contract back towards the last feasible point; it is not going to suddenly decide to give up on a successful area and go wandering in hopes that another area might also be successful.
The exception to this is that MATLAB uses the linear constraints to divide the search area into bounded regions, and after exploring one region permitted by linear constraints, it moves on to the next region permitted by linear constraints. But you cannot use linear constraints to express disjoint regions in a single variable.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!