Updating x in fitness function
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hari
el 8 de Mzo. de 2017
Respondida: Walter Roberson
el 8 de Mzo. de 2017
For a custom vectorised fitness function like this,
FitnessFunction = @(x) my_fitness(x,a,b);
I need to modify the values of x (i.e 'This population')based on some parameters computed in the fitness function. I have tried including the code for this in the fitness function but I guess this is not the right way. In the subsequent steps, while generating the next generation, ga is using the same x values as before and not the modified ones. Can these values be modified within the fitness function?
0 comentarios
Respuesta aceptada
Walter Roberson
el 8 de Mzo. de 2017
ga is the wrong approach for that. In ga, you never modify the population in the objective function. Instead, you generate a fitness value for the population as-is. Then the population along with all of the fitness values are passed to the crossover or mutation functions, which can generate whatever modified values desired.
To phrase this a different way, take that detection and modification code out of the fitness function and put it in the crossover or mutation function.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Curve Fitting Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!