I am using JGAP as the api to set my GA app. In my chromosome some times there are duplicate integer values set as alleles. I am using the basic random generator to get the random values from a desired range. I want to avoid the genes to be the same integer in the chromosome. Any idea how i can fix this
Asked
Active
Viewed 549 times
1 Answers
0
I suppose you are talking about generating the initial population of the GA, and what you want to do is to create many random orders of a certain value list.
There are many ways to do so, here's two possibilities:
- Create an array of all the possible values, shuffle it, copy it to a new chromosome, repeat... (you can assign a random real value to each possible value, then order the values by the random value).
- Put all the values in a list, select a random item from the list, remove it and add it to the chromosome until there are no more values in the list, repeat...

Ron Teller
- 1,880
- 1
- 12
- 23