Clean up configure/build-process.
- assume C++ standard-conforming environment - add a user-option for gnuplot-support - separate gnuplot-code into declaration and implementation, so we can define at EO-build-time whether to use it or not. Adopt code and Makefiles to above changes. Some minor fixes.
This commit is contained in:
parent
6485482f39
commit
47af7cfe5a
22 changed files with 603 additions and 537 deletions
|
|
@ -5,42 +5,30 @@
|
|||
#ifndef mlp_h
|
||||
#define mlp_h
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NUMERIC_LIMITS
|
||||
#include <numeric>
|
||||
#define MLP_MAXFLOAT std::numeric_limits<double>::max()
|
||||
#define MLP_MINFLOAT std::numeric_limits<double>::min()
|
||||
#elif defined HAVE_VALUES_H
|
||||
#include <values.h>
|
||||
#define MLP_MAXFLOAT MAXFLOAT
|
||||
#define MLP_MINFLOAT MINFLOAT
|
||||
#else
|
||||
#error numerical limits not available
|
||||
#endif
|
||||
#include <math.h> // exp
|
||||
#include <stdexcept> // invalid_argument
|
||||
#include <iostream> // istream ostream
|
||||
#include <algorithm> // generate
|
||||
#include <vector> // vector
|
||||
#include <utils/eoRNG.h> // eoRng
|
||||
#include <utils/rnd_generators.h> // normal_geneurator
|
||||
#include <vecop.h> // *
|
||||
#include <utility>
|
||||
#include <cmath> // exp
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
#include <stdexcept> // invalid_argument
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <utils/eoRNG.h> // eoRng
|
||||
#include <utils/rnd_generators.h> // normal_generator
|
||||
#include <vecop.h> // *
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
namespace mlp
|
||||
{
|
||||
typedef double real;
|
||||
typedef std::vector<real> vector;
|
||||
using namespace std;
|
||||
|
||||
typedef double real;
|
||||
typedef std::vector<real> vector;
|
||||
}
|
||||
|
||||
|
||||
namespace std {
|
||||
ostream& operator<<(ostream& os, const mlp::vector& v)
|
||||
{
|
||||
|
|
@ -60,13 +48,15 @@ namespace std {
|
|||
|
||||
namespace mlp
|
||||
{
|
||||
using namespace std;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// useful typedefs
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
const real max_real = MLP_MAXFLOAT;
|
||||
const real min_real = MLP_MINFLOAT;
|
||||
const real max_real = std::numeric_limits<real>::max();
|
||||
const real min_real = std::numeric_limits<real>::min();
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -459,12 +449,9 @@ namespace mlp {
|
|||
|
||||
|
||||
|
||||
#undef MLP_MAXFLOAT
|
||||
#undef MLP_MINFLOAT
|
||||
|
||||
|
||||
#endif // mlp_h
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// c-file-style: "Stroustrup"
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@ LIBEO = $(top_builddir)/src/libeo.a
|
|||
LIBEOUTILS = $(top_builddir)/src/utils/libeoutils.a
|
||||
|
||||
AM_CXXFLAGS = -I$(top_srcdir)/src
|
||||
DEPS = $(LIBEOUTILS) $(LIBEO)
|
||||
LIBS = $(LIBEOUTILS) $(LIBEO)
|
||||
DEPS = $(LIBEO) $(LIBEOUTILS)
|
||||
LIBS = $(LIBEO) $(LIBEOUTILS)
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ LIBEO = $(top_builddir)/src/libeo.a
|
|||
LIBEOUTILS = $(top_builddir)/src/utils/libeoutils.a
|
||||
|
||||
AM_CXXFLAGS = -I$(top_srcdir)/src
|
||||
DEPS = $(LIBEOUTILS) $(LIBEO)
|
||||
LIBS = $(LIBEOUTILS) $(LIBEO)
|
||||
DEPS = $(LIBEO) $(LIBEOUTILS)
|
||||
LIBS = $(LIBEO) $(LIBEOUTILS)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include <eoVector.h> // eoVectorLength
|
||||
#include <eoOp.h> // eoMonOp eoQuadraticOp
|
||||
#include <eoInit.h> // eoInit
|
||||
#include <utils/rnd_generators.h> // uniform_generator
|
||||
#include "utils/rnd_generators.h" // uniform_generator
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// phenotype
|
||||
|
|
@ -50,7 +50,7 @@ phenotype eoChromEvaluator(const Chrom& chrom)
|
|||
++black;
|
||||
tmp[i] = -1;
|
||||
}
|
||||
|
||||
|
||||
// look for whites
|
||||
for (unsigned i = 0; i < chrom.size(); ++i)
|
||||
for (unsigned j = 0; j < tmp.size(); ++j)
|
||||
|
|
@ -75,7 +75,7 @@ unsigned num_colors;
|
|||
void init_eoChromEvaluator(const unsigned& c, const unsigned& l, std::string s)
|
||||
{
|
||||
num_colors = c;
|
||||
|
||||
|
||||
// check consistency between parameters
|
||||
if (s != default_solution)
|
||||
{
|
||||
|
|
@ -85,14 +85,14 @@ void init_eoChromEvaluator(const unsigned& c, const unsigned& l, std::string s)
|
|||
std::cerr << "solution length != length" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
// check number of colors
|
||||
if (c != default_colors && c < *max_element(s.begin(), s.end()) - '0')
|
||||
if ((c != default_colors) && (c < unsigned(*max_element(s.begin(), s.end()) - '0')))
|
||||
{
|
||||
std::cerr << "too high color number found!" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (l != default_length || c != default_colors )
|
||||
// generate a random solution
|
||||
|
|
@ -102,7 +102,7 @@ void init_eoChromEvaluator(const unsigned& c, const unsigned& l, std::string s)
|
|||
s.resize(l);
|
||||
generate(s.begin(), s.end(), color);
|
||||
}
|
||||
|
||||
|
||||
// put the solution parameter on the solution chromosome
|
||||
if (num_colors <= 10)
|
||||
{
|
||||
|
|
|
|||
Reference in a new issue