changing Makefile.am's to accept new subdiretory structure

This commit is contained in:
gustavo 2000-03-30 14:20:25 +00:00
commit 1fe3a72e10
11 changed files with 148 additions and 72 deletions

View file

@ -3,13 +3,13 @@ AC_INIT(src/eo)
dnl Change the version number here
AM_INIT_AUTOMAKE(eo)
AC_PROG_CXX
AC_PROG_CXX
CXXFLAGS=-g
CXXFLAGS = -Wall -g
AM_PROG_LIBTOOL
AM_PROG_LIBTOOL
AM_MAINTAINER_MODE
dnl add Makefiles that must be modified by the configuration here
AC_OUTPUT(Makefile src/Makefile test/Makefile win/Makefile)
AC_OUTPUT(Makefile src/Makefile src/es/Makefile src/ga/Makefile src/gp/Makefile src/obsolete/Makefile src/other/Makefile src/utils/Makefile test/Makefile win/Makefile)

View file

@ -4,26 +4,17 @@
##
###############################################################################
SUBDIRS = es ga gp obsolete other utils
lib_LIBRARIES = libeo.a
libeo_a_SOURCES = eoPrintable.cpp eoPersistent.cpp
libeo_a_SOURCES = eoPrintable.o eoPersistent.o
#libeo_a_LIBADD = libeoutils.a
libeoincdir = $(includedir)/eo
libeoinc_HEADERS = EO.h eo eo1d.h eo1dWDistance.h eo2d.h \
eo2dVector.h eoAged.h eoAlgo.h\
eoAltBreeder.h \
eoAtomBitFlip.h eoAtomCreep.h eoAtomMutation.h eoAtomMutator.h \
eoAtomRandom.h eoBin.h eoBitOp.h eoBitOpFactory.h eoBreeder.h\
eoData.h eoDetTournament.h eoDistance.h eoDup.h eoESChrom.h \
eoESFullChrom.h eoESFullMut.h eoEasyEA.h\
eoEvalFunc.h eoEvalFuncPtr.h eoEvalFuncPtrCnt.h eoFitTerm.h eoFitness.h\
eoGenTerm.h eoGeneralOp.h eoGeneration.h eoGOpSelector.h eoID.h\
eoInclusion.h eoInsertion.h\
eoKill.h eoLottery.h eoMerge.h eoMultiBinOp.h eoMultiMonOp.h eoMutation.h eoNegExp.h\
eoNonUniform.h eoNormal.h eoObject.h eoOp.h eoOpSelector.h\
eoParser.h eoPersistent.h eoPop.h eoPopOps.h eoPrintable.h\
eoProblem.h eoProportionalGOpSel.h eoProportionalOpSel.h eoRNG.h\
eoRnd.h eoString.h\
eoStochTournament.h eoTerm.h eoTranspose.h eoUniform.h \
eoUniformSelect.h eoUniformXOver.h eoVector.h eoXOver2.h
libeoinc_HEADERS = EO.h eoDup.h eoKill.h eoProportionalGOpSelector.h eoTournament.h eo1d.h eoEasyEA.h eoLottery.h eoProportionalOpSel.h eoTranspose.h eo1dWDistance.h eoEvalFunc.h eoMerge.h eoRandomBreed.h eoUniform.h eo2d.h eoEvalFuncPtr.h eoMutation.h eoRandomIndiSelector.h eoUniformSelect.h eo2dVector.h eoEvalFuncPtrCnt.h eoNegExp.h eoRandomSelect.h eoUniformXOver.h eoAlgo.h eoFactory.h eoNonUniform.h eoRank.h eoVector.h eoAtomBitFlip.h eoFitTerm.h eoNormal.h eoRnd.h eoWrappedOps.h eoAtomCreep.h eoFitness.h eoObject.h eoScalarFitness.h eoXOver2.h eoAtomMutation.h eoGOpBreeder.h eoOp.h eoScheme.h eoAtomMutator.h eoGOpSelector.h eoOpFactory.h eoSelectFactory.h eoBreeder.h eoID.h eoPersistent.h eoSteadyStateGeneration.h eoAtomRandom.h eoGenTerm.h eoOpSelMason.h eoSequentialGOpSelector.h eoBackInserter.h eoGeneration.h eoOpSelector.h eoSteadyStateEA.h eoDetTournament.h eoInclusion.h eoPop.h eoSteadyStateInserter.h eoDetTournamentIndiSelector.h eoIndiSelector.h eoPopOps.h eoStochTournament.h eoDetTournamentInserter.h eoInserter.h eoPrintable.h eoStochTournamentInserter.h eoDistance.h eoInsertion.h eoProportionalGOpSel.h eoTerm.h \
es/eoESFullChrom.h es/eoESChrom.h es/eoESFullMut.h \
ga/eoBin.h ga/eoBitOp.h ga/eoBitOpFactory.h \
gp/eoParseTree.h gp/node_pool.h gp/parse_tree.h \
obsolete/eoParser.h obsolete/eoParserUtils.h obsolete/eoProblem.h \
other/eoStringMutation.h other/eoExternalEO.h other/eoString.h \
utils/compatibility.h utils/eoData.h utils/eoParser.h utils/eoState.h utils/eoRNG.h utils/rnd_generators.h utils/selectors.h utils/eoParam.h

