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

@ -62,7 +62,7 @@ public:
*/
virtual bool operator() (EOT & _solution) {
if(_solution.invalid())
if (_solution.invalid())
fullEval(_solution);
// initialization of the parameter of the search (for example fill empty the tabu list)
@ -77,7 +77,7 @@ public:
// explore the neighborhood of the solution
searchExplorer(_solution);
// if a solution in the neighborhood can be accepted
if (searchExplorer.accept(_solution)){
if (searchExplorer.accept(_solution)) {
searchExplorer.move(_solution);
searchExplorer.moveApplied(true);
}

View file

@ -55,7 +55,7 @@ public :
* @param _cont a continuator
* @param _interval frequency to compute statistical operators
*/
moCheckpoint(moContinuator<Neighborhood>& _cont, unsigned int _interval=1):interval(_interval), counter(0){
moCheckpoint(moContinuator<Neighborhood>& _cont, unsigned int _interval=1):interval(_interval), counter(0) {
continuators.push_back(&_cont);
}
@ -96,7 +96,7 @@ public :
* @param _sol the corresponding solution
*/
virtual void init(EOT& _sol) {
for(unsigned i = 0; i < continuators.size(); ++i)
for (unsigned i = 0; i < continuators.size(); ++i)
continuators[i]->init(_sol);
}
@ -116,8 +116,8 @@ public :
unsigned i;
bool bContinue = true;
for (i = 0; i < stats.size(); ++i){
if(counter % interval == 0)
for (i = 0; i < stats.size(); ++i) {
if (counter % interval == 0)
(*stats[i])(_sol);
counter++;
}
@ -139,7 +139,7 @@ public :
* last call of statistic operators, monitors and updaters
* @param _sol reference of the solution
*/
void lastCall(EOT& _sol){
void lastCall(EOT& _sol) {
unsigned int i;
for (i = 0; i < stats.size(); ++i)
stats[i]->lastCall(_sol);

View file

@ -51,13 +51,13 @@ public:
* Init Continuator parameters
* @param _solution the related solution
*/
virtual void init(EOT& _solution){};
virtual void init(EOT& _solution) {};
/**
* Last Call to terminate the checkpoint
* @param _solution the related solution
*/
virtual void lastCall(EOT& _solution){};
virtual void lastCall(EOT& _solution) {};
};
#endif

View file

@ -83,7 +83,9 @@ public :
/**
* @return name of the class
*/
virtual std::string className(void) const { return "moCounterMonitorSaver"; }
virtual std::string className(void) const {
return "moCounterMonitorSaver";
}
private :
/** interval and counter value */

View file

@ -54,20 +54,22 @@ public :
* @param _dist a distance
* @param _ref the reference solution
*/
moDistanceStat(eoDistance<EOT> & _dist, EOT & _ref): moStat<EOT, T>(0, "distance"), dist(_dist), refSolution(_ref){}
moDistanceStat(eoDistance<EOT> & _dist, EOT & _ref): moStat<EOT, T>(0, "distance"), dist(_dist), refSolution(_ref) {}
/**
* Compute distance between a solution and the reference solution
* @param _sol a solution
*/
virtual void operator()(EOT & _sol){
virtual void operator()(EOT & _sol) {
value() = dist(_sol, refSolution);
}
/**
* @return name of the class
*/
virtual std::string className(void) const { return "moDistanceStat"; }
virtual std::string className(void) const {
return "moDistanceStat";
}
private:
/** the distance */

View file

@ -54,7 +54,7 @@ public :
* @param _description a description of the stat
*/
moFitnessStat(std::string _description = "fitness"):
moStat<EOT, Fitness>(Fitness(), _description){}
moStat<EOT, Fitness>(Fitness(), _description) {}
/**
* store fitness value
@ -68,7 +68,9 @@ public :
/**
* @return the name of the class
*/
virtual std::string className(void) const { return "moFitnessStat"; }
virtual std::string className(void) const {
return "moFitnessStat";
}
};
#endif

View file

@ -55,20 +55,22 @@ public :
* @param _nhStat a neighborhoodStat
*/
moMaxNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat){}
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
/**
* Set the max fitness in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol){
virtual void operator()(EOT & _sol) {
value() = nhStat.getMax();
}
/**
* @return the class name
*/
virtual std::string className(void) const { return "moMaxNeighborStat"; }
virtual std::string className(void) const {
return "moMaxNeighborStat";
}
private:
/** moNeighborhoodStat */

View file

@ -55,20 +55,22 @@ public :
* @param _nhStat a neighborhoodStat
*/
moMinNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat){}
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
/**
* Set the worst fitness in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol){
virtual void operator()(EOT & _sol) {
value() = nhStat.getMin();
}
/**
* @return the class name
*/
virtual std::string className(void) const { return "moMinNeighborStat"; }
virtual std::string className(void) const {
return "moMinNeighborStat";
}
private:
/** moNeighborhoodStat */

View file

@ -58,20 +58,22 @@ public :
* @param _nhStat a neighborhoodStat
*/
moNbInfNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
moStat<EOT, unsigned>(0, "nb inf"), nhStat(_nhStat){}
moStat<EOT, unsigned>(0, "nb inf"), nhStat(_nhStat) {}
/**
* Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol){
virtual void operator()(EOT & _sol) {
value() = nhStat.getNbInf();
}
/**
* @return the class name
*/
virtual std::string className(void) const { return "moNbInfNeighborStat"; }
virtual std::string className(void) const {
return "moNbInfNeighborStat";
}
private:
/** moNeighborhoodStat */

View file

@ -58,20 +58,22 @@ public :
* @param _nhStat a neighborhoodStat
*/
moNbSupNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
moStat<EOT, unsigned>(0, "nb sup"), nhStat(_nhStat){}
moStat<EOT, unsigned>(0, "nb sup"), nhStat(_nhStat) {}
/**
* Set the number of solutions in the neighborhood with better fitness than the current solution
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol){
virtual void operator()(EOT & _sol) {
value() = nhStat.getNbSup();
}
/**
* @return the class name
*/
virtual std::string className(void) const { return "moNbSupNeighborStat"; }
virtual std::string className(void) const {
return "moNbSupNeighborStat";
}
private:
/** moNeighborhoodStat */

View file

@ -73,12 +73,12 @@ public :
* Compute classical statistics of a solution's neighborhood
* @param _solution the corresponding solution
*/
virtual void operator()(EOT & _solution){
virtual void operator()(EOT & _solution) {
Neighbor current ;
Neighbor best ;
Neighbor lowest ;
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
//init the first neighbor
neighborhood.init(_solution, current);
@ -141,7 +141,7 @@ public :
else
sd = 0.0;
}
else{
else {
//if _solution hasn't neighbor,
value() = false;
}
@ -150,49 +150,49 @@ public :
/**
* @return the worst fitness value found in the neighborhood
*/
Fitness getMin(){
Fitness getMin() {
return min;
}
/**
* @return the best fitness value found in the neighborhood
*/
Fitness getMax(){
Fitness getMax() {
return max;
}
/**
* @return the mean fitness value of the neighborhood
*/
double getMean(){
double getMean() {
return mean;
}
/**
* @return the standard deviation value of the neighborhood
*/
double getSD(){
double getSD() {
return sd;
}
/**
* @return the size of the neighborhood
*/
unsigned getSize(){
unsigned getSize() {
return nb;
}
/**
* @return the number of neighbors having a better fitness than the current solution
*/
unsigned getNbSup(){
unsigned getNbSup() {
return nbSup;
}
/**
* @return the number of neighbors having the same fitness than the current solution
*/
unsigned getNbEqual(){
unsigned getNbEqual() {
return nbEqual;
}

View file

@ -57,20 +57,22 @@ public :
* @param _nhStat a neighborhoodStat
*/
moNeutralDegreeNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
moStat<EOT, unsigned>(0, "neutral degree"), nhStat(_nhStat){}
moStat<EOT, unsigned>(0, "neutral degree"), nhStat(_nhStat) {}
/**
* Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol){
virtual void operator()(EOT & _sol) {
value() = nhStat.getNbEqual();
}
/**
* @return the class name
*/
virtual std::string className(void) const { return "moNeutralDegreeNeighborStat"; }
virtual std::string className(void) const {
return "moNeutralDegreeNeighborStat";
}
private:
/** moNeighborhoodStat */

View file

@ -55,13 +55,13 @@ public :
* @param _nhStat a neighborhoodStat
*/
moSecondMomentNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
moStat<EOT, std::pair<double, double> >(std::make_pair(0.0,0.0), "average and stdev"), nhStat(_nhStat){}
moStat<EOT, std::pair<double, double> >(std::make_pair(0.0,0.0), "average and stdev"), nhStat(_nhStat) {}
/**
* Set the average and the standard deviation of fitness in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol){
virtual void operator()(EOT & _sol) {
value().first = nhStat.getMean();
value().second = nhStat.getSD();
}
@ -69,7 +69,9 @@ public :
/**
* @return the class name
*/
virtual std::string className(void) const { return "moSecondMomentNeighborStat"; }
virtual std::string className(void) const {
return "moSecondMomentNeighborStat";
}
private:
/** moNeighborhoodStat */

View file

@ -56,20 +56,22 @@ public :
* @param _nhStat a neighborhoodStat
*/
moSizeNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
moStat<EOT, unsigned>(0, "size"), nhStat(_nhStat){}
moStat<EOT, unsigned>(0, "size"), nhStat(_nhStat) {}
/**
* Set the number of solutions in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol){
virtual void operator()(EOT & _sol) {
value() = nhStat.getSize();
}
/**
* @return the class name
*/
virtual std::string className(void) const { return "moSizeNeighborStat"; }
virtual std::string className(void) const {
return "moSizeNeighborStat";
}
private:
/** moNeighborhoodStat */

View file

@ -53,20 +53,20 @@ public :
* @param _description a description of the parameter
*/
moSolutionStat(std::string _description = "solution"):
moStat<EOT, EOT>(EOT(), _description){}
moStat<EOT, EOT>(EOT(), _description) {}
/**
* Set the solution by copy
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol){
virtual void operator()(EOT & _sol) {
value() = _sol;
}
/**
* @return name of the class
*/
virtual std::string className(void) const{
virtual std::string className(void) const {
return "moSolutionStat";
}
};

View file

@ -53,12 +53,12 @@ public:
* @param _description a description of the parameter
*/
moStat(T _value, std::string _description):
eoValueParam<T>(_value, _description){}
eoValueParam<T>(_value, _description) {}
/**
* @return name of the class
*/
virtual std::string className(void) const{
virtual std::string className(void) const {
return "moStat";
}
};

View file

@ -57,7 +57,7 @@ public:
/**
* @return name of the class
*/
virtual std::string className(void) const{
virtual std::string className(void) const {
return "moStatBase";
}
};

View file

@ -67,33 +67,33 @@ public:
/**
* Destructor
*/
~moFirstImprExplorer(){
~moFirstImprExplorer() {
delete current;
}
/**
* initParam: NOTHING TO DO
*/
virtual void initParam(EOT & solution){};
virtual void initParam(EOT & solution) {};
/**
* updateParam: NOTHING TO DO
*/
virtual void updateParam(EOT & solution){};
virtual void updateParam(EOT & solution) {};
/**
* terminate: NOTHING TO DO
*/
virtual void terminate(EOT & solution){};
virtual void terminate(EOT & solution) {};
/**
* Explore the neighborhood of a solution
* @param _solution
*/
virtual void operator()(EOT & _solution){
virtual void operator()(EOT & _solution) {
//Test if _solution has a Neighbor
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
//init the first neighbor
neighborhood.init(_solution, (*current));
@ -108,7 +108,7 @@ public:
eval(_solution, (*current));
}
}
else{
else {
//if _solution hasn't neighbor,
isAccept=false;
}
@ -140,7 +140,7 @@ public:
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution) {
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
isAccept = solNeighborComparator(_solution, (*current)) ;
}
return isAccept;

View file

@ -70,9 +70,9 @@ public:
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
unsigned _nbStep) :
moSimpleHCneutralExplorer<Neighborhood>(_neighborhood, _eval, _neighborComparator, _solNeighborComparator),
nbStep(_nbStep){
nbStep(_nbStep) {
//Some cycle is possible with equals fitness solutions if the neighborhood is not random
if(!neighborhood.isRandom()){
if (!neighborhood.isRandom()) {
std::cout << "moHCneutralExplorer::Warning -> the neighborhood used is not random" << std::endl;
}
}
@ -80,13 +80,13 @@ public:
/**
* Destructor
*/
~moHCneutralExplorer(){
~moHCneutralExplorer() {
}
/**
* initial number of step
*/
virtual void initParam(EOT & solution){
virtual void initParam(EOT & solution) {
moSimpleHCneutralExplorer<Neighborhood>::initParam(solution);
step = 0;
@ -95,7 +95,7 @@ public:
/**
* one more step
*/
virtual void updateParam(EOT & solution){
virtual void updateParam(EOT & solution) {
moSimpleHCneutralExplorer<Neighborhood>::updateParam(solution);
step++;
@ -116,7 +116,7 @@ public:
* @return true if the best neighbor ameliorate the fitness or is equals
*/
virtual bool accept(EOT & _solution) {
if(neighborhood.hasNeighbor(_solution))
if (neighborhood.hasNeighbor(_solution))
isAccept = solNeighborComparator(_solution, bestVector[0]) || solNeighborComparator.equals(_solution, bestVector[0]) ;
return isAccept;
};

View file

@ -69,7 +69,7 @@ public:
moMetropolisHastingExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) {
isAccept = false;
current=new Neighbor();
if(!neighborhood.isRandom()){
if (!neighborhood.isRandom()) {
std::cout << "moMetropolisHastingExplorer::Warning -> the neighborhood used is not random" << std::endl;
}
}
@ -77,7 +77,7 @@ public:
/**
* Destructor
*/
~moMetropolisHastingExplorer(){
~moMetropolisHastingExplorer() {
delete current;
}
@ -85,7 +85,7 @@ public:
* initialization of the number of step to be done
* @param _solution the solution (unused here)
*/
virtual void initParam(EOT & _solution){
virtual void initParam(EOT & _solution) {
step = 0;
isAccept = true;
};
@ -94,7 +94,7 @@ public:
* increase the number of step
* @param _solution the solution (unused here)
*/
virtual void updateParam(EOT & _solution){
virtual void updateParam(EOT & _solution) {
step++;
};
@ -102,22 +102,22 @@ public:
* terminate: NOTHING TO DO
* @param _solution the solution (unused here)
*/
virtual void terminate(EOT & _solution){};
virtual void terminate(EOT & _solution) {};
/**
* Explore the neighborhood of a solution
* @param _solution
*/
virtual void operator()(EOT & _solution){
virtual void operator()(EOT & _solution) {
//Test if _solution has a Neighbor
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
//init the first neighbor
neighborhood.init(_solution, (*current));
//eval the _solution moved with the neighbor and stock the result in the neighbor
eval(_solution, (*current));
}
else{
else {
//if _solution hasn't neighbor,
isAccept=false;
}
@ -150,19 +150,19 @@ public:
*/
virtual bool accept(EOT & _solution) {
double alpha=0.0;
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
if (solNeighborComparator(_solution, *current))
isAccept = true;
else{
if(_solution.fitness() != 0){
if( (double)current->fitness() < (double)_solution.fitness()) // maximizing
else {
if (_solution.fitness() != 0) {
if ( (double)current->fitness() < (double)_solution.fitness()) // maximizing
alpha = (double) current->fitness() / (double) _solution.fitness();
else //minimizing
alpha = (double) _solution.fitness() / (double) current->fitness();
isAccept = (rng.uniform() < alpha) ;
}
else{
if( (double)current->fitness() < (double)_solution.fitness()) // maximizing
else {
if ( (double)current->fitness() < (double)_solution.fitness()) // maximizing
isAccept = true;
else
isAccept = false;

View file

@ -102,7 +102,7 @@ public:
* Getter for variable "isMoved"
* @return true if move is applied
*/
bool moveApplied(){
bool moveApplied() {
return isMoved;
}
@ -110,7 +110,7 @@ public:
* Setter for variable "isMoved"
* @param _isMoved
*/
void moveApplied(bool _isMoved){
void moveApplied(bool _isMoved) {
isMoved=_isMoved;
}

View file

@ -69,7 +69,7 @@ public:
nbStep(_nbStep) {
isAccept = false;
current=new Neighbor();
if(!neighborhood.isRandom()){
if (!neighborhood.isRandom()) {
std::cout << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random" << std::endl;
}
}
@ -77,14 +77,14 @@ public:
/**
* Destructor
*/
~moRandomNeutralWalkExplorer(){
~moRandomNeutralWalkExplorer() {
delete current;
}
/**
* initialization of the number of step to be done
*/
virtual void initParam(EOT & solution){
virtual void initParam(EOT & solution) {
step = 0;
isAccept = true;
};
@ -92,22 +92,22 @@ public:
/**
* increase the number of step
*/
virtual void updateParam(EOT & solution){
virtual void updateParam(EOT & solution) {
step++;
};
/**
* terminate: NOTHING TO DO
*/
virtual void terminate(EOT & solution){};
virtual void terminate(EOT & solution) {};
/**
* Explore the neighborhood of a solution
* @param _solution
*/
virtual void operator()(EOT & _solution){
virtual void operator()(EOT & _solution) {
//Test if _solution has a Neighbor
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
//init the first neighbor
neighborhood.init(_solution, (*current));
@ -122,7 +122,7 @@ public:
eval(_solution, (*current));
}
}
else{
else {
//if _solution hasn't neighbor,
isAccept=false;
}
@ -154,7 +154,7 @@ public:
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution) {
if(neighborhood.hasNeighbor(_solution))
if (neighborhood.hasNeighbor(_solution))
isAccept = solNeighborComparator.equals(_solution, (*current)) ;
return isAccept;
};

View file

@ -63,7 +63,7 @@ public:
current=new Neighbor();
// number of step done
step = 0;
if(!neighborhood.isRandom()){
if (!neighborhood.isRandom()) {
std::cout << "moRandomWalkExplorer::Warning -> the neighborhood used is not random" << std::endl;
}
}
@ -71,14 +71,14 @@ public:
/**
* Destructor
*/
~moRandomWalkExplorer(){
~moRandomWalkExplorer() {
delete current;
}
/**
* initialization of the number of step to be done
*/
virtual void initParam(EOT & solution){
virtual void initParam(EOT & solution) {
step = 0;
isAccept = true;
};
@ -86,23 +86,23 @@ public:
/**
* increase the number of step
*/
virtual void updateParam(EOT & solution){
virtual void updateParam(EOT & solution) {
step++;
};
/**
* terminate: NOTHING TO DO
*/
virtual void terminate(EOT & solution){};
virtual void terminate(EOT & solution) {};
/**
* Explore the neighborhood with only one random solution
* @param _solution
*/
virtual void operator()(EOT & _solution){
virtual void operator()(EOT & _solution) {
//Test if _solution has a Neighbor
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
//init the first neighbor
neighborhood.init(_solution, (*current));
@ -111,7 +111,7 @@ public:
isAccept = true;
}
else{
else {
//if _solution hasn't neighbor,
isAccept=false;
}
@ -143,7 +143,7 @@ public:
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution) {
if(neighborhood.hasNeighbor(_solution))
if (neighborhood.hasNeighbor(_solution))
isAccept = true ;
return isAccept;
};

View file

@ -68,7 +68,7 @@ public:
/**
* Destructor
*/
~moSimpleHCexplorer(){
~moSimpleHCexplorer() {
delete current;
delete best;
}
@ -76,27 +76,27 @@ public:
/**
* initParam: NOTHING TO DO
*/
virtual void initParam(EOT & solution){};
virtual void initParam(EOT & solution) {};
/**
* updateParam: NOTHING TO DO
*/
virtual void updateParam(EOT & solution){};
virtual void updateParam(EOT & solution) {};
/**
* terminate: NOTHING TO DO
*/
virtual void terminate(EOT & solution){};
virtual void terminate(EOT & solution) {};
/**
* Explore the neighborhood of a solution
* @param _solution
*/
virtual void operator()(EOT & _solution){
virtual void operator()(EOT & _solution) {
//est qu'on peut initializer
//Test if _solution has a Neighbor
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
//init the first neighbor
neighborhood.init(_solution, (*current));
@ -119,7 +119,7 @@ public:
}
}
else{
else {
//if _solution hasn't neighbor,
isAccept=false;
}
@ -151,7 +151,7 @@ public:
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution) {
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
isAccept = solNeighborComparator(_solution, (*best)) ;
}
return isAccept;

View file

@ -75,14 +75,14 @@ public:
/**
* Destructor
*/
~moSimpleHCneutralExplorer(){
~moSimpleHCneutralExplorer() {
delete current;
}
/**
* empty the vector of best solutions
*/
virtual void initParam(EOT & solution){
virtual void initParam(EOT & solution) {
// delete all the best solutions
bestVector.clear();
};
@ -90,7 +90,7 @@ public:
/**
* empty the vector of best solutions
*/
virtual void updateParam(EOT & solution){
virtual void updateParam(EOT & solution) {
// delete all the best solutions
bestVector.clear();
};
@ -98,16 +98,16 @@ public:
/**
* terminate: NOTHING TO DO
*/
virtual void terminate(EOT & solution){};
virtual void terminate(EOT & solution) {};
/**
* Explore the neighborhood of a solution
* @param _solution
*/
virtual void operator()(EOT & _solution){
virtual void operator()(EOT & _solution) {
//Test if _solution has a Neighbor
if(neighborhood.hasNeighbor(_solution)){
if (neighborhood.hasNeighbor(_solution)) {
//init the first neighbor
neighborhood.init(_solution, (*current));
@ -170,7 +170,7 @@ public:
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution) {
if(neighborhood.hasNeighbor(_solution))
if (neighborhood.hasNeighbor(_solution))
isAccept = solNeighborComparator(_solution, bestVector[0]) ;
return isAccept;
};

View file

@ -85,7 +85,7 @@ public:
/**
* Destructor
*/
~moTSExplorer(){
~moTSExplorer() {
delete current;
delete best;
}
@ -110,11 +110,11 @@ public:
*/
virtual void updateParam(EOT& _solution)
{
if ((*this).moveApplied()){
if ((*this).moveApplied()) {
tabuList.add(_solution, *best);
intensification.add(_solution, *best);
diversification.add(_solution, *best);
if(_solution.fitness() > bestSoFar.fitness())
if (_solution.fitness() > bestSoFar.fitness())
bestSoFar = _solution;
}
tabuList.update(_solution, *best);
@ -127,7 +127,7 @@ public:
/**
* terminate : _solution becomes the best so far
*/
virtual void terminate(EOT & _solution){
virtual void terminate(EOT & _solution) {
_solution= bestSoFar;
};
@ -141,7 +141,7 @@ public:
bool found=false;
intensification(_solution);
diversification(_solution);
if(neighborhood.hasNeighbor(_solution))
if (neighborhood.hasNeighbor(_solution))
{
//init the current neighbor
neighborhood.init(_solution, *current);
@ -149,43 +149,43 @@ public:
eval(_solution, *current);
//Find the first non-tabu element
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ){
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ) {
// set best
(*best)= (*current);
found=true;
}
while(neighborhood.cont(_solution) && !found){
while (neighborhood.cont(_solution) && !found) {
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ){
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ) {
// set best
(*best)=(*current);
found=true;
}
}
//Explore the neighborhood
if(found){
if (found) {
isAccept=true;
while(neighborhood.cont(_solution)){
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))){
if ( (!tabuList.check(_solution, *current) || aspiration(_solution, (*current))) && neighborComparator((*best),(*current))) {
// set best
(*best)=(*current);
}
}
}
else{
else {
isAccept=false;
}
}
else{
else {
isAccept=false;
}
};
@ -196,7 +196,7 @@ public:
* @param _solution the solution
* @return true
*/
virtual bool isContinue(EOT & _solution){
virtual bool isContinue(EOT & _solution) {
return true;
};
@ -218,7 +218,7 @@ public:
* @param _solution the solution
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution){
virtual bool accept(EOT & _solution) {
return isAccept;
};

View file

@ -17,7 +17,7 @@ public:
* init the best solution
* @param _sol the best solution found
*/
void init(EOT & _sol){
void init(EOT & _sol) {
bestFoundSoFar = _sol;
}
@ -26,7 +26,7 @@ public:
* @param _sol a solution
* @param _neighbor a neighbor
*/
void update(EOT & _sol, Neighbor & _neighbor){
void update(EOT & _sol, Neighbor & _neighbor) {
if (bestFoundSoFar.fitness() < _sol.fitness())
bestFoundSoFar = _sol;
}
@ -38,7 +38,7 @@ public:
* @param _neighbor a neighbor
* @return true if _neighbor fitness is better than the "bestFoundSoFar"
*/
bool operator()(EOT & _sol, Neighbor & _neighbor){
bool operator()(EOT & _sol, Neighbor & _neighbor) {
return (bestFoundSoFar.fitness() < _neighbor.fitness());
}
@ -46,7 +46,7 @@ public:
* Getter
* @return a reference on the best found so far solution
*/
EOT& getBest(){
EOT& getBest() {
return bestFoundSoFar;
}

View file

@ -9,6 +9,6 @@
*/
template< class Neighbor >
class moDiversification : public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool>
{};
{};
#endif

View file

@ -35,7 +35,7 @@ public:
/**
* @return always false
*/
bool operator()(EOT &){
bool operator()(EOT &) {
return false;
}
};

View file

@ -35,7 +35,7 @@ public:
/**
* @return always false
*/
bool operator()(EOT &){
bool operator()(EOT &) {
return false;
}
};

View file

@ -9,6 +9,6 @@
*/
template< class Neighbor >
class moIntensification : public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool>
{};
{};
#endif

View file

@ -19,7 +19,7 @@ public:
* @param _maxSize maximum size of the tabu list
* @param _howlong how many iteration a move is tabu
*/
moSolVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong){
moSolVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong) {
tabuList.reserve(_maxSize);
tabuList.resize(0);
}
@ -28,7 +28,7 @@ public:
* init the tabuList by clearing the memory
* @param _sol the current solution
*/
virtual void init(EOT & _sol){
virtual void init(EOT & _sol) {
clearMemory();
}
@ -38,15 +38,15 @@ public:
* @param _sol the current solution
* @param _neighbor the current neighbor (unused)
*/
virtual void add(EOT & _sol, Neighbor & _neighbor){
virtual void add(EOT & _sol, Neighbor & _neighbor) {
if(tabuList.size() < maxSize){
if (tabuList.size() < maxSize) {
std::pair<EOT, unsigned int> tmp;
tmp.first=_sol;
tmp.second=howlong;
tabuList.push_back(tmp);
}
else{
else {
tabuList[index%maxSize].first = _sol;
tabuList[index%maxSize].second = howlong;
index++;
@ -58,8 +58,8 @@ public:
* @param _sol the current solution
* @param _neighbor the current neighbor (unused)
*/
virtual void update(EOT & _sol, Neighbor & _neighbor){
for(unsigned int i=0; i<tabuList.size(); i++)
virtual void update(EOT & _sol, Neighbor & _neighbor) {
for (unsigned int i=0; i<tabuList.size(); i++)
tabuList[i].second--;
}
@ -69,10 +69,10 @@ public:
* @param _neighbor the current neighbor (unused)
* @return true if tabuList contains _sol
*/
virtual bool check(EOT & _sol, Neighbor & _neighbor){
virtual bool check(EOT & _sol, Neighbor & _neighbor) {
EOT tmp=_sol;
_neighbor.move(tmp);
for(unsigned int i=0; i<tabuList.size(); i++){
for (unsigned int i=0; i<tabuList.size(); i++) {
if ((howlong > 0 && tabuList[i].second > 0 && tabuList[i].first == tmp) || (howlong==0 && tabuList[i].first==tmp))
return true;
}
@ -82,7 +82,7 @@ public:
/**
* clearMemory: remove all solution of the tabuList
*/
virtual void clearMemory(){
virtual void clearMemory() {
tabuList.resize(0);
index = 0;
}

View file

@ -87,10 +87,10 @@ public:
std::string fitness_str;
int pos = _is.tellg();
_is >> fitness_str;
if (fitness_str == "INVALID"){
if (fitness_str == "INVALID") {
throw std::runtime_error("invalid fitness");
}
else{
else {
Fitness repFit ;
_is.seekg(pos); // rewind
_is >> repFit;

View file

@ -50,7 +50,7 @@ public:
/**
* Default Constructor
*/
moIndexNeighbor() : moNeighbor<EOT, Fitness>(), key(0){}
moIndexNeighbor() : moNeighbor<EOT, Fitness>(), key(0) {}
/**
* Copy Constructor
@ -80,7 +80,7 @@ public:
* Getter
* @return index of the IndexNeighbor
*/
unsigned int index(){
unsigned int index() {
return key;
}
@ -88,7 +88,7 @@ public:
* Setter
* @param _key index of the IndexNeighbor
*/
void index(unsigned int _key){
void index(unsigned int _key) {
key=_key;
}

View file

@ -53,7 +53,7 @@ public:
* Constructor
* @param _neighborhoodSize the size of the neighborhood
*/
moIndexNeighborhood(unsigned int _neighborhoodSize):neighborhoodSize(_neighborhoodSize){}
moIndexNeighborhood(unsigned int _neighborhoodSize):neighborhoodSize(_neighborhoodSize) {}
/**
* Return the class id.

View file

@ -51,7 +51,7 @@ public:
/**
* Default Constructor
*/
moNeighbor(){}
moNeighbor() {}
/**
* Copy Constructor
@ -98,7 +98,7 @@ public:
* Set fitness. At the same time, validates it.
* @param _fitness new fitness value.
*/
void fitness(const Fitness& _fitness){
void fitness(const Fitness& _fitness) {
repFitness = _fitness;
}
@ -106,7 +106,9 @@ public:
* Return the class id.
* @return the class name as a std::string
*/
virtual std::string className() const { return "moNeighbor"; }
virtual std::string className() const {
return "moNeighbor";
}
/**
* Read object.

View file

@ -52,12 +52,12 @@ public:
/**
* Default Constructor
*/
moNeighborhood(){}
moNeighborhood() {}
/**
* @return if the neighborhood is random
*/
virtual bool isRandom(){
virtual bool isRandom() {
return false;
}

View file

@ -59,7 +59,7 @@ public:
* Constructor
* @param _neighborhoodSize the size of the neighborhood
*/
moOrderNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize), currentIndex(0){}
moOrderNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize), currentIndex(0) {}
/**
* Test if it exist a neighbor
@ -105,7 +105,7 @@ public:
* Getter
* @return the position in the Neighborhood
*/
unsigned int position(){
unsigned int position() {
return currentIndex;
}

View file

@ -33,11 +33,11 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <neighborhood/moNeighborhood.h>
template< class Neighbor >
class moRndNeighborhood : virtual public moNeighborhood<Neighbor>{
class moRndNeighborhood : virtual public moNeighborhood<Neighbor> {
public:
bool isRandom(){
bool isRandom() {
return true;
}
};

View file

@ -60,7 +60,7 @@ public:
* Constructor
* @param _neighborhoodSize the size of the neighborhood
*/
moRndWithReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize){}
moRndWithReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize) {}
/**
* Test if it exist a neighbor

View file

@ -60,8 +60,8 @@ public:
* Constructor
* @param _neighborhoodSize the size of the neighborhood
*/
moRndWithoutReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize), maxIndex(0){
for(unsigned int i=0; i < neighborhoodSize; i++)
moRndWithoutReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize), maxIndex(0) {
for (unsigned int i=0; i < neighborhoodSize; i++)
indexVector.push_back(i);
}
@ -119,7 +119,7 @@ public:
* Getter
* @return the position in the Neighborhood
*/
unsigned int position(){
unsigned int position() {
return indexVector[maxIndex];
}

View file

@ -15,13 +15,13 @@ public:
using moEval<BackableNeighbor>::EOT EOT;
using moEval<BackableNeighbor>::Fitness Fitness;
moIncrEvalWrapper(moIncrEval<M>& _incr):incr(_incr){}
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){
virtual void eval(MoveNeighbor& _neighbor,EOT & _solution) {
_neighbor.fitness(incrEval(*(_neighbor.getMove()), _solution));
}

View file

@ -48,7 +48,7 @@
template < class EOT >
class moMove:public eoUF < EOT &, void >
{
public:
public:
// Alias for the type
typedef EOT EOType;

View file

@ -47,6 +47,6 @@
*/
template < class M, class Objective = typename M::EOType::Fitness>
class moMoveIncrEval:public eoBF < const M &, const typename M::EOType &, Objective >
{};
{};
#endif

View file

@ -45,6 +45,6 @@
*/
template < class M >
class moMoveInit:public eoBF < M &, const typename M::EOType &, void >
{};
{};
#endif

View file

@ -12,7 +12,7 @@
contener of the neighbor informations
*/
template< class M , class Fitness >
class moMoveNeighbor : public moNeighbor <typename M::EOType, Fitness>
class moMoveNeighbor : public moNeighbor <typename M::EOType, Fitness>
{
public:
@ -43,20 +43,22 @@ public:
/*
* move the solution
*/
virtual void move(EOT & _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"; }
virtual std::string className() const {
return "moMoveNeighbor";
}
void setMove(M* _move){
void setMove(M* _move) {
move=_move;
}
M* getMove(){
M* getMove() {
return move;
}

View file

@ -8,7 +8,7 @@
#include <move/moNextMove.h>
template< class M, class Fitness >
class moMoveNeighborhood : public moNeighborhood <moMoveNeighbor<M, Fitness> >
class moMoveNeighborhood : public moNeighborhood <moMoveNeighbor<M, Fitness> >
{
public:
@ -17,14 +17,14 @@ public:
moMoveNeighborhood(moMoveInit<M>& i, moNextMove<M>& n):_init(i), _next(n), isContinue(true) {}
virtual bool hasNeighbor(EOT & solution){
virtual bool hasNeighbor(EOT & solution) {
return true;
}
/*
initialisation of the neighborhood
*/
virtual void init(EOT & solution, Neighbor & current){
virtual void init(EOT & solution, Neighbor & current) {
_init(*(current._move), solution);
isContinue=true;
}
@ -32,23 +32,25 @@ public:
/*
Give the next neighbor
*/
virtual void next(EOT & solution, Neighbor & current){
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){
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"; }
virtual std::string className() const {
return "moMoveNeighborhood";
}
private:
private:
moMoveInit<M>& _init;
moNextMove<M>& _next;
bool isContinue;

View file

@ -45,6 +45,6 @@
*/
template < class M >
class moNextMove:public eoBF < M &, const typename M::EOType &, bool >
{};
{};
#endif

View file

@ -54,44 +54,44 @@
typedef eoBit<eoMinimizingFitness> bitVector;
typedef moBitNeighbor<eoMinimizingFitness> bitNeighbor ;
class moDummyRndNeighborhood: public moOrderNeighborhood<bitNeighbor>/*, public moRndNeighborhood<bitNeighbor>*/{
class moDummyRndNeighborhood: public moOrderNeighborhood<bitNeighbor>/*, public moRndNeighborhood<bitNeighbor>*/ {
public:
moDummyRndNeighborhood(unsigned int a): moOrderNeighborhood<bitNeighbor>(a){}
moDummyRndNeighborhood(unsigned int a): moOrderNeighborhood<bitNeighbor>(a) {}
};
typedef moDummyRndNeighborhood bitNeighborhood ;
typedef EO<int> Solution;
class moDummyNeighbor : public moNeighbor<Solution,int>{
class moDummyNeighbor : public moNeighbor<Solution,int> {
public:
virtual void move(Solution & _solution){}
virtual void move(Solution & _solution) {}
};
class moDummyBackableNeighbor : public moBackableNeighbor<Solution,int>{
class moDummyBackableNeighbor : public moBackableNeighbor<Solution,int> {
public:
virtual void move(Solution & _solution){}
virtual void moveBack(Solution & _solution){}
virtual void move(Solution & _solution) {}
virtual void moveBack(Solution & _solution) {}
};
class moDummyNeighborhood : public moNeighborhood<moDummyNeighbor>{
class moDummyNeighborhood : public moNeighborhood<moDummyNeighbor> {
public:
typedef moDummyNeighbor Neighbor;
moDummyNeighborhood():i(0),j(0){}
moDummyNeighborhood():i(0),j(0) {}
virtual bool hasNeighbor(EOT & _solution){
virtual bool hasNeighbor(EOT & _solution) {
bool res;
if(i%3==0)
if (i%3==0)
res=false;
else
res=true;
i++;
return res;
}
virtual void init(EOT & _solution, Neighbor & _current){}
virtual void next(EOT & _solution, Neighbor & _current){}
virtual bool cont(EOT & _solution){
virtual void init(EOT & _solution, Neighbor & _current) {}
virtual void next(EOT & _solution, Neighbor & _current) {}
virtual bool cont(EOT & _solution) {
j++;
return (j%10!=0);
}
@ -100,10 +100,10 @@ private:
int i,j;
};
class moDummyEval: public eoEvalFunc<Solution>{
class moDummyEval: public eoEvalFunc<Solution> {
public:
void operator()(Solution& _sol){
if(_sol.invalid())
void operator()(Solution& _sol) {
if (_sol.invalid())
_sol.fitness(100);
else
_sol.fitness(_sol.fitness()+50);
@ -122,7 +122,7 @@ public:
void operator() (bitVector& _sol, bitNeighbor& _n) {
unsigned int fit = _sol.fitness();
if(_sol[_n.index()])
if (_sol[_n.index()])
fit--;
else
fit++;
@ -150,14 +150,14 @@ class monitor1 : public eoMonitor
{
public:
monitor1(unsigned int& _a): a(_a){}
monitor1(unsigned int& _a): a(_a) {}
eoMonitor& operator()(){
eoMonitor& operator()() {
a++;
return *this;
}
void lastCall(){
void lastCall() {
a++;
}
@ -169,14 +169,14 @@ class monitor2 : public eoMonitor
{
public:
monitor2(unsigned int& _a): a(_a){}
monitor2(unsigned int& _a): a(_a) {}
eoMonitor& operator()(){
eoMonitor& operator()() {
a++;
return *this;
}
void lastCall(){
void lastCall() {
a++;
}
@ -187,13 +187,13 @@ private:
class updater1: public eoUpdater
{
public:
updater1(unsigned int& _a): a(_a){}
updater1(unsigned int& _a): a(_a) {}
void operator()(){
void operator()() {
a++;
}
void lastCall(){
void lastCall() {
a++;
}

View file

@ -33,7 +33,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moBestImprAspiration] => START" << std::endl;

View file

@ -37,7 +37,7 @@
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moBitNeighbor] => START" << std::endl;

View file

@ -36,7 +36,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moCheckpoint] => START" << std::endl;

View file

@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cassert>
int main(){
int main() {
std::cout << "[t-moCounterMonitorSaver] => START" << std::endl;

View file

@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moDistanceStat] => START" << std::endl;

View file

@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moDummyMemory] => START" << std::endl;

View file

@ -36,7 +36,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moFirstImprExplorer] => START" << std::endl;

View file

@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moFitnessStat] => START" << std::endl;

View file

@ -38,7 +38,7 @@
#include <cstdlib>
#include <cassert>
int main(){
int main() {
//Pas grand chose à faire: le gros du travail est fait par le voisin et l'eval

View file

@ -38,7 +38,7 @@
#include <cstdlib>
#include <cassert>
int main(){
int main() {
//Pas grand chose à faire: le gros du travail est fait par le voisin et l'eval

View file

@ -36,7 +36,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moHCneutralExplorer] => START" << std::endl;

View file

@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moMetropolisHastingExplorer] => START" << std::endl;
@ -60,9 +60,9 @@ int main(){
unsigned int oui=0, non=0;
//test de l'acceptation d'un voisin non améliorant
for(unsigned int i=0; i<1000; i++){
for (unsigned int i=0; i<1000; i++) {
test(sol);
if(test.accept(sol))
if (test.accept(sol))
oui++;
else
non++;

View file

@ -37,7 +37,7 @@
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moNeighbor] => START" << std::endl;

View file

@ -40,7 +40,7 @@
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moNeighborComparator] => START" << std::endl;

View file

@ -46,7 +46,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
/*
* Tests all classes depending of moNeighborhoodStat.h
*/
int main(){
int main() {
//test de moNeighborhoodStat.h
std::cout << "[t-moNeighborhoodStat] => START" << std::endl;
@ -81,7 +81,7 @@ int main(){
assert(test.getMax()==6);
assert(test.getMean()==6.6);
double sd=test.getSD();
assert(test.getSD()>0.966 && test.getSD()<0.967);
assert(sd>0.966 && sd<0.967);
assert(test.getSize()==10);
assert(test.getNbSup()==7);
assert(test.getNbInf()==3);

View file

@ -39,7 +39,7 @@
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moOrderNeighborhood] => START" << std::endl;

View file

@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moRandomNeutralWalkExplorer] => START" << std::endl;

View file

@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moRandomWalkExplorer] => START" << std::endl;

View file

@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moRndWithReplNeighborhood] => START" << std::endl;
@ -52,7 +52,7 @@ int main(){
test.init(sol,n);
//on s'assure qu'on a bien toujours bien l'index 0, 1 ou 2 qui est renvoyé
for(unsigned int i=0; i<100; i++){
for (unsigned int i=0; i<100; i++) {
a=n.index();
test.next(sol,n);

View file

@ -35,7 +35,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moRndWithoutReplNeighborhood] => START" << std::endl;

View file

@ -41,7 +41,7 @@
#include <cstdlib>
#include <cassert>
int main(){
int main() {
//Pas grand chose à faire: le gros du travail est fait par le voisin et l'eval

View file

@ -36,7 +36,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moSimpleHCneutralExplorer] => START" << std::endl;

View file

@ -40,7 +40,7 @@
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moSolNeighborComparator] => START" << std::endl;

View file

@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moSolVectorTabuList] => START" << std::endl;

View file

@ -34,7 +34,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moSolutionStat] => START" << std::endl;

View file

@ -38,7 +38,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <cstdlib>
#include <cassert>
int main(){
int main() {
std::cout << "[t-moTSExplorer] => START" << std::endl;

View file

@ -39,7 +39,7 @@
#include <cassert>
int main(){
int main() {
std::cout << "[t-moTrueContinuator] => START" << std::endl;

View file

@ -72,11 +72,11 @@ void main_function(int argc, char **argv)
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp()){
if (parser.userNeedsHelp()) {
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != ""){
if (statusParam.value() != "") {
ofstream os(statusParam.value().c_str());
os << parser;// and you can use that file as parameter file
}
@ -187,10 +187,10 @@ void main_function(int argc, char **argv)
int main(int argc, char **argv)
{
try{
try {
main_function(argc, argv);
}
catch(exception& e){
catch (exception& e) {
cout << "Exception: " << e.what() << '\n';
}
return 1;

View file

@ -76,11 +76,11 @@ void main_function(int argc, char **argv)
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp()){
if (parser.userNeedsHelp()) {
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != ""){
if (statusParam.value() != "") {
ofstream os(statusParam.value().c_str());
os << parser;// and you can use that file as parameter file
}
@ -191,10 +191,10 @@ void main_function(int argc, char **argv)
int main(int argc, char **argv)
{
try{
try {
main_function(argc, argv);
}
catch(exception& e){
catch (exception& e) {
cout << "Exception: " << e.what() << '\n';
}
return 1;

View file

@ -76,11 +76,11 @@ void main_function(int argc, char **argv)
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp()){
if (parser.userNeedsHelp()) {
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != ""){
if (statusParam.value() != "") {
ofstream os(statusParam.value().c_str());
os << parser;// and you can use that file as parameter file
}
@ -191,10 +191,10 @@ void main_function(int argc, char **argv)
int main(int argc, char **argv)
{
try{
try {
main_function(argc, argv);
}
catch(exception& e){
catch (exception& e) {
cout << "Exception: " << e.what() << '\n';
}
return 1;

View file

@ -94,11 +94,11 @@ void main_function(int argc, char **argv)
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp()){
if (parser.userNeedsHelp()) {
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != ""){
if (statusParam.value() != "") {
ofstream os(statusParam.value().c_str());
os << parser;// and you can use that file as parameter file
}
@ -268,10 +268,10 @@ void main_function(int argc, char **argv)
int main(int argc, char **argv)
{
try{
try {
main_function(argc, argv);
}
catch(exception& e){
catch (exception& e) {
cout << "Exception: " << e.what() << '\n';
}
return 1;

View file

@ -82,11 +82,11 @@ void main_function(int argc, char **argv)
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp()){
if (parser.userNeedsHelp()) {
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != ""){
if (statusParam.value() != "") {
ofstream os(statusParam.value().c_str());
os << parser;// and you can use that file as parameter file
}
@ -233,10 +233,10 @@ void main_function(int argc, char **argv)
int main(int argc, char **argv)
{
try{
try {
main_function(argc, argv);
}
catch(exception& e){
catch (exception& e) {
cout << "Exception: " << e.what() << '\n';
}
return 1;

View file

@ -72,11 +72,11 @@ void main_function(int argc, char **argv)
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp()){
if (parser.userNeedsHelp()) {
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != ""){
if (statusParam.value() != "") {
ofstream os(statusParam.value().c_str());
os << parser;// and you can use that file as parameter file
}
@ -187,10 +187,10 @@ void main_function(int argc, char **argv)
int main(int argc, char **argv)
{
try{
try {
main_function(argc, argv);
}
catch(exception& e){
catch (exception& e) {
cout << "Exception: " << e.what() << '\n';
}
return 1;

View file

@ -72,11 +72,11 @@ void main_function(int argc, char **argv)
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp()){
if (parser.userNeedsHelp()) {
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != ""){
if (statusParam.value() != "") {
ofstream os(statusParam.value().c_str());
os << parser;// and you can use that file as parameter file
}
@ -187,10 +187,10 @@ void main_function(int argc, char **argv)
int main(int argc, char **argv)
{
try{
try {
main_function(argc, argv);
}
catch(exception& e){
catch (exception& e) {
cout << "Exception: " << e.what() << '\n';
}
return 1;

View file

@ -74,11 +74,11 @@ void main_function(int argc, char **argv)
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp()){
if (parser.userNeedsHelp()) {
parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != ""){
if (statusParam.value() != "") {
ofstream os(statusParam.value().c_str());
os << parser;// and you can use that file as parameter file
}
@ -193,10 +193,10 @@ void main_function(int argc, char **argv)
int main(int argc, char **argv)
{
try{
try {
main_function(argc, argv);
}
catch(exception& e){
catch (exception& e) {
cout << "Exception: " << e.what() << '\n';
}
return 1;

View file

@ -205,7 +205,7 @@ int main(int argc, char **argv)
{
main_function(argc, argv);
}
catch(exception& e)
catch (exception& e)
{
cout << "Exception: " << e.what() << '\n';
}

View file

@ -13,7 +13,7 @@ class BitMove : public moMove <EOT> {
public :
typedef EOT EOType;
typedef EOT EOType;
unsigned bit;

View file

@ -12,16 +12,16 @@ template <class EOT>
class OneMaxIncrEval : public moMoveIncrEval < BitMove<EOT> > {
public :
OneMaxIncrEval(){ };
OneMaxIncrEval() { };
typename EOT::Fitness operator () (const BitMove<EOT> & move, const EOT & chrom) {
if(chrom[move.bit]==0){
if (chrom[move.bit]==0) {
return chrom.fitness()+1;
}
else{
}
else {
return chrom.fitness()-1;
}
};
}
};
};
#endif

View file

@ -18,9 +18,9 @@ public:
bool operator () (BitMove<EOT> & __move, const EOT & genome) {
if (__move.bit >= (genome.size() - 1)){
if (__move.bit >= (genome.size() - 1)) {
return false ;
}
}
else {
__move.bit++;
return true ;