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:
parent
4cb18252cc
commit
ff67c2c650
1 changed files with 14 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue