Comparator updated and test added
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1694 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
8f1cdb68d5
commit
4e00b61d79
6 changed files with 150 additions and 16 deletions
|
|
@ -52,22 +52,13 @@
|
|||
|
||||
|
||||
/**
|
||||
* Comparator of two solutions
|
||||
* Comparator of two types
|
||||
*/
|
||||
template< class EOT >
|
||||
class moComparator : public eoBF<const EOT & , const EOT & , bool>
|
||||
template< class T1, class T2 >
|
||||
class moComparator : public eoBF<const T1 & , const T2 & , bool>
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Compare two solutions
|
||||
* @param _sol1 the first solution
|
||||
* @param _sol2 the second solution
|
||||
* @return true if the _sol1 is better than _sol2
|
||||
*/
|
||||
virtual bool operator()(const EOT& _sol1, const EOT& _sol2) {
|
||||
return (_sol1.fitness() > _sol2.fitness());
|
||||
}
|
||||
virtual bool equals(const T1&, const T2&) = 0;
|
||||
|
||||
/**
|
||||
* Return the class id.
|
||||
|
|
|
|||
|
|
@ -39,13 +39,14 @@
|
|||
#include <eoFunctor.h>
|
||||
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
#include <comparator/moComparator.h>
|
||||
|
||||
|
||||
/**
|
||||
* Comparator of two neighbors
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moNeighborComparator : public eoBF<const Neighbor & , const Neighbor & , bool>
|
||||
class moNeighborComparator : public moComparator<Neighbor, Neighbor>
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -39,13 +39,14 @@
|
|||
#include <eoFunctor.h>
|
||||
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
#include <comparator/moComparator.h>
|
||||
|
||||
|
||||
/**
|
||||
* Comparator of two neighbors
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moSolNeighborComparator : public eoBF<const typename Neighbor::EOT & , const Neighbor & , bool>
|
||||
class moSolNeighborComparator : public moComparator<typename Neighbor::EOT, Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue