Arborescence modifiée

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1651 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-01-19 09:33:54 +00:00
commit d009ffcc19
9 changed files with 14 additions and 9 deletions

View file

@ -0,0 +1,34 @@
#ifndef moIncrEvalWrapper_H
#define moIncrEvalWrapper_H
#include <eoEvalFunc.h>
#include <moEval.h>
/*
* (Old fashioned) Incremental evaluation to use with a moMoveNeighbor
* WARNING: Don't use this class unless you are an moMove user.
*/
template<class MoveNeighbor, class M>
class moIncrEvalWrapper : public moEval<MoveNeighbor>
{
public:
using moEval<BackableNeighbor>::EOT EOT;
using moEval<BackableNeighbor>::Fitness Fitness;
moIncrEvalWrapper(moIncrEval<M>& _incr):incr(_incr){}
/*
* make the evaluation of the current neighbor and update the information on this neighbor
* the evaluation could be incremental
*/
virtual void eval(MoveNeighbor& _neighbor,EOT & _solution){
_neighbor.fitness(incrEval(*(_neighbor.getMove()), _solution));
}
private:
/** the full evaluation object */
moIncrEval<M> & incrEval;
};
#endif

View file

@ -0,0 +1,69 @@
#ifndef _moMoveNeighbor_h
#define _moMoveNeighbor_h
#include <eo>
#include <neighborhood/moNeighbor.h>
#include <move/moMoveIncrEval.h>
#include <move/moMove.h>
/*
contener of the neighbor informations
*/
template< class M , class Fitness >
class moMoveNeighbor : public moNeighbor <typename M::EOType, Fitness>
{
public:
typedef typename M::EOType EOT;
// empty constructor
moMoveNeighbor() {
move=new M();
};
~moMoveNeighbor() {
delete move;
};
// copy constructeur
moMoveNeighbor(const moMoveNeighbor<M, Fitness> & _n) {
moNeighbor<EOT, Fitness>::operator=(_n);
(*move) = *(_n.getMove());
}
// assignment operator
virtual moMoveNeighbor<M, Fitness> & operator=(const moMoveNeighbor<M, Fitness> & _n) {
moNeighbor <EOT, Fitness>::operator=(_n);
(*move) = *(_n.getMove());
return *this ;
}
/*
* move the solution
*/
virtual void move(EOT & _solution){
(*move)(_solution);
}
/** Return the class id.
* @return the class name as a std::string
*/
virtual std::string className() const { return "moMoveNeighbor"; }
void setMove(M* _move){
move=_move;
}
M* getMove(){
return move;
}
private:
M* move;
};
#endif

View file

@ -0,0 +1,59 @@
#ifndef _moMoveNeighborhood_h
#define _moMoveNeighborhood_h
#include <neighborhood/moMoveNeighbor.h>
#include <neighborhood/moNeighborhood.h>
#include <move/moMoveInit.h>
#include <move/moNextMove.h>
template< class M, class Fitness >
class moMoveNeighborhood : public moNeighborhood <moMoveNeighbor<M, Fitness> >
{
public:
typedef moMoveNeighbor<M, Fitness> Neighbor;
typedef typename M::EOType EOT;
moMoveNeighborhood(moMoveInit<M>& i, moNextMove<M>& n):_init(i), _next(n), isContinue(true) {}
virtual bool hasNeighbor(EOT & solution){
return true;
}
/*
initialisation of the neighborhood
*/
virtual void init(EOT & solution, Neighbor & current){
_init(*(current._move), solution);
isContinue=true;
}
/*
Give the next neighbor
*/
virtual void next(EOT & solution, Neighbor & current){
isContinue=_next(*(current._move), solution);
}
/*
if false, there is no neighbor left to explore
*/
virtual bool cont(EOT & solution){
return isContinue;
}
/** Return the class id.
* @return the class name as a std::string
*/
virtual std::string className() const { return "moMoveNeighborhood"; }
private:
moMoveInit<M>& _init;
moNextMove<M>& _next;
bool isContinue;
};
#endif

View file

@ -0,0 +1,57 @@
/*
<moMove.h>
Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
(C) OPAC Team, LIFL, 2002-2008
Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moMove_h
#define _moMove_h
#include <eoFunctor.h>
//! Definition of a move.
/*!
A move transforms a solution to another close solution.
It describes how a solution can be modified to another one.
*/
template < class EOT >
class moMove:public eoUF < EOT &, void >
{
public:
//! Alias for the type
typedef EOT EOType;
};
#endif

View file

@ -0,0 +1,52 @@
/*
<moMoveIncrEval.h>
Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
(C) OPAC Team, LIFL, 2002-2008
Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moMoveIncrEval_h
#define _moMoveIncrEval_h
#include <eoFunctor.h>
//! (generally) Efficient evaluation function based a move and a solution.
/*!
From a move and a solution, it computes
a new fitness that could be associated to
the solution if this one is updated.
*/
template < class M, class Objective = typename M::EOType::Fitness>
class moMoveIncrEval:public eoBF < const M &, const typename M::EOType &, Objective >
{};
#endif

View file

@ -0,0 +1,50 @@
/*
<moMoveInit.h>
Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
(C) OPAC Team, LIFL, 2002-2008
Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moMoveInit_h
#define _moMoveInit_h
#include <eoFunctor.h>
//! Move (moMove) initializer
/*!
Class which allows to initiase a move.
Only a description... An object that herits from this class needs to be designed to be used.
*/
template < class M >
class moMoveInit:public eoBF < M &, const typename M::EOType &, void >
{};
#endif

View file

@ -0,0 +1,50 @@
/*
<moNextMove.h>
Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
(C) OPAC Team, LIFL, 2002-2008
Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moNextMove_h
#define _moNextMove_h
#include <eoFunctor.h>
//! Class which allows to generate a new move (moMove).
/*!
Useful for the explorer (for moTS or moHC).
Does nothing... An object that herits from this class needs to be designed for being used.
*/
template < class M >
class moNextMove:public eoBF < M &, const typename M::EOType &, bool >
{};
#endif