how to make population pool generated as request in GA

1 view (last 30 days)
Urgent, There are 256 binary variables and I want GA can generate population pool follow these constraints: 1.For variables x(1) to x(256), once these is value "1" of variables, it must be at least 12 continuous. 2.For the variables whose value is "0", it must be at least 8 continuous, except the "0"s before first"1" and the "0"s after last"1". For example, x(1):x(256) is (00111111111111000000001111111111111000000000........1111111111111000) 3. How to limited the numbers of variable whose value is "1"?
The reason why I want to generate population pool like this is there are 2^256 combinations, that's too much, and I just need the solutions that follow the constraints described above. Since that, in my objective function I code those criterion and give a extreme high value,like 10^20, to the dependent variable(y), if the solution is not what I need, to make the GA will not consider this solution when it minimizing the objective function. But the problem is, comparing with the all solution combinations, the solutions that follow the constraints is a very small part of it. So, even the population size is 10000, in every generation, there is no required solution has been generated, the result maintain the extreme high value.

Answers (1)

Alan Weiss
Alan Weiss on 22 Jan 2015
I suggest that you help GA by providing a custom initial population. It is not difficult to generate an initial population that satisfies your constraints. Do so, then let GA do the rest. Look at the documentation for the InitialPopulation option.
Alan Weiss
MATLAB mathematical toolbox documentation
  1 Comment
Lingjun Zeng
Lingjun Zeng on 23 Jan 2015
Thank you Alan, I looked the documentation, and I want to use the custom creation function to generate population. If did that, will population in every generation satisfies my constraints? And Could you help me code this creation function, if you OK with it? Thank you.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!