View file

@ -28,10 +28,13 @@
//-----------------------------------------------------------------------------
#include <functional> //
#include <numeric> // accumulate
#include "utils/selectors.h"
#include <eo> // eoPop eoSelect MINFLOAT
#include <stdexcept> // logic_error
#include <utils/selectors.h> // sum_fitness
// #include <functional> //
// #include <numeric> // accumulate
// #include <eo> // eoPop eoSelect MINFLOAT
//-----------------------------------------------------------------------------
/** eoLottery: a selection method. Puts into the output a group of individuals
@ -45,12 +48,11 @@ template<class EOT> class eoLottery: public eoBinPopOp<EOT>
{
public:
/// (Default) Constructor.
eoLottery(const float& _rate = 1.0): eoBinPopOp<EOT>(), rate(_rate)
eoLottery(const float& _rate = 1.0): eoBinPopOp<EOT>(), rate_(_rate)
{
if (minimizing_fitness<EOT>())
{
eoMinimizingFitnessException up(*this);
throw up; // :-)
throw logic_error("eoLottery: minimizing fitness");
}
}
@ -61,23 +63,27 @@ template<class EOT> class eoLottery: public eoBinPopOp<EOT>
*/
void operator()( eoPop<EOT>& pop, eoPop<EOT>& breeders)
{
int target = (int)(rate * pop.size());
int target = static_cast<int>(rate_ * pop.size());
/* Gustavo: uncomment this if it must be here
// test of consistency
if (breeders.size() >= target) {
throw("Problem in eoLottery: already too many offspring");
}
}
double total;
try
{
total = sum_fitness(pop);
total = sum_fitness (pop);
}
catch (eoNegativeFitnessException&)
{ // say where it occured...
throw eoNegativeFitnessException(*this);
}
*/
double total = sum_fitness (pop);
// selection of chromosomes
while (breeders.size() < target)
@ -86,10 +92,10 @@ template<class EOT> class eoLottery: public eoBinPopOp<EOT>
}
}
double Rate(void) const { return rate; }
double rate(void) const { return rate_; }
private:
double rate; // selection rate
double rate_; // selection rate
};
//-----------------------------------------------------------------------------

View file

