Debug some new class again

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2555 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
verel 2011-12-08 23:31:00 +00:00
commit f22c862d1c
3 changed files with 20 additions and 5 deletions

View file

@ -44,7 +44,7 @@
* The sizes of the neighborhoods are equal * The sizes of the neighborhoods are equal
*/ */
template<class Neighbor> template<class Neighbor>
class moDoubleIncrEvaluation : public moNeighborhoodEvaluation<Neighbor>, moUpdater class moDoubleIncrEvaluation : public moNeighborhoodEvaluation<Neighbor>, public moUpdater
{ {
public: public:
typedef typename Neighbor::EOT EOT; typedef typename Neighbor::EOT EOT;
@ -76,6 +76,9 @@ public:
firstEval = true; firstEval = true;
} }
virtual void operator()() {
}
/** /**
* Evaluation of the neighborhood * Evaluation of the neighborhood
* Here nothing to do * Here nothing to do

View file

@ -62,12 +62,16 @@ public:
* @param _searchExplorer the neighborhood explorer of the local search * @param _searchExplorer the neighborhood explorer of the local search
* @param _incrEval the incremental evaluation of the UBQP * @param _incrEval the incremental evaluation of the UBQP
*/ */
moUBQPdoubleIncrEvaluation(unsigned int _neighborhoodSize, moNeighborhoodExplorer<Neighbor> & _searchExplorer, moEval<Neighbor> & _incrEval) : moDoubleIncrEvaluation<Neighbor>(_neighborhoodSize), searchExplorer(_searchExplorer) // moUBQPdoubleIncrEvaluation(unsigned int _neighborhoodSize, moNeighborhoodExplorer<Neighbor> & _searchExplorer, moEval<Neighbor> & _incrEval) : moDoubleIncrEvaluation<Neighbor>(_neighborhoodSize), searchExplorer(_searchExplorer)
moUBQPdoubleIncrEvaluation(unsigned int _neighborhoodSize, moUBQPSimpleIncrEval<Neighbor> & _incrEval) : moDoubleIncrEvaluation<Neighbor>(_neighborhoodSize), searchExplorer(NULL)
{ {
n = _incrEval.getNbVar(); n = _incrEval.getNbVar();
Q = _incrEval.getQ(); Q = _incrEval.getQ();
} }
void neighborhoodExplorer(moNeighborhoodExplorer<Neighbor> & _searchExplorer) {
searchExplorer = & _searchExplorer;
}
/** /**
* Evaluation of the neighborhood * Evaluation of the neighborhood
@ -100,11 +104,11 @@ public:
} }
} else { } else {
if (searchExplorer.moveApplied()) { // compute the new fitness only when the solution has moved if (searchExplorer->moveApplied()) { // compute the new fitness only when the solution has moved
// the currentNeighbor is the previous neighbor // the currentNeighbor is the previous neighbor
// the movement is made on this neighbor // the movement is made on this neighbor
// we suppose that the neighborhood is bit string neighborhood (indexed neighbor) // we suppose that the neighborhood is bit string neighborhood (indexed neighbor)
unsigned iMove = searchExplorer.currentNeighbor.index(); unsigned iMove = searchExplorer->getCurrentNeighbor().index();
for(unsigned i = 0; i < n; i++) { for(unsigned i = 0; i < n; i++) {
if (i == iMove) if (i == iMove)
@ -202,7 +206,7 @@ private:
int ** Q; int ** Q;
/** The search explorer of the local search */ /** The search explorer of the local search */
moNeighborhoodExplorer<Neighbor> & searchExplorer; moNeighborhoodExplorer<Neighbor> * searchExplorer;
}; };
#endif #endif

View file

@ -125,6 +125,14 @@ public:
isMoved=_isMoved; isMoved=_isMoved;
} }
/**
* Getter of the current neighbor
* @return current neighbor
*/
Neighbor & getCurrentNeighbor() {
return currentNeighbor;
}
protected: protected:
// default class for the empty constructor // default class for the empty constructor
moDummyNeighborhood<Neighbor> dummyNeighborhood; moDummyNeighborhood<Neighbor> dummyNeighborhood;