Global minimisation of multivariable constrained function with mixed integers

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

Thanks. The issue is that I need to have non linear constraints, so I cannot use some of those. Patternsearch works similarly to ga(), finding the variable minimum If I am not mistaken.
You are mistaken. ga() and patternsearch() minimize the function value, not the variables. But as usual, global minimizers typically cannot guarantee that the global minima will be found (there are some kinds of functions for which it is possible to prove that ga() will find the global minima given enough time. Quadratic functions, or something similar to that.)
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.
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)

Since there are only 100 combinations, I would just run fmincon 100 times.

4 Comments

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

Asked:

on 1 Sep 2021

Edited:

on 1 Sep 2021

Community Treasure Hunt

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

Start Hunting!