Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to deal with continuous and discrete mixed variables with matlab ga function
How to deal with continuous and discrete mixed variables with matlab ga function
Does this have to be done by genetic algorithm? At present, all the genetic algorithm programs I can find seem to be unable to deal with integer constraints. I am a little interested in programming myself, but I really don't have time to do it.

It is suggested that we can try the new function intlinprog of 20 14a, which can handle mixed integer linear programming (MILP).

For this particular example, we can introduce a simple transformation to X6~X 10: Xi=3*xi-8, where xi=0~6 is an integer.

The end result is

x? =

- 10.0000

9.0000

10.0000

- 10.0000

9.0000

-8.0000

-8.0000

10.0000

4.0000

-8.0000 The objective function value is -36.

Reference code:

Answer? =? [0? 0? 1? 1? 1? 3? 3? 0? 0? 0];

b? =? 20;

Ae? =? [ 1? 0? 1? 0? 1? 0? 3? 0? 3? 0; ? 0? 1? 0? 1? 1? 3? 0? 3? 0? 3];

Is it? =? [2 1; ? 26];

lb? =? [- 10 * (5,1); ? Zero (5,1)];

ub? =? [10 * (5,1); ? 6 * one (5,1)];

f? =? [ 1? 0? 0? 1? 0? 3? 0? 0? 0? 3];

intcon? =? 6: 10;

x? =? intlinprog(f,intcon,A,b,Ae,be,lb,ub);

f*x- 16

x(6: 10)? =? 3*x(6: 10)? -? eight