Nettoyage et documentation des classes de bases

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1653 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-01-19 10:42:01 +00:00
commit 31c6fe9888
9 changed files with 224 additions and 177 deletions

View file

@ -2,17 +2,17 @@
#define _BackableNeighbor_h
/*
neighbor with a move back function to use in a moFullEvalByModif
*/
* Neighbor with a move back function to use in a moFullEvalByModif
*/
template< class EOT , class Fitness >
class moBackableNeighbor : moNeighbor<EOT, Fitness>
{
public:
/*
* the move back function
* @param _solution the solution to moveBack
*/
/*
* the move back function
* @param _solution the solution to moveBack
*/
virtual moveBack(EOT & _solution) = 0;
};

View file

@ -30,12 +30,3 @@ public:
};
#endif
// Local Variables:
// coding: iso-8859-1
// mode: C++
// c-file-offsets: ((c . 0))
// c-file-style: "Stroustrup"
// fill-column: 80
// End:

View file

@ -1,76 +1,96 @@
#ifndef _moNeighbor_h
#define _moNeighbor_h
#include <eo>
//EO inclusion
#include <EO.h>
#include <eoObject.h>
#include <eoPersistent.h>
#include <comparator/moNeighborComparator.h>
/*
contener of the neighbor informations
*/
* Container of the neighbor informations
*/
template< class EOT , class Fitness >
class moNeighbor : public eoObject, public eoPersistent
{
public:
typedef EOT EOType ;
// empty constructor
moNeighbor() { } ;
/*
* Default Constructor
*/
moNeighbor(){}
// copy constructeur
moNeighbor(const moNeighbor<EOType, Fitness> & _n) {
repFitness = _n.fitness();
}
// assignment operator
virtual moNeighbor<EOType, Fitness> & operator=(const moNeighbor<EOType, Fitness> & _n) {
repFitness = _n.fitness();
return *this ;
/*
* Copy Constructor
* @param _neighbor to copy
*/
moNeighbor(const moNeighbor<EOType, Fitness>& _neighbor) {
repFitness = _neighbor.fitness();
}
/*
* move the solution
*/
virtual void move(EOT & solution) = 0 ;
* Assignment operator
* @param the _neighbor to assign
* @return a neighbor equal to the other
*/
virtual moNeighbor<EOT, Fitness>& operator=(const moNeighbor<EOT, Fitness>& _neighbor) {
repFitness = _neighbor.fitness();
return (*this);
}
/*
* Move a solution
* @param _solution the related solution
*/
virtual void move(EOT & _solution) = 0 ;
/// Return fitness value.
/*
* Get the fitness of the neighbor
* @return fitness of the neighbor
*/
const Fitness& fitness() const {
return repFitness;
}
/// Get fitness as reference, useful when fitness is set in a multi-stage way, e.g., MOFitness gets performance information, is subsequently ranked
/*
* Get fitness as reference, useful when fitness is set in a multi-stage way, e.g., MOFitness gets performance information, is subsequently ranked
* @return fitness as reference of the neighbor
*/
Fitness& fitnessReference() {
return repFitness;
}
/** Set fitness. At the same time, validates it.
* @param _fitness New fitness value.
*/
void fitness(const Fitness& _fitness)
{
/*
* Set fitness. At the same time, validates it.
* @param _fitness new fitness value.
*/
void fitness(const Fitness& _fitness){
repFitness = _fitness;
}
/** Return the class id.
* @return the class name as a std::string
*/
/*
* Return the class id.
* @return the class name as a std::string
*/
virtual std::string className() const { return "moNeighbor"; }
/**
* Read object.\ \
* Calls base class, just in case that one had something to do.
* The read and print methods should be compatible and have the same format.
* In principle, format is "plain": they just print a number
* @param _is a std::istream.
*/
/*
* Read object.
* Calls base class, just in case that one had something to do.
* The read and print methods should be compatible and have the same format.
* In principle, format is "plain": they just print a number
* @param _is a std::istream.
*/
virtual void readFrom(std::istream& _is) {
_is >> repFitness;
_is >> repFitness;
}
/**
* Write object. Called printOn since it prints the object _on_ a stream.
* @param _os A std::ostream.
*/
/*
* Write object. Called printOn since it prints the object _on_ a stream.
* @param _os A std::ostream.
*/
virtual void printOn(std::ostream& _os) const {
_os << repFitness << ' ' ;
}

View file

@ -1,35 +1,57 @@
#ifndef _moNeighborhood_h
#define _moNeighborhood_h
template< class Neigh >
#include <eoObject.h>
/*
* A Neighborhood
*/
template< class Neighbor >
class moNeighborhood : public eoObject
{
public:
typedef Neigh Neighbor;
/*
* Define type of a solution corresponding to Neighbor
*/
typedef typename Neighbor::EOType EOT;
moNeighborhood() { }
virtual bool hasNeighbor(EOT & solution) = 0 ;
/*
* Default Constructor
*/
moNeighborhood(){}
/*
initialisation of the neighborhood
*/
virtual void init(EOT & solution, Neighbor & current) = 0 ;
* Test if a solution has (again) a Neighbor
* @param _solution the related solution
* @return if _solution has a Neighbor
*/
virtual bool hasNeighbor(EOT & _solution) = 0 ;
/*
Give the next neighbor
*/
virtual void next(EOT & solution, Neighbor & current) = 0 ;
* Initialization of the neighborhood
* @param _solution the solution to explore
* @param _current the first neighbor
*/
virtual void init(EOT & _solution, Neighbor & _current) = 0 ;
/*
if false, there is no neighbor left to explore
*/
virtual bool cont(EOT & solution) = 0 ;
* Give the next neighbor
* @param _solution the solution to explore
* @param _current the next neighbor
*/
virtual void next(EOT & _solution, Neighbor & _current) = 0 ;
/** Return the class id.
* @return the class name as a std::string
*/
/*
* Test if there is again a neighbor
* @param _solution the solution to explore
* @return if there is again a neighbor not explored
*/
virtual bool cont(EOT & _solution) = 0 ;
/* Return the class id.
* @return the class name as a std::string
*/
virtual std::string className() const { return "moNeighborhood"; }
};