adding examples for eoBin & other stuff
This commit is contained in:
parent
50062e7c30
commit
0f4ff4691c
10 changed files with 1306 additions and 0 deletions
152
eo/test/Makefile.am
Normal file
152
eo/test/Makefile.am
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
###############################################################################
|
||||
##
|
||||
## Makefile.am for eo/test
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
DEPS = $(top_builddir)/src/libeo.a
|
||||
|
||||
###############################################################################
|
||||
|
||||
INCLUDES = -I$(top_builddir)/src
|
||||
LDADDS = $(top_builddir)/src/libeo.a
|
||||
|
||||
###############################################################################
|
||||
|
||||
noinst_PROGRAMS = t-eobreeder t-eoinclusion t-eoinsertion t-eo t-eofitness t-eoproblem t-eobin t-eolottery t_eornd t_eovector t_eoaged t_eoid t_eostring t_ops t_popops t_pop t_es t_opsel t_opfactory t_opMut t_eobitfact
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eobreeder_SOURCES = t-eobreeder.cpp
|
||||
t_eobreeder_DEPENDENCIES = $(DEPS)
|
||||
t_eobreeder_LDFLAGS = -lm
|
||||
t_eobreeder_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoinclusion_SOURCES = t-eoinclusion.cpp
|
||||
t_eoinclusion_DEPENDENCIES = $(DEPS)
|
||||
t_eoinclusion_LDFLAGS = -lm
|
||||
t_eoinclusion_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoinsertion_SOURCES = t-eoinsertion.cpp
|
||||
t_eoinsertion_DEPENDENCIES = $(DEPS)
|
||||
t_eoinsertion_LDFLAGS = -lm
|
||||
t_eoinsertion_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eo_SOURCES = t-eo.cpp
|
||||
t_eo_DEPENDENCIES = $(DEPS)
|
||||
t_eo_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eofitness_SOURCES = t-eofitness.cpp
|
||||
t_eofitness_DEPENDENCIES = $(DEPS)
|
||||
t_eofitness_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoproblem_SOURCES = t-eoproblem.cpp
|
||||
t_eoproblem_LDFLAGS = -lm
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eobin_SOURCES = t-eobin.cpp
|
||||
t_eobin_DEPENDENCIES = $(DEPS)
|
||||
t_eobin_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eolottery_SOURCES = t-eolottery.cpp
|
||||
t_eolottery_DEPENDENCIES = $(DEPS)
|
||||
t_eovector_LDFLAGS = -lm
|
||||
t_eolottery_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eornd_SOURCES = t_eornd.cpp
|
||||
t_eornd_LDFLAGS = -lm
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eovector_SOURCES = t_eovector.cpp
|
||||
t_eovector_LDFLAGS = -lm
|
||||
t_eovector_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoaged_SOURCES = t_eoaged.cpp
|
||||
t_eoaged_DEPENDENCIES = $(DEPS)
|
||||
t_eoaged_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoid_SOURCES = t_eoid.cpp
|
||||
t_eoid_DEPENDENCIES = $(DEPS)
|
||||
t_eoid_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eostring_SOURCES = t_eostring.cpp
|
||||
t_eostring_DEPENDENCIES = $(DEPS)
|
||||
t_eostring_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eostring_SOURCES = t_eostring.cpp
|
||||
t_eostring_DEPENDENCIES = $(DEPS)
|
||||
t_eostring_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_es_SOURCES = t_es.cpp
|
||||
t_es_DEPENDENCIES = $(DEPS)
|
||||
t_es_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_ops_SOURCES = t_ops.cpp
|
||||
t_ops_DEPENDENCIES = $(DEPS)
|
||||
t_ops_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_pop_SOURCES = t_pop.cpp
|
||||
t_pop_DEPENDENCIES = $(DEPS)
|
||||
t_pop_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_popops_SOURCES = t_popops.cpp
|
||||
t_popops_DEPENDENCIES = $(DEPS)
|
||||
t_popops_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_opsel_SOURCES = t_opsel.cpp
|
||||
t_opsel_DEPENDENCIES = $(DEPS)
|
||||
t_opsel_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_opfactory_SOURCES = t_opfactory.cpp
|
||||
t_opfactory_DEPENDENCIES = $(DEPS)
|
||||
t_opfactory_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_opMut_SOURCES = t_opMut.cpp
|
||||
t_opMut_DEPENDENCIES = $(DEPS)
|
||||
t_opMut_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eobitfact_SOURCES = t_eobitfact.cpp
|
||||
t_eobitfact_DEPENDENCIES = $(DEPS)
|
||||
t_eobitfact_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
560
eo/test/Makefile.in
Normal file
560
eo/test/Makefile.in
Normal file
|
|
@ -0,0 +1,560 @@
|
|||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
|
||||
DEPS = $(top_builddir)/src/libeo.a
|
||||
|
||||
###############################################################################
|
||||
|
||||
INCLUDES = -I$(top_builddir)/src
|
||||
LDADDS = $(top_builddir)/src/libeo.a
|
||||
|
||||
###############################################################################
|
||||
|
||||
noinst_PROGRAMS = t-eobreeder t-eoinclusion t-eoinsertion t-eo t-eofitness t-eoproblem t-eobin t-eolottery t_eornd t_eovector t_eoaged t_eoid t_eostring t_ops t_popops t_pop t_es t_opsel t_opfactory t_opMut t_eobitfact
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eobreeder_SOURCES = t-eobreeder.cpp
|
||||
t_eobreeder_DEPENDENCIES = $(DEPS)
|
||||
t_eobreeder_LDFLAGS = -lm
|
||||
t_eobreeder_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoinclusion_SOURCES = t-eoinclusion.cpp
|
||||
t_eoinclusion_DEPENDENCIES = $(DEPS)
|
||||
t_eoinclusion_LDFLAGS = -lm
|
||||
t_eoinclusion_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoinsertion_SOURCES = t-eoinsertion.cpp
|
||||
t_eoinsertion_DEPENDENCIES = $(DEPS)
|
||||
t_eoinsertion_LDFLAGS = -lm
|
||||
t_eoinsertion_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eo_SOURCES = t-eo.cpp
|
||||
t_eo_DEPENDENCIES = $(DEPS)
|
||||
t_eo_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eofitness_SOURCES = t-eofitness.cpp
|
||||
t_eofitness_DEPENDENCIES = $(DEPS)
|
||||
t_eofitness_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoproblem_SOURCES = t-eoproblem.cpp
|
||||
t_eoproblem_LDFLAGS = -lm
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eobin_SOURCES = t-eobin.cpp
|
||||
t_eobin_DEPENDENCIES = $(DEPS)
|
||||
t_eobin_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eolottery_SOURCES = t-eolottery.cpp
|
||||
t_eolottery_DEPENDENCIES = $(DEPS)
|
||||
t_eovector_LDFLAGS = -lm
|
||||
t_eolottery_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eornd_SOURCES = t_eornd.cpp
|
||||
t_eornd_LDFLAGS = -lm
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eovector_SOURCES = t_eovector.cpp
|
||||
t_eovector_LDFLAGS = -lm
|
||||
t_eovector_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoaged_SOURCES = t_eoaged.cpp
|
||||
t_eoaged_DEPENDENCIES = $(DEPS)
|
||||
t_eoaged_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoid_SOURCES = t_eoid.cpp
|
||||
t_eoid_DEPENDENCIES = $(DEPS)
|
||||
t_eoid_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eostring_SOURCES = t_eostring.cpp
|
||||
t_eostring_DEPENDENCIES = $(DEPS)
|
||||
t_eostring_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eostring_SOURCES = t_eostring.cpp
|
||||
t_eostring_DEPENDENCIES = $(DEPS)
|
||||
t_eostring_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_es_SOURCES = t_es.cpp
|
||||
t_es_DEPENDENCIES = $(DEPS)
|
||||
t_es_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_ops_SOURCES = t_ops.cpp
|
||||
t_ops_DEPENDENCIES = $(DEPS)
|
||||
t_ops_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_pop_SOURCES = t_pop.cpp
|
||||
t_pop_DEPENDENCIES = $(DEPS)
|
||||
t_pop_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_popops_SOURCES = t_popops.cpp
|
||||
t_popops_DEPENDENCIES = $(DEPS)
|
||||
t_popops_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_opsel_SOURCES = t_opsel.cpp
|
||||
t_opsel_DEPENDENCIES = $(DEPS)
|
||||
t_opsel_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_opfactory_SOURCES = t_opfactory.cpp
|
||||
t_opfactory_DEPENDENCIES = $(DEPS)
|
||||
t_opfactory_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_opMut_SOURCES = t_opMut.cpp
|
||||
t_opMut_DEPENDENCIES = $(DEPS)
|
||||
t_opMut_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eobitfact_SOURCES = t_eobitfact.cpp
|
||||
t_eobitfact_DEPENDENCIES = $(DEPS)
|
||||
t_eobitfact_LDADD = $(LDADDS)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
t_eobreeder_OBJECTS = t-eobreeder.o
|
||||
t_eoinclusion_OBJECTS = t-eoinclusion.o
|
||||
t_eoinsertion_OBJECTS = t-eoinsertion.o
|
||||
t_eo_OBJECTS = t-eo.o
|
||||
t_eo_LDFLAGS =
|
||||
t_eofitness_OBJECTS = t-eofitness.o
|
||||
t_eofitness_LDFLAGS =
|
||||
t_eoproblem_OBJECTS = t-eoproblem.o
|
||||
t_eoproblem_LDADD = $(LDADD)
|
||||
t_eoproblem_DEPENDENCIES =
|
||||
t_eobin_OBJECTS = t-eobin.o
|
||||
t_eobin_LDFLAGS =
|
||||
t_eolottery_OBJECTS = t-eolottery.o
|
||||
t_eolottery_LDFLAGS =
|
||||
t_eornd_OBJECTS = t_eornd.o
|
||||
t_eornd_LDADD = $(LDADD)
|
||||
t_eornd_DEPENDENCIES =
|
||||
t_eovector_OBJECTS = t_eovector.o
|
||||
t_eovector_DEPENDENCIES = $(top_builddir)/src/libeo.a
|
||||
t_eoaged_OBJECTS = t_eoaged.o
|
||||
t_eoaged_LDFLAGS =
|
||||
t_eoid_OBJECTS = t_eoid.o
|
||||
t_eoid_LDFLAGS =
|
||||
t_eostring_OBJECTS = t_eostring.o
|
||||
t_eostring_LDFLAGS =
|
||||
t_ops_OBJECTS = t_ops.o
|
||||
t_ops_LDFLAGS =
|
||||
t_popops_OBJECTS = t_popops.o
|
||||
t_popops_LDFLAGS =
|
||||
t_pop_OBJECTS = t_pop.o
|
||||
t_pop_LDFLAGS =
|
||||
t_es_OBJECTS = t_es.o
|
||||
t_es_LDFLAGS =
|
||||
t_opsel_OBJECTS = t_opsel.o
|
||||
t_opsel_LDFLAGS =
|
||||
t_opfactory_OBJECTS = t_opfactory.o
|
||||
t_opfactory_LDFLAGS =
|
||||
t_opMut_OBJECTS = t_opMut.o
|
||||
t_opMut_LDFLAGS =
|
||||
t_eobitfact_OBJECTS = t_eobitfact.o
|
||||
t_eobitfact_LDFLAGS =
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
|
||||
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
|
||||
CXXLINK = $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
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_eornd_SOURCES) $(t_eovector_SOURCES) $(t_eoaged_SOURCES) $(t_eoid_SOURCES) $(t_eostring_SOURCES) $(t_ops_SOURCES) $(t_popops_SOURCES) $(t_pop_SOURCES) $(t_es_SOURCES) $(t_opsel_SOURCES) $(t_opfactory_SOURCES) $(t_opMut_SOURCES) $(t_eobitfact_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_eornd_OBJECTS) $(t_eovector_OBJECTS) $(t_eoaged_OBJECTS) $(t_eoid_OBJECTS) $(t_eostring_OBJECTS) $(t_ops_OBJECTS) $(t_popops_OBJECTS) $(t_pop_OBJECTS) $(t_es_OBJECTS) $(t_opsel_OBJECTS) $(t_opfactory_OBJECTS) $(t_opMut_OBJECTS) $(t_eobitfact_OBJECTS)
|
||||
|
||||
all: Makefile $(PROGRAMS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .cpp .lo .o .s
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps test/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-noinstPROGRAMS:
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
|
||||
distclean-noinstPROGRAMS:
|
||||
|
||||
maintainer-clean-noinstPROGRAMS:
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
t-eobreeder: $(t_eobreeder_OBJECTS) $(t_eobreeder_DEPENDENCIES)
|
||||
@rm -f t-eobreeder
|
||||
$(CXXLINK) $(t_eobreeder_LDFLAGS) $(t_eobreeder_OBJECTS) $(t_eobreeder_LDADD) $(LIBS)
|
||||
|
||||
t-eoinclusion: $(t_eoinclusion_OBJECTS) $(t_eoinclusion_DEPENDENCIES)
|
||||
@rm -f t-eoinclusion
|
||||
$(CXXLINK) $(t_eoinclusion_LDFLAGS) $(t_eoinclusion_OBJECTS) $(t_eoinclusion_LDADD) $(LIBS)
|
||||
|
||||
t-eoinsertion: $(t_eoinsertion_OBJECTS) $(t_eoinsertion_DEPENDENCIES)
|
||||
@rm -f t-eoinsertion
|
||||
$(CXXLINK) $(t_eoinsertion_LDFLAGS) $(t_eoinsertion_OBJECTS) $(t_eoinsertion_LDADD) $(LIBS)
|
||||
|
||||
t-eo: $(t_eo_OBJECTS) $(t_eo_DEPENDENCIES)
|
||||
@rm -f t-eo
|
||||
$(CXXLINK) $(t_eo_LDFLAGS) $(t_eo_OBJECTS) $(t_eo_LDADD) $(LIBS)
|
||||
|
||||
t-eofitness: $(t_eofitness_OBJECTS) $(t_eofitness_DEPENDENCIES)
|
||||
@rm -f t-eofitness
|
||||
$(CXXLINK) $(t_eofitness_LDFLAGS) $(t_eofitness_OBJECTS) $(t_eofitness_LDADD) $(LIBS)
|
||||
|
||||
t-eoproblem: $(t_eoproblem_OBJECTS) $(t_eoproblem_DEPENDENCIES)
|
||||
@rm -f t-eoproblem
|
||||
$(CXXLINK) $(t_eoproblem_LDFLAGS) $(t_eoproblem_OBJECTS) $(t_eoproblem_LDADD) $(LIBS)
|
||||
|
||||
t-eobin: $(t_eobin_OBJECTS) $(t_eobin_DEPENDENCIES)
|
||||
@rm -f t-eobin
|
||||
$(CXXLINK) $(t_eobin_LDFLAGS) $(t_eobin_OBJECTS) $(t_eobin_LDADD) $(LIBS)
|
||||
|
||||
t-eolottery: $(t_eolottery_OBJECTS) $(t_eolottery_DEPENDENCIES)
|
||||
@rm -f t-eolottery
|
||||
$(CXXLINK) $(t_eolottery_LDFLAGS) $(t_eolottery_OBJECTS) $(t_eolottery_LDADD) $(LIBS)
|
||||
|
||||
t_eornd: $(t_eornd_OBJECTS) $(t_eornd_DEPENDENCIES)
|
||||
@rm -f t_eornd
|
||||
$(CXXLINK) $(t_eornd_LDFLAGS) $(t_eornd_OBJECTS) $(t_eornd_LDADD) $(LIBS)
|
||||
|
||||
t_eovector: $(t_eovector_OBJECTS) $(t_eovector_DEPENDENCIES)
|
||||
@rm -f t_eovector
|
||||
$(CXXLINK) $(t_eovector_LDFLAGS) $(t_eovector_OBJECTS) $(t_eovector_LDADD) $(LIBS)
|
||||
|
||||
t_eoaged: $(t_eoaged_OBJECTS) $(t_eoaged_DEPENDENCIES)
|
||||
@rm -f t_eoaged
|
||||
$(CXXLINK) $(t_eoaged_LDFLAGS) $(t_eoaged_OBJECTS) $(t_eoaged_LDADD) $(LIBS)
|
||||
|
||||
t_eoid: $(t_eoid_OBJECTS) $(t_eoid_DEPENDENCIES)
|
||||
@rm -f t_eoid
|
||||
$(CXXLINK) $(t_eoid_LDFLAGS) $(t_eoid_OBJECTS) $(t_eoid_LDADD) $(LIBS)
|
||||
|
||||
t_eostring: $(t_eostring_OBJECTS) $(t_eostring_DEPENDENCIES)
|
||||
@rm -f t_eostring
|
||||
$(CXXLINK) $(t_eostring_LDFLAGS) $(t_eostring_OBJECTS) $(t_eostring_LDADD) $(LIBS)
|
||||
|
||||
t_ops: $(t_ops_OBJECTS) $(t_ops_DEPENDENCIES)
|
||||
@rm -f t_ops
|
||||
$(CXXLINK) $(t_ops_LDFLAGS) $(t_ops_OBJECTS) $(t_ops_LDADD) $(LIBS)
|
||||
|
||||
t_popops: $(t_popops_OBJECTS) $(t_popops_DEPENDENCIES)
|
||||
@rm -f t_popops
|
||||
$(CXXLINK) $(t_popops_LDFLAGS) $(t_popops_OBJECTS) $(t_popops_LDADD) $(LIBS)
|
||||
|
||||
t_pop: $(t_pop_OBJECTS) $(t_pop_DEPENDENCIES)
|
||||
@rm -f t_pop
|
||||
$(CXXLINK) $(t_pop_LDFLAGS) $(t_pop_OBJECTS) $(t_pop_LDADD) $(LIBS)
|
||||
|
||||
t_es: $(t_es_OBJECTS) $(t_es_DEPENDENCIES)
|
||||
@rm -f t_es
|
||||
$(CXXLINK) $(t_es_LDFLAGS) $(t_es_OBJECTS) $(t_es_LDADD) $(LIBS)
|
||||
|
||||
t_opsel: $(t_opsel_OBJECTS) $(t_opsel_DEPENDENCIES)
|
||||
@rm -f t_opsel
|
||||
$(CXXLINK) $(t_opsel_LDFLAGS) $(t_opsel_OBJECTS) $(t_opsel_LDADD) $(LIBS)
|
||||
|
||||
t_opfactory: $(t_opfactory_OBJECTS) $(t_opfactory_DEPENDENCIES)
|
||||
@rm -f t_opfactory
|
||||
$(CXXLINK) $(t_opfactory_LDFLAGS) $(t_opfactory_OBJECTS) $(t_opfactory_LDADD) $(LIBS)
|
||||
|
||||
t_opMut: $(t_opMut_OBJECTS) $(t_opMut_DEPENDENCIES)
|
||||
@rm -f t_opMut
|
||||
$(CXXLINK) $(t_opMut_LDFLAGS) $(t_opMut_OBJECTS) $(t_opMut_LDADD) $(LIBS)
|
||||
|
||||
t_eobitfact: $(t_eobitfact_OBJECTS) $(t_eobitfact_DEPENDENCIES)
|
||||
@rm -f t_eobitfact
|
||||
$(CXXLINK) $(t_eobitfact_LDFLAGS) $(t_eobitfact_OBJECTS) $(t_eobitfact_LDADD) $(LIBS)
|
||||
.cpp.o:
|
||||
$(CXXCOMPILE) -c $<
|
||||
.cpp.lo:
|
||||
$(LTCXXCOMPILE) -c $<
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = test
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
t-eobreeder.o: t-eobreeder.cpp ../src/eo ../src/eoData.h \
|
||||
../src/eoObject.h ../src/eoPrintable.h ../src/eoPersistent.h \
|
||||
../src/EO.h ../src/eoID.h ../src/eoAged.h ../src/eoVector.h \
|
||||
../src/eo1d.h ../src/eoRnd.h ../src/eoString.h \
|
||||
../src/eoESChrom.h ../src/eoBin.h ../src/eoUniform.h \
|
||||
../src/eoNormal.h ../src/eoNegExp.h ../src/eoOp.h \
|
||||
../src/eoMultiMonOp.h ../src/eoDup.h ../src/eoKill.h \
|
||||
../src/eoTranspose.h ../src/eoXOver2.h ../src/eoMutation.h \
|
||||
../src/eoPop.h ../src/eoPopOps.h ../src/eoBitOp.h \
|
||||
../src/eoLottery.h ../src/eoBreeder.h ../src/eoInsertion.h \
|
||||
../src/eoInclusion.h ../src/eoFitness.h ../src/eoProblem.h
|
||||
t-eoinsertion.o: t-eoinsertion.cpp ../src/eo ../src/eoData.h \
|
||||
../src/eoObject.h ../src/eoPrintable.h ../src/eoPersistent.h \
|
||||
../src/EO.h ../src/eoID.h ../src/eoAged.h ../src/eoVector.h \
|
||||
../src/eo1d.h ../src/eoRnd.h ../src/eoString.h \
|
||||
../src/eoESChrom.h ../src/eoBin.h ../src/eoUniform.h \
|
||||
../src/eoNormal.h ../src/eoNegExp.h ../src/eoOp.h \
|
||||
../src/eoMultiMonOp.h ../src/eoDup.h ../src/eoKill.h \
|
||||
../src/eoTranspose.h ../src/eoXOver2.h ../src/eoMutation.h \
|
||||
../src/eoPop.h ../src/eoPopOps.h ../src/eoBitOp.h \
|
||||
../src/eoLottery.h ../src/eoBreeder.h ../src/eoInsertion.h \
|
||||
../src/eoInclusion.h ../src/eoFitness.h ../src/eoProblem.h
|
||||
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-noinstPROGRAMS mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
||||
clean: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
|
||||
clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-noinstPROGRAMS distclean-compile distclean-libtool \
|
||||
distclean-tags distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-noinstPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
|
||||
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 dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
21
eo/test/t-eo.cpp
Normal file
21
eo/test/t-eo.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eo.cpp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <eo> // EO
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef EO<float> Chrom;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
main()
|
||||
{
|
||||
Chrom chrom1, chrom2;
|
||||
|
||||
cout << "chrom1 = " << chrom1 << endl
|
||||
<< "chrom2 = " << chrom2 << endl;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
116
eo/test/t-eobin.cpp
Normal file
116
eo/test/t-eobin.cpp
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eobin.cpp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <iostream> // cout
|
||||
#include <strstream> // ostrstream, istrstream
|
||||
#include <eo> // eoBin
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef eoBin<float> Chrom;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
main()
|
||||
{
|
||||
const unsigned SIZE = 8;
|
||||
unsigned i, j;
|
||||
|
||||
Chrom chrom(SIZE), chrom2;
|
||||
|
||||
cout << "chrom: " << chrom << endl;
|
||||
chrom[0] = chrom[SIZE - 1] = true;
|
||||
cout << "chrom: " << chrom << endl;
|
||||
chrom[0] = chrom[SIZE - 1] = false;
|
||||
cout << "chrom: " << chrom << endl;
|
||||
chrom[0] = chrom[SIZE - 1] = true;
|
||||
|
||||
cout << "chrom.className() = " << chrom.className() << endl;
|
||||
|
||||
cout << "chrom: " << chrom << endl
|
||||
<< "chrom2: " << chrom2 << endl;
|
||||
|
||||
ostrstream os;
|
||||
os << chrom;
|
||||
istrstream is(os.str());
|
||||
is >> chrom2;
|
||||
|
||||
cout << "chrom: " << chrom << endl
|
||||
<< "chrom2: " << chrom2 << endl;
|
||||
|
||||
fill(chrom.begin(), chrom.end(), false);
|
||||
cout << "--------------------------------------------------"
|
||||
<< endl << "eoMonOp's aplied to .......... " << chrom << endl;
|
||||
|
||||
eoBinRandom<Chrom> random;
|
||||
random(chrom);
|
||||
cout << "after eoBinRandom ............ " << chrom << endl;
|
||||
|
||||
eoBinBitFlip<Chrom> bitflip;
|
||||
bitflip(chrom);
|
||||
cout << "after eoBitFlip .............. " << chrom << endl;
|
||||
|
||||
eoBinMutation<Chrom> mutation(0.5);
|
||||
mutation(chrom);
|
||||
cout << "after eoBinMutation(0.5) ..... " << chrom << endl;
|
||||
|
||||
eoBinInversion<Chrom> inversion;
|
||||
inversion(chrom);
|
||||
cout << "after eoBinInversion ......... " << chrom << endl;
|
||||
|
||||
eoBinNext<Chrom> next;
|
||||
next(chrom);
|
||||
cout << "after eoBinNext .............. " << chrom << endl;
|
||||
|
||||
eoBinPrev<Chrom> prev;
|
||||
prev(chrom);
|
||||
cout << "after eoBinPrev .............. " << chrom << endl;
|
||||
|
||||
fill(chrom.begin(), chrom.end(), false);
|
||||
fill(chrom2.begin(), chrom2.end(), true);
|
||||
cout << "--------------------------------------------------"
|
||||
<< endl << "eoBinOp's aplied to ... "
|
||||
<< chrom << " " << chrom2 << endl;
|
||||
|
||||
eoBinCrossover<Chrom> xover;
|
||||
fill(chrom.begin(), chrom.end(), false);
|
||||
fill(chrom2.begin(), chrom2.end(), true);
|
||||
xover(chrom, chrom2);
|
||||
cout << "eoBinCrossover ........ " << chrom << " " << chrom2 << endl;
|
||||
|
||||
for (i = 1; i < SIZE; i++)
|
||||
{
|
||||
eoBinNxOver<Chrom> nxover(i);
|
||||
fill(chrom.begin(), chrom.end(), false);
|
||||
fill(chrom2.begin(), chrom2.end(), true);
|
||||
nxover(chrom, chrom2);
|
||||
cout << "eoBinNxOver(" << i << ") ........ "
|
||||
<< chrom << " " << chrom2 << endl;
|
||||
}
|
||||
|
||||
for (i = 1; i < SIZE / 2; i++)
|
||||
for (j = 1; j < SIZE / 2; j++)
|
||||
{
|
||||
eoBinGxOver<Chrom> gxover(i, j);
|
||||
fill(chrom.begin(), chrom.end(), false);
|
||||
fill(chrom2.begin(), chrom2.end(), true);
|
||||
gxover(chrom, chrom2);
|
||||
cout << "eoBinGxOver(" << i << ", " << j << ") ..... "
|
||||
<< chrom << " " << chrom2 << endl;
|
||||
}
|
||||
|
||||
for (float r = 0.1; r < 1.0; r += 0.1)
|
||||
{
|
||||
eoBinUxOver<Chrom> uxover(r);
|
||||
fill(chrom.begin(), chrom.end(), false);
|
||||
fill(chrom2.begin(), chrom2.end(), true);
|
||||
uxover(chrom, chrom2);
|
||||
cout << "eoBinUxOver(" << r << ") ...... "
|
||||
<< chrom << " " << chrom2 << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
65
eo/test/t-eobreeder.cpp
Normal file
65
eo/test/t-eobreeder.cpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eobreeder.cpp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <stdlib.h> // srand
|
||||
#include <time.h> // time
|
||||
#include <eo> // eoBin, eoPop, eoBreeder
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef eoBin<float> Chrom;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void binary_value(Chrom& chrom)
|
||||
{
|
||||
float sum = 0;
|
||||
for (unsigned i = 0; i < chrom.size(); i++)
|
||||
if (chrom[i])
|
||||
sum += pow(2, chrom.size() - i - 1);
|
||||
chrom.fitness(sum);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
main()
|
||||
{
|
||||
srand(time(NULL));
|
||||
|
||||
const unsigned POP_SIZE = 8, CHROM_SIZE = 4;
|
||||
unsigned i;
|
||||
|
||||
eoUniform<Chrom::Type> uniform(false, true);
|
||||
eoBinRandom<Chrom> random;
|
||||
eoPop<Chrom> pop, pop2;
|
||||
|
||||
for (i = 0; i < POP_SIZE; i++)
|
||||
{
|
||||
Chrom chrom(CHROM_SIZE);
|
||||
random(chrom);
|
||||
binary_value(chrom);
|
||||
pop.push_back(chrom);
|
||||
}
|
||||
|
||||
eoBinBitFlip<Chrom> bitflip;
|
||||
eoBinCrossover<Chrom> xover;
|
||||
eoBreeder<Chrom> breeder;
|
||||
breeder.add(bitflip, 1.0);
|
||||
breeder.add(xover, 1.0);
|
||||
|
||||
pop2 = pop;
|
||||
breeder(pop2);
|
||||
|
||||
for (i = 0; i < pop2.size(); i++)
|
||||
binary_value(pop2[i]);
|
||||
|
||||
cout << "population: \tnew population" << endl;
|
||||
for (i = 0; i < pop.size(); i++)
|
||||
cout << pop[i] << " " << pop[i].fitness() << " \t"
|
||||
<< pop2[i] << " " << pop2[i].fitness() << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
77
eo/test/t-eofitness.cpp
Normal file
77
eo/test/t-eofitness.cpp
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eofitness.cpp
|
||||
// (c) GeNeura Team 1998
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <iostream> // cout
|
||||
#include <eo> // eoFitness
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class eoFloat: public eoFitness
|
||||
{
|
||||
public:
|
||||
bool operator<(const eoFitness& other) const
|
||||
{
|
||||
const eoFloat& x = (const eoFloat&) other;
|
||||
return fitness < x.fitness;
|
||||
}
|
||||
|
||||
operator float() const
|
||||
{
|
||||
return fitness;
|
||||
}
|
||||
|
||||
void printOn(ostream& os) const
|
||||
{
|
||||
os << fitness;
|
||||
}
|
||||
|
||||
void readFrom(istream& is)
|
||||
{
|
||||
is >> fitness;
|
||||
}
|
||||
|
||||
private:
|
||||
float fitness;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
main()
|
||||
{
|
||||
eoFloat a, b;
|
||||
|
||||
unsigned repeat = 2;
|
||||
while (repeat--)
|
||||
{
|
||||
cout << "------------------------------------------------------" << endl;
|
||||
cout << "testing < ";
|
||||
if (a < b)
|
||||
cout << a << " < " << b << " is true" << endl;
|
||||
else
|
||||
cout << a << " < " << b << " is false" <<endl;
|
||||
|
||||
cout << "testing > ";
|
||||
if (a > b)
|
||||
cout << a << " > " << b << " is true" << endl;
|
||||
else
|
||||
cout << a << " > " << b << " is false" <<endl;
|
||||
|
||||
cout << "testing == ";
|
||||
if (a == b)
|
||||
cout << a << " == " << b << " is true" << endl;
|
||||
else
|
||||
cout << a << " == " << b << " is false" <<endl;
|
||||
|
||||
cout << "testing != ";
|
||||
if (a != b)
|
||||
cout << a << " != " << b << " is true" << endl;
|
||||
else
|
||||
cout << a << " != " << b << " is false" <<endl;
|
||||
|
||||
a = b;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
105
eo/test/t-eoinclusion.cpp
Normal file
105
eo/test/t-eoinclusion.cpp
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eoinclusion.cpp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <eo> // eoBin, eoPop, eoInclusion
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef eoBin<float> Chrom;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void binary_value(Chrom& chrom)
|
||||
{
|
||||
float sum = 0;
|
||||
for (unsigned i = 0; i < chrom.size(); i++)
|
||||
if (chrom[i])
|
||||
sum += pow(2, chrom.size() - i - 1);
|
||||
chrom.fitness(sum);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
main()
|
||||
{
|
||||
const unsigned CHROM_SIZE = 4;
|
||||
unsigned i;
|
||||
|
||||
eoUniform<Chrom::Type> uniform(false, true);
|
||||
eoBinRandom<Chrom> random;
|
||||
|
||||
for (unsigned POP_SIZE = 4; POP_SIZE <=6; POP_SIZE++)
|
||||
{
|
||||
eoPop<Chrom> pop;
|
||||
|
||||
for (unsigned i = 0; i < POP_SIZE; i++)
|
||||
{
|
||||
Chrom chrom(CHROM_SIZE);
|
||||
random(chrom);
|
||||
binary_value(chrom);
|
||||
pop.push_back(chrom);
|
||||
}
|
||||
|
||||
for (unsigned POP2_SIZE = 4; POP2_SIZE <=6; POP2_SIZE++)
|
||||
{
|
||||
eoPop<Chrom> pop2, pop3, pop4, pop5;
|
||||
|
||||
for (i = 0; i < POP2_SIZE; i++)
|
||||
{
|
||||
Chrom chrom(CHROM_SIZE);
|
||||
random(chrom);
|
||||
binary_value(chrom);
|
||||
pop2.push_back(chrom);
|
||||
}
|
||||
|
||||
cout << "--------------------------------------------------" << endl
|
||||
<< "breeders \tpop" << endl
|
||||
<< "--------------------------------------------------" << endl;
|
||||
for (i = 0; i < max(pop.size(), pop2.size()); i++)
|
||||
{
|
||||
if (pop.size() > i)
|
||||
cout << pop[i] << " " << pop[i].fitness() << " \t";
|
||||
else
|
||||
cout << "\t\t";
|
||||
if (pop2.size() > i)
|
||||
cout << pop2[i] << " " << pop2[i].fitness();
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
eoInclusion<Chrom> inclusion(0.75);
|
||||
pop3 = pop2;
|
||||
inclusion(pop, pop3);
|
||||
|
||||
eoInclusion<Chrom> inclusion2;
|
||||
pop4 = pop2;
|
||||
inclusion2(pop, pop4);
|
||||
|
||||
eoInclusion<Chrom> inclusion3(1.5);
|
||||
pop5 = pop2;
|
||||
inclusion3(pop, pop5);
|
||||
|
||||
cout << endl
|
||||
<< "0.75 \t\t1.0 \t\t1.5" << endl
|
||||
<< "---- \t\t--- \t\t---" << endl;
|
||||
for (i = 0; i < pop5.size(); i++)
|
||||
{
|
||||
if (pop3.size() > i)
|
||||
cout << pop3[i] << " " << pop3[i].fitness() << " \t";
|
||||
else
|
||||
cout << " \t\t";
|
||||
if (pop4.size() > i)
|
||||
cout << pop4[i] << " " << pop4[i].fitness() << " \t";
|
||||
else
|
||||
cout << " \t\t";
|
||||
if (pop5.size() > i)
|
||||
cout << pop5[i] << " " << pop5[i].fitness();
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
105
eo/test/t-eoinsertion.cpp
Normal file
105
eo/test/t-eoinsertion.cpp
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eoinsertion.cpp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <eo> // eoBin, eoPop, eoInsertion
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef eoBin<float> Chrom;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void binary_value(Chrom& chrom)
|
||||
{
|
||||
float sum = 0;
|
||||
for (unsigned i = 0; i < chrom.size(); i++)
|
||||
if (chrom[i])
|
||||
sum += pow(2, chrom.size() - i - 1);
|
||||
chrom.fitness(sum);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
main()
|
||||
{
|
||||
const unsigned CHROM_SIZE = 4;
|
||||
unsigned i;
|
||||
|
||||
eoUniform<Chrom::Type> uniform(false, true);
|
||||
eoBinRandom<Chrom> random;
|
||||
|
||||
for (unsigned POP_SIZE = 4; POP_SIZE <=6; POP_SIZE++)
|
||||
{
|
||||
eoPop<Chrom> pop;
|
||||
|
||||
for (i = 0; i < POP_SIZE; i++)
|
||||
{
|
||||
Chrom chrom(CHROM_SIZE);
|
||||
random(chrom);
|
||||
binary_value(chrom);
|
||||
pop.push_back(chrom);
|
||||
}
|
||||
|
||||
for (unsigned POP2_SIZE = 4; POP2_SIZE <=6; POP2_SIZE++)
|
||||
{
|
||||
eoPop<Chrom> pop2, pop3, pop4, pop5;
|
||||
|
||||
for (i = 0; i < POP2_SIZE; i++)
|
||||
{
|
||||
Chrom chrom(CHROM_SIZE);
|
||||
random(chrom);
|
||||
binary_value(chrom);
|
||||
pop2.push_back(chrom);
|
||||
}
|
||||
|
||||
cout << "--------------------------------------------------" << endl
|
||||
<< "breeders \tpop" << endl
|
||||
<< "--------------------------------------------------" << endl;
|
||||
for (i = 0; i < max(pop.size(), pop2.size()); i++)
|
||||
{
|
||||
if (pop.size() > i)
|
||||
cout << pop[i] << " " << pop[i].fitness() << " \t";
|
||||
else
|
||||
cout << "\t\t";
|
||||
if (pop2.size() > i)
|
||||
cout << pop2[i] << " " << pop2[i].fitness();
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
eoInsertion<Chrom> insertion(0.75);
|
||||
pop3 = pop2;
|
||||
insertion(pop, pop3);
|
||||
|
||||
eoInsertion<Chrom> insertion2;
|
||||
pop4 = pop2;
|
||||
insertion2(pop, pop4);
|
||||
|
||||
eoInsertion<Chrom> insertion3(1.5);
|
||||
pop5 = pop2;
|
||||
insertion3(pop, pop5);
|
||||
|
||||
cout << endl
|
||||
<< "0.75 \t\t1.0 \t\t1.5" << endl
|
||||
<< "---- \t\t--- \t\t---" << endl;
|
||||
for (i = 0; i < pop5.size(); i++)
|
||||
{
|
||||
if (pop3.size() > i)
|
||||
cout << pop3[i] << " " << pop3[i].fitness() << " \t";
|
||||
else
|
||||
cout << " \t\t";
|
||||
if (pop4.size() > i)
|
||||
cout << pop4[i] << " " << pop4[i].fitness() << " \t";
|
||||
else
|
||||
cout << " \t\t";
|
||||
if (pop5.size() > i)
|
||||
cout << pop5[i] << " " << pop5[i].fitness();
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
53
eo/test/t-eolottery.cpp
Normal file
53
eo/test/t-eolottery.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eolottery.cpp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <eo> // eoBin, eoPop, eoLottery
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef eoBin<float> Chrom;
|
||||
|
||||
void binary_value(Chrom& chrom)
|
||||
{
|
||||
float sum = 0;
|
||||
for (unsigned i = 0; i < chrom.size(); i++)
|
||||
if (chrom[i])
|
||||
sum += pow(2, i);
|
||||
chrom.fitness(sum);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
main()
|
||||
{
|
||||
const unsigned POP_SIZE = 8, CHROM_SIZE = 4;
|
||||
|
||||
eoUniform<Chrom::Type> uniform(false, true);
|
||||
eoPop<Chrom> pop, pop2;
|
||||
eoBinRandom<Chrom> random;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < POP_SIZE; i++)
|
||||
{
|
||||
Chrom chrom(CHROM_SIZE);
|
||||
random(chrom);
|
||||
binary_value(chrom);
|
||||
pop.push_back(chrom);
|
||||
}
|
||||
|
||||
cout << "original population:" << endl;
|
||||
for (i = 0; i < pop.size(); i++)
|
||||
cout << pop[i] << " " << pop[i].fitness() << endl;
|
||||
|
||||
eoLottery<Chrom> lottery;
|
||||
lottery(pop, pop2);
|
||||
|
||||
cout << "selected by lottery population:" << endl;
|
||||
for (i = 0; i < pop2.size(); i++)
|
||||
cout << pop2[i] << " " << pop2[i].fitness() << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
52
eo/test/t-eoproblem.cpp
Normal file
52
eo/test/t-eoproblem.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eoproblem.cpp
|
||||
// (c) GeNeura Team 1998
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <time.h> // time
|
||||
#include <math.h> // fabs
|
||||
#include <iostream> // cout
|
||||
#include <eo> // eoVector, eoProblem
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef eoVector<float, float> Chrom;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ostream& operator<<(ostream& os, const Chrom& chrom)
|
||||
{
|
||||
copy(chrom.begin(), chrom.end(), ostream_iterator<int>(os));
|
||||
return os;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class Easy//: public eoProblem<Chrom>
|
||||
{
|
||||
public:
|
||||
const size = 1;
|
||||
|
||||
float operator()(const Chrom& chrom)
|
||||
{
|
||||
return 1.0 / (fabs(chrom[0]) + 1.0);
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
main()
|
||||
{
|
||||
Easy easy;
|
||||
Chrom chrom(Easy::size);
|
||||
|
||||
srand(time(0));
|
||||
|
||||
chrom[0] = ((float)rand()) / ((float)RAND_MAX);
|
||||
chrom.fitness(easy(chrom));
|
||||
|
||||
cout << "chrom = " << chrom << endl
|
||||
<< "chrom.fitness() = " << chrom.fitness() << endl;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Reference in a new issue