Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: GA outputs
Date: Tue, 26 Aug 2008 13:27:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 31
Message-ID: <g910b5$j37$1@fred.mathworks.com>
References: <g8kk0m$fa6$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1219757221 19559 172.30.248.35 (26 Aug 2008 13:27:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 26 Aug 2008 13:27:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1338633
Xref: news.mathworks.com comp.soft-sys.matlab:487304



"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.