Removed "using namespace std" statements from header files in EO -- "std::" identifier were added where necessary.

This commit is contained in:
okoenig 2003-02-27 19:28:07 +00:00
commit 86fa476c67
39 changed files with 2009 additions and 1976 deletions

View file

@ -290,7 +290,7 @@ void algo(eoPop<EOT>& _pop)
eoPop<EOT> offspring; // how to get the scaling info into this guy??
offspring.setPerf2Worth(_pop.getPerf2Worth()); // like this!
copy(_pop.begin(), _pop.end(), back_inserter(offspring));
std::copy(_pop.begin(), _pop.end(), back_inserter(offspring));
offspring.sort(); // should call scale
@ -307,9 +307,9 @@ void minimization_test()
eo1.performance(1.0);
eo2.performance(2.0);
cout << "With minimizing fitness" << endl;
cout << eo1.fitness() << " < " << eo2.fitness() << " returns " << (eo1 < eo2) << endl;
cout << eo2.fitness() << " < " << eo1.fitness() << " returns " << (eo2 < eo1) << endl;
std::cout << "With minimizing fitness" << std::endl;
std::cout << eo1.fitness() << " < " << eo2.fitness() << " returns " << (eo1 < eo2) << std::endl;
std::cout << eo2.fitness() << " < " << eo1.fitness() << " returns " << (eo2 < eo1) << std::endl;
}
void the_main()
@ -325,10 +325,10 @@ void the_main()
eo1.fitness(10); // could also use performance()
eo3.fitness(5);
cout << eo1.fitness() << endl;
cout << eo3.fitness() << endl;
std::cout << eo1.fitness() << std::endl;
std::cout << eo3.fitness() << std::endl;
cout << "eo1 < eo3 = " << (eo1 < eo3) << endl;
std::cout << "eo1 < eo3 = " << (eo1 < eo3) << std::endl;
scaled_eo eo2;
@ -340,14 +340,14 @@ void the_main()
try
{
cout << eo2.fitness() << endl;
cout << "did not throw" << endl;
std::cout << eo2.fitness() << std::endl;
std::cout << "did not throw" << std::endl;
assert(false); // should throw
}
catch(exception& e)
catch(std::exception& e)
{
cout << "Fitness threw exception, as it should" << endl;
cout << e.what() << endl;
std::cout << "Fitness threw exception, as it should" << std::endl;
std::cout << e.what() << std::endl;
}
/* Set the worth and all is well (this is normally done by some perf2worth functor */
@ -355,10 +355,10 @@ void the_main()
eo2.worth(3);
eo4.worth(5);
cout << "with maximization " << endl;
cout << eo2.fitness() << endl;
cout << eo4.fitness() << endl;
cout << eo2.fitness() << " < " << eo4.fitness() << " returns " << (eo2 < eo4) << endl;
std::cout << "with maximization " << std::endl;
std::cout << eo2.fitness() << std::endl;
std::cout << eo4.fitness() << std::endl;
std::cout << eo2.fitness() << " < " << eo4.fitness() << " returns " << (eo2 < eo4) << std::endl;
/* Test the minimization of fitness */
minimization_test();
@ -373,7 +373,7 @@ void the_main()
algo(pop0);
cout << pop0[0].fitness() << endl;
std::cout << pop0[0].fitness() << std::endl;
assert(pop0[0].fitness() == 1);
@ -389,14 +389,14 @@ void the_main()
// at this point getting the fitness should throw
try
{
cout << pop1[0].fitness() << endl;
cout << "did not throw" << endl;
std::cout << pop1[0].fitness() << std::endl;
std::cout << "did not throw" << std::endl;
assert(false); // should throw
}
catch(exception& e)
catch(std::exception& e)
{
cout << "Fitness threw exception, as it should" << endl;
cout << e.what() << endl;
std::cout << "Fitness threw exception, as it should" << std::endl;
std::cout << e.what() << std::endl;
}
// at this point trying to scale should throw
@ -405,9 +405,9 @@ void the_main()
algo(pop1); // should complain that it cannot scale
assert(false); // so it would never get here
}
catch(exception& e)
catch(std::exception& e)
{ // but rather ends here
cout << e.what() << endl;
std::cout << e.what() << std::endl;
}
// ok, now set the scaling
@ -415,7 +415,7 @@ void the_main()
algo(pop1);
cout << "the fitness has been transformed from " << pop1[0].performance() << " to exp(-1) = " << pop1[0].fitness() << endl;
std::cout << "the fitness has been transformed from " << pop1[0].performance() << " to exp(-1) = " << pop1[0].fitness() << std::endl;
}
int main()
@ -424,9 +424,9 @@ int main()
{
the_main();
}
catch(exception& e)
catch(std::exception& e)
{
cout << e.what() << endl;
std::cout << e.what() << std::endl;
}
}

