Can someone help how to write a binary constraint, in particular a variable to take 1 or 0 value. I am working on a facility location problem and I need YES/NO decision constraints. One idea that I got (not working) was putting the boundaries of the variables 0 and 1, and plus writing a constraint like this:
cons(22) = x(2) - 1;
cons(23) = x(1) - 1;
I want the function to choose between the variable x(1) or x(2)
Iman or Ivan, thanks for your response. In the code I have tried the following but still cant get a maximum optimization (still negative values).
options.objfun = @(-NSGA2_Objfun);
*doesn't work still looking up @ function properties in matlab.
Or within the NSGA2_Objfun I multiple the final result by negative one.
Dear Song Lin,
Thanks for your great work. I am researching on cognitive radios and use NPGM with integer coding. I have an binary assignment matrix and a cost matrix. Each population member represents an assignment matrix and the objective evaluated based on cost.
Each solution is a vector of size 90 with integer values in it. Even though, I set the 'options.vartype=2' for integer optimization, at the output result, I have seen real values in population member. How can I fix this issue? Thanks for your great effort and help.