Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
GA outputs

Subject: GA outputs

From: Dave Brackett

Date: 21 Aug, 2008 20:43:02

Message: 1 of 2

Does anyone know how I can pass variables back from a
genetic algorithm (GA) optimisation function to the m file
that initiated the GA?

I am using anonymous functions to pass variables to the GA,
but cannot work out how to get variables back from the GA.
It appears that the only allowable outputs are
[x,fval,exitflag,output,population,scores].

One way could be to write each variable to file and then
read them back from that file, but that is very
inefficient. I am trying to avoid using global variables as
I run into problems with these when running the GA in
parallel using the parallel computing toolbox.

Hopefully someone can point me in the right direction.
Thanks!

Subject: GA outputs

From: Dave Brackett

Date: 26 Aug, 2008 13:27:01

Message: 2 of 2

"Dave Brackett" <davebrackett@hotmail.com> wrote in message
<g8kk0m$fa6$1@fred.mathworks.com>...
> Does anyone know how I can pass variables back from a
> genetic algorithm (GA) optimisation function to the m
file
> that initiated the GA?
>
> I am using anonymous functions to pass variables to the
GA,
> but cannot work out how to get variables back from the
GA.
> It appears that the only allowable outputs are
> [x,fval,exitflag,output,population,scores].
>
> One way could be to write each variable to file and then
> read them back from that file, but that is very
> inefficient. I am trying to avoid using global variables
as
> I run into problems with these when running the GA in
> parallel using the parallel computing toolbox.
>
> Hopefully someone can point me in the right direction.
> Thanks!
>
>

I have found a workaround for this by recalculating based
on the GA output x. This only adds minor overhead as it is
recalculated only once at the very end of the optimisation
run. This then eliminates the need to pass any other
outputs from the GA to the initiating function.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us