Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

can any one give me an idea to solve a problem using genetic algorithm

1 Ansicht (letzte 30 Tage)
Firas Al-Kharabsheh
Firas Al-Kharabsheh am 19 Apr. 2016
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
if i have a matrix
A = [ 1 0 1 1
0 1 0 0
1 1 0 0
1 0 0 1 ]
AND with some code i found these matrix
B = [ 1 2
1 0 which represent the number of group ones in rows of A
2 0
1 1 ]
C = [ 1 0 0 1 which represent the number of group ones in columns of A
2 2 1 1 ]
then how can i use the genetic algorithm if i give to the function A as input matrix to find solution that give Matrix A but after applied the Genetic Algorithm
WHERE THE fitness function is
S = (sum(sum(A ~= x)));
where A is Matrix and x is the population matrix

Antworten (1)

Walter Roberson
Walter Roberson am 19 Apr. 2016
Bearbeitet: Walter Roberson am 19 Apr. 2016
Parameterize your function. Pass in A. For example,
A_fitness = @(x) (sum(sum(A ~= x)));
ga(A_fitness, .......)
I don't see why you don't just use A itself as the answer, since it is always going to have the lowest fitness under ~= .

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by