Ok, updated the Makefile.am again to use the
make check Command I picked up in the automake documentation (RTFM, you know) Tagged a lot of header functions in the GnuPlot files with 'inline', so they can be used from more than one sourcefile. Ok, now the interesting news. Started a new library libga (not to be confused with Matthew's GaLib). Here I suggest we put a fairly complete and configurable genetic algorithm. Just to see how far we can stretch ourselves and also to have a GA-componenent that can be used in other applications without having to rebuild the entire thing. test/t-eoGA.cpp tests this library
This commit is contained in:
parent
9f5069b23a
commit
dea8a51f7e
12 changed files with 260 additions and 81 deletions
|
|
@ -3,7 +3,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// eoState.h
|
||||
// (c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2000
|
||||
/*
|
||||
/*
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
|
|
@ -32,6 +32,8 @@
|
|||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <eoFunctorStore.h>
|
||||
|
||||
class eoObject;
|
||||
class eoPersistent;
|
||||
|
||||
|
|
@ -40,7 +42,7 @@ class eoPersistent;
|
|||
* then in turn implement the persistence framework through members load
|
||||
* and save, that will call readFrom and printOn for the registrated objects.
|
||||
*/
|
||||
class eoState
|
||||
class eoState
|
||||
{
|
||||
public :
|
||||
|
||||
|
|
@ -54,7 +56,7 @@ public :
|
|||
void registerObject(eoPersistent& registrant);
|
||||
|
||||
/**
|
||||
* Copies the object (MUST be derived from eoPersistent)
|
||||
* Copies the object (MUST be derived from eoPersistent)
|
||||
* and returns a reference to the owned object.
|
||||
* Note: it does not register the object, this must be done afterwards!
|
||||
*/
|
||||
|
|
@ -65,7 +67,13 @@ public :
|
|||
ownedObjects.push_back(new T(persistent));
|
||||
return static_cast<T&>(*ownedObjects.back());
|
||||
}
|
||||
|
||||
|
||||
void storeFunctor(eoFunctorBase* _functor)
|
||||
{
|
||||
// add it to the functorStore, fo
|
||||
functorStore.add(_functor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loading error thrown when nothing seems to work.
|
||||
*/
|
||||
|
|
@ -82,21 +90,21 @@ public :
|
|||
* @param _filename the name of the file to load from
|
||||
*/
|
||||
void load(const std::string& _filename);
|
||||
|
||||
|
||||
/**
|
||||
* Reads the file specified
|
||||
*
|
||||
* @param is the stream to load from
|
||||
*/
|
||||
void load(std::istream& is);
|
||||
|
||||
|
||||
/**
|
||||
* Saves the state in file specified
|
||||
*
|
||||
* @param _filename the name of the file to save into
|
||||
*/
|
||||
void save(const std::string& _filename) const;
|
||||
|
||||
|
||||
/**
|
||||
* Saves the state in file specified
|
||||
*
|
||||
|
|
@ -109,13 +117,15 @@ private :
|
|||
|
||||
// first is Persistent, second is the raw data associated with it.
|
||||
typedef std::map<std::string, eoPersistent*> ObjectMap;
|
||||
|
||||
|
||||
ObjectMap objectMap;
|
||||
|
||||
std::vector<ObjectMap::iterator> creationOrder;
|
||||
|
||||
std::vector<eoPersistent*> ownedObjects;
|
||||
|
||||
// And a functor store to boot
|
||||
eoFunctorStore functorStore;
|
||||
|
||||
// private copy and assignment as eoState is supposed to be unique
|
||||
eoState(const eoState&);
|
||||
eoState& operator=(const eoState&);
|
||||
|
|
|
|||
Reference in a new issue