[EvA] Fwd: Re: About Eva2 Exemples!!

M.Kronfeld makron at gmx.net
Thu Nov 24 23:45:02 CET 2011


On 11/24/2011 07:11 AM, Andreas Dräger wrote:
> > But I would like to know how to implement 20 multiruns, and take the
> > "meanfit", on the "TestingGAB1.class" for exemple!!
Hi there,

thanks for your interest in EvA2 (and/or your efforts to maintain it ;))!
By the way: it might generally be better to discuss such issues on the
EvA mailing list, so anyone interested may help:
https://listserv.uni-tuebingen.de/mailman/listinfo/eva

Concerning the TestingGAB1 example, you might want to replace the call
<<
sol = OptimizerFactory.optimizeToBinary(gaParams, "ga-opt-results");
>> >>
by the following lines:

<<
OptimizerRunnable runnable =
	new OptimizerRunnable(gaParams, "ga-opt-results");
runnable.setMultiRuns(25);
runnable = OptimizerFactory.optimize(runnable);
sol = OptimizerFactory.getBinarySolution();
>> >>
The output file should then contain loads of statistical information
including the mean fit (just like the GUI text output). In case you want
to access these statistical data during runtime from within a console
program, you might want to implement the InterfaceStatisticsListener and
try something like the following:

<<
OptimizerRunnable runnable =
	new OptimizerRunnable(gaParams, "ga-opt-results");
InterfaceStatisticsListener statsListener = new YourStatsListener();
runnable.setMultiRuns(25);
runnable.getStats().addDataListener(statsListener);
runnable = OptimizerFactory.optimize(runnable);
>> >>
One way to do YourStatsListener is to leave all methods emtpy except for
finalMultiRunResults(String[] header, List<Object[]>
multiRunFinalObjectData). After the multi-run is complete, that method
should receive a list with 25 data arrays containing the best/worst/mean
final fitness etc. per run. Check the header on the exact data field
contents. All numeric data can directly be casted to (Double). Loop the
list to calculate mean or any other statistic values you like.

In any case, please note that I did neither compile nor test the example
code in this mail, so there might be slight modifications necessary.
Even if so, those *should* be rather easy to figure out when looking
into the relevant source code.

Best regards,
 Marcel


More information about the EvA mailing list