View file

@ -44,9 +44,9 @@ int main()
pop.push_back(chrom);
}
cout << "population:" << endl;
std::cout << "population:" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << "\t" << pop[i] << " " << pop[i].fitness() << endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
// selection
eoStochTournamentSelect<Chrom> lottery(0.9 );
@ -83,17 +83,17 @@ int main()
{
ea(pop);
}
catch (exception& e)
catch (std::exception& e)
{
cout << "exception: " << e.what() << endl;;
std::cout << "exception: " << e.what() << std::endl;;
exit(EXIT_FAILURE);
}
cout << "pop" << endl;
std::cout << "pop" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << "\t" << pop[i] << " " << pop[i].fitness() << endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
cout << "\n --> Number of Evaluations = " << eval.getValue() << endl;
std::cout << "\n --> Number of Evaluations = " << eval.getValue() << std::endl;
return 0;
}

View file

@ -44,9 +44,9 @@ int main()
pop.push_back(chrom);
}
cout << "population:" << endl;
std::cout << "population:" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << "\t" << pop[i] << " " << pop[i].fitness() << endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
// selection
eoStochTournamentSelect<Chrom> lottery(0.9 );
@ -87,17 +87,17 @@ int main()
{
ea(pop);
}
catch (exception& e)
catch (std::exception& e)
{
cout << "exception: " << e.what() << endl;;
std::cout << "exception: " << e.what() << std::endl;;
exit(EXIT_FAILURE);
}
cout << "pop" << endl;
std::cout << "pop" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << "\t" << pop[i] << " " << pop[i].fitness() << endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
cout << "\n --> Number of Evaluations = " << eval.getValue() << endl;
std::cout << "\n --> Number of Evaluations = " << eval.getValue() << std::endl;
return 0;
}

View file

@ -44,9 +44,9 @@ int main()
pop.push_back(chrom);
}
cout << "population:" << endl;
std::cout << "population:" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << "\t" << pop[i] << " " << pop[i].fitness() << endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
// selection
eoStochTournamentSelect<Chrom> lottery(0.9 );
@ -87,17 +87,17 @@ int main()
{
ea(pop);
}
catch (exception& e)
catch (std::exception& e)
{
cout << "exception: " << e.what() << endl;;
std::cout << "exception: " << e.what() << std::endl;;
exit(EXIT_FAILURE);
}
cout << "pop" << endl;
std::cout << "pop" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << "\t" << pop[i] << " " << pop[i].fitness() << endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
cout << "\n --> Number of Evaluations = " << eval.getValue() << endl;
std::cout << "\n --> Number of Evaluations = " << eval.getValue() << std::endl;
return 0;
}

View file

@ -14,8 +14,8 @@ int main()
{
Chrom chrom1, chrom2;
cout << "chrom1 = " << chrom1 << endl
<< "chrom2 = " << chrom2 << endl;
std::cout << "chrom1 = " << chrom1 << std::endl
<< "chrom2 = " << chrom2 << std::endl;
return 0;
}

View file

