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
|
||||
*/
|
||||
template< class EOT >
|
||||
class moBackableNeighbor : virtual public moNeighbor<EOT>
|
||||
template< class EOT, class Fitness=typename EOT::Fitness >
|
||||
class moBackableNeighbor : virtual public moNeighbor<EOT, Fitness>
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* Dummy Neighborhood
|
||||
*/
|
||||
template< class EOT >
|
||||
class moDummyNeighbor : public moNeighbor< EOT > {
|
||||
template< class EOT, class Fitness=typename EOT::Fitness >
|
||||
class moDummyNeighbor : public moNeighbor< EOT, Fitness > {
|
||||
public:
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,23 +40,23 @@
|
|||
/**
|
||||
* Index Neighbor
|
||||
*/
|
||||
template< class EOT >
|
||||
class moIndexNeighbor : virtual public moNeighbor<EOT>
|
||||
template< class EOT, class Fitness=typename EOT::Fitness >
|
||||
class moIndexNeighbor : virtual public moNeighbor<EOT, Fitness>
|
||||
{
|
||||
public:
|
||||
|
||||
using moNeighbor<EOT>::fitness;
|
||||
using moNeighbor<EOT, Fitness>::fitness;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
moIndexNeighbor() : moNeighbor<EOT>(), key(0) {}
|
||||
moIndexNeighbor() : moNeighbor<EOT, Fitness>(), key(0) {}
|
||||
|
||||
/**
|
||||
* Copy Constructor
|
||||
* @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 ;
|
||||
}
|
||||
|
||||
|
|
@ -64,8 +64,8 @@ public:
|
|||
* Assignment operator
|
||||
* @param _source the source neighbor
|
||||
*/
|
||||
virtual moIndexNeighbor<EOT> & operator=(const moIndexNeighbor<EOT> & _source) {
|
||||
moNeighbor<EOT>::operator=(_source);
|
||||
virtual moIndexNeighbor<EOT, Fitness> & operator=(const moIndexNeighbor<EOT, Fitness> & _source) {
|
||||
moNeighbor<EOT, Fitness>::operator=(_source);
|
||||
this->key = _source.key ;
|
||||
return *this ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@
|
|||
/**
|
||||
* Container of the neighbor informations
|
||||
*/
|
||||
template< class EOType >
|
||||
template< class EOType, class Fitness=typename EOType::Fitness>
|
||||
class moNeighbor : public eoObject, public eoPersistent
|
||||
{
|
||||
public:
|
||||
typedef EOType EOT;
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
|
|
@ -58,7 +58,7 @@ public:
|
|||
* Copy Constructor
|
||||
* @param _neighbor to copy
|
||||
*/
|
||||
moNeighbor(const moNeighbor<EOT>& _neighbor) {
|
||||
moNeighbor(const moNeighbor<EOT, Fitness>& _neighbor) {
|
||||
repFitness = _neighbor.fitness();
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ public:
|
|||
* @param _neighbor the neighbor to assign
|
||||
* @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();
|
||||
return (*this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* Indexed Shift Neighbor
|
||||
*/
|
||||
template <class EOT>
|
||||
class moShiftNeighbor: public moIndexNeighbor<EOT>
|
||||
template <class EOT, class Fitness=typename EOT::Fitness>
|
||||
class moShiftNeighbor: public moIndexNeighbor<EOT, Fitness>
|
||||
{
|
||||
public:
|
||||
|
||||
using moIndexNeighbor<EOT>::key;
|
||||
using moIndexNeighbor<EOT, Fitness>::key;
|
||||
|
||||
/**
|
||||
* Apply move on a solution regarding a key
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* Swap Neighbor
|
||||
*/
|
||||
template <class EOT>
|
||||
class moSwapNeighbor: public moBackableNeighbor<EOT>
|
||||
template <class EOT, class Fitness=typename EOT::Fitness>
|
||||
class moSwapNeighbor: public moBackableNeighbor<EOT, Fitness>
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* Swap Neighborhood
|
||||
*/
|
||||
template <class EOT>
|
||||
class moSwapNeighborhood : public moNeighborhood<moSwapNeighbor<EOT> >
|
||||
template <class EOT, class Fitness=typename EOT::Fitness>
|
||||
class moSwapNeighborhood : public moNeighborhood<moSwapNeighbor<EOT, Fitness> >
|
||||
{
|
||||
public:
|
||||
typedef moSwapNeighbor<EOT> Neighbor;
|
||||
typedef moSwapNeighbor<EOT, Fitness> Neighbor;
|
||||
|
||||
/**
|
||||
* @return if there are available Neighbor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue