New style for MO

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@787 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
canape 2007-11-16 11:25:54 +00:00
commit 7161febf9c
80 changed files with 2014 additions and 2038 deletions

View file

@ -1,4 +1,4 @@
/*
/*
* <moSimpleMoveTabuList.h>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
@ -45,107 +45,107 @@
//! Class describing a move tabu list with a limited memory.
template <class M>
class moSimpleMoveTabuList: public moTabuList < M >
{
public:
//! Alias for the type
typedef typename M::EOType EOT;
{
//! Constructor
/*
\param __size The maximum size of the move tabu list.
*/
moSimpleMoveTabuList(unsigned int __size): maxSize(__size)
{
currentSize=0;
}
public:
//! Function that indicates if, in a given state, the _move is tabu or not.
/*!
\param __move A given moMove.
\param __sol A solution.
\return true or false.
*/
bool
operator () (const M & __move, const EOT & __sol)
{
typename std::list<M>::iterator it;
it=tabuList.begin();
while(it!=tabuList.end()&&(!((*it)==__move)))
//! Alias for the type
typedef typename M::EOType EOT;
//! Constructor
/*
\param __size The maximum size of the move tabu list.
*/
moSimpleMoveTabuList(unsigned int __size): maxSize(__size)
{
currentSize=0;
}
//! Function that indicates if, in a given state, the _move is tabu or not.
/*!
\param __move A given moMove.
\param __sol A solution.
\return true or false.
*/
bool
operator () (const M & __move, const EOT & __sol)
{
typename std::list<M>::iterator it;
it=tabuList.begin();
while (it!=tabuList.end()&&(!((*it)==__move)))
{
it++;
}
return it!=tabuList.end();
}
void
add (const M & __move, const EOT & __sol)
{
it++;
}
return it!=tabuList.end();
}
void
add (const M & __move, const EOT & __sol)
{
if(currentSize!=0)
{
// Useful in the case of a move has been kept thanks to the moAspirCrit.
// In this case, the move can already be in the tabuList.
removeMove(__move);
if (currentSize!=0)
{
// Useful in the case of a move has been kept thanks to the moAspirCrit.
// In this case, the move can already be in the tabuList.
removeMove(__move);
}
tabuList.push_back(__move);
if (currentSize==maxSize)
{
tabuList.erase(tabuList.begin());
}
else
{
currentSize++;
}
}
tabuList.push_back(__move);
if(currentSize==maxSize)
{
tabuList.erase(tabuList.begin());
}
else
{
currentSize++;
}
}
void
update ()
{
//nothing to do
}
void
update ()
{
//nothing to do
}
void
init ()
{
//nothing to do
}
void
init ()
{
//nothing to do
}
private:
//! Procedure that removes a given move from the tabu list (if it is into, else do nothing).
/*!
\param __move A given moMove.
*/
void
removeMove(const M & __move)
{
typename std::list<M>::iterator it;
it=tabuList.begin();
while(it!=tabuList.end()&&(!((*it)==__move)))
{
it++;
}
private:
if(it!=tabuList.end())
{
tabuList.erase(it);
}
}
//! Procedure that removes a given move from the tabu list (if it is into, else do nothing).
/*!
\param __move A given moMove.
*/
void
removeMove(const M & __move)
{
typename std::list<M>::iterator it;
//! The maximum size of the tabu list.
unsigned int maxSize;
it=tabuList.begin();
while (it!=tabuList.end()&&(!((*it)==__move)))
{
it++;
}
//! The current size of the tabu list.
unsigned int currentSize;
//! The move tabu list.
std::list<M> tabuList;
};
if (it!=tabuList.end())
{
tabuList.erase(it);
}
}
//! The maximum size of the tabu list.
unsigned int maxSize;
//! The current size of the tabu list.
unsigned int currentSize;
//! The move tabu list.
std::list<M> tabuList;
};
#endif