@ -56,11 +56,11 @@ main(int argc, char *argv[]) {
eoAtomRandom<char> randomer( charNE );
eoAtomMutation< eoString<float> > mutator2 ( randomer, 0.5 );
cout << "Before aString " << aString << endl;
std::cout << "Before aString " << aString << std::endl;
mutator( aString);
cout << " after mutator " << aString << endl;
std::cout << " after mutator " << aString << std::endl;
mutator2( aString);
cout << " after mutator2 " << aString << endl;;
std::cout << " after mutator2 " << aString << std::endl;;
return 0; // to avoid VC++ complaints
}

View file

@ -21,6 +21,6 @@ int main()
eo2 _2;
int i = _2();
cout << i << '\n';
std::cout << i << '\n';
return i;
}
}

View file

@ -49,8 +49,8 @@ int the_main(int argc, char **argv)
eoValueParam<double> rate(0.01, "mutationRatePerBit", "Initial value for mutation rate per bit");
eoValueParam<double> factor(0.99, "mutationFactor", "Decrease factor for mutation rate");
eoValueParam<uint32> seed(time(0), "seed", "Random number seed");
eoValueParam<string> load_name("", "Load","Load",'L');
eoValueParam<string> save_name("", "Save","Save",'S');
eoValueParam<std::string> load_name("", "Load","Load",'L');
eoValueParam<std::string> save_name("", "Save","Save",'S');
// Register them
parser.processParam(rate, "Genetic Operators");
@ -122,7 +122,7 @@ int the_main(int argc, char **argv)
if (parser.userNeedsHelp())
{
parser.printHelp(cout);
parser.printHelp(std::cout);
return 0;
}
@ -153,7 +153,7 @@ int the_main(int argc, char **argv)
while (time(0) == now) {} // wait a second to test timed saver
cout << "gen " << generationCounter.value() << endl;
std::cout << "gen " << generationCounter.value() << std::endl;
}
// run the algorithm
@ -161,7 +161,7 @@ int the_main(int argc, char **argv)
// Save when needed
if (save_name.value() != "")
{
string file_name = save_name.value();
std::string file_name = save_name.value();
save_name.value() = ""; // so that it does not appear in the parser section of the state file
state.save(file_name);
}
@ -175,9 +175,9 @@ int main(int argc, char **argv)
{
the_main(argc, argv);
}
catch(exception& e)
catch(std::exception& e)
{
cout << "Exception: " << e.what() << endl;
std::cout << "Exception: " << e.what() << std::endl;
}
}

View file

@ -46,22 +46,22 @@ int main_function(int argc, char *argv[])
// Run the appropriate algorithm
if (simpleParam.value() == false)
{
cout << "Using eoReal" << endl;
std::cout << "Using eoReal" << std::endl;
runAlgorithm(eoReal<FitT>(), parser, state);
}
else if (stdevsParam.value() == false)
{
cout << "Using eoEsSimple" << endl;
std::cout << "Using eoEsSimple" << std::endl;
runAlgorithm(eoEsSimple<FitT>(), parser, state);
}
else if (corrParam.value() == false)
{
cout << "Using eoEsStdev" << endl;
std::cout << "Using eoEsStdev" << std::endl;
runAlgorithm(eoEsStdev<FitT>(), parser, state);
}
else
{
cout << "Using eoEsFull" << endl;
std::cout << "Using eoEsFull" << std::endl;
runAlgorithm(eoEsFull<FitT>(), parser, state);
}
@ -84,9 +84,9 @@ int main(int argc, char **argv)
{
main_function(argc, argv);
}
catch(exception& e)
catch(std::exception& e)
{
cout << "Exception: " << e.what() << '\n';
std::cout << "Exception: " << e.what() << '\n';
}
}
@ -136,13 +136,13 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state)
//// GO
///////
cout << "Initial Population\n";
pop.sortedPrintOn(cout);
cout << endl;
std::cout << "Initial Population\n";
pop.sortedPrintOn(std::cout);
std::cout << std::endl;
run_ea(ga, pop); // run the ga
cout << "Final Population\n";
pop.sortedPrintOn(cout);
cout << endl;
std::cout << "Final Population\n";
pop.sortedPrintOn(std::cout);
std::cout << std::endl;
}

View file

@ -99,9 +99,9 @@ int main(int argc, char **argv)
{
main_function(argc, argv);
}
catch(exception& e)
catch(std::exception& e)
{
cout << "Exception: " << e.what() << '\n';
std::cout << "Exception: " << e.what() << '\n';
}
return 1;
@ -174,6 +174,6 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state, eoRealVectorBounds& _
es(pop);
pop.sort();
cout << "Final population\n" << pop << endl;
std::cout << "Final population\n" << pop << std::endl;
}

View file

@ -54,9 +54,9 @@ main(int argc, char *argv[]) {
FirstEO.StdDevLength(), FirstEO.size(),
FirstEO.CorCffLength() );
cout << "First EO " << FirstEO << endl;
std::cout << "First EO " << FirstEO << std::endl;
MyMut(FirstEO);
cout << "First EO mutated" << FirstEO << endl;
std::cout << "First EO mutated" << FirstEO << std::endl;
/*
// Evolution and population parameters
@ -88,10 +88,10 @@ main(int argc, char *argv[]) {
unsigned i, iind;
cout << "Initial population: \n" << endl;
std::cout << "Initial population: \n" << std::endl;
for (i = 0; i < pop.size(); ++i) {
eval(pop[i]);
cout << pop[i].fitness() << "\t" << pop[i] << endl;
std::cout << pop[i].fitness() << "\t" << pop[i] << std::endl;
}
// the Operators
@ -107,9 +107,9 @@ main(int argc, char *argv[]) {
ea(pop);
cout << "Final population: \n" << endl;
std::cout << "Final population: \n" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << pop[i].fitness() << "\t" << pop[i] << endl;
std::cout << pop[i].fitness() << "\t" << pop[i] << std::endl;
return 0;
*/
}

View file

@ -38,9 +38,9 @@ main()
pop.push_back(chrom);
}
cout << "population:" << endl;
std::cout << "population:" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << "\t" << pop[i] << " " << pop[i].fitness() << endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
// selection
@ -68,15 +68,15 @@ main()
{
ea(pop);
}
catch (exception& e)
catch (std::exception& e)
{
cout << "exception: " << e.what() << endl;;
std::cout << "exception: " << e.what() << std::endl;;
exit(EXIT_FAILURE);
}
cout << "pop" << endl;
std::cout << "pop" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << "\t" << pop[i] << " " << pop[i].fitness() << endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
return 0;
}

View file

