MATLAB: How could I make a Boolean chromosome with Genetic algorithm

fitness functiongenetic algorithm

How could I make the fitness function for the GA individuals vector or chromosome.
How could I make the result of the GA equal to ''1 or 0''.
How could I add or returned the fitness value to the GA in order to get goodness.

Best Answer

The fitness function should seldom return 0 or 1; it should return a value which increases as the proposed X gets further away from optimum.
To have a boolean variable, set its minimum to 0, its maximum to 1, and include it in the IntCon (integer constraints) list.
Related Question