How to avoid permutation condition in Genetic Algorithm?

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.

Answers (1)

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.

1 Comment

Thank you so much for your suggession.
The constrain which you have suggested will avoid the repetation and arrange the out output in accending/decending order.
Suppose my range is 1 to 100(ie. want to pick 8 variable from 1 - 100), the whole result will depents on x(8). That means, if the algorithm pick x(8) as 50 then it will ignore all the values from 50-100 because of the constrain suggested by you.
Kindly give me a suggestion to over come this iisue.
Thanks.

Sign in to comment.

Products

Release

R2018a

Asked:

on 19 Oct 2019

Commented:

on 23 Oct 2019

Community Treasure Hunt

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

Start Hunting!