@ -20,7 +20,7 @@ struct UserDefStruct
enum Enum { just, another, test } d;
};
ostream& operator<<(ostream& os, const UserDefStruct& str)
std::ostream& operator<<(std::ostream& os, const UserDefStruct& str)
{
return os << str.a << ' ' << str.b << ' ' << str.c << ' ' << static_cast<int>(str.d) << ' ';
}
@ -40,7 +40,7 @@ istream& operator>>(istream& is, UserDefStruct& str)
UserDefStruct RandomStruct()
{
cout << "RandomStruct\n";
std::cout << "RandomStruct\n";
UserDefStruct result;
@ -57,7 +57,7 @@ UserDefStruct RandomStruct()
bool UserDefMutate(UserDefStruct& a)
{
cout << "UserDefMutate\n";
std::cout << "UserDefMutate\n";
a = RandomStruct(); // just for testing
if (rng.flip(0.1f))
@ -69,7 +69,7 @@ bool UserDefMutate(UserDefStruct& a)
bool UserDefBinCrossover(UserDefStruct& a, const UserDefStruct& b)
{
cout << "UserDefBinCrossover\n";
std::cout << "UserDefBinCrossover\n";
if (rng.flip(0.5))
a.a = b.a;
@ -84,7 +84,7 @@ bool UserDefBinCrossover(UserDefStruct& a, const UserDefStruct& b)
bool UserDefQuadCrossover(UserDefStruct& a, UserDefStruct& b)
{
cout << "UserDefQuadCrossover\n";
std::cout << "UserDefQuadCrossover\n";
if (rng.flip(0.5))
swap(a.a, b.a);
if (rng.flip(0.5))
@ -99,7 +99,7 @@ bool UserDefQuadCrossover(UserDefStruct& a, UserDefStruct& b)
float UserDefEvalFunc(const UserDefStruct& a)
{
cout << "UserDefEvalFunc\n";
std::cout << "UserDefEvalFunc\n";
return a.b;
}
@ -121,11 +121,11 @@ int main()
EoType eo2;
init(eo2);
cout << "before mutation " << eo1 << '\n';
std::cout << "before mutation " << eo1 << '\n';
mutate(eo1);
cout << "after mutation " << eo1 << '\n';
std::cout << "after mutation " << eo1 << '\n';
cross1(eo1, eo2);
cout << "after crossover " << eo1 << '\n';
std::cout << "after crossover " << eo1 << '\n';
cross2(eo1,eo2);

View file

@ -55,18 +55,18 @@ int main(int argc, char* argv[])
// evaluate intial population AFTER help and status in case it takes time
apply<EOT>(eval, pop);
// print it out
cout << "Initial Population\n";
pop.sortedPrintOn(cout);
cout << endl;
std::cout << "Initial Population\n";
pop.sortedPrintOn(std::cout);
std::cout << std::endl;
run_ea(ga, pop); // run the ga
cout << "Final Population\n";
pop.sortedPrintOn(cout);
cout << endl;
std::cout << "Final Population\n";
pop.sortedPrintOn(std::cout);
std::cout << std::endl;
}
catch(exception& e)
catch(std::exception& e)
{
cout << e.what() << endl;
std::cout << e.what() << std::endl;
}
}

View file

@ -75,9 +75,9 @@ main()
pop.push_back(chrom);
}
cout << "population:" << endl;
std::cout << "population:" << std::endl;
for (i = 0; i < pop.size(); ++i)
cout << pop[i] << " " << pop[i].fitness() << endl;
std::cout << pop[i] << " " << pop[i].fitness() << std::endl;
eoBinBitFlip<Chrom> bitflip;
eoBinCrossover<Chrom> xover;
@ -123,7 +123,7 @@ main()
state.registerObject(pop);
state.save(std::cout);
state.save(std::std::cout);
return 0;
}

View file

