Added #ifdef HAVE_GNUPLOT for Windows compatibility
This commit is contained in:
parent
b1220d189b
commit
6b0cfffe09
8 changed files with 38 additions and 6 deletions
|
|
@ -30,6 +30,10 @@
|
||||||
#ifndef _make_checkpoint_assembled_h
|
#ifndef _make_checkpoint_assembled_h
|
||||||
#define _make_checkpoint_assembled_h
|
#define _make_checkpoint_assembled_h
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
@ -143,9 +147,10 @@ eoCheckPoint<EOT>& do_make_checkpoint_assembled(eoParser& _parser, eoState& _sta
|
||||||
eoScalarFitnessStat<EOT> *fitStat = new eoScalarFitnessStat<EOT>;
|
eoScalarFitnessStat<EOT> *fitStat = new eoScalarFitnessStat<EOT>;
|
||||||
_state.storeFunctor(fitStat);
|
_state.storeFunctor(fitStat);
|
||||||
checkpoint->add(*fitStat);
|
checkpoint->add(*fitStat);
|
||||||
// a gnuplot-based monitor for snapshots: needs a dir name
|
#ifdef HAVE_GNUPLOT
|
||||||
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirName);
|
// a gnuplot-based monitor for snapshots: needs a dir name
|
||||||
_state.storeFunctor(fitSnapshot);
|
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirName);
|
||||||
|
_state.storeFunctor(fitSnapshot);
|
||||||
// add any stat that is a vector<double> to it
|
// add any stat that is a vector<double> to it
|
||||||
fitSnapshot->add(*fitStat);
|
fitSnapshot->add(*fitStat);
|
||||||
// and of course add it to the checkpoint
|
// and of course add it to the checkpoint
|
||||||
|
|
@ -161,7 +166,7 @@ eoCheckPoint<EOT>& do_make_checkpoint_assembled(eoParser& _parser, eoState& _sta
|
||||||
gnumonitors[k]->add(*bestvals[k]);
|
gnumonitors[k]->add(*bestvals[k]);
|
||||||
gnumonitors[k]->add(*avgvals[k]);
|
gnumonitors[k]->add(*avgvals[k]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// WRITE STUFF TO FILE
|
// WRITE STUFF TO FILE
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
#include <eoNSGA_II_Eval.h>
|
#include <eoNSGA_II_Eval.h>
|
||||||
|
|
||||||
namespace nsga2 {
|
namespace nsga2 {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
#include <moo/eoNSGA_IIa_Eval.h>
|
#include <moo/eoNSGA_IIa_Eval.h>
|
||||||
|
|
||||||
namespace nsga2a {
|
namespace nsga2a {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ double real_value (const Particle & _particle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main()
|
int main()
|
||||||
{
|
{
|
||||||
const unsigned int VEC_SIZE = 2;
|
const unsigned int VEC_SIZE = 2;
|
||||||
const unsigned int POP_SIZE = 20;
|
const unsigned int POP_SIZE = 20;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <eo>
|
#include <eo>
|
||||||
|
|
||||||
#include <moo/eoMOFitness.h>
|
#include <moo/eoMOFitness.h>
|
||||||
|
|
@ -178,6 +182,7 @@ void the_main(int argc, char* argv[])
|
||||||
cp.add(fitness0);
|
cp.add(fitness0);
|
||||||
cp.add(fitness1);
|
cp.add(fitness1);
|
||||||
|
|
||||||
|
#ifdef HAVE_GNUPLOT
|
||||||
eoGnuplot1DSnapshot snapshot("pareto");
|
eoGnuplot1DSnapshot snapshot("pareto");
|
||||||
//snapshot.with(eoGnuplot::Points(3));
|
//snapshot.with(eoGnuplot::Points(3));
|
||||||
|
|
||||||
|
|
@ -185,6 +190,7 @@ void the_main(int argc, char* argv[])
|
||||||
|
|
||||||
snapshot.add(fitness0);
|
snapshot.add(fitness0);
|
||||||
snapshot.add(fitness1);
|
snapshot.add(fitness1);
|
||||||
|
#endif
|
||||||
|
|
||||||
// the algo
|
// the algo
|
||||||
eoEasyEA<eoDouble> ea(cp, eval, breeder, replace);
|
eoEasyEA<eoDouble> ea(cp, eval, breeder, replace);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
|
|
||||||
/** test program for PBIL algorithm */
|
/** test program for PBIL algorithm */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <eo>
|
#include <eo>
|
||||||
#include <ga/make_ga.h>
|
#include <ga/make_ga.h>
|
||||||
|
|
@ -34,6 +38,7 @@
|
||||||
#include <ga/eoPBILAdditive.h>
|
#include <ga/eoPBILAdditive.h>
|
||||||
#include <eoSimpleEDA.h>
|
#include <eoSimpleEDA.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
typedef eoBit<double> Indi;
|
typedef eoBit<double> Indi;
|
||||||
|
|
@ -97,6 +102,7 @@ int main(int argc, char* argv[])
|
||||||
"Output - Graphical");
|
"Output - Graphical");
|
||||||
if (plotDistribParam.value())
|
if (plotDistribParam.value())
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_GNUPLOT
|
||||||
unsigned frequency=1; // frequency of plots updates
|
unsigned frequency=1; // frequency of plots updates
|
||||||
eoGnuplot1DSnapshot *distribSnapshot = new eoGnuplot1DSnapshot(ptDirNameParam->value(),
|
eoGnuplot1DSnapshot *distribSnapshot = new eoGnuplot1DSnapshot(ptDirNameParam->value(),
|
||||||
frequency, "distrib");
|
frequency, "distrib");
|
||||||
|
|
@ -105,6 +111,7 @@ int main(int argc, char* argv[])
|
||||||
distribSnapshot->add(distrib);
|
distribSnapshot->add(distrib);
|
||||||
// and of course add it to the checkpoint
|
// and of course add it to the checkpoint
|
||||||
checkpoint.add(*distribSnapshot);
|
checkpoint.add(*distribSnapshot);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// the algorithm: EDA
|
// the algorithm: EDA
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <eo>
|
#include <eo>
|
||||||
|
|
||||||
//#include <utils/eoMOFitnessStat.h>
|
//#include <utils/eoMOFitnessStat.h>
|
||||||
|
|
@ -225,6 +229,7 @@ void the_main(int argc, char* argv[])
|
||||||
cp.add(fitness0);
|
cp.add(fitness0);
|
||||||
cp.add(fitness1);
|
cp.add(fitness1);
|
||||||
|
|
||||||
|
#ifdef HAVE_GNUPLOT
|
||||||
eoGnuplot1DSnapshot snapshot("pareto");
|
eoGnuplot1DSnapshot snapshot("pareto");
|
||||||
//snapshot.with(eoGnuplot::Points(3));
|
//snapshot.with(eoGnuplot::Points(3));
|
||||||
|
|
||||||
|
|
@ -232,6 +237,7 @@ void the_main(int argc, char* argv[])
|
||||||
|
|
||||||
snapshot.add(fitness0);
|
snapshot.add(fitness0);
|
||||||
snapshot.add(fitness1);
|
snapshot.add(fitness1);
|
||||||
|
#endif
|
||||||
|
|
||||||
// the algo
|
// the algo
|
||||||
eoEasyEA<eoDouble> ea(cp, eval, breeder, replace);
|
eoEasyEA<eoDouble> ea(cp, eval, breeder, replace);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
#include <eoSecondsElapsedContinue.h>
|
#include <eoSecondsElapsedContinue.h>
|
||||||
#include <eoPop.h>
|
#include <eoPop.h>
|
||||||
#include <EO.h>
|
#include <EO.h>
|
||||||
|
|
@ -12,7 +17,7 @@ int main() {
|
||||||
int s = 1;
|
int s = 1;
|
||||||
eoSecondsElapsedContinue<Dummy> cnt(1);
|
eoSecondsElapsedContinue<Dummy> cnt(1);
|
||||||
|
|
||||||
time_t start_time = time(0);
|
time_t start_time = time(0);
|
||||||
|
|
||||||
while (cnt(pop)) {}
|
while (cnt(pop)) {}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue