git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@130 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
0d6dfb5b0e
commit
a6fe42664b
743 changed files with 67629 additions and 0 deletions
49
trunk/paradiseo-peo/examples/shared/Makefile.am
Normal file
49
trunk/paradiseo-peo/examples/shared/Makefile.am
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
CXX=mpicxx
|
||||
|
||||
INCLUDES = \
|
||||
-I$(EO_DIR)/src/ \
|
||||
-I$(MO_DIR)/src/ \
|
||||
-I$(MOEO_DIR)/src/ \
|
||||
-I../../src/
|
||||
|
||||
AM_CXXFLAGS = \
|
||||
-Wall -g
|
||||
|
||||
lib_LIBRARIES = \
|
||||
libtsp_shared.a
|
||||
|
||||
libtsp_shared_a_SOURCES = \
|
||||
data.h \
|
||||
data.cpp \
|
||||
opt_route.h \
|
||||
opt_route.cpp \
|
||||
param.h \
|
||||
param.cpp \
|
||||
node.h \
|
||||
node.cpp \
|
||||
route.h \
|
||||
route.cpp \
|
||||
route_init.h \
|
||||
route_init.cpp \
|
||||
route_eval.h \
|
||||
route_eval.cpp \
|
||||
two_opt.h \
|
||||
two_opt.cpp \
|
||||
two_opt_init.h \
|
||||
two_opt_init.cpp \
|
||||
two_opt_incr_eval.h \
|
||||
two_opt_incr_eval.cpp \
|
||||
two_opt_next.h \
|
||||
two_opt_next.cpp \
|
||||
order_xover.h \
|
||||
order_xover.cpp \
|
||||
partial_mapped_xover.h \
|
||||
partial_mapped_xover.cpp \
|
||||
edge_xover.h \
|
||||
edge_xover.cpp \
|
||||
city_swap.h \
|
||||
city_swap.cpp \
|
||||
part_route_eval.h \
|
||||
part_route_eval.cpp \
|
||||
merge_route_eval.h \
|
||||
merge_route_eval.cpp
|
||||
495
trunk/paradiseo-peo/examples/shared/Makefile.in
Normal file
495
trunk/paradiseo-peo/examples/shared/Makefile.in
Normal file
|
|
@ -0,0 +1,495 @@
|
|||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 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.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = examples/shared
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
|
||||
am__installdirs = "$(DESTDIR)$(libdir)"
|
||||
libLIBRARIES_INSTALL = $(INSTALL_DATA)
|
||||
LIBRARIES = $(lib_LIBRARIES)
|
||||
AR = ar
|
||||
ARFLAGS = cru
|
||||
libtsp_shared_a_AR = $(AR) $(ARFLAGS)
|
||||
libtsp_shared_a_LIBADD =
|
||||
am_libtsp_shared_a_OBJECTS = data.$(OBJEXT) opt_route.$(OBJEXT) \
|
||||
param.$(OBJEXT) node.$(OBJEXT) route.$(OBJEXT) \
|
||||
route_init.$(OBJEXT) route_eval.$(OBJEXT) two_opt.$(OBJEXT) \
|
||||
two_opt_init.$(OBJEXT) two_opt_incr_eval.$(OBJEXT) \
|
||||
two_opt_next.$(OBJEXT) order_xover.$(OBJEXT) \
|
||||
partial_mapped_xover.$(OBJEXT) edge_xover.$(OBJEXT) \
|
||||
city_swap.$(OBJEXT) part_route_eval.$(OBJEXT) \
|
||||
merge_route_eval.$(OBJEXT)
|
||||
libtsp_shared_a_OBJECTS = $(am_libtsp_shared_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libtsp_shared_a_SOURCES)
|
||||
DIST_SOURCES = $(libtsp_shared_a_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = mpicxx
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EO_DIR = @EO_DIR@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MOEO_DIR = @MOEO_DIR@
|
||||
MO_DIR = @MO_DIR@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
INCLUDES = \
|
||||
-I$(EO_DIR)/src/ \
|
||||
-I$(MO_DIR)/src/ \
|
||||
-I$(MOEO_DIR)/src/ \
|
||||
-I../../src/
|
||||
|
||||
AM_CXXFLAGS = \
|
||||
-Wall -g
|
||||
|
||||
lib_LIBRARIES = \
|
||||
libtsp_shared.a
|
||||
|
||||
libtsp_shared_a_SOURCES = \
|
||||
data.h \
|
||||
data.cpp \
|
||||
opt_route.h \
|
||||
opt_route.cpp \
|
||||
param.h \
|
||||
param.cpp \
|
||||
node.h \
|
||||
node.cpp \
|
||||
route.h \
|
||||
route.cpp \
|
||||
route_init.h \
|
||||
route_init.cpp \
|
||||
route_eval.h \
|
||||
route_eval.cpp \
|
||||
two_opt.h \
|
||||
two_opt.cpp \
|
||||
two_opt_init.h \
|
||||
two_opt_init.cpp \
|
||||
two_opt_incr_eval.h \
|
||||
two_opt_incr_eval.cpp \
|
||||
two_opt_next.h \
|
||||
two_opt_next.cpp \
|
||||
order_xover.h \
|
||||
order_xover.cpp \
|
||||
partial_mapped_xover.h \
|
||||
partial_mapped_xover.cpp \
|
||||
edge_xover.h \
|
||||
edge_xover.cpp \
|
||||
city_swap.h \
|
||||
city_swap.cpp \
|
||||
part_route_eval.h \
|
||||
part_route_eval.cpp \
|
||||
merge_route_eval.h \
|
||||
merge_route_eval.cpp
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/shared/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/shared/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
install-libLIBRARIES: $(lib_LIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
|
||||
@list='$(lib_LIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
f=$(am__strip_dir) \
|
||||
echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
|
||||
else :; fi; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@list='$(lib_LIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
p=$(am__strip_dir) \
|
||||
echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
|
||||
$(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LIBRARIES)'; for p in $$list; do \
|
||||
p=$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
|
||||
rm -f "$(DESTDIR)$(libdir)/$$p"; \
|
||||
done
|
||||
|
||||
clean-libLIBRARIES:
|
||||
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
|
||||
libtsp_shared.a: $(libtsp_shared_a_OBJECTS) $(libtsp_shared_a_DEPENDENCIES)
|
||||
-rm -f libtsp_shared.a
|
||||
$(libtsp_shared_a_AR) libtsp_shared.a $(libtsp_shared_a_OBJECTS) $(libtsp_shared_a_LIBADD)
|
||||
$(RANLIB) libtsp_shared.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/city_swap.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edge_xover.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/merge_route_eval.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/node.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt_route.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/order_xover.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/param.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/part_route_eval.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partial_mapped_xover.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/route.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/route_eval.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/route_init.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_opt.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_opt_incr_eval.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_opt_init.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_opt_next.Po@am__quote@
|
||||
|
||||
.cpp.o:
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
|
||||
|
||||
.cpp.obj:
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LIBRARIES)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)"; do \
|
||||
test -z "$$dir" || $(mkdir_p) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am: install-libLIBRARIES
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-libLIBRARIES
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLIBRARIES ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-libLIBRARIES install-man install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-info-am uninstall-libLIBRARIES
|
||||
|
||||
# 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:
|
||||
36
trunk/paradiseo-peo/examples/shared/city_swap.cpp
Normal file
36
trunk/paradiseo-peo/examples/shared/city_swap.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "city_swap.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2002
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
#include "city_swap.h"
|
||||
|
||||
bool CitySwap :: operator () (Route & __route) {
|
||||
|
||||
std :: swap (__route [rng.random (__route.size ())],
|
||||
__route [rng.random (__route.size ())]) ;
|
||||
|
||||
__route.invalidate () ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/city_swap.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/city_swap.cpp:
Normal file
41
trunk/paradiseo-peo/examples/shared/city_swap.h
Normal file
41
trunk/paradiseo-peo/examples/shared/city_swap.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "city_swap.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2002
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef city_swap_h
|
||||
#define city_swap_h
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Its swaps two vertices
|
||||
randomly choosen */
|
||||
class CitySwap : public eoMonOp <Route> {
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (Route & __route) ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/city_swap.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/city_swap.h:
Normal file
113
trunk/paradiseo-peo/examples/shared/data.cpp
Normal file
113
trunk/paradiseo-peo/examples/shared/data.cpp
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "data.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <utils/eoParser.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "node.h"
|
||||
|
||||
#define MAX_TRASH_LENGTH 1000
|
||||
#define MAX_FIELD_LENGTH 1000
|
||||
#define MAX_LINE_LENGTH 1000
|
||||
|
||||
static void getNextField (FILE * __f, char * __buff) {
|
||||
|
||||
char trash [MAX_TRASH_LENGTH];
|
||||
|
||||
fscanf (__f, "%[ \t:\n]", trash); /* Discarding sep. */
|
||||
fscanf (__f, "%[^:\n]", __buff); /* Reading the field */
|
||||
fgetc (__f);
|
||||
}
|
||||
|
||||
static void getLine (FILE * __f, char * __buff) {
|
||||
|
||||
char trash [MAX_TRASH_LENGTH];
|
||||
|
||||
fscanf (__f, "%[ \t:\n]", trash); /* Discarding sep. */
|
||||
fscanf (__f, "%[^\n]", __buff); /* Reading the line */
|
||||
}
|
||||
|
||||
void loadData (const char * __filename) {
|
||||
|
||||
FILE * f = fopen (__filename, "r");
|
||||
|
||||
if (f) {
|
||||
|
||||
printf ("Loading '%s'.\n", __filename);
|
||||
|
||||
char field [MAX_FIELD_LENGTH];
|
||||
|
||||
getNextField (f, field); /* Name */
|
||||
assert (strstr (field, "NAME"));
|
||||
getNextField (f, field);
|
||||
printf ("NAME: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Comment */
|
||||
assert (strstr (field, "COMMENT"));
|
||||
getLine (f, field);
|
||||
printf ("COMMENT: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Type */
|
||||
assert (strstr (field, "TYPE"));
|
||||
getNextField (f, field);
|
||||
printf ("TYPE: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Dimension */
|
||||
assert (strstr (field, "DIMENSION"));
|
||||
getNextField (f, field);
|
||||
printf ("DIMENSION: %s.\n", field);
|
||||
numNodes = atoi (field);
|
||||
|
||||
getNextField (f, field); /* Edge weight type */
|
||||
assert (strstr (field, "EDGE_WEIGHT_TYPE"));
|
||||
getNextField (f, field);
|
||||
printf ("EDGE_WEIGHT_TYPE: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Node coord section */
|
||||
assert (strstr (field, "NODE_COORD_SECTION"));
|
||||
loadNodes (f);
|
||||
|
||||
getNextField (f, field); /* End of file */
|
||||
assert (strstr (field, "EOF"));
|
||||
printf ("EOF.\n");
|
||||
}
|
||||
else {
|
||||
|
||||
fprintf (stderr, "Can't open '%s'.\n", __filename);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
void loadData (eoParser & __parser) {
|
||||
|
||||
/* Getting the path of the instance */
|
||||
|
||||
eoValueParam <std :: string> param ("", "inst", "Path of the instance") ;
|
||||
__parser.processParam (param) ;
|
||||
loadData (param.value ().c_str ());
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/data.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/data.cpp:
Normal file
33
trunk/paradiseo-peo/examples/shared/data.h
Normal file
33
trunk/paradiseo-peo/examples/shared/data.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "data.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __data_h
|
||||
#define __data_h
|
||||
|
||||
#include <utils/eoParser.h>
|
||||
|
||||
extern void loadData (const char * __filename);
|
||||
|
||||
extern void loadData (eoParser & __parser);
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/data.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/data.h:
Normal file
132
trunk/paradiseo-peo/examples/shared/display.cpp
Normal file
132
trunk/paradiseo-peo/examples/shared/display.cpp
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "display.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "node.h"
|
||||
#include "opt_route.h"
|
||||
|
||||
#define BORDER 20
|
||||
#define RATIO 0.5
|
||||
|
||||
#define screen_width 1024
|
||||
#define screen_height 768
|
||||
|
||||
static const char * filename;
|
||||
|
||||
/* Computed coordinates */
|
||||
static unsigned * X_new_coord, * Y_new_coord ;
|
||||
|
||||
/* this variable will contain the handle to the returned graphics context. */
|
||||
static GC gc;
|
||||
|
||||
/* this variable will contain the pointer to the Display structure */
|
||||
static Display* disp;
|
||||
|
||||
/* this variable will store the ID of the newly created window. */
|
||||
static Window win;
|
||||
|
||||
static int screen;
|
||||
|
||||
/* Create a new backing pixmap of the appropriate size */
|
||||
|
||||
/* Best tour */
|
||||
/*
|
||||
gdk_gc_set_line_attributes (gc, 2, GDK_LINE_ON_OFF_DASH, GDK_CAP_NOT_LAST, GDK_JOIN_MITER) ;
|
||||
|
||||
gdk_gc_set_foreground (gc, & color_green) ;
|
||||
|
||||
for (int i = 0 ; i < (int) numNodes ; i ++) {
|
||||
|
||||
gdk_draw_line (pixmap, gc,
|
||||
X_new_coord [opt_route [i]],
|
||||
Y_new_coord [opt_route [i]],
|
||||
X_new_coord [opt_route [(i + 1) % numNodes]],
|
||||
Y_new_coord [opt_route [(i + 1) % numNodes]]);
|
||||
|
||||
}*/
|
||||
|
||||
void openMainWindow (const char * __filename) {
|
||||
|
||||
filename = __filename;
|
||||
|
||||
/* Map */
|
||||
int map_width = (int) (X_max - X_min);
|
||||
int map_height = (int) (Y_max - Y_min);
|
||||
int map_side = std :: max (map_width, map_height);
|
||||
|
||||
/* Calculate the window's width and height. */
|
||||
int win_width = (int) (screen_width * RATIO * map_width / map_side);
|
||||
int win_height = (int) (screen_height * RATIO * map_height / map_side);
|
||||
|
||||
/* Computing the coordinates */
|
||||
X_new_coord = new unsigned [numNodes];
|
||||
Y_new_coord = new unsigned [numNodes];
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++) {
|
||||
X_new_coord [i] = (unsigned) (win_width * (1.0 - (X_coord [i] - X_min) / map_width) + BORDER);
|
||||
Y_new_coord [i] = (unsigned) (win_height * (1.0 - (Y_coord [i] - Y_min) / map_height) + BORDER);
|
||||
}
|
||||
|
||||
/* Initialisation */
|
||||
XGCValues val ;
|
||||
|
||||
disp = XOpenDisplay (NULL) ;
|
||||
screen = DefaultScreen (disp) ;
|
||||
win = XCreateSimpleWindow (disp, RootWindow (disp, screen), 0, 0, win_width + 2 * BORDER, win_height + 2 * BORDER, 2, BlackPixel (disp, screen), WhitePixel (disp, screen)) ;
|
||||
val.foreground = BlackPixel(disp, screen) ;
|
||||
val.background = WhitePixel(disp, screen) ;
|
||||
gc = XCreateGC (disp, win, GCForeground | GCBackground, & val) ;
|
||||
|
||||
XMapWindow (disp, win) ;
|
||||
XFlush (disp) ;
|
||||
|
||||
while (true) {
|
||||
XClearWindow (disp, win) ;
|
||||
|
||||
/* Vertices as circles */
|
||||
for (unsigned i = 1 ; i < numNodes ; i ++)
|
||||
XDrawArc (disp, win, gc, X_new_coord [i] - 1, Y_new_coord [i] - 1, 3, 3, 0, 364 * 64) ;
|
||||
|
||||
/* New tour */
|
||||
std :: ifstream f (filename);
|
||||
if (f) {
|
||||
Route route;
|
||||
f >> route;
|
||||
f.close ();
|
||||
|
||||
for (int i = 0; i < (int) numNodes; i ++)
|
||||
XDrawLine (disp, win, gc,
|
||||
X_new_coord [route [i]],
|
||||
Y_new_coord [route [i]],
|
||||
X_new_coord [route [(i + 1) % numNodes]],
|
||||
Y_new_coord [route [(i + 1) % numNodes]]);
|
||||
}
|
||||
XFlush (disp) ;
|
||||
sleep (1) ;
|
||||
}
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/display.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/display.cpp:
Normal file
31
trunk/paradiseo-peo/examples/shared/display.h
Normal file
31
trunk/paradiseo-peo/examples/shared/display.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "display.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __display_h
|
||||
#define __display_h
|
||||
|
||||
#include "route.h"
|
||||
|
||||
extern void openMainWindow (const char * __filename);
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/display.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/display.h:
Normal file
37
trunk/paradiseo-peo/examples/shared/display_best_route.cpp
Normal file
37
trunk/paradiseo-peo/examples/shared/display_best_route.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "display_best_route.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "display_best_route.h"
|
||||
#include "display.h"
|
||||
|
||||
DisplayBestRoute :: DisplayBestRoute (eoPop <Route> & __pop
|
||||
) : pop (__pop) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DisplayBestRoute :: operator () () {
|
||||
|
||||
displayRoute (pop.best_element ());
|
||||
}
|
||||
|
||||
47
trunk/paradiseo-peo/examples/shared/display_best_route.h
Normal file
47
trunk/paradiseo-peo/examples/shared/display_best_route.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "display_best_route.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __display_best_route_h
|
||||
#define __display_best_route_h
|
||||
|
||||
#include <utils/eoUpdater.h>
|
||||
|
||||
#include <eoPop.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class DisplayBestRoute : public eoUpdater {
|
||||
|
||||
public :
|
||||
|
||||
DisplayBestRoute (eoPop <Route> & __pop);
|
||||
|
||||
void operator () ();
|
||||
|
||||
private :
|
||||
|
||||
eoPop <Route> & pop;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
133
trunk/paradiseo-peo/examples/shared/edge_xover.cpp
Normal file
133
trunk/paradiseo-peo/examples/shared/edge_xover.cpp
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "edge_xover.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2003
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <values.h>
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
#include "edge_xover.h"
|
||||
|
||||
void EdgeXover :: build_map (const Route & __par1, const Route & __par2) {
|
||||
|
||||
unsigned len = __par1.size () ;
|
||||
|
||||
/* Initialization */
|
||||
_map.clear () ;
|
||||
_map.resize (len) ;
|
||||
|
||||
for (unsigned i = 0 ; i < len ; i ++) {
|
||||
_map [__par1 [i]].insert (__par1 [(i + 1) % len]) ;
|
||||
_map [__par2 [i]].insert (__par2 [(i + 1) % len]) ;
|
||||
_map [__par1 [i]].insert (__par1 [(i - 1 + len) % len]) ;
|
||||
_map [__par2 [i]].insert (__par2 [(i - 1 + len) % len]) ;
|
||||
}
|
||||
|
||||
visited.clear () ;
|
||||
visited.resize (len, false) ;
|
||||
}
|
||||
|
||||
void EdgeXover :: remove_entry (unsigned __vertex, std :: vector <std :: set <unsigned> > & __map) {
|
||||
|
||||
std :: set <unsigned> & neigh = __map [__vertex] ;
|
||||
|
||||
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
||||
it != neigh.end () ;
|
||||
it ++)
|
||||
__map [* it].erase (__vertex) ;
|
||||
|
||||
}
|
||||
|
||||
void EdgeXover :: add_vertex (unsigned __vertex, Route & __child) {
|
||||
|
||||
visited [__vertex] = true ;
|
||||
__child.push_back (__vertex) ;
|
||||
remove_entry (__vertex, _map) ; /* Removing entries */
|
||||
}
|
||||
|
||||
void EdgeXover :: cross (const Route & __par1, const Route & __par2, Route & __child) {
|
||||
|
||||
build_map (__par1, __par2) ;
|
||||
|
||||
unsigned len = __par1.size () ;
|
||||
|
||||
/* Go ! */
|
||||
__child.clear () ;
|
||||
|
||||
unsigned cur_vertex = rng.random (len) ;
|
||||
|
||||
add_vertex (cur_vertex, __child) ;
|
||||
|
||||
for (unsigned i = 1 ; i < len ; i ++) {
|
||||
|
||||
unsigned len_min_entry = MAXINT ;
|
||||
|
||||
std :: set <unsigned> & neigh = _map [cur_vertex] ;
|
||||
|
||||
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
||||
it != neigh.end () ;
|
||||
it ++) {
|
||||
unsigned l = _map [* it].size () ;
|
||||
if (len_min_entry > l)
|
||||
len_min_entry = l ;
|
||||
}
|
||||
|
||||
std :: vector <unsigned> cand ; /* Candidates */
|
||||
|
||||
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
||||
it != neigh.end () ;
|
||||
it ++) {
|
||||
unsigned l = _map [* it].size () ;
|
||||
if (len_min_entry == l)
|
||||
cand.push_back (* it) ;
|
||||
}
|
||||
|
||||
if (! cand.size ()) {
|
||||
|
||||
/* Oh no ! Implicit mutation */
|
||||
for (unsigned j = 0 ; j < len ; j ++)
|
||||
if (! visited [j])
|
||||
cand.push_back (j) ;
|
||||
}
|
||||
|
||||
cur_vertex = cand [rng.random (cand.size ())] ;
|
||||
|
||||
add_vertex (cur_vertex, __child) ;
|
||||
}
|
||||
}
|
||||
|
||||
bool EdgeXover :: operator () (Route & __route1, Route & __route2) {
|
||||
|
||||
// Init. copy
|
||||
Route par [2] ;
|
||||
par [0] = __route1 ;
|
||||
par [1] = __route2 ;
|
||||
|
||||
cross (par [0], par [1], __route1) ;
|
||||
cross (par [1], par [0], __route2) ;
|
||||
|
||||
__route1.invalidate () ;
|
||||
__route2.invalidate () ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/edge_xover.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/edge_xover.cpp:
Normal file
58
trunk/paradiseo-peo/examples/shared/edge_xover.h
Normal file
58
trunk/paradiseo-peo/examples/shared/edge_xover.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "edge_xover.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2003
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef edge_xover_h
|
||||
#define edge_xover_h
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Edge Crossover */
|
||||
class EdgeXover : public eoQuadOp <Route> {
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (Route & __route1, Route & __route2) ;
|
||||
|
||||
private :
|
||||
|
||||
void cross (const Route & __par1, const Route & __par2, Route & __child) ; /* Binary */
|
||||
|
||||
void remove_entry (unsigned __vertex, std :: vector <std :: set <unsigned> > & __map) ;
|
||||
/* Updating the map of entries */
|
||||
|
||||
void build_map (const Route & __par1, const Route & __par2) ;
|
||||
|
||||
void add_vertex (unsigned __vertex, Route & __child) ;
|
||||
|
||||
std :: vector <std :: set <unsigned> > _map ; /* The handled map */
|
||||
|
||||
std :: vector <bool> visited ; /* Vertices that are already visited */
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/edge_xover.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/edge_xover.h:
Normal file
32
trunk/paradiseo-peo/examples/shared/merge_route_eval.cpp
Normal file
32
trunk/paradiseo-peo/examples/shared/merge_route_eval.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "merge_route_eval.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2005
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "merge_route_eval.h"
|
||||
|
||||
void MergeRouteEval :: operator () (Route & __route, const int & __part_fit) {
|
||||
|
||||
int len = __route.fitness ();
|
||||
len += __part_fit;
|
||||
__route.fitness (len);
|
||||
}
|
||||
|
||||
39
trunk/paradiseo-peo/examples/shared/merge_route_eval.h
Normal file
39
trunk/paradiseo-peo/examples/shared/merge_route_eval.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "merge_route_eval.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2005
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __merge_route_eval_h
|
||||
#define __merge_route_eval_h
|
||||
|
||||
#include <peoAggEvalFunc.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class MergeRouteEval : public peoAggEvalFunc <Route> {
|
||||
|
||||
public :
|
||||
|
||||
void operator () (Route & __route, const int & __part_fit) ;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/merge_route_eval.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/merge_route_eval.h:
Normal file
25
trunk/paradiseo-peo/examples/shared/mix.h
Normal file
25
trunk/paradiseo-peo/examples/shared/mix.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
/*
|
||||
file: 'mix.h'
|
||||
author: S. CAHON
|
||||
mail: paradiseo-help@lists.gforge.inria.fr
|
||||
date: dec. 2005
|
||||
*/
|
||||
|
||||
#ifndef __mix_h
|
||||
#define __mix_h
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
template <class T> void mix (std :: vector <T> & __v) {
|
||||
|
||||
unsigned len = __v.size () ;
|
||||
|
||||
for (unsigned i = 0 ; i < len ; i ++)
|
||||
std :: swap (__v [i], __v [rng.random (len)]) ;
|
||||
}
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/mix.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/mix.h:
Normal file
92
trunk/paradiseo-peo/examples/shared/node.cpp
Normal file
92
trunk/paradiseo-peo/examples/shared/node.cpp
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "node.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <values.h>
|
||||
|
||||
#include "node.h"
|
||||
|
||||
unsigned numNodes; /* Number of nodes */
|
||||
|
||||
//static unsigned * * dist; /* Square matrix of distances */
|
||||
|
||||
double * X_coord, * Y_coord;
|
||||
|
||||
double X_min = MAXDOUBLE, X_max = MINDOUBLE, Y_min = MAXDOUBLE, Y_max = MINDOUBLE;
|
||||
|
||||
void loadNodes (FILE * __f) {
|
||||
|
||||
/* Coord */
|
||||
|
||||
X_coord = new double [numNodes];
|
||||
|
||||
Y_coord = new double [numNodes];
|
||||
|
||||
unsigned num;
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++) {
|
||||
|
||||
fscanf (__f, "%u%lf%lf", & num, X_coord + i, Y_coord + i);
|
||||
|
||||
if (X_coord [i] < X_min)
|
||||
X_min = X_coord [i];
|
||||
if (X_coord [i] > X_max)
|
||||
X_max = X_coord [i];
|
||||
if (Y_coord [i] < Y_min)
|
||||
Y_min = Y_coord [i];
|
||||
if (Y_coord [i] > Y_max)
|
||||
Y_max = Y_coord [i];
|
||||
}
|
||||
|
||||
/* Allocation */
|
||||
/*
|
||||
dist = new unsigned * [numNodes];
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++)
|
||||
dist [i] = new unsigned [numNodes];
|
||||
*/
|
||||
/* Computation of the distances */
|
||||
|
||||
/*
|
||||
for (unsigned i = 0; i < numNodes; i ++) {
|
||||
|
||||
dist [i] [i] = 0;
|
||||
|
||||
for (unsigned j = 0; j < numNodes; j ++) {
|
||||
|
||||
double dx = X_coord [i] - X_coord [j], dy = Y_coord [i] - Y_coord [j];
|
||||
|
||||
dist [i] [j] = dist [j] [i] = (unsigned) (sqrt (dx * dx + dy * dy) + 0.5) ;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
unsigned distance (Node __from, Node __to) {
|
||||
|
||||
// return dist [__from] [__to];
|
||||
|
||||
double dx = X_coord [__from] - X_coord [__to], dy = Y_coord [__from] - Y_coord [__to];
|
||||
|
||||
return (unsigned) (sqrt (dx * dx + dy * dy) + 0.5) ;
|
||||
}
|
||||
|
||||
0
trunk/paradiseo-peo/examples/shared/node.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/node.cpp:
Normal file
41
trunk/paradiseo-peo/examples/shared/node.h
Normal file
41
trunk/paradiseo-peo/examples/shared/node.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "node.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __node_h
|
||||
#define __node_h
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef unsigned Node;
|
||||
|
||||
extern double X_min, X_max, Y_min, Y_max;
|
||||
|
||||
extern double * X_coord, * Y_coord;
|
||||
|
||||
extern unsigned numNodes; /* Number of nodes */
|
||||
|
||||
extern void loadNodes (FILE * __f);
|
||||
|
||||
extern unsigned distance (Node __from, Node __to);
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/node.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/node.h:
Normal file
122
trunk/paradiseo-peo/examples/shared/opt_route.cpp
Normal file
122
trunk/paradiseo-peo/examples/shared/opt_route.cpp
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "opt_route.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "opt_route.h"
|
||||
|
||||
#define MAX_TRASH_LENGTH 1000
|
||||
#define MAX_FIELD_LENGTH 1000
|
||||
#define MAX_LINE_LENGTH 1000
|
||||
|
||||
static void getNextField (FILE * __f, char * __buff) {
|
||||
|
||||
char trash [MAX_TRASH_LENGTH];
|
||||
|
||||
fscanf (__f, "%[ \t:\n]", trash); /* Discarding sep. */
|
||||
fscanf (__f, "%[^:\n]", __buff); /* Reading the field */
|
||||
fgetc (__f);
|
||||
}
|
||||
|
||||
static void getLine (FILE * __f, char * __buff) {
|
||||
|
||||
char trash [MAX_TRASH_LENGTH];
|
||||
|
||||
fscanf (__f, "%[ \t:\n]", trash); /* Discarding sep. */
|
||||
fscanf (__f, "%[^\n]", __buff); /* Reading the line */
|
||||
}
|
||||
|
||||
static void loadBestRoute (FILE * __f) {
|
||||
|
||||
opt_route.clear ();
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++) {
|
||||
Node node;
|
||||
fscanf (__f, "%u", & node);
|
||||
opt_route.push_back (node - 1);
|
||||
}
|
||||
int d; /* -1 ! */
|
||||
fscanf (__f, "%d", & d);
|
||||
}
|
||||
|
||||
void loadOptimumRoute (const char * __filename) {
|
||||
|
||||
FILE * f = fopen (__filename, "r");
|
||||
|
||||
if (f) {
|
||||
|
||||
printf ("Loading '%s'.\n", __filename);
|
||||
|
||||
char field [MAX_FIELD_LENGTH];
|
||||
|
||||
getNextField (f, field); /* Name */
|
||||
assert (strstr (field, "NAME"));
|
||||
getNextField (f, field);
|
||||
//printf ("NAME: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Comment */
|
||||
assert (strstr (field, "COMMENT"));
|
||||
getLine (f, field);
|
||||
// printf ("COMMENT: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Type */
|
||||
assert (strstr (field, "TYPE"));
|
||||
getNextField (f, field);
|
||||
//printf ("TYPE: %s.\n", field);
|
||||
|
||||
getNextField (f, field); /* Dimension */
|
||||
assert (strstr (field, "DIMENSION"));
|
||||
getNextField (f, field);
|
||||
// printf ("DIMENSION: %s.\n", field);
|
||||
numNodes = atoi (field);
|
||||
|
||||
getNextField (f, field); /* Tour section */
|
||||
assert (strstr (field, "TOUR_SECTION"));
|
||||
loadBestRoute (f);
|
||||
|
||||
getNextField (f, field); /* End of file */
|
||||
assert (strstr (field, "EOF"));
|
||||
//printf ("EOF.\n");
|
||||
|
||||
printf ("The length of the best route is %u.\n", length (opt_route));
|
||||
}
|
||||
else {
|
||||
|
||||
fprintf (stderr, "Can't open '%s'.\n", __filename);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
void loadOptimumRoute (eoParser & __parser) {
|
||||
|
||||
/* Getting the path of the instance */
|
||||
|
||||
eoValueParam <std :: string> param ("", "optimumTour", "Optimum tour") ;
|
||||
__parser.processParam (param) ;
|
||||
if (strlen (param.value ().c_str ()))
|
||||
loadOptimumRoute (param.value ().c_str ());
|
||||
else
|
||||
opt_route.fitness (0);
|
||||
}
|
||||
|
||||
Route opt_route; /* Optimum route */
|
||||
|
||||
|
||||
0
trunk/paradiseo-peo/examples/shared/opt_route.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/opt_route.cpp:
Normal file
38
trunk/paradiseo-peo/examples/shared/opt_route.h
Normal file
38
trunk/paradiseo-peo/examples/shared/opt_route.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "opt_route.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __opt_route_h
|
||||
#define __opt_route_h
|
||||
|
||||
#include <cassert>
|
||||
#include <utils/eoParser.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
extern void loadOptimumRoute (const char * __filename);
|
||||
|
||||
extern void loadOptimumRoute (eoParser & __parser);
|
||||
|
||||
extern Route opt_route; /* Optimum route */
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/opt_route.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/opt_route.h:
Normal file
79
trunk/paradiseo-peo/examples/shared/order_xover.cpp
Normal file
79
trunk/paradiseo-peo/examples/shared/order_xover.cpp
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "order_xover.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2002
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
#include "order_xover.h"
|
||||
|
||||
void OrderXover :: cross (const Route & __par1, const Route & __par2, Route & __child) {
|
||||
|
||||
unsigned cut2 = 1 + rng.random (numNodes) ;
|
||||
unsigned cut1 = rng.random (cut2);
|
||||
unsigned l = 0;
|
||||
|
||||
/* To store vertices that have already been crossed */
|
||||
std :: vector <bool> v (numNodes, false);
|
||||
|
||||
/* Copy of the left partial route of the first parent */
|
||||
for (unsigned i = cut1 ; i < cut2 ; i ++) {
|
||||
__child [l ++] = __par1 [i] ;
|
||||
v [__par1 [i]] = true ;
|
||||
}
|
||||
|
||||
/* Searching the vertex of the second path, that ended the previous first one */
|
||||
unsigned from = 0 ;
|
||||
for (unsigned i = 0; i < numNodes; i ++)
|
||||
if (__par2 [i] == __child [cut2 - 1]) {
|
||||
from = i ;
|
||||
break ;
|
||||
}
|
||||
|
||||
/* Selecting a direction (Left or Right) */
|
||||
char direct = rng.flip () ? 1 : -1 ;
|
||||
|
||||
for (unsigned i = 0; i < numNodes + 1; i ++) {
|
||||
unsigned bidule = (direct * i + from + numNodes) % numNodes;
|
||||
if (! v [__par2 [bidule]]) {
|
||||
__child [l ++] = __par2 [bidule] ;
|
||||
v [__par2 [bidule]] = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OrderXover :: operator () (Route & __route1, Route & __route2) {
|
||||
|
||||
// Init. copy
|
||||
Route par [2] ;
|
||||
par [0] = __route1 ;
|
||||
par [1] = __route2 ;
|
||||
|
||||
cross (par [0], par [1], __route1) ;
|
||||
cross (par [1], par [0], __route2) ;
|
||||
|
||||
__route1.invalidate () ;
|
||||
__route2.invalidate () ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/order_xover.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/order_xover.cpp:
Normal file
43
trunk/paradiseo-peo/examples/shared/order_xover.h
Normal file
43
trunk/paradiseo-peo/examples/shared/order_xover.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "order_xover.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2003
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef order_xover_h
|
||||
#define order_xover_h
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Order Crossover */
|
||||
class OrderXover : public eoQuadOp <Route> {
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (Route & __route1, Route & __route2) ;
|
||||
|
||||
private :
|
||||
|
||||
void cross (const Route & __par1, const Route & __par2, Route & __child) ;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/order_xover.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/order_xover.h:
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
# Doxyfile 1.4.7
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "ParadisEO-PEO - Lessons"
|
||||
PROJECT_NUMBER = 0.1
|
||||
OUTPUT_DIRECTORY = ../../docs/html/lsnshared
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = .
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
NEWS \
|
||||
README
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = peo
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = ../../../paradiseo-mo/docs/eo.doxytag=../../../../paradiseo-mo/docs/html \
|
||||
../../../paradiseo-mo/docs/mo.doxytag=../../../../paradiseo-mo/docs/html \
|
||||
../../docs/paradiseo-peo.doxytag=../../
|
||||
GENERATE_TAGFILE = ../../docs/paradiseo-peo-lsn-shared.doxytag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
||||
38
trunk/paradiseo-peo/examples/shared/param.cpp
Normal file
38
trunk/paradiseo-peo/examples/shared/param.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "param.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <utils/eoParser.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "opt_route.h"
|
||||
|
||||
void loadParameters (int __argc, char * * __argv) {
|
||||
|
||||
eoParser parser (__argc, __argv);
|
||||
|
||||
loadData (parser);
|
||||
|
||||
loadOptimumRoute (parser);
|
||||
}
|
||||
|
||||
|
||||
0
trunk/paradiseo-peo/examples/shared/param.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/param.cpp:
Normal file
29
trunk/paradiseo-peo/examples/shared/param.h
Normal file
29
trunk/paradiseo-peo/examples/shared/param.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "param.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __param_h
|
||||
#define __param_h
|
||||
|
||||
extern void loadParameters (int __argc, char * * __argv);
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/param.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/param.h:
Normal file
45
trunk/paradiseo-peo/examples/shared/part_route_eval.cpp
Normal file
45
trunk/paradiseo-peo/examples/shared/part_route_eval.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "part_route_eval.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2003
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "part_route_eval.h"
|
||||
#include "node.h"
|
||||
|
||||
PartRouteEval :: PartRouteEval (float __from,
|
||||
float __to
|
||||
) : from (__from),
|
||||
to (__to) {
|
||||
|
||||
}
|
||||
|
||||
void PartRouteEval :: operator () (Route & __route) {
|
||||
|
||||
|
||||
unsigned len = 0 ;
|
||||
|
||||
for (unsigned i = (unsigned) (__route.size () * from) ;
|
||||
i < (unsigned) (__route.size () * to) ;
|
||||
i ++)
|
||||
len += distance (__route [i], __route [(i + 1) % numNodes]) ;
|
||||
|
||||
__route.fitness (- (int) len) ;
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/part_route_eval.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/part_route_eval.cpp:
Normal file
48
trunk/paradiseo-peo/examples/shared/part_route_eval.h
Normal file
48
trunk/paradiseo-peo/examples/shared/part_route_eval.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "part_route_eval.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2005
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __part_route_eval_h
|
||||
#define __part_route_eval_h
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Route Evaluator */
|
||||
class PartRouteEval : public eoEvalFunc <Route> {
|
||||
|
||||
public :
|
||||
|
||||
/** Constructor */
|
||||
PartRouteEval (float __from, float __to) ;
|
||||
|
||||
void operator () (Route & __route) ;
|
||||
|
||||
private :
|
||||
|
||||
float from, to ;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/part_route_eval.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/part_route_eval.h:
Normal file
76
trunk/paradiseo-peo/examples/shared/partial_mapped_xover.cpp
Normal file
76
trunk/paradiseo-peo/examples/shared/partial_mapped_xover.cpp
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "partial_mapped_xover.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2003
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
#include "partial_mapped_xover.h"
|
||||
#include "mix.h"
|
||||
|
||||
void PartialMappedXover :: repair (Route & __route, unsigned __cut1, unsigned __cut2) {
|
||||
|
||||
unsigned v [__route.size ()] ; // Number of times a cities are visited ...
|
||||
|
||||
for (unsigned i = 0 ; i < __route.size () ; i ++)
|
||||
v [i] = 0 ;
|
||||
|
||||
for (unsigned i = 0 ; i < __route.size () ; i ++)
|
||||
v [__route [i]] ++ ;
|
||||
|
||||
std :: vector <unsigned> vert ;
|
||||
|
||||
for (unsigned i = 0 ; i < __route.size () ; i ++)
|
||||
if (! v [i])
|
||||
vert.push_back (i) ;
|
||||
|
||||
mix (vert) ;
|
||||
|
||||
for (unsigned i = 0 ; i < __route.size () ; i ++)
|
||||
if (i < __cut1 || i >= __cut2)
|
||||
if (v [__route [i]] > 1) {
|
||||
__route [i] = vert.back () ;
|
||||
vert.pop_back () ;
|
||||
}
|
||||
}
|
||||
|
||||
bool PartialMappedXover :: operator () (Route & __route1, Route & __route2) {
|
||||
|
||||
unsigned cut1 = rng.random (__route1.size ()), cut2 = rng.random (__route2.size ()) ;
|
||||
|
||||
if (cut2 < cut1)
|
||||
std :: swap (cut1, cut2) ;
|
||||
|
||||
// Between the cuts
|
||||
for (unsigned i = cut1 ; i < cut2 ; i ++)
|
||||
std :: swap (__route1 [i], __route2 [i]) ;
|
||||
|
||||
// Outside the cuts
|
||||
repair (__route1, cut1, cut2) ;
|
||||
repair (__route2, cut1, cut2) ;
|
||||
|
||||
__route1.invalidate () ;
|
||||
__route2.invalidate () ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
43
trunk/paradiseo-peo/examples/shared/partial_mapped_xover.h
Normal file
43
trunk/paradiseo-peo/examples/shared/partial_mapped_xover.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "partial_mapped_xover.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2003
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef partial_mapped_xover_h
|
||||
#define partial_mapped_xover_h
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
/** Partial Mapped Crossover */
|
||||
class PartialMappedXover : public eoQuadOp <Route> {
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (Route & __route1, Route & __route2) ;
|
||||
|
||||
private :
|
||||
|
||||
void repair (Route & __route, unsigned __cut1, unsigned __cut2) ;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
36
trunk/paradiseo-peo/examples/shared/route.cpp
Normal file
36
trunk/paradiseo-peo/examples/shared/route.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "route.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "route.h"
|
||||
|
||||
unsigned length (const Route & __route) {
|
||||
|
||||
unsigned len = 0 ;
|
||||
|
||||
for (unsigned i = 0; i < numNodes; i ++)
|
||||
len += distance (__route [i], __route [(i + 1) % numNodes]) ;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
0
trunk/paradiseo-peo/examples/shared/route.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/route.cpp:
Normal file
35
trunk/paradiseo-peo/examples/shared/route.h
Normal file
35
trunk/paradiseo-peo/examples/shared/route.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "route.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __route_h
|
||||
#define __route_h
|
||||
|
||||
#include <eoVector.h>
|
||||
|
||||
#include "node.h"
|
||||
|
||||
typedef eoVector <int, Node> Route;
|
||||
|
||||
unsigned length (const Route & __route);
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/route.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/route.h:
Normal file
29
trunk/paradiseo-peo/examples/shared/route_eval.cpp
Normal file
29
trunk/paradiseo-peo/examples/shared/route_eval.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "route_eval.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "route_eval.h"
|
||||
|
||||
void RouteEval :: operator () (Route & __route) {
|
||||
|
||||
__route.fitness (- (int) length (__route));
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/route_eval.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/route_eval.cpp:
Normal file
38
trunk/paradiseo-peo/examples/shared/route_eval.h
Normal file
38
trunk/paradiseo-peo/examples/shared/route_eval.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "route_eval.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __route_eval_h
|
||||
#define __route_eval_h
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class RouteEval : public eoEvalFunc <Route> {
|
||||
|
||||
public :
|
||||
|
||||
void operator () (Route & __route) ;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/route_eval.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/route_eval.h:
Normal file
38
trunk/paradiseo-peo/examples/shared/route_init.cpp
Normal file
38
trunk/paradiseo-peo/examples/shared/route_init.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "route_init.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
#include "route_init.h"
|
||||
#include "node.h"
|
||||
|
||||
void RouteInit :: operator () (Route & __route) {
|
||||
|
||||
__route.clear ();
|
||||
|
||||
for (unsigned i = 0 ; i < numNodes ; i ++)
|
||||
__route.push_back (i);
|
||||
|
||||
for (unsigned i = 0 ; i < numNodes ; i ++)
|
||||
std :: swap (__route [i], __route [rng.random (numNodes)]);
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/route_init.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/route_init.cpp:
Normal file
38
trunk/paradiseo-peo/examples/shared/route_init.h
Normal file
38
trunk/paradiseo-peo/examples/shared/route_init.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "route_init.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __route_init_h
|
||||
#define __route_init_h
|
||||
|
||||
#include <eoInit.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class RouteInit : public eoInit <Route> {
|
||||
|
||||
public :
|
||||
|
||||
void operator () (Route & __route);
|
||||
} ;
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/route_init.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/route_init.h:
Normal file
35
trunk/paradiseo-peo/examples/shared/two_opt.cpp
Normal file
35
trunk/paradiseo-peo/examples/shared/two_opt.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "two_opt.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "two_opt.h"
|
||||
|
||||
void TwoOpt :: operator () (Route & __route) {
|
||||
|
||||
unsigned i = 0;
|
||||
|
||||
while ((2 * i) < (second - first)) {
|
||||
|
||||
std :: swap (__route [first + i], __route [second - i]);
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/two_opt.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/two_opt.cpp:
Normal file
40
trunk/paradiseo-peo/examples/shared/two_opt.h
Normal file
40
trunk/paradiseo-peo/examples/shared/two_opt.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "two_opt.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_h
|
||||
#define __two_opt_h
|
||||
|
||||
#include <utility>
|
||||
#include <moMove.h>
|
||||
|
||||
#include "route.h"
|
||||
|
||||
class TwoOpt : public moMove <Route>, public std :: pair <unsigned, unsigned> {
|
||||
|
||||
public :
|
||||
|
||||
void operator () (Route & __route);
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/two_opt.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/two_opt.h:
Normal file
39
trunk/paradiseo-peo/examples/shared/two_opt_incr_eval.cpp
Normal file
39
trunk/paradiseo-peo/examples/shared/two_opt_incr_eval.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "TwoOptIncrEval.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "two_opt_incr_eval.h"
|
||||
#include "node.h"
|
||||
|
||||
int TwoOptIncrEval :: operator () (const TwoOpt & __move, const Route & __route) {
|
||||
|
||||
/* From */
|
||||
Node v1 = __route [__move.first], v1_left = __route [(__move.first - 1 + numNodes) % numNodes];
|
||||
|
||||
/* To */
|
||||
Node v2 = __route [__move.second], v2_right = __route [(__move.second + 1) % numNodes];
|
||||
|
||||
if (v1 == v2 || v2_right == v1)
|
||||
return __route.fitness ();
|
||||
else
|
||||
return __route.fitness () - distance (v1_left, v2) - distance (v1, v2_right) + distance (v1_left, v1) + distance (v2, v2_right);
|
||||
}
|
||||
38
trunk/paradiseo-peo/examples/shared/two_opt_incr_eval.h
Normal file
38
trunk/paradiseo-peo/examples/shared/two_opt_incr_eval.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "TwoOptIncrEval.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_incr_eval_h
|
||||
#define __two_opt_incr_eval_h
|
||||
|
||||
#include <moMoveIncrEval.h>
|
||||
#include "two_opt.h"
|
||||
|
||||
class TwoOptIncrEval : public moMoveIncrEval <TwoOpt> {
|
||||
|
||||
public :
|
||||
|
||||
int operator () (const TwoOpt & __move, const Route & __route) ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/two_opt_incr_eval.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/two_opt_incr_eval.h:
Normal file
29
trunk/paradiseo-peo/examples/shared/two_opt_init.cpp
Normal file
29
trunk/paradiseo-peo/examples/shared/two_opt_init.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "two_opt_init.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, 2003
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "two_opt_init.h"
|
||||
|
||||
void TwoOptInit :: operator () (TwoOpt & __move, const Route & __route) {
|
||||
|
||||
__move.first = __move.second = 0;
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/two_opt_init.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/two_opt_init.cpp:
Normal file
40
trunk/paradiseo-peo/examples/shared/two_opt_init.h
Normal file
40
trunk/paradiseo-peo/examples/shared/two_opt_init.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "two_opt_init.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_init_h
|
||||
#define __two_opt_init_h
|
||||
|
||||
#include <moMoveInit.h>
|
||||
|
||||
#include "two_opt.h"
|
||||
|
||||
class TwoOptInit : public moMoveInit <TwoOpt> {
|
||||
|
||||
public :
|
||||
|
||||
void operator () (TwoOpt & __move, const Route & __route) ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/two_opt_init.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/two_opt_init.h:
Normal file
42
trunk/paradiseo-peo/examples/shared/two_opt_next.cpp
Normal file
42
trunk/paradiseo-peo/examples/shared/two_opt_next.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "two_opt_next.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include "two_opt_next.h"
|
||||
#include "node.h"
|
||||
|
||||
bool TwoOptNext :: operator () (TwoOpt & __move, const Route & __route) {
|
||||
|
||||
if (__move.first == numNodes - 1 && __move.second == numNodes - 1)
|
||||
return false;
|
||||
|
||||
else {
|
||||
|
||||
__move.second ++;
|
||||
if (__move.second == numNodes) {
|
||||
|
||||
__move.first ++;
|
||||
__move.second = __move.first;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
0
trunk/paradiseo-peo/examples/shared/two_opt_next.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/two_opt_next.cpp:
Normal file
39
trunk/paradiseo-peo/examples/shared/two_opt_next.h
Normal file
39
trunk/paradiseo-peo/examples/shared/two_opt_next.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "two_opt_next.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_next_h
|
||||
#define __two_opt_next_h
|
||||
|
||||
#include <moNextMove.h>
|
||||
|
||||
#include "two_opt.h"
|
||||
|
||||
class TwoOptNext : public moNextMove <TwoOpt> {
|
||||
|
||||
public :
|
||||
|
||||
bool operator () (TwoOpt & __move, const Route & __route);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/two_opt_next.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/two_opt_next.h:
Normal file
36
trunk/paradiseo-peo/examples/shared/two_opt_rand.cpp
Normal file
36
trunk/paradiseo-peo/examples/shared/two_opt_rand.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "two_opt_rand.cpp"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
#include "two_opt_rand.h"
|
||||
#include "node.h"
|
||||
|
||||
void TwoOptRand :: operator () (TwoOpt & __move, const Route & __route) {
|
||||
|
||||
__move.second = rng.random (numNodes);
|
||||
|
||||
__move.first = rng.random (__move.second);
|
||||
}
|
||||
|
||||
|
||||
0
trunk/paradiseo-peo/examples/shared/two_opt_rand.cpp:
Normal file
0
trunk/paradiseo-peo/examples/shared/two_opt_rand.cpp:
Normal file
39
trunk/paradiseo-peo/examples/shared/two_opt_rand.h
Normal file
39
trunk/paradiseo-peo/examples/shared/two_opt_rand.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
// "two_opt_rand.h"
|
||||
|
||||
// (c) OPAC Team, LIFL, January 2006
|
||||
|
||||
/* 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: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef __two_opt_rand_h
|
||||
#define __two_opt_rand_h
|
||||
|
||||
#include <eoMoveRand.h>
|
||||
|
||||
#include "two_opt.h"
|
||||
|
||||
class TwoOptRand : public eoMoveRand <TwoOpt> {
|
||||
|
||||
public :
|
||||
|
||||
void operator () (TwoOpt & __move, const Route & __route) ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
0
trunk/paradiseo-peo/examples/shared/two_opt_rand.h:
Normal file
0
trunk/paradiseo-peo/examples/shared/two_opt_rand.h:
Normal file
Loading…
Add table
Add a link
Reference in a new issue