passage du code dans astyle

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1713 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-03-24 10:25:33 +00:00
commit dd66b5e4bd
105 changed files with 3950 additions and 3924 deletions

View file

@ -54,81 +54,81 @@ public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
/**
* Constructor
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
* @param _neighborComparator a neighbor comparator
* @param _solNeighborComparator a comparator between a solution and a neighbor
* @param _tabuList the tabu list
* @param _intensification the intensification box
* @param _diversification the diversification box
* @param _aspiration the aspiration criteria
*/
/**
* Constructor
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
* @param _neighborComparator a neighbor comparator
* @param _solNeighborComparator a comparator between a solution and a neighbor
* @param _tabuList the tabu list
* @param _intensification the intensification box
* @param _diversification the diversification box
* @param _aspiration the aspiration criteria
*/
moTSExplorer(Neighborhood& _neighborhood,
moEval<Neighbor>& _eval,
moNeighborComparator<Neighbor>& _neighborComparator,
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
moTabuList<Neighbor> & _tabuList,
moIntensification<Neighbor> & _intensification,
moDiversification<Neighbor> & _diversification,
moAspiration<Neighbor> & _aspiration
) :
moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator),
tabuList(_tabuList), intensification(_intensification), diversification(_diversification), aspiration(_aspiration)
moEval<Neighbor>& _eval,
moNeighborComparator<Neighbor>& _neighborComparator,
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
moTabuList<Neighbor> & _tabuList,
moIntensification<Neighbor> & _intensification,
moDiversification<Neighbor> & _diversification,
moAspiration<Neighbor> & _aspiration
) :
moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator),
tabuList(_tabuList), intensification(_intensification), diversification(_diversification), aspiration(_aspiration)
{
isAccept = false;
current=new Neighbor();
best=new Neighbor();
isAccept = false;
current=new Neighbor();
best=new Neighbor();
}
/**
* Destructor
*/
~moTSExplorer(){
delete current;
delete best;
/**
* Destructor
*/
~moTSExplorer() {
delete current;
delete best;
}
/**
* init tabu list, intensification box, diversification box and aspiration criteria
* @param _solution
*/
/**
* init tabu list, intensification box, diversification box and aspiration criteria
* @param _solution
*/
virtual void initParam(EOT& _solution)
{
tabuList.init(_solution);
intensification.init(_solution);
diversification.init(_solution);
aspiration.init(_solution);
bestSoFar=_solution;
tabuList.init(_solution);
intensification.init(_solution);
diversification.init(_solution);
aspiration.init(_solution);
bestSoFar=_solution;
};
/**
* update params of tabu list, intensification box, diversification box and aspiration criteria
* @param _solution
*/
/**
* update params of tabu list, intensification box, diversification box and aspiration criteria
* @param _solution
*/
virtual void updateParam(EOT& _solution)
{
if ((*this).moveApplied()){
tabuList.add(_solution, *best);
intensification.add(_solution, *best);
diversification.add(_solution, *best);
if(_solution.fitness() > bestSoFar.fitness())
bestSoFar = _solution;
}
tabuList.update(_solution, *best);
intensification.update(_solution, *best);
diversification.update(_solution, *best);
aspiration.update(_solution, *best);
if ((*this).moveApplied()) {
tabuList.add(_solution, *best);
intensification.add(_solution, *best);
diversification.add(_solution, *best);
if (_solution.fitness() > bestSoFar.fitness())
bestSoFar = _solution;
}
tabuList.update(_solution, *best);
intensification.update(_solution, *best);
diversification.update(_solution, *best);
aspiration.update(_solution, *best);
};
/**
* terminate : _solution becomes the best so far
*/
virtual void terminate(EOT & _solution){
_solution= bestSoFar;
/**
* terminate : _solution becomes the best so far
*/
virtual void terminate(EOT & _solution) {
_solution= bestSoFar;
};
@ -138,56 +138,56 @@ public:
*/
virtual void operator()(EOT & _solution)
{
bool found=false;
intensification(_solution);
diversification(_solution);
if(neighborhood.hasNeighbor(_solution))
{
//init the current neighbor
neighborhood.init(_solution, *current);
//eval the current neighbor
eval(_solution, *current);
bool found=false;
intensification(_solution);
diversification(_solution);
if (neighborhood.hasNeighbor(_solution))
{
//init the current neighbor
neighborhood.init(_solution, *current);
//eval the current neighbor
eval(_solution, *current);
//Find the first non-tabu element
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ){
// set best
(*best)= (*current);
found=true;
}
while(neighborhood.cont(_solution) && !found){
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
//Find the first non-tabu element
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ) {
// set best
(*best)= (*current);
found=true;
}
while (neighborhood.cont(_solution) && !found) {
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ){
// set best
(*best)=(*current);
found=true;
}
}
//Explore the neighborhood
if(found){
isAccept=true;
while(neighborhood.cont(_solution)){
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
//check if the current is better than the best and is not tabu or if it is aspirat (by the aspiration criteria of course)
if ( (!tabuList.check(_solution, *current) || aspiration(_solution, (*current))) && neighborComparator((*best),(*current))){
// set best
(*best)=(*current);
}
}
}
else{
isAccept=false;
}
}
else{
isAccept=false;
}
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ) {
// set best
(*best)=(*current);
found=true;
}
}
//Explore the neighborhood
if (found) {
isAccept=true;
while (neighborhood.cont(_solution)) {
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
//check if the current is better than the best and is not tabu or if it is aspirat (by the aspiration criteria of course)
if ( (!tabuList.check(_solution, *current) || aspiration(_solution, (*current))) && neighborComparator((*best),(*current))) {
// set best
(*best)=(*current);
}
}
}
else {
isAccept=false;
}
}
else {
isAccept=false;
}
};
@ -196,8 +196,8 @@ public:
* @param _solution the solution
* @return true
*/
virtual bool isContinue(EOT & _solution){
return true;
virtual bool isContinue(EOT & _solution) {
return true;
};
@ -206,10 +206,10 @@ public:
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
//move the solution
best->move(_solution);
//update its fitness
_solution.fitness(best->fitness());
//move the solution
best->move(_solution);
//update its fitness
_solution.fitness(best->fitness());
};
@ -218,8 +218,8 @@ public:
* @param _solution the solution
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution){
return isAccept;
virtual bool accept(EOT & _solution) {
return isAccept;
};
@ -236,11 +236,11 @@ protected:
// Tabu components
moTabuList<Neighbor> & tabuList;
moIntensification<Neighbor> & intensification;
moDiversification<Neighbor> & diversification;
moAspiration<Neighbor> & aspiration;
moDiversification<Neighbor> & diversification;
moAspiration<Neighbor> & aspiration;
//Current and best neighbor
Neighbor* best;
//Current and best neighbor
Neighbor* best;
Neighbor* current;
//Best so far Solution