Grokbase Groups Perl ai August 2004
I don't actually have any experience with AI::Genetic, but is probably your best bet. Take a look at how
AI::Categorizer interfaces with it:

If you throw something like this into the bottom of one of your perl
files, you should be able just to call
$gen->store_state('filename') and then $gen->restore_state
('filename') (where $gen is an instance of AI::Genetic)

package AI::Genetic;

use strict;
use Storable;
use File::Spec ();
use File::Path ();

sub save_state {
my ($self, $path) = @_;
if (-e $path) {
File::Path::rmtree($path) or die "Couldn't overwrite $path: $!";
mkdir($path, 0777) or die "Can't create $path: $!";
Storable::nstore($self, File::Spec->catfile($path, 'self'));

sub restore_state {
my ($package, $path) = @_;
return Storable::retrieve(File::Spec->catfile($path, 'self'));


On Dec 8, 2006, at 9:37 AM, Brad Larsen wrote:

One (possibly stupid) suggestion is to look at Data::Dumper. It
should work, but may be very slow if the object in question is
large. Let us know if you find anything better.

Brad Larsen wrote:
I know this is going to turn out to be a stupid question, but
could someone tell me the easiest way to store and retrieve the
state of the entire AI::Genetic colony, and parameters, to a disk
file so it can be read in and out at will?
I'm doing some constrained optimization experiments that can take
several days, even a week, to run in the background, but I have a
computer (Mac OS X 10.4.8) that is shared, and I need to install
software and restart it almost daily.
I would like to save the entire thing about every hour, but I can
handle the timing part myself.
Gregg Allen
Cerebra, Inc.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 7 | next ›
Discussion Overview
groupai @
postedAug 31, '04 at 11:12a
activeDec 9, '06 at 12:12a



site design / logo © 2021 Grokbase