@ -32,16 +32,16 @@
struct Dummy : public EO<double>
{
typedef double Type;
typedef double Type;
Dummy(std::string _s="") : s(_s) {}
void printOn(ostream & _os) const
void printOn(std::ostream & _os) const
{
EO<double>::printOn(_os);
_os << " - " << s ;
}
string s;
std::string s;
};
typedef Dummy EOT;
@ -59,9 +59,9 @@ class monop : public eoMonOp<EOT>
_eo.fitness(_eo.fitness()+pSize);
return false;
}
string className() const {return sig;}
std::string className() const {return sig;}
private:
string sig;
std::string sig;
};
class binop: public eoBinOp<EOT>
@ -74,13 +74,13 @@ class binop: public eoBinOp<EOT>
_eo1.fitness(_eo1.fitness()+f);
return false;
}
string className() const {return "binop";}
std::string className() const {return "binop";}
};
class quadop: public eoQuadOp<EOT>
{
public :
string className() const {return "quadop";}
std::string className() const {return "quadop";}
bool operator()(EOT& a, EOT& b)
{
EOT oi = a;
@ -98,7 +98,7 @@ class quadop: public eoQuadOp<EOT>
class quadClone: public eoQuadOp<EOT>
{
public :
string className() const {return "quadclone";}
std::string className() const {return "quadclone";}
bool operator()(EOT& , EOT& ) {return false;}
};
@ -120,7 +120,7 @@ class one2threeOp : public eoGenOp<EOT> // :-)
eo.s = "v(" + eo.s + ", 0)"; // only now change the thing
// oh right, and invalidate fitnesses
}
virtual string className() const {return "one2threeOp";}
virtual std::string className() const {return "one2threeOp";}
};
@ -136,7 +136,7 @@ class two2oneOp : public eoGenOp<EOT> // :-)
eo.s = "221(" + eo.s + ", " + eo2.s + ")";
// oh right, and invalidate fitnesses
}
virtual string className() const {return "two2oneOp";}
virtual std::string className() const {return "two2oneOp";}
};
class three2threeOp : public eoGenOp<EOT> // :-)
@ -152,14 +152,14 @@ class three2threeOp : public eoGenOp<EOT> // :-)
EOT a = eo1;
EOT b = eo2;
EOT c = eo3;
cout << "les selectionnes: a=" << a << " et b=" << b << " et c=" << c << endl;
std::cout << "les selectionnes: a=" << a << " et b=" << b << " et c=" << c << std::endl;
eo1.s = "323-1(" + a.s + ", " + b.s + ", " + c.s + ")";
eo2.s = "323-2(" + a.s + ", " + b.s + ", " + c.s + ")";
eo3.s = "323-3(" + a.s + ", " + b.s + ", " + c.s + ")";
// oh right, and invalidate fitnesses
cout << "les enfants: a=" << eo1 << " et b=" << eo2 << " et c=" << eo3 << endl;
std::cout << "les enfants: a=" << eo1 << " et b=" << eo2 << " et c=" << eo3 << std::endl;
}
virtual string className() const {return "three2threeOp";}
virtual std::string className() const {return "three2threeOp";}
};
@ -172,13 +172,13 @@ void init(eoPop<Dummy> & _pop, unsigned _pSize)
}
else
{
throw runtime_error("init pop with 0 size");
throw std::runtime_error("init pop with 0 size");
}
for (unsigned i=0; i<_pSize; i++)
{
char s[255];
ostrstream os(s, 254);
os << i << ends;
std::ostrstream os(s, 254);
os << i << std::ends;
_pop[i] = Dummy(s);
_pop[i].fitness(i);
}
@ -200,7 +200,7 @@ int the_main(int argc, char **argv)
// i.e. in case you need parameters somewhere else, postpone these
if (parser.userNeedsHelp())
{
parser.printHelp(cout);
parser.printHelp(std::cout);
exit(1);
}
@ -267,7 +267,7 @@ int the_main(int argc, char **argv)
init(pop, pSize);
// sort pop so seqPopulator is identical to SelectPopulator(SequentialSelect)
pop.sort();
cout << "Population initiale\n" << pop << endl;
std::cout << "Population initiale\n" << pop << std::endl;
// To simulate SGA: first a prop between quadOp and quadClone
eoProportionalOp<EOT> pSGAOp;
@ -286,25 +286,25 @@ int the_main(int argc, char **argv)
while (offspring.size() < pop.size())
{
virtualSGA(popit);
cout << "SeqPopulator boucle et incremente\n";
std::cout << "SeqPopulator boucle et incremente\n";
++popit;
}
}
catch(eoPopulator<EOT>::OutOfIndividuals&)
{
cout << "Warning: not enough individuals to handle\n";
std::cout << "Warning: not enough individuals to handle\n";
}
swap(pop, offspring);
std::swap(pop, offspring);
offspring.clear();
// ok, now print
cout << "Apres virtualSGA \n" << pop << endl;
std::cout << "Apres virtualSGA \n" << pop << std::endl;
init(pop, pSize);
cout << "=========================================================\n";
cout << "Now the eoSelectPopulator version !" << endl;
std::cout << "=========================================================\n";
std::cout << "Now the eoSelectPopulator version !" << std::endl;
eoSequentialSelect<EOT> seqSelect;
// select.init(); should be sorted out: is it the setup method???
@ -313,18 +313,18 @@ int the_main(int argc, char **argv)
while (offspring.size() < 2*pop.size())
{
virtualSGA(it_step3);
cout << "SelectPopulator boucle et incremente\n";
std::cout << "SelectPopulator boucle et incremente\n";
++it_step3;
}
swap(pop, offspring);
std::swap(pop, offspring);
offspring.clear();
// ok, now print
cout << "Apres SGA-like eoSelectivePopulator\n" << pop << endl;
std::cout << "Apres SGA-like eoSelectivePopulator\n" << pop << std::endl;
cout << "=========================================================\n";
cout << "Now the pure addition !" << endl;
std::cout << "=========================================================\n";
std::cout << "Now the pure addition !" << std::endl;
init(pop, pSize);
eoSelectivePopulator<EOT> it_step4(pop, offspring, seqSelect);
@ -334,11 +334,11 @@ int the_main(int argc, char **argv)
++it_step4;
}
swap(pop, offspring);
std::swap(pop, offspring);
offspring.clear();
// ok, now print
cout << "Apres Quad+Mon ds un eoSelectivePopulator\n" << pop << endl;
std::cout << "Apres Quad+Mon ds un eoSelectivePopulator\n" << pop << std::endl;
// On teste 1->3
init(pop, pSize);
@ -349,11 +349,11 @@ int the_main(int argc, char **argv)
++it_step5;
}
swap(pop, offspring);
std::swap(pop, offspring);
offspring.clear();
// ok, now print
cout << "Apres 1->3 seul ds un eoSelectivePopulator\n" << pop << endl;
std::cout << "Apres 1->3 seul ds un eoSelectivePopulator\n" << pop << std::endl;
// On teste 3->3
init(pop, pSize);
@ -364,11 +364,11 @@ int the_main(int argc, char **argv)
++it_step6;
}
swap(pop, offspring);
std::swap(pop, offspring);
offspring.clear();
// ok, now print
cout << "Apres 3->3 seul ds un eoSelectivePopulator\n" << pop << endl;
std::cout << "Apres 3->3 seul ds un eoSelectivePopulator\n" << pop << std::endl;
return 1;
@ -380,9 +380,9 @@ int main(int argc, char **argv)
{
the_main(argc, argv);
}
catch(exception& e)
catch(std::exception& e)
{
cout << "Exception: " << e.what() << endl;
std::cout << "Exception: " << e.what() << std::endl;
}
}

