Genetic Algorithm Tool Question.

8 visualizaciones (últimos 30 días)
Scott Lowrie
Scott Lowrie el 10 de Ag. de 2016
Comentada: Alan Weiss el 11 de Ag. de 2016
I'm going to oversimplify my problem so that you know exactly what I am trying to figure out. So say you have an array of a few numbers and you have an extremely long code that does a bunch of operations on this array and returns three values. So I want ga to change the values in the array to minimize the three output values. How do I go about doing this? Changing the array values at the beginning of the code to minimize three outputs at the end of the code. Thanks!

Respuesta aceptada

Alan Weiss
Alan Weiss el 10 de Ag. de 2016
This is known as multiobjective optimization, because you have three numbers that you are trying to minimize. Obviously, you cannot in general find one set of inputs that simultaneously minimizes all of the outputs.
The gamultiobj function is designed to find the Pareto set, meaning the set of nondominated points. Each point on the Pareto set can have one function value lowered only by raising some other ones.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 comentarios
Scott Lowrie
Scott Lowrie el 10 de Ag. de 2016
Editada: Scott Lowrie el 10 de Ag. de 2016
Thanks for your reply Alan, this helps me understand how I'll go about minimizing these three things. But the real issue it seems is how gamultiobj will know to change the values of this array from the beginning of the program to minimize these three outputs. Such as below, in this basic form, the program changes x to minimize y(1) and y(2). How do I tell the program to change each of the values in an array to minimize y(1) and y(2)? This may be something simple that I am just missing. Thanks for the help!
function y = simple_multiobjective(x)
y(1) = (x+2)^2 - 10;
y(2) = (x-2)^2 + 20;
FitnessFunction = @simple_multiobjective;
numberOfVariables = 1;
[x,fval] = gamultiobj(FitnessFunction,numberOfVariables);
Alan Weiss
Alan Weiss el 11 de Ag. de 2016
You have to write a fitness function that accepts a row vector x containing all the variables that you want to move, and that gives a row vector output f containing the function values at the point x. In other words,
f = yourfunction(x)
where yourfunction is your function.
gamultiobj then tries to move all the values in x to find the Pareto points. Really, you should look at the examples that I linked to.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Genetic Algorithm 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!

Translated by