How to avoid permutation condition in Genetic Algorithm?
9 views (last 30 days)
Show older comments
I want to minimize my objective fuction with with 8 variables using genetic algorithm. Considering my problem, all my 8 variables are integer and the arrangenment of my variable wont affect my objective function.
Example: output like 1 2 3 4 5 6 7 8 or 8 7 6 5 4 3 2 1 wont affect my objective function. But the GA considering both this set of variable as a separate gene. Kindly someone let me know how to avoid this condition in GA.
Thanks.
0 Comments
Answers (1)
Walter Roberson
on 19 Oct 2019
Use A and b constraints to enforce that the values are in sorted order. x(1) < x(2) if [1 -1]*x(1:2).' < 0 so
A = [1 -1 0 0 0 0 0 0
0 1 -1 0 0 0 0 0
0 0 1 -1 0 0 0 0
0 0 0 1 -1 0 0 0
0 0 0 0 1 -1 0 0
0 0 0 0 0 1 -1 0
0 0 0 0 0 0 1 -1]
b = [0; 0; 0; 0; 0; 0; 0; 0]
However, that particular matrix does not enforce that the values are different: it would be satisfied with x(1) = x(2) for example. Fortunately when you work with integer variables you can rewrite x(1) < x(2) as x(1) + 1 < x(2) which is x(1)-x(2) < -1 so instead of all 0'is in b, make it all -1's and duplicates would be ruled out.
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!