GCC 4.3 compatible

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1240 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
liefooga 2008-09-24 15:04:01 +00:00
commit ea6fce84f2
2 changed files with 81 additions and 80 deletions

View file

@ -34,7 +34,7 @@
* *
*/ */
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include <iostream>
#include <stdexcept> #include <stdexcept>
#include <FlowShopBenchmarkParser.h> #include <FlowShopBenchmarkParser.h>
@ -69,7 +69,7 @@ const std::vector<unsigned int> FlowShopBenchmarkParser::getD()
void FlowShopBenchmarkParser::printOn(std::ostream & _os) const void FlowShopBenchmarkParser::printOn(std::ostream & _os) const
{ {
_os << "M=" << M << " N=" << N << std::endl; _os << "M=" << M << " N=" << N << std::endl;
_os << "*** processing times" << std::endl; _os << "*** processing times" << std::endl;
for (unsigned int i=0; i<M; i++) for (unsigned int i=0; i<M; i++)
@ -86,7 +86,7 @@ void FlowShopBenchmarkParser::printOn(std::ostream & _os) const
_os << d[j] << " "; _os << d[j] << " ";
} }
_os << std::endl << std::endl; _os << std::endl << std::endl;
} }
void FlowShopBenchmarkParser::init(const std::string _benchmarkFileName) void FlowShopBenchmarkParser::init(const std::string _benchmarkFileName)
@ -106,8 +106,12 @@ 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); p.resize(M);
for (unsigned int j=0 ; j<M ; j++)
{
p[j].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++)
@ -120,7 +124,6 @@ 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

@ -77,14 +77,12 @@ 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; std::vector< std::vector<unsigned int> > C;
C.resize(M); C.resize(M);
for(unsigned int i=0;i<N;i++) for (unsigned int i=0;i<M;i++)
{ {
C[i].resize(N); 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]];