From ea6fce84f21667f031d9154f3544d4a712b72ed3 Mon Sep 17 00:00:00 2001 From: liefooga Date: Wed, 24 Sep 2008 15:04:01 +0000 Subject: [PATCH] GCC 4.3 compatible git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1240 331e1502-861f-0410-8da2-ba01fb791d7f --- .../flowshop/FlowShopBenchmarkParser.cpp | 101 +++++++++--------- .../examples/flowshop/FlowShopEval.cpp | 60 +++++------ 2 files changed, 81 insertions(+), 80 deletions(-) diff --git a/trunk/paradiseo-moeo/tutorial/examples/flowshop/FlowShopBenchmarkParser.cpp b/trunk/paradiseo-moeo/tutorial/examples/flowshop/FlowShopBenchmarkParser.cpp index 14c50c493..6d9ab5925 100644 --- a/trunk/paradiseo-moeo/tutorial/examples/flowshop/FlowShopBenchmarkParser.cpp +++ b/trunk/paradiseo-moeo/tutorial/examples/flowshop/FlowShopBenchmarkParser.cpp @@ -34,100 +34,103 @@ * */ //----------------------------------------------------------------------------- - +#include #include #include FlowShopBenchmarkParser::FlowShopBenchmarkParser(const std::string _benchmarkFileName) { - init(_benchmarkFileName); + init(_benchmarkFileName); } const unsigned int FlowShopBenchmarkParser::getM() { - return M; + return M; } const unsigned int FlowShopBenchmarkParser::getN() { - return N; + return N; } const std::vector< std::vector > FlowShopBenchmarkParser::getP() { - return p; + return p; } const std::vector FlowShopBenchmarkParser::getD() { - return d; + return d; } void FlowShopBenchmarkParser::printOn(std::ostream & _os) const - { +{ _os << "M=" << M << " N=" << N << std::endl; _os << "*** processing times" << std::endl; for (unsigned int i=0; i > (M,N); - p.resize(N); - d = std::vector (N); - // for each job... - for (unsigned int j=0 ; j > (M,N); + p.resize(M); + for (unsigned int j=0 ; j j) - getline(inputFile, buffer, '\n'); - // due-date of the job j - getline(inputFile, buffer, '\n'); - d[j] = atoi(buffer.data()); - // processing times of the job j on each machine - getline(inputFile, buffer, '\n'); - start = buffer.find_first_not_of(" "); - p[j].resize(M); - for (unsigned int i=0 ; i (N); + // for each job... + for (unsigned int j=0 ; j j) + getline(inputFile, buffer, '\n'); + // due-date of the job j + getline(inputFile, buffer, '\n'); + d[j] = atoi(buffer.data()); + // processing times of the job j on each machine + getline(inputFile, buffer, '\n'); + start = buffer.find_first_not_of(" "); + for (unsigned int i=0 ; i > & _p, const std::vector & _d) : - M(_M), N (_N), p(_p), d(_d) + M(_M), N (_N), p(_p), d(_d) {} void FlowShopEval::operator()(FlowShop & _flowshop) { - FlowShopObjectiveVector objVector; - objVector[0] = makespan(_flowshop); - objVector[1] = tardiness(_flowshop); - _flowshop.objectiveVector(objVector); + FlowShopObjectiveVector objVector; + objVector[0] = makespan(_flowshop); + objVector[1] = tardiness(_flowshop); + _flowshop.objectiveVector(objVector); } double FlowShopEval::makespan(const FlowShop & _flowshop) { - // completion times computation for each job on each machine - // C[i][j] = completion of the jth job of the scheduling on the ith machine - std::vector< std::vector > C = completionTime(_flowshop); - return C[M-1][_flowshop[N-1]]; + // completion times computation for each job on each machine + // C[i][j] = completion of the jth job of the scheduling on the ith machine + std::vector< std::vector > C = completionTime(_flowshop); + return C[M-1][_flowshop[N-1]]; } double FlowShopEval::tardiness(const FlowShop & _flowshop) { - // completion times computation for each job on each machine - // C[i][j] = completion of the jth job of the scheduling on the ith machine - std::vector< std::vector > C = completionTime(_flowshop); - // tardiness computation - unsigned int long sum = 0; - for (unsigned int j=0 ; j > C = completionTime(_flowshop); + // tardiness computation + unsigned int long sum = 0; + for (unsigned int j=0 ; j > FlowShopEval::completionTime(const FlowShop & _flowshop) { - //std::vector< std::vector > C(M,N); - std::vector< std::vector > C; - C.resize(M); - for(unsigned int i=0;i > C; + C.resize(M); + for (unsigned int i=0;i