View file

@ -11,20 +11,20 @@ main()
{
eoNonUniform nu(1000);
cout << "----------------------------------------------------------" << endl
std::cout << "----------------------------------------------------------" << std::endl
<< "nu.step() = " << nu.step()
<< "\t nu.num_step() = " << nu.num_step() << endl
<< "----------------------------------------------------------" << endl;
<< "\t nu.num_step() = " << nu.num_step() << std::endl
<< "----------------------------------------------------------" << std::endl;
eoLinear l1(0, 1, nu), l2(1, 0, nu);
eoNegExp2 n1(0.1, 8, nu), n2(0.75, 3, nu);
for (; nu; ++nu)
{
cout << nu.step()
std::cout << nu.step()
<< "\t" << l1() << "\t" << l2()
<< "\t" << n1() << "\t" << n2()
<< endl;
<< std::endl;
}
}

View file

@ -121,9 +121,9 @@ int main(int argc, char* argv[])
dea(distrib); // run the dea
cout << "Final Distribution\n";
distrib.printOn(cout);
cout << endl;
std::cout << "Final Distribution\n";
distrib.printOn(std::cout);
std::cout << std::endl;
#if !defined(NO_GNUPLOT)
// wait - for graphical output
@ -134,8 +134,8 @@ int main(int argc, char* argv[])
}
#endif
}
catch(exception& e)
catch(std::exception& e)
{
cout << e.what() << endl;
std::cout << e.what() << std::endl;
}
}

View file

