there is a Genetic algorithm toolbox. in which the ranking function is only aiming for the minimization of the fitness function i need to find a ranking function which aim for the maximization of the fitness function ....

 Respuesta aceptada

Sean de Wolski
Sean de Wolski el 29 de Dic. de 2014
maxfcn = @(x)-minfcn;
Just negate the min function!

3 comentarios

Hamza
Hamza el 30 de Dic. de 2014
i am not getting you properly. the following is the main code
FitnV=ranking(ObjV); %this is the the function which is giving me the value by following the goal of minimizing the ObjV.
ranking_max=@(x)-ranking(ObjV);
FitnV=ranking_max(ObjV);
%is that what you are trying to say .
this one just converting the FitnV value into negative .
which is not usefull in the program, can you explain little please.
Sean de Wolski
Sean de Wolski el 30 de Dic. de 2014
The minima of the negation will be the maxima. What you have above looks right to me.
Hamza
Hamza el 3 de En. de 2015
Thank you very much sir for your help i have one another problem. i want to make random complex numbers like real part between (-0.5 to 0.5) and imaginary also -0.5i to 0.5i .
in the gatbx the range of the variable is found using rep function in matlab like FieldD = [rep([PRECI],[1, NVAR]); rep([-0.5-0.5;+0.5i+0.5i],[1, NVAR]);... rep([1; 0; 1 ;1], [1, NVAR])]; Chrom = crtbp(NIND, NVAR*PRECI); Phen = bs2rv(Chrom,FieldD);
i wrote -0.5-0.5;+0.5i+0.5i. but this is not giving me what i want. in my phenotype this is giving me (random)real-random(imag) and random(real)+random(imag). but it is skipping the numbers like -(random)real+random(imag) or random(real)-random(imag). e.t.c
can you help me with this one ..

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 29 de Dic. de 2014

Comentada:

el 3 de En. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by