Add a default constructor use default comparator to moBetterAcceptCrit

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1892 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
verel 2010-07-27 18:25:00 +00:00
commit ff67c2c650

View file

@ -43,10 +43,21 @@ class moBetterAcceptCrit : public moAcceptanceCriterion<Neighbor>, public moDumm
public: public:
typedef typename Neighbor::EOT EOT; typedef typename Neighbor::EOT EOT;
/*
constructor with a specific comparator
@param _comparator the comparaison method of two solutions
*/
moBetterAcceptCrit(moSolComparator<EOT>& _comparator):comparator(_comparator) {} moBetterAcceptCrit(moSolComparator<EOT>& _comparator):comparator(_comparator) {}
/*
default constructor:
compare the fitness value: accept if the fitness is higher
*/
moBetterAcceptCrit():comparator(defaultComparator) {}
/** /**
* Accept if the new solution is better than previous one * Accept if the new solution is better than previous one according to the comparator
* @param _sol1 the previous solution * @param _sol1 the previous solution
* @param _sol2 the new solution after local search * @param _sol2 the new solution after local search
* @return true if the new solution is better than previous one * @return true if the new solution is better than previous one
@ -58,6 +69,8 @@ public:
private: private:
moSolComparator<EOT>& comparator; moSolComparator<EOT>& comparator;
moSolComparator<EOT> defaultComparator;
}; };
#endif #endif