if there is a matrix how to apply genetic algorithm?

1 view (last 30 days)
if there is a (N x M )matrix A
AND B represent a number of group of ones in each row
AND C represent a number of group of ones in each column
A = [ 1 1 0 0 1 0
1 0 1 0 0 1
1 1 0 1 0 1
0 1 0 1 0 0 ]
B = [ 2 1 0
1 1 1
2 1 1
1 1 0 ]
C = [ 0 1 0 0 0 0
3 2 1 2 1 2 ]
and i want to apply genetic algorithm
in first step generate a (N x M) Matrix
AND apply this fitness function F(x) = ∑ ∑ | Bij - Xij | .
to understand this equation let take example
if the first population x1 = 0 1 1 0 1 , x2 = 1 0 1 0 1 0 , x3 = 1 0 0 1 1 0
then x1 = 0 1 1 0 1 wil be (2,1)
x2 = 1 0 1 0 1 0 will be (1,1,1)
x3 = 1 0 0 1 1 0 will be (1,2)
in the first row in A [ 1 1 0 0 1 0] which is [2 1 0]
then
F(x1) = | 2-2 | + |1-1| + |0-0| = 0
F(x2) = | 1 - 2| + |1-1| + |1-0| = 2
F(x3) = | 2-1 | + | 1-2 | + |0-0| = 2
then F(x1) is the better

Answers (0)

Community Treasure Hunt

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

Start Hunting!