July 2005


Options: Use Proportional Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sean Luke <[log in to unmask]>
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Tue, 19 Jul 2005 14:41:40 -0400
text/plain (55 lines)
On Jul 19, 2005, at 12:10 PM, Robert Hovden wrote:

> I would like to setup a script that will let me run ECJ many times with
> different settings, and collect data from each run into ONE file.  I
> would like
> to know how I can setup a statistics file that will simply add to a
> file (such
> as out.stat).  By default, ECJ will create a new out.stat file every
> time it is
> ran.  I would like it to instead add to the out.stat file every time
> ECJ is ran.

The Output facility can do this but it's somewhat cryptic.  The crucial
thing is that you need to provide a FileWriter (which will get wrapped
into a BufferedWriter, then into a PrintWriter by the Log), and you
also need to provide a so-called LogRestarter, whose job it is to
restart the log after checkpoint and recovery or when the user demands

My default mode has always been to generate statistics logs, then
append them with a script (I'm a MacOS X/Unix guy, not a Windows guy).
Here's a rough idea of how you'd modify the SimpleStatistics' setup
method to make an appendable log.

        final File statisticsFile =

        LogRestarter restarter = new LogRestarter()
                        // this is called whenever your log is restarted after
                        // recovery from checkpoint.  You may or may not want to
                        // append in this situation -- I presume here you want
                        // to append.
                        public Log restart(Log l) throws IOException
                                if (l.writer!=null) l.writer.close();
                                l.writer = new PrintWriter(
                                        new BufferedWriter(new FileWriter(statisticsFile,true));

                        // this is supposedly called whenever your log is requested
                        // to clear itself and start over -- so you just close the
                        // file and reoopen non-appended.  In truth, ECJ never calls this
                        public Log reopen(Log l) throws IOException
                                if (l.writer!=null) l.writer.close();
                                l.writer = new PrintWriter(
                                        new BufferedWriter(new FileWriter(statisticsFile));

        statisticslog = state.output.addLog(
                        new FileWriter(statisticsFile,true),restarter,