Global minimisation of multivariable constrained function with mixed integers

2 views (last 30 days)
Hello, I was minimising a function with 2 variables and non-linear constraints with fmincon because it does exactly what I need, and it worked perfectly. Then, I introduced 2 additional variables and changed the constraints accordingly and still worked. The issue I am facing is that, while the first 2 variables could be any number (integer or decimal), the last 2 can only have a certain value: x(3) can only be [4,6,8,10] while x(4) [6:1:30] (for a total of 100 combinations), and fmincon obviusly returns decimal numbers.
I cannot round the results because I need the right combination of all 4 variables. I also know that ga() can work with integers limitations, however ga() doesn't minimise the function, but the variables. How could I model the problem?
Many thanks
  5 Comments
Lorenzo Manni
Lorenzo Manni on 1 Sep 2021
ok thank you. I tried with ga() and patternsearch() but they dont find the minima like fmin. I need to find the minimum mass for certain combinations of parameters so i know that some results they return are just not the minima.
Walter Roberson
Walter Roberson on 1 Sep 2021
There are some classes of functions for which it is possible to guaranteed that a minima can be found, but if you have non-linear constraints, then chances are that your function is not one of those varieties.

Sign in to comment.

Answers (1)

Matt J
Matt J on 1 Sep 2021
Since there are only 100 combinations, I would just run fmincon 100 times.
  4 Comments
Matt J
Matt J on 1 Sep 2021
Edited: Matt J on 1 Sep 2021
No, with a loop around the call to fmincon,
for i=1:100
fun=@(x)objectiveFunction( [x,p1(i),p2(i)] );
[X(i,:),fval(i)]=fmincon(fun,x0,________)
end
imin=min(fval);
x=[X(imin,:),p1(imin),p2(imin)];

Sign in to comment.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!