Changes due to MSVC

This commit is contained in:
evomarc 2001-11-17 07:22:59 +00:00
commit f41cd957c0
12 changed files with 114 additions and 37 deletions

View file

@ -9,7 +9,11 @@
#include <iostream>
#include <iterator>
#include <stdexcept>
#include <time.h>
#include <ctime>
#ifdef _MSC_VER
#include <crtdbg.h>
#endif
using namespace std;

View file

@ -1,7 +1,7 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoGenOp.h
// eoGenOp.cpp
// (c) Maarten Keijzer and Marc Schoenauer, 2001
/*
This library is free software; you can redistribute it and/or
@ -189,7 +189,7 @@ int the_main(int argc, char **argv)
{
eoParser parser(argc, argv);
eoValueParam<unsigned int> parentSizeParam = parser.createParam<unsigned int>(10, "parentSize", "Parent size",'P');
eoValueParam<unsigned int> parentSizeParam = parser.createParam(unsigned(10), "parentSize", "Parent size",'P');
pSize = parentSizeParam.value(); // global variable
eoValueParam<uint32> seedParam(time(0), "seed", "Random number seed", 'S');

View file

@ -1,5 +1,30 @@
#include <iostream>
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// t-eoPBIL.cpp
// (c) Marc Schoenauer, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: Marc.Schoenauer@inria.fr
*/
//-----------------------------------------------------------------------------
/** test program for PBIL algorithm */
#include <iostream>
#include <eo>
#include <ga/make_ga.h>
#include "binary_value.h"
@ -66,6 +91,7 @@ int main(int argc, char* argv[])
if (!ptDirNameParam) // not found
throw runtime_error("Parameter resDir not found where it was supposed to be");
#if !defined(NO_GNUPLOT)
// now create the snapshot monitor
eoValueParam<bool>& plotDistribParam = parser.createParam(false, "plotDistrib", "Plot Distribution", '\0', "Output - Graphical");
if (plotDistribParam.value())
@ -78,6 +104,7 @@ int main(int argc, char* argv[])
// and of course add it to the checkpoint
checkpoint.add(*distribSnapshot);
}
#endif
// the algorithm: DEA
// don't know where else to put the population size!
@ -98,6 +125,7 @@ int main(int argc, char* argv[])
distrib.printOn(cout);
cout << endl;
#if !defined(NO_GNUPLOT)
// wait - for graphical output
if (plotDistribParam.value())
{
@ -105,6 +133,7 @@ int main(int argc, char* argv[])
cin >> foo;
}
}
#endif
catch(exception& e)
{
cout << e.what() << endl;

View file

@ -195,6 +195,7 @@ void the_main(int argc, char* argv[])
cp.add(fitness0);
cp.add(fitness1);
#if !defined(NO_GNUPLOT)
eoGnuplot1DSnapshot snapshot("pareto");
snapshot.pointSize =3;
@ -202,6 +203,7 @@ void the_main(int argc, char* argv[])
snapshot.add(fitness0);
snapshot.add(fitness1);
#endif
// the algo
eoEasyEA<eoDouble> ea(cp, eval, breeder, replace);

View file

@ -1,4 +1,33 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// t-eoParetoFitness.cpp
// (c) Maarten Keijzer
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: mak@dhi.dk
*/
//-----------------------------------------------------------------------------
#include <iostream>
#include "eoParetoFitness.h"
#include <assert.h>
using namespace std;
/** test program for Pareto Fitness */
class MinimizingTraits : public eoParetoFitnessTraits
{

View file

@ -105,7 +105,7 @@ void testSelectOne(eoSelectOne<EOT> & _select, eoHowMany & _hm, string _name)
int the_main(int argc, char **argv)
{
eoParser parser(argc, argv);
eoValueParam<unsigned int> parentSizeParam = parser.createParam<unsigned int>(10, "parentSize", "Parent size",'P');
eoValueParam<unsigned> parentSizeParam = parser.createParam(unsigned(10), "parentSize", "Parent size",'P');
pSize = parentSizeParam.value(); // global variable
// eoValueParam<double> offsrpringRateParam = parser.createParam<double>(1.0, "offsrpringRate", "Offsrpring rate",'O');
@ -113,13 +113,13 @@ int the_main(int argc, char **argv)
eoValueParam<eoHowMany> offsrpringRateParam = parser.createParam(eoHowMany(1.0), "offsrpringRate", "Offsrpring rate (% or absolute)",'O');
eoHowMany oRate = offsrpringRateParam.value();
eoValueParam<unsigned int> tournamentSizeParam = parser.createParam<unsigned int>(2, "tournamentSize", "Deterministic tournament size",'T');
eoValueParam<unsigned> tournamentSizeParam = parser.createParam(unsigned(2), "tournamentSize", "Deterministic tournament size",'T');
unsigned int tSize = tournamentSizeParam.value();
eoValueParam<double> tournamentRateParam = parser.createParam<double>(0.75, "tournamentRate", "Stochastic tournament rate",'R');
eoValueParam<double> tournamentRateParam = parser.createParam(0.75, "tournamentRate", "Stochastic tournament rate",'R');
double tRate = tournamentRateParam.value();
eoValueParam<double> rankingPressureParam = parser.createParam<double>(1.75, "rankingPressure", "Selective pressure for the ranking selection",'p');
eoValueParam<double> rankingPressureParam = parser.createParam(1.75, "rankingPressure", "Selective pressure for the ranking selection",'p');
double rankingPressure = rankingPressureParam.value();
if (parser.userNeedsHelp())