minor modifications for GCC 4.3.0 compatibility

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1239 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jboisson 2008-09-23 21:36:40 +00:00
commit 33f3b82974
14 changed files with 40 additions and 5 deletions

View file

@ -61,6 +61,10 @@ class moBestImprSelect:public moMoveSelect < M >
Fitness fitness; Fitness fitness;
fitness=(Fitness)_fitness; fitness=(Fitness)_fitness;
//std::cout.precision(10);
//std::cout << "old fitness = " << _fitness << std::endl;
first_time = true; first_time = true;
} }
@ -84,6 +88,8 @@ class moBestImprSelect:public moMoveSelect < M >
first_time = false; first_time = false;
} }
//std::cout << "best fitness = " << best_fitness << std::endl;
return true; return true;
} }
@ -101,6 +107,9 @@ class moBestImprSelect:public moMoveSelect < M >
_move = best_move; _move = best_move;
_fitness = best_fitness; _fitness = best_fitness;
//std::cout << "Final fitness = " << best_fitness << std::endl;
} }
private: private:

View file

@ -43,6 +43,7 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <math.h> #include <math.h>
#include <stdlib.h>
namespace Graph namespace Graph

View file

@ -169,14 +169,20 @@ class moeoEasyEA: public moeoEA < MOEOT >
unsigned int pSize = _pop.size(); unsigned int pSize = _pop.size();
offspring.clear(); // new offspring offspring.clear(); // new offspring
// fitness and diversity assignment (if you want to or if it is the first generation) // fitness and diversity assignment (if you want to or if it is the first generation)
//std::cout << "eval ou first time" << std::endl;
if (evalFitAndDivBeforeSelection || firstTime) if (evalFitAndDivBeforeSelection || firstTime)
{ {
firstTime = false; firstTime = false;
//std::cout << "fitness eval" << std::endl;
fitnessEval(_pop); fitnessEval(_pop);
//std::cout << "diversity eval" << std::endl;
diversityEval(_pop); diversityEval(_pop);
} }
//std::cout << "breed" << std::endl;
breed(_pop, offspring); breed(_pop, offspring);
//std::cout << "pop eval" << std::endl;
popEval(_pop, offspring); // eval of parents + offspring if necessary popEval(_pop, offspring); // eval of parents + offspring if necessary
//std::cout << "replace" << std::endl;
replace(_pop, offspring); // after replace, the new pop. is in _pop replace(_pop, offspring); // after replace, the new pop. is in _pop
if (pSize > _pop.size()) if (pSize > _pop.size())
{ {

View file

@ -38,6 +38,7 @@
#ifndef MAKE_CHECKPOINT_MOEO_H_ #ifndef MAKE_CHECKPOINT_MOEO_H_
#define MAKE_CHECKPOINT_MOEO_H_ #define MAKE_CHECKPOINT_MOEO_H_
#include <limits.h>
#include <stdlib.h> #include <stdlib.h>
#include <sstream> #include <sstream>
#include <eoContinue.h> #include <eoContinue.h>
@ -52,6 +53,7 @@
#include <utils/moeoArchiveObjectiveVectorSavingUpdater.h> #include <utils/moeoArchiveObjectiveVectorSavingUpdater.h>
#include <utils/moeoBinaryMetricSavingUpdater.h> #include <utils/moeoBinaryMetricSavingUpdater.h>
bool testDirRes(std::string _dirName, bool _erase); bool testDirRes(std::string _dirName, bool _erase);
/** /**

View file

@ -106,7 +106,8 @@ void FlowShopBenchmarkParser::init(const std::string _benchmarkFileName)
// initial and current seeds (not used) // initial and current seeds (not used)
getline(inputFile, buffer, '\n'); getline(inputFile, buffer, '\n');
// processing times and due-dates // processing times and due-dates
p = std::vector< std::vector<unsigned int> > (M,N); //p = std::vector< std::vector<unsigned int> > (M,N);
p.resize(N);
d = std::vector<unsigned int> (N); d = std::vector<unsigned int> (N);
// for each job... // for each job...
for (unsigned int j=0 ; j<N ; j++) for (unsigned int j=0 ; j<N ; j++)
@ -119,6 +120,7 @@ void FlowShopBenchmarkParser::init(const std::string _benchmarkFileName)
// processing times of the job j on each machine // processing times of the job j on each machine
getline(inputFile, buffer, '\n'); getline(inputFile, buffer, '\n');
start = buffer.find_first_not_of(" "); start = buffer.find_first_not_of(" ");
p[j].resize(M);
for (unsigned int i=0 ; i<M ; i++) for (unsigned int i=0 ; i<M ; i++)
{ {
end = buffer.find_first_of(" ", start); end = buffer.find_first_of(" ", start);

View file

@ -38,6 +38,7 @@
#ifndef FLOWSHOPBENCHMARKPARSER_H_ #ifndef FLOWSHOPBENCHMARKPARSER_H_
#define FLOWSHOPBENCHMARKPARSER_H_ #define FLOWSHOPBENCHMARKPARSER_H_
#include <stdlib.h>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <vector> #include <vector>

View file

@ -77,7 +77,14 @@ double FlowShopEval::tardiness(const FlowShop & _flowshop)
std::vector< std::vector<unsigned int> > FlowShopEval::completionTime(const FlowShop & _flowshop) std::vector< std::vector<unsigned int> > FlowShopEval::completionTime(const FlowShop & _flowshop)
{ {
std::vector< std::vector<unsigned int> > C(M,N); //std::vector< std::vector<unsigned int> > C(M,N);
std::vector< std::vector<unsigned int> > C;
C.resize(M);
for(unsigned int i=0;i<N;i++)
{
C[i].resize(N);
}
C[0][_flowshop[0]] = p[0][_flowshop[0]]; C[0][_flowshop[0]] = p[0][_flowshop[0]];
for (unsigned int j=1; j<N; j++) for (unsigned int j=1; j<N; j++)
C[0][_flowshop[j]] = C[0][_flowshop[j-1]] + p[0][_flowshop[j]]; C[0][_flowshop[j]] = C[0][_flowshop[j-1]] + p[0][_flowshop[j]];

View file

@ -38,7 +38,7 @@
#define THREAD_H_ #define THREAD_H_
#include <vector> #include <vector>
#include <pthread.h>
/* A high-level thread */ /* A high-level thread */
class Thread class Thread

View file

@ -41,7 +41,7 @@
#include "../../core/peo_debug.h" #include "../../core/peo_debug.h"
#include "node.h" #include "node.h"
#define MPI_BUF_SIZE 1024*64 #define MPI_BUF_SIZE 1024*512
static char mpi_buf [MPI_BUF_SIZE]; static char mpi_buf [MPI_BUF_SIZE];
@ -89,7 +89,7 @@ void cleanBuffers ()
void waitBuffers () void waitBuffers ()
{ {
printDebugMessage ("waiting the termination of the asynchronous operations to complete"); // printDebugMessage ("waiting the termination of the asynchronous operations to complete");
for (unsigned i = 0; i < act_req.size (); i ++) for (unsigned i = 0; i < act_req.size (); i ++)
{ {

View file

@ -37,6 +37,8 @@
#ifndef __mess_rmc_h #ifndef __mess_rmc_h
#define __mess_rmc_h #define __mess_rmc_h
#include <string.h>
#include "../../core/messaging.h" #include "../../core/messaging.h"
extern void initMessage (); extern void initMessage ();

View file

@ -39,6 +39,7 @@
#include <map> #include <map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <stdlib.h>
#include "mess.h" #include "mess.h"

View file

@ -40,6 +40,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <stdlib.h>
#include "node.h" #include "node.h"
#include "../../core/runner.h" #include "../../core/runner.h"

View file

@ -38,6 +38,7 @@
#define __xml_parser_h #define __xml_parser_h
#include <string> #include <string>
#include <string.h>
extern void openXMLDocument (const char * __filename); extern void openXMLDocument (const char * __filename);

View file

@ -39,6 +39,8 @@
#include <cassert> #include <cassert>
#include <utils/eoParser.h> #include <utils/eoParser.h>
#include <stdlib.h>
#include <string.h>
#include "route.h" #include "route.h"