From: Tiago Sousa on
Hello,
I'm new to the forums, I hope you can help me.

Is there any way to return extra values from the fitness function of
GA?

For example, I have a fitness function that returns the variable f,
but i need to know the value of other variable.

My problem is:

function f=obj(x, a, b, c)
if a==1
f=x*b
a=0;
else
f=x*c
a=1;
end

Then, i call in other m-file:

options=gaoptimset(.....)
a=1; b=2; c=3;
funGA=@(x)obj(x, a, b, c)
[x, fval]=ga(funGA,...)

And i want to know the a value because it changes during the obj
function. I dont know if it is possible doing this?

Thanks for any help.

Tiago Sousa