if there is a matrix how to apply genetic algorithm?

1 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by