@ -95,7 +95,7 @@ public:
{
unsigned sz = _parents.size();
_parents.reserve(_parents.size() + _offspring.size());
copy(_offspring.begin(), _offspring.end(), back_inserter(_parents));
std::copy(_offspring.begin(), _offspring.end(), back_inserter(_parents));
// calculate worths
perf2worth(_parents);
@ -131,7 +131,7 @@ eoPerf2Worth<EOT, double>& make_perf2worth(eoParser& parser, eoState& state)
if (what > 2)
{
cout << "Warning, need an integer < 3 for perf2worth" << endl;
std::cout << "Warning, need an integer < 3 for perf2worth" << std::endl;
// should actually set parser flag, but I don't care
}
@ -210,7 +210,7 @@ void the_main(int argc, char* argv[])
if (parser.userNeedsHelp())
{
parser.printHelp(cout);
parser.printHelp(std::cout);
return;
}
@ -225,9 +225,9 @@ int main(int argc, char* argv[])
{
the_main(argc, argv);
}
catch (exception& e)
catch (std::exception& e)
{
cout << "Exception thrown: " << e.what() << endl;
std::cout << "Exception thrown: " << e.what() << std::endl;
throw e; // make sure it does not pass the test
}
}

View file

@ -42,11 +42,11 @@ template <class F>
void compare(F & _eo1, F & _eo2)
{
if (_eo1.dominates(_eo2))
cout << _eo1 << " dominates " << _eo2 << endl;
std::cout << _eo1 << " dominates " << _eo2 << std::endl;
else if (_eo2.dominates(_eo1))
cout << _eo2 << " dominates " << _eo1 << endl;
std::cout << _eo2 << " dominates " << _eo1 << std::endl;
else
cout << "None of " << _eo1 << " and " << _eo2 << "dominates the other" << endl;
std::cout << "None of " << _eo1 << " and " << _eo2 << "dominates the other" << std::endl;
return;
}
@ -75,7 +75,7 @@ int main()
if (!f0.dominates(f2))
{
cout << f2 << " not dominated by " << f0;
std::cout << f2 << " not dominated by " << f0;
throw;
}
@ -83,13 +83,13 @@ int main()
if (f0.dominates(f1) || f1.dominates(f0))
{
cout << f0 << " and " << f1 << " dominate";
std::cout << f0 << " and " << f1 << " dominate";
throw;
}
if (! (f0 == f0))
{
cout << "f0 == f0 failed" << endl;
std::cout << "f0 == f0 failed" << std::endl;
throw;
}
@ -132,7 +132,7 @@ int main()
// now the run-time set-able number of objectives
////////////////////////////////////////////
cout << "On y va" << endl;
std::cout << "On y va" << std::endl;
// setup fitness WARNING do not try to allocate any EO before that (runtime error)
@ -140,7 +140,7 @@ int main()
b[0]=true;
b[1]=false;
VarFitness::setUp(2, b);
cout << "\nMAXimizing on Obj 0 and MINimizing on Obj 1\n";
std::cout << "\nMAXimizing on Obj 0 and MINimizing on Obj 1\n";
VarFitness mv0;
VarFitness mv1;
@ -166,11 +166,11 @@ int main()
compare <VarFitness>(mv1,mv3);
compare <VarFitness>(mv2,mv3);
cout << "\nChanging now the min <-> max\n";
std::cout << "\nChanging now the min <-> max\n";
b[0]=false;
b[1]=true;
VarFitness::setUp(2, b);
cout << "\nMINimizing on Obj 0 and MAXimizing on Obj 1\n";
std::cout << "\nMINimizing on Obj 0 and MAXimizing on Obj 1\n";
compare <VarFitness>(mv0,mv1);
compare <VarFitness>(mv0,mv2);
compare <VarFitness>(mv0,mv3);
@ -178,7 +178,7 @@ int main()
compare <VarFitness>(mv1,mv3);
compare <VarFitness>(mv2,mv3);
cout << "\nTesting WARNING\n";
std::cout << "\nTesting WARNING\n";
b.resize(3);
b[0]=false;
b[1]=true;
@ -186,9 +186,9 @@ int main()
VarFitness::setUp(3, b);
}
catch(exception& e)
catch(std::exception& e)
{
cout << e.what() << endl;
std::cout << e.what() << std::endl;
}
}

Some files were not shown because too many files have changed in this diff Show more