@ -182,7 +182,7 @@ template<class Chrom> class eoBinPrev: public eoMonOp<Chrom>
};
/** eoBinCrossover --> classic crossover */
/** eoBinCrossover --> classic 2-point crossover */
template<class Chrom> class eoBinCrossover: public eoQuadraticOp<Chrom>
{

View file

@ -27,7 +27,7 @@ void InitRandom( Parser & parser) {
s << _seed;
parser.setParamValue("--seed", s.str()); // so it will be printed out in the status file, and canbe later re-used to re-run EXACTLY the same run
}
#error This does not work: load and save the entire state of the rng object.
//#error This does not work: load and save the entire state of the rng object.
rng.reseed(_seed);
return;

View file

@ -14,7 +14,7 @@ Modifications.:
#ifndef EO_PARSER_UTILS
#define EO_PARSER_UTILS
#include <eoRNG.h>
#include <utils/eoRNG.h>
#include <eoParser.h>
/// Reproducible random seed

View file

@ -26,7 +26,7 @@
#ifndef eoExternalEO_h
#define eoExternalEO_h
#include "EO.h"
#include <EO.h>
/**
* Definition of an object that allows an external struct
@ -65,3 +65,4 @@ class eoExternalEO : public EO, virtual public External
};
#endif

View file

@ -78,7 +78,7 @@ double sum_fitness(It begin, It end)
{
double v = static_cast<double>(begin->fitness());
if (v < 0.0)
throw std::logical_error("Negative Fitness Encountered");
throw std::logic_error("sum_fitness: negative fitness value encountered");
sum += v;
}

View file

@ -9,7 +9,7 @@ EXTRA_DIST = LICENSE
###############################################################################
INCLUDES = -I$(top_builddir)/src
INCLUDES = -I$(top_builddir)/src -I$(top_builddir)/src/ga -I$(top_builddir)/src/utils
LDADDS = $(top_builddir)/src/libeo.a
###############################################################################

View file

@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4a from Makefile.am
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@ -49,10 +49,9 @@ AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_FLAG =
transform = @program_transform_name@
NORMAL_INSTALL = :
@ -73,9 +72,9 @@ LN_S = @LN_S@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
NM = @NM@
OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
VERSION = @VERSION@
DEPS = $(top_builddir)/src/libeo.a
@ -83,7 +82,7 @@ EXTRA_DIST = LICENSE
###############################################################################
INCLUDES = -I$(top_builddir)/src
INCLUDES = -I$(top_builddir)/src -I$(top_builddir)/src/ga -I$(top_builddir)/src/utils
LDADDS = $(top_builddir)/src/libeo.a
###############################################################################
@ -300,6 +299,14 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/t-eo.P .deps/t-eo2dVector.P .deps/t-eoAtomOps.P \
.deps/t-eoESFull.P .deps/t-eoESOps.P .deps/t-eoEasyEA.P \
.deps/t-eoGOpSel.P .deps/t-eoGeneralOps.P .deps/t-eoNonUniform.P \
.deps/t-eoRandom.P .deps/t-eoUniform.P .deps/t-eoVector.P \
.deps/t-eoaltbreeder.P .deps/t-eobin.P .deps/t-eobreeder.P \
.deps/t-eofitness.P .deps/t-eogeneration.P .deps/t-eoinclusion.P \
.deps/t-eoinsertion.P .deps/t-eolottery.P .deps/t-eoproblem.P \
.deps/t-parser.P .deps/t-selectOne.P
SOURCES = $(t_eobreeder_SOURCES) $(t_eoinclusion_SOURCES) $(t_eoinsertion_SOURCES) $(t_eo_SOURCES) $(t_eofitness_SOURCES) $(t_eoproblem_SOURCES) $(t_eobin_SOURCES) $(t_eolottery_SOURCES) $(t_eo2dVector_SOURCES) $(t_eogeneration_SOURCES) $(t_eoEasyEA_SOURCES) $(t_eoNonUniform_SOURCES) $(t_eoUniform_SOURCES) $(t_eoRandom_SOURCES) $(t_parser_SOURCES) $(t_eoESFull_SOURCES) $(t_eoESOps_SOURCES) $(t_eoAtomOps_SOURCES) $(t_selectOne_SOURCES) $(t_eoaltbreeder_SOURCES) $(t_eoGeneralOps_SOURCES) $(t_eoGOpSel_SOURCES) $(t_eoVector_SOURCES)
OBJECTS = $(t_eobreeder_OBJECTS) $(t_eoinclusion_OBJECTS) $(t_eoinsertion_OBJECTS) $(t_eo_OBJECTS) $(t_eofitness_OBJECTS) $(t_eoproblem_OBJECTS) $(t_eobin_OBJECTS) $(t_eolottery_OBJECTS) $(t_eo2dVector_OBJECTS) $(t_eogeneration_OBJECTS) $(t_eoEasyEA_OBJECTS) $(t_eoNonUniform_OBJECTS) $(t_eoUniform_OBJECTS) $(t_eoRandom_OBJECTS) $(t_parser_OBJECTS) $(t_eoESFull_OBJECTS) $(t_eoESOps_OBJECTS) $(t_eoAtomOps_OBJECTS) $(t_selectOne_OBJECTS) $(t_eoaltbreeder_OBJECTS) $(t_eoGeneralOps_OBJECTS) $(t_eoGOpSel_OBJECTS) $(t_eoVector_OBJECTS)
@ -307,9 +314,9 @@ all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .cc .cpp .lo .o .s
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps test/Makefile
cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@ -323,9 +330,6 @@ distclean-noinstPROGRAMS:
maintainer-clean-noinstPROGRAMS:
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
@ -342,9 +346,6 @@ distclean-compile:
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
@ -495,16 +496,91 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = test
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu test/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
%.o: %.cc
@echo '$(CXXCOMPILE) -c $<'; \
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.cc
@echo '$(LTCXXCOMPILE) -c $<'; \
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
%.o: %.cpp
@echo '$(CXXCOMPILE) -c $<'; \
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.cpp
@echo '$(LTCXXCOMPILE) -c $<'; \
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
@ -527,7 +603,7 @@ uninstall: uninstall-am
all-am: Makefile $(PROGRAMS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
@ -541,27 +617,27 @@ distclean-generic:
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags \
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
clean-generic mostlyclean-am
clean-depend clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-noinstPROGRAMS distclean-compile \
distclean-libtool distclean-tags distclean-generic \
clean-am
distclean-libtool distclean-tags distclean-depend \
distclean-generic clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstPROGRAMS \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean-am
maintainer-clean-tags maintainer-clean-depend \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
@ -572,12 +648,14 @@ clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
distclean-tags clean-tags maintainer-clean-tags distdir \
mostlyclean-depend distclean-depend clean-depend \
maintainer-clean-depend info-am info dvi-am dvi check check-am \
installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
###############################################################################

View file

@ -45,8 +45,8 @@ main()
cout << "selected by lottery population:" << endl;
for (i = 0; i < pop2.size(); i++)
cout << pop2[i] << " " << pop2[i].fitness() << endl;
cout << pop2[i] << " " << pop2[i].fitness() << endl;
return 0;
}