Dans les "neighbors": Ajout d'un template Fitness avec comme valeur par défaut EOT::Fitness.
Utile pour la compatibilité avec MOEO ou Fitness doit être un Objective Vector git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1816 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
961dcba259
commit
2a102a5cf7
7 changed files with 23 additions and 23 deletions
|
|
@ -40,8 +40,8 @@
|
||||||
/**
|
/**
|
||||||
* 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 >
|
template< class EOT, class Fitness=typename EOT::Fitness >
|
||||||
class moBackableNeighbor : virtual public moNeighbor<EOT>
|
class moBackableNeighbor : virtual public moNeighbor<EOT, Fitness>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
/**
|
/**
|
||||||
* Dummy Neighborhood
|
* Dummy Neighborhood
|
||||||
*/
|
*/
|
||||||
template< class EOT >
|
template< class EOT, class Fitness=typename EOT::Fitness >
|
||||||
class moDummyNeighbor : public moNeighbor< EOT > {
|
class moDummyNeighbor : public moNeighbor< EOT, Fitness > {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -40,23 +40,23 @@
|
||||||
/**
|
/**
|
||||||
* Index Neighbor
|
* Index Neighbor
|
||||||
*/
|
*/
|
||||||
template< class EOT >
|
template< class EOT, class Fitness=typename EOT::Fitness >
|
||||||
class moIndexNeighbor : virtual public moNeighbor<EOT>
|
class moIndexNeighbor : virtual public moNeighbor<EOT, Fitness>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using moNeighbor<EOT>::fitness;
|
using moNeighbor<EOT, Fitness>::fitness;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
*/
|
*/
|
||||||
moIndexNeighbor() : moNeighbor<EOT>(), key(0) {}
|
moIndexNeighbor() : moNeighbor<EOT, Fitness>(), key(0) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy Constructor
|
* Copy Constructor
|
||||||
* @param _n the neighbor to copy
|
* @param _n the neighbor to copy
|
||||||
*/
|
*/
|
||||||
moIndexNeighbor(const moIndexNeighbor& _n) : moNeighbor<EOT>(_n) {
|
moIndexNeighbor(const moIndexNeighbor& _n) : moNeighbor<EOT, Fitness>(_n) {
|
||||||
this->key = _n.key ;
|
this->key = _n.key ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,8 +64,8 @@ public:
|
||||||
* Assignment operator
|
* Assignment operator
|
||||||
* @param _source the source neighbor
|
* @param _source the source neighbor
|
||||||
*/
|
*/
|
||||||
virtual moIndexNeighbor<EOT> & operator=(const moIndexNeighbor<EOT> & _source) {
|
virtual moIndexNeighbor<EOT, Fitness> & operator=(const moIndexNeighbor<EOT, Fitness> & _source) {
|
||||||
moNeighbor<EOT>::operator=(_source);
|
moNeighbor<EOT, Fitness>::operator=(_source);
|
||||||
this->key = _source.key ;
|
this->key = _source.key ;
|
||||||
return *this ;
|
return *this ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,12 @@
|
||||||
/**
|
/**
|
||||||
* Container of the neighbor informations
|
* Container of the neighbor informations
|
||||||
*/
|
*/
|
||||||
template< class EOType >
|
template< class EOType, class Fitness=typename EOType::Fitness>
|
||||||
class moNeighbor : public eoObject, public eoPersistent
|
class moNeighbor : public eoObject, public eoPersistent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef EOType EOT;
|
typedef EOType EOT;
|
||||||
typedef typename EOT::Fitness Fitness;
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
*/
|
*/
|
||||||
|
|
@ -58,7 +58,7 @@ public:
|
||||||
* Copy Constructor
|
* Copy Constructor
|
||||||
* @param _neighbor to copy
|
* @param _neighbor to copy
|
||||||
*/
|
*/
|
||||||
moNeighbor(const moNeighbor<EOT>& _neighbor) {
|
moNeighbor(const moNeighbor<EOT, Fitness>& _neighbor) {
|
||||||
repFitness = _neighbor.fitness();
|
repFitness = _neighbor.fitness();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ public:
|
||||||
* @param _neighbor the neighbor to assign
|
* @param _neighbor the neighbor to assign
|
||||||
* @return a neighbor equal to the other
|
* @return a neighbor equal to the other
|
||||||
*/
|
*/
|
||||||
virtual moNeighbor<EOT>& operator=(const moNeighbor<EOT>& _neighbor) {
|
virtual moNeighbor<EOT, Fitness>& operator=(const moNeighbor<EOT, Fitness>& _neighbor) {
|
||||||
repFitness = _neighbor.fitness();
|
repFitness = _neighbor.fitness();
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,12 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
/**
|
/**
|
||||||
* Indexed Shift Neighbor
|
* Indexed Shift Neighbor
|
||||||
*/
|
*/
|
||||||
template <class EOT>
|
template <class EOT, class Fitness=typename EOT::Fitness>
|
||||||
class moShiftNeighbor: public moIndexNeighbor<EOT>
|
class moShiftNeighbor: public moIndexNeighbor<EOT, Fitness>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using moIndexNeighbor<EOT>::key;
|
using moIndexNeighbor<EOT, Fitness>::key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply move on a solution regarding a key
|
* Apply move on a solution regarding a key
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
/**
|
/**
|
||||||
* Swap Neighbor
|
* Swap Neighbor
|
||||||
*/
|
*/
|
||||||
template <class EOT>
|
template <class EOT, class Fitness=typename EOT::Fitness>
|
||||||
class moSwapNeighbor: public moBackableNeighbor<EOT>
|
class moSwapNeighbor: public moBackableNeighbor<EOT, Fitness>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,11 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
/**
|
/**
|
||||||
* Swap Neighborhood
|
* Swap Neighborhood
|
||||||
*/
|
*/
|
||||||
template <class EOT>
|
template <class EOT, class Fitness=typename EOT::Fitness>
|
||||||
class moSwapNeighborhood : public moNeighborhood<moSwapNeighbor<EOT> >
|
class moSwapNeighborhood : public moNeighborhood<moSwapNeighbor<EOT, Fitness> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef moSwapNeighbor<EOT> Neighbor;
|
typedef moSwapNeighbor<EOT, Fitness> Neighbor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if there are available Neighbor
|
* @return if there are available Neighbor
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue