From: Ze Yu on
Hey guys,

I was trying to program with integers using GA. I've found a demo code for GA dealing with integers (the "ga_demo.m" from http://www.mathworks.com/support/solutions/en/data/1-10PDHC/?solution=1-10PDHC)

However, I noticed that there was no functions for crossover operator. Any idea how could I possibly do this?
From: Alan Weiss on
Ze Yu wrote:
> Hey guys,
> I was trying to program with integers using GA. I've found a demo code
> for GA dealing with integers (the "ga_demo.m" from
> http://www.mathworks.com/support/solutions/en/data/1-10PDHC/?solution=1-10PDHC)
>
>
> However, I noticed that there was no functions for crossover operator.
> Any idea how could I possibly do this?

Several of the built-in crossover functions maintain integer entries. See
http://www.mathworks.com/access/helpdesk/help/toolbox/gads/f6174dfi10.html#f7820

I believe the following maintain integers:
Scattered (@crossoverscattered), the default crossover function
Single point (@crossoversinglepoint)
Two point (@crossovertwopoint)

You can easily write your own crossover function using the syntax in the
section I just referenced. Just make sure that the resulting vectors are
integers if the input vectors are.

Alan Weiss
MATLAB mathematical toolbox documentation