ParadisEO-MOEO before new separated modules
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@361 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
38f8b00568
commit
c56a41ffc3
95 changed files with 11111 additions and 0 deletions
4
tags/paradiseo-moeo-0.3/AUTHORS
Normal file
4
tags/paradiseo-moeo-0.3/AUTHORS
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Arnaud Liefooghe
|
||||||
|
Thomas Legrand
|
||||||
|
Sébastien Cahon
|
||||||
|
Abdelhakim Deneche
|
||||||
0
tags/paradiseo-moeo-0.3/ChangeLog
Normal file
0
tags/paradiseo-moeo-0.3/ChangeLog
Normal file
16
tags/paradiseo-moeo-0.3/Makefile.am
Normal file
16
tags/paradiseo-moeo-0.3/Makefile.am
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
SUBDIRS = docs src tutorials
|
||||||
|
|
||||||
|
clean_all: clean_aux clean_doc
|
||||||
|
-@make clean
|
||||||
|
-@(rm -rf aclocal.m4 autom4te.cache configure config.* CO* dep* INST* install-sh miss* mkins* Makefile Makefile.in;\
|
||||||
|
cd docs; rm -rf Makefile Makefile.in *.doxytag; cd ../src ; rm -rf Makefile Makefile.in; cd ../tutorials; rm -rf Makefile Makefile.in;\
|
||||||
|
cd lesson1; rm -rf .deps/ Makefile Makefile.in; cd ../lesson2; rm -rf .deps/ Makefile Makefile.in)
|
||||||
|
|
||||||
|
clean_aux:
|
||||||
|
-@find . \( -name "*~" -o -name "*.old" -o -name "#*" -o -name "*.bak" \) -print -exec rm -rf \{\} \;
|
||||||
|
|
||||||
|
doc:
|
||||||
|
-@(cd docs; make doc)
|
||||||
|
|
||||||
|
clean_doc:
|
||||||
|
-@(cd docs; make clean-local)
|
||||||
7
tags/paradiseo-moeo-0.3/NEWS
Normal file
7
tags/paradiseo-moeo-0.3/NEWS
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
* release 0.1
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# coding: iso-8859-1
|
||||||
|
# mode: text
|
||||||
|
# fill-column: 80
|
||||||
|
# End:
|
||||||
63
tags/paradiseo-moeo-0.3/README
Normal file
63
tags/paradiseo-moeo-0.3/README
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
PARADISEO-MOEO README FILE
|
||||||
|
=======================================================================
|
||||||
|
check latest news at http://paradiseo.gforge.inria.fr/
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
Welcome to ParadisEO-MOEO, the Multi-Objective Evolving Objects library.
|
||||||
|
The latest news about ParadisEO-MOEO can be found on the gforge repository at
|
||||||
|
http://paradiseo.gforge.inria.fr/
|
||||||
|
In case of any problem, please e-mail us at
|
||||||
|
paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
|
|
||||||
|
==================================================================
|
||||||
|
BUILDING PARADISEO-MOEO
|
||||||
|
==================================================================
|
||||||
|
The basic installation procedure goes the following:
|
||||||
|
|
||||||
|
Go to your build-directory and run
|
||||||
|
> ./autogen.sh --with-EOdir=$(EO_SRC)
|
||||||
|
> make
|
||||||
|
> make doc
|
||||||
|
|
||||||
|
where $(EO_SRC) is the top-level source directory of PARADISEO-EO.
|
||||||
|
|
||||||
|
In case of problems, you can read the INSTALL file - but remember this
|
||||||
|
is a standard installation file from GNU and that it contains nothing
|
||||||
|
specific about PARADISEO-MOEO.
|
||||||
|
|
||||||
|
To clean everything, the simply run
|
||||||
|
> make clean_all
|
||||||
|
|
||||||
|
===================================================================
|
||||||
|
DIRECTORY STRUCTURE
|
||||||
|
===================================================================
|
||||||
|
After unpacking the archive file, you should end up with the following
|
||||||
|
structure:
|
||||||
|
|
||||||
|
.../ The main PARADISEO-MOEO directory, created when unpacking.
|
||||||
|
|
|
||||||
|
+-- src SOURCE directory Contains most PARADISEO-MOEO .h files.
|
||||||
|
|
|
||||||
|
+-- docs DOCUMENTATION directory (generated by Doxygen).
|
||||||
|
| |
|
||||||
|
| +- html HTML files - start at index.html.
|
||||||
|
| |
|
||||||
|
| +- latex latex files - use to generate Postcript doc.
|
||||||
|
| |
|
||||||
|
| +- man Unix man format documentation.
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- tutorials APPLICATIONS - one directory per separate application.
|
||||||
|
|
|
||||||
|
+-- lesson1 A bi-objective flow-shop problem example with main algorithms.
|
||||||
|
| |
|
||||||
|
| +-benchmarks Instance files for testing.
|
||||||
|
|
|
||||||
|
|-- lesson2 Implement NSGA-II for the SCH1 problem.
|
||||||
|
|
||||||
|
===================================================================
|
||||||
|
NOTES
|
||||||
|
===================================================================
|
||||||
|
|
||||||
|
Mailing list : paradiseo-help@lists.gforge.inria.fr
|
||||||
148
tags/paradiseo-moeo-0.3/autogen.sh
Normal file
148
tags/paradiseo-moeo-0.3/autogen.sh
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Run this to generate all the initial makefiles, etc.
|
||||||
|
|
||||||
|
srcdir=`dirname $0`
|
||||||
|
PKG_NAME="the package."
|
||||||
|
|
||||||
|
DIE=0
|
||||||
|
|
||||||
|
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "**Error**: You must have \`autoconf' installed to."
|
||||||
|
echo "Download the appropriate package for your distribution,"
|
||||||
|
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
|
||||||
|
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
|
||||||
|
(libtool --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "**Error**: You must have \`libtool' installed."
|
||||||
|
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
|
||||||
|
echo "(or a newer version if it is available)"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
|
||||||
|
grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
|
||||||
|
(gettext --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "**Error**: You must have \`gettext' installed."
|
||||||
|
echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
|
||||||
|
echo "(or a newer version if it is available)"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
|
||||||
|
grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
|
||||||
|
(gettext --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "**Error**: You must have \`gettext' installed."
|
||||||
|
echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
|
||||||
|
echo "(or a newer version if it is available)"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "**Error**: You must have \`automake' installed."
|
||||||
|
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
|
||||||
|
echo "(or a newer version if it is available)"
|
||||||
|
DIE=1
|
||||||
|
NO_AUTOMAKE=yes
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# if no automake, don't bother testing for aclocal
|
||||||
|
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
|
||||||
|
echo "installed doesn't appear recent enough."
|
||||||
|
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
|
||||||
|
echo "(or a newer version if it is available)"
|
||||||
|
DIE=1
|
||||||
|
}
|
||||||
|
|
||||||
|
if test "$DIE" -eq 1; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$*"; then
|
||||||
|
echo "**Warning**: I am going to run \`configure' with no arguments."
|
||||||
|
echo "If you wish to pass any to it, please specify them on the"
|
||||||
|
echo \`$0\'" command line."
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $CC in
|
||||||
|
xlc )
|
||||||
|
am_opt=--include-deps;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for coin in `find $srcdir -name configure.in -print`
|
||||||
|
do
|
||||||
|
dr=`dirname $coin`
|
||||||
|
if test -f $dr/NO-AUTO-GEN; then
|
||||||
|
echo skipping $dr -- flagged as no auto-gen
|
||||||
|
else
|
||||||
|
echo processing $dr
|
||||||
|
macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
|
||||||
|
( cd $dr
|
||||||
|
aclocalinclude="$ACLOCAL_FLAGS"
|
||||||
|
for k in $macrodirs; do
|
||||||
|
if test -d $k; then
|
||||||
|
aclocalinclude="$aclocalinclude -I $k"
|
||||||
|
##else
|
||||||
|
## echo "**Warning**: No such directory \`$k'. Ignored."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
|
||||||
|
if grep "sed.*POTFILES" configure.in >/dev/null; then
|
||||||
|
: do nothing -- we still have an old unmodified configure.in
|
||||||
|
else
|
||||||
|
echo "Creating $dr/aclocal.m4 ..."
|
||||||
|
test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
|
||||||
|
echo "Running gettextize... Ignore non-fatal messages."
|
||||||
|
echo "no" | gettextize --force --copy
|
||||||
|
echo "Making $dr/aclocal.m4 writable ..."
|
||||||
|
test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
|
||||||
|
echo "Creating $dr/aclocal.m4 ..."
|
||||||
|
test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
|
||||||
|
echo "Running gettextize... Ignore non-fatal messages."
|
||||||
|
echo "no" | gettextize --force --copy
|
||||||
|
echo "Making $dr/aclocal.m4 writable ..."
|
||||||
|
test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
|
||||||
|
fi
|
||||||
|
if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
|
||||||
|
echo "Running libtoolize..."
|
||||||
|
libtoolize --force --copy
|
||||||
|
fi
|
||||||
|
echo "Running aclocal $aclocalinclude ..."
|
||||||
|
aclocal $aclocalinclude
|
||||||
|
if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
|
||||||
|
echo "Running autoheader..."
|
||||||
|
autoheader
|
||||||
|
fi
|
||||||
|
echo "Running automake --gnu $am_opt ..."
|
||||||
|
automake --add-missing --gnu $am_opt
|
||||||
|
echo "Running autoconf ..."
|
||||||
|
autoconf
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
|
||||||
|
|
||||||
|
if test x$NOCONFIGURE = x; then
|
||||||
|
echo Running $srcdir/configure $conf_flags "$@" ...
|
||||||
|
$srcdir/configure $conf_flags "$@" \
|
||||||
|
&& echo Now type \`make\' to compile $PKG_NAME
|
||||||
|
else
|
||||||
|
echo Skipping configure process.
|
||||||
|
fi
|
||||||
43
tags/paradiseo-moeo-0.3/configure.in
Normal file
43
tags/paradiseo-moeo-0.3/configure.in
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
AC_INIT(configure.in)
|
||||||
|
AM_INIT_AUTOMAKE(moeo, 0.1)
|
||||||
|
|
||||||
|
AC_ISC_POSIX
|
||||||
|
AC_PROG_CXX
|
||||||
|
AM_PROG_CC_STDC
|
||||||
|
AC_HEADER_STDC
|
||||||
|
AC_PROG_RANLIB
|
||||||
|
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
AC_PROG_LN_S
|
||||||
|
AC_PROG_MAKE_SET
|
||||||
|
|
||||||
|
AC_C_CONST
|
||||||
|
AC_C_INLINE
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
|
|
||||||
|
AC_SUBST(EO_DIR)
|
||||||
|
|
||||||
|
dnl EO
|
||||||
|
AC_ARG_WITH(EOdir,
|
||||||
|
--with-EOdir : Giving the path of the EO tree.,
|
||||||
|
EO_DIR="$withval"
|
||||||
|
if test ! -d $EO_DIR
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
echo "# --with-EOdir Invalid directory $withval"
|
||||||
|
exit 1
|
||||||
|
fi,
|
||||||
|
echo ""
|
||||||
|
echo "# You forgot to give the path of the EO tree !"
|
||||||
|
echo "# Please write something like ... './configure --with-EOdir=\$HOME/eo'"
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_OUTPUT([
|
||||||
|
Makefile
|
||||||
|
src/Makefile
|
||||||
|
docs/Makefile
|
||||||
|
tutorials/Makefile
|
||||||
|
tutorials/lesson1/Makefile
|
||||||
|
tutorials/lesson2/Makefile
|
||||||
|
])
|
||||||
5
tags/paradiseo-moeo-0.3/docs/Makefile.am
Normal file
5
tags/paradiseo-moeo-0.3/docs/Makefile.am
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
doc:
|
||||||
|
-@doxygen moeo.doxyfile
|
||||||
|
|
||||||
|
clean-local:
|
||||||
|
rm -rf html latex man
|
||||||
53
tags/paradiseo-moeo-0.3/docs/index.h
Normal file
53
tags/paradiseo-moeo-0.3/docs/index.h
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
/** @mainpage Welcome to ParadisEO-MOEO
|
||||||
|
|
||||||
|
@section intro Introduction
|
||||||
|
|
||||||
|
ParadisEO-MOEO is a white-box object-oriented generic framework dedicated to the flexible design of evolutionary multi-objective algorithms.
|
||||||
|
This paradigm-free software embeds some features and techniques for Pareto-based resolution and
|
||||||
|
aims to provide a set of classes allowing to ease and speed up the development of computationally efficient programs.
|
||||||
|
It is based on a clear conceptual distinction between the solution methods and the multi-objective problems they are intended to solve.
|
||||||
|
This separation confers a maximum design and code reuse.
|
||||||
|
ParadisEO-MOEO provides a broad range of archive-related features (such as elitism or performance metrics)
|
||||||
|
and the most common Pareto-based fitness assignment strategies (MOGA, NSGA, SPEA, IBEA and more).
|
||||||
|
Furthermore, parallel and distributed models as well as hybridization mechanisms can be applied to an algorithm designed within ParadisEO-MOEO
|
||||||
|
using the whole version of ParadisEO.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@section tutorials Tutorials
|
||||||
|
|
||||||
|
Tutorials for ParadisEO-MOEO are available <a href="http://paradiseo.gforge.inria.fr/index.php?n=Paradiseo.UsersGuides">here</a>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@section install Installation
|
||||||
|
|
||||||
|
The installation procedure of the package is detailed in the <a
|
||||||
|
href="../../README">README</a> file in the top-directory of the source-tree.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@section design Overall Design
|
||||||
|
|
||||||
|
For an introduction to the design of ParadisEO-MOEO,
|
||||||
|
you can look at the <a href="http://paradiseo.gforge.inria.fr">ParadisEO website</a>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** @page webpages Related webpages
|
||||||
|
|
||||||
|
- ParadisEO <a href="http://paradiseo.gforge.inria.fr">homepage</a>
|
||||||
|
- INRIA GForge <a href="http://gforge.inria.fr/projects/paradiseo/">project page</a>
|
||||||
|
- <a href="../../README">README</a>
|
||||||
|
- <a href="../../NEWS">NEWS</a>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// coding: iso-8859-1
|
||||||
|
// mode: C++
|
||||||
|
// c-file-style: "Stroustrup"
|
||||||
|
// fill-column: 80
|
||||||
|
// End:
|
||||||
237
tags/paradiseo-moeo-0.3/docs/moeo.doxyfile
Normal file
237
tags/paradiseo-moeo-0.3/docs/moeo.doxyfile
Normal file
|
|
@ -0,0 +1,237 @@
|
||||||
|
# Doxyfile 1.5.1
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Project related configuration options
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
PROJECT_NAME = ParadisEO-MOEO
|
||||||
|
PROJECT_NUMBER = 1.0
|
||||||
|
OUTPUT_DIRECTORY =
|
||||||
|
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 = . ../src
|
||||||
|
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 = moeo
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# 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 = NO
|
||||||
|
USE_PDFLATEX = NO
|
||||||
|
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-eo/doc/eo.doxytag=../../../paradiseo-eo/doc/html
|
||||||
|
GENERATE_TAGFILE = moeo.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
|
||||||
291
tags/paradiseo-moeo-0.3/src/MOEO.h
Normal file
291
tags/paradiseo-moeo-0.3/src/MOEO.h
Normal file
|
|
@ -0,0 +1,291 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// MOEO.h
|
||||||
|
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||||
|
/*
|
||||||
|
This library...
|
||||||
|
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MOEO_H_
|
||||||
|
#define MOEO_H_
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <EO.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class allowing to represent a solution (an individual) for multi-objective optimization.
|
||||||
|
* The template argument MOEOObjectiveVector allows to represent the solution in the objective space (it can be a moeoObjectiveVector object).
|
||||||
|
* The template argument MOEOFitness is an object reflecting the quality of the solution in term of convergence (the fitness of a solution is always to be maximized).
|
||||||
|
* The template argument MOEODiversity is an object reflecting the quality of the solution in term of diversity (the diversity of a solution is always to be maximized).
|
||||||
|
* All template arguments must have a void and a copy constructor.
|
||||||
|
* Using some specific representations, you will have to define a copy constructor if the default one is not what you want.
|
||||||
|
* In the same cases, you will also have to define the affectation operator (operator=).
|
||||||
|
* Then, you will explicitly have to call the parent copy constructor and the parent affectation operator at the beginning of the corresponding implementation.
|
||||||
|
* Besides, note that, contrary to the mono-objective case (and to EO) where the fitness value of a solution is confused with its objective value,
|
||||||
|
* the fitness value differs of the objectives values in the multi-objective case.
|
||||||
|
*/
|
||||||
|
template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity >
|
||||||
|
class MOEO : public EO < MOEOObjectiveVector >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** the objective vector type of a solution */
|
||||||
|
typedef MOEOObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
/** the fitness type of a solution */
|
||||||
|
typedef MOEOFitness Fitness;
|
||||||
|
|
||||||
|
/** the diversity type of a solution */
|
||||||
|
typedef MOEODiversity Diversity;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
*/
|
||||||
|
MOEO()
|
||||||
|
{
|
||||||
|
// default values for every parameters
|
||||||
|
objectiveVectorValue = ObjectiveVector();
|
||||||
|
fitnessValue = Fitness();
|
||||||
|
diversityValue = Diversity();
|
||||||
|
// invalidate all
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual dtor
|
||||||
|
*/
|
||||||
|
virtual ~MOEO() {};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the objective vector of the current solution
|
||||||
|
*/
|
||||||
|
ObjectiveVector objectiveVector() const
|
||||||
|
{
|
||||||
|
if ( invalidObjectiveVector() )
|
||||||
|
{
|
||||||
|
throw std::runtime_error("invalid objective vector");
|
||||||
|
}
|
||||||
|
return objectiveVectorValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the objective vector of the current solution
|
||||||
|
* @param _objectiveVectorValue the new objective vector
|
||||||
|
*/
|
||||||
|
void objectiveVector(const ObjectiveVector & _objectiveVectorValue)
|
||||||
|
{
|
||||||
|
objectiveVectorValue = _objectiveVectorValue;
|
||||||
|
invalidObjectiveVectorValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the objective vector as invalid
|
||||||
|
*/
|
||||||
|
void invalidateObjectiveVector()
|
||||||
|
{
|
||||||
|
invalidObjectiveVectorValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the objective vector is invalid, false otherwise
|
||||||
|
*/
|
||||||
|
bool invalidObjectiveVector() const
|
||||||
|
{
|
||||||
|
return invalidObjectiveVectorValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fitness value of the current solution
|
||||||
|
*/
|
||||||
|
Fitness fitness() const
|
||||||
|
{
|
||||||
|
if ( invalidFitness() )
|
||||||
|
{
|
||||||
|
throw std::runtime_error("invalid fitness (MOEO)");
|
||||||
|
}
|
||||||
|
return fitnessValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the fitness value of the current solution
|
||||||
|
* @param _fitnessValue the new fitness value
|
||||||
|
*/
|
||||||
|
void fitness(const Fitness & _fitnessValue)
|
||||||
|
{
|
||||||
|
fitnessValue = _fitnessValue;
|
||||||
|
invalidFitnessValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the fitness value as invalid
|
||||||
|
*/
|
||||||
|
void invalidateFitness()
|
||||||
|
{
|
||||||
|
invalidFitnessValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the fitness value is invalid, false otherwise
|
||||||
|
*/
|
||||||
|
bool invalidFitness() const
|
||||||
|
{
|
||||||
|
return invalidFitnessValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the diversity value of the current solution
|
||||||
|
*/
|
||||||
|
Diversity diversity() const
|
||||||
|
{
|
||||||
|
if ( invalidDiversity() )
|
||||||
|
{
|
||||||
|
throw std::runtime_error("invalid diversity");
|
||||||
|
}
|
||||||
|
return diversityValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the diversity value of the current solution
|
||||||
|
* @param _diversityValue the new diversity value
|
||||||
|
*/
|
||||||
|
void diversity(const Diversity & _diversityValue)
|
||||||
|
{
|
||||||
|
diversityValue = _diversityValue;
|
||||||
|
invalidDiversityValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the diversity value as invalid
|
||||||
|
*/
|
||||||
|
void invalidateDiversity()
|
||||||
|
{
|
||||||
|
invalidDiversityValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the diversity value is invalid, false otherwise
|
||||||
|
*/
|
||||||
|
bool invalidDiversity() const
|
||||||
|
{
|
||||||
|
return invalidDiversityValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the objective vector, the fitness value and the diversity value as invalid
|
||||||
|
*/
|
||||||
|
void invalidate()
|
||||||
|
{
|
||||||
|
invalidateObjectiveVector();
|
||||||
|
invalidateFitness();
|
||||||
|
invalidateDiversity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the fitness value is invalid, false otherwise
|
||||||
|
*/
|
||||||
|
bool invalid() const
|
||||||
|
{
|
||||||
|
return invalidObjectiveVector();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the objective vector of the current solution is smaller than the objective vector of _other on the first objective,
|
||||||
|
* then on the second, and so on (can be usefull for sorting/printing).
|
||||||
|
* You should implement another function in the sub-class of MOEO to have another sorting mecanism.
|
||||||
|
* @param _other the other MOEO object to compare with
|
||||||
|
*/
|
||||||
|
bool operator<(const MOEO & _other) const
|
||||||
|
{
|
||||||
|
return objectiveVector() < _other.objectiveVector();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class id (the class name as a std::string)
|
||||||
|
*/
|
||||||
|
virtual std::string className() const
|
||||||
|
{
|
||||||
|
return "MOEO";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writing object
|
||||||
|
* @param _os output stream
|
||||||
|
*/
|
||||||
|
virtual void printOn(std::ostream & _os) const
|
||||||
|
{
|
||||||
|
if ( invalidObjectiveVector() )
|
||||||
|
{
|
||||||
|
_os << "INVALID\t";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_os << objectiveVectorValue << '\t';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reading object
|
||||||
|
* @param _is input stream
|
||||||
|
*/
|
||||||
|
virtual void readFrom(std::istream & _is)
|
||||||
|
{
|
||||||
|
std::string objectiveVector_str;
|
||||||
|
int pos = _is.tellg();
|
||||||
|
_is >> objectiveVector_str;
|
||||||
|
if (objectiveVector_str == "INVALID")
|
||||||
|
{
|
||||||
|
invalidateObjectiveVector();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
invalidObjectiveVectorValue = false;
|
||||||
|
_is.seekg(pos); // rewind
|
||||||
|
_is >> objectiveVectorValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** the objective vector of this solution */
|
||||||
|
ObjectiveVector objectiveVectorValue;
|
||||||
|
/** true if the objective vector is invalid */
|
||||||
|
bool invalidObjectiveVectorValue;
|
||||||
|
/** the fitness value of this solution */
|
||||||
|
Fitness fitnessValue;
|
||||||
|
/** true if the fitness value is invalid */
|
||||||
|
bool invalidFitnessValue;
|
||||||
|
/** the diversity value of this solution */
|
||||||
|
Diversity diversityValue;
|
||||||
|
/** true if the diversity value is invalid */
|
||||||
|
bool invalidDiversityValue;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*MOEO_H_*/
|
||||||
1
tags/paradiseo-moeo-0.3/src/Makefile.am
Normal file
1
tags/paradiseo-moeo-0.3/src/Makefile.am
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# Nothing to compile !
|
||||||
227
tags/paradiseo-moeo-0.3/src/distance/moeoDistance.h
Normal file
227
tags/paradiseo-moeo-0.3/src/distance/moeoDistance.h
Normal file
|
|
@ -0,0 +1,227 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// moeoDistance.h
|
||||||
|
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||||
|
/*
|
||||||
|
This library...
|
||||||
|
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MOEODISTANCE_H_
|
||||||
|
#define MOEODISTANCE_H_
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
#include <utils/eoRealBounds.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base class for distance computation.
|
||||||
|
*/
|
||||||
|
template < class MOEOT , class Type >
|
||||||
|
class moeoDistance : public eoBF < const MOEOT &, const MOEOT &, const Type >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nothing to do
|
||||||
|
* @param _pop the population
|
||||||
|
*/
|
||||||
|
virtual void setup(const eoPop < MOEOT > & _pop)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nothing to do
|
||||||
|
* @param _min lower bound
|
||||||
|
* @param _max upper bound
|
||||||
|
* @param _obj the objective index
|
||||||
|
*/
|
||||||
|
virtual void setup(double _min, double _max, unsigned _obj)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nothing to do
|
||||||
|
* @param _realInterval the eoRealInterval object
|
||||||
|
* @param _obj the objective index
|
||||||
|
*/
|
||||||
|
virtual void setup(eoRealInterval _realInterval, unsigned _obj)
|
||||||
|
{}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base class for double distance computation with normalized objective values (i.e. between 0 and 1).
|
||||||
|
*/
|
||||||
|
template < class MOEOT , class Type = double >
|
||||||
|
class moeoNormalizedDistance : public moeoDistance < MOEOT , Type >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** the objective vector type of the solutions */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default ctr
|
||||||
|
*/
|
||||||
|
moeoNormalizedDistance()
|
||||||
|
{
|
||||||
|
bounds.resize(ObjectiveVector::Traits::nObjectives());
|
||||||
|
// initialize bounds in case someone does not want to use them
|
||||||
|
for (unsigned i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
|
||||||
|
{
|
||||||
|
bounds[i] = eoRealInterval(0,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a very small value that can be used to avoid extreme cases (where the min bound == the max bound)
|
||||||
|
*/
|
||||||
|
static double tiny()
|
||||||
|
{
|
||||||
|
return 1e-6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the lower and the upper bounds for every objective using extremes values for solutions contained in the population _pop
|
||||||
|
* @param _pop the population
|
||||||
|
*/
|
||||||
|
virtual void setup(const eoPop < MOEOT > & _pop)
|
||||||
|
{
|
||||||
|
double min, max;
|
||||||
|
for (unsigned i=0; i<ObjectiveVector::Traits::nObjectives(); i++)
|
||||||
|
{
|
||||||
|
min = _pop[0].objectiveVector()[i];
|
||||||
|
max = _pop[0].objectiveVector()[i];
|
||||||
|
for (unsigned j=1; j<_pop.size(); j++)
|
||||||
|
{
|
||||||
|
min = std::min(min, _pop[j].objectiveVector()[i]);
|
||||||
|
max = std::max(max, _pop[j].objectiveVector()[i]);
|
||||||
|
}
|
||||||
|
// setting of the bounds for the objective i
|
||||||
|
setup(min, max, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the lower bound (_min) and the upper bound (_max) for the objective _obj
|
||||||
|
* @param _min lower bound
|
||||||
|
* @param _max upper bound
|
||||||
|
* @param _obj the objective index
|
||||||
|
*/
|
||||||
|
virtual void setup(double _min, double _max, unsigned _obj)
|
||||||
|
{
|
||||||
|
if (_min == _max)
|
||||||
|
{
|
||||||
|
_min -= tiny();
|
||||||
|
_max += tiny();
|
||||||
|
}
|
||||||
|
bounds[_obj] = eoRealInterval(_min, _max);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the lower bound and the upper bound for the objective _obj using a eoRealInterval object
|
||||||
|
* @param _realInterval the eoRealInterval object
|
||||||
|
* @param _obj the objective index
|
||||||
|
*/
|
||||||
|
virtual void setup(eoRealInterval _realInterval, unsigned _obj)
|
||||||
|
{
|
||||||
|
bounds[_obj] = _realInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/** the bounds for every objective (bounds[i] = bounds for the objective i) */
|
||||||
|
std::vector < eoRealInterval > bounds;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class allowing to compute an euclidian distance between two solutions in the objective space with normalized objective values (i.e. between 0 and 1).
|
||||||
|
* A distance value then lies between 0 and sqrt(nObjectives).
|
||||||
|
*/
|
||||||
|
template < class MOEOT >
|
||||||
|
class moeoEuclideanDistance : public moeoNormalizedDistance < MOEOT >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** the objective vector type of the solutions */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the euclidian distance between _moeo1 and _moeo2 in the objective space
|
||||||
|
* @param _moeo1 the first solution
|
||||||
|
* @param _moeo2 the second solution
|
||||||
|
*/
|
||||||
|
const double operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
|
{
|
||||||
|
double result = 0.0;
|
||||||
|
double tmp1, tmp2;
|
||||||
|
for (unsigned i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||||
|
{
|
||||||
|
tmp1 = (_moeo1.objectiveVector()[i] - bounds[i].minimum()) / bounds[i].range();
|
||||||
|
tmp2 = (_moeo2.objectiveVector()[i] - bounds[i].minimum()) / bounds[i].range();
|
||||||
|
result += (tmp1-tmp2) * (tmp1-tmp2);
|
||||||
|
}
|
||||||
|
return sqrt(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** the bounds for every objective */
|
||||||
|
using moeoNormalizedDistance < MOEOT > :: bounds;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class allowing to compute the Manhattan distance between two solutions in the objective space normalized objective values (i.e. between 0 and 1).
|
||||||
|
* A distance value then lies between 0 and nObjectives.
|
||||||
|
*/
|
||||||
|
template < class MOEOT >
|
||||||
|
class moeoManhattanDistance : public moeoNormalizedDistance < MOEOT >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** the objective vector type of the solutions */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Manhattan distance between _moeo1 and _moeo2 in the objective space
|
||||||
|
* @param _moeo1 the first solution
|
||||||
|
* @param _moeo2 the second solution
|
||||||
|
*/
|
||||||
|
const double operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
|
{
|
||||||
|
double result = 0.0;
|
||||||
|
double tmp1, tmp2;
|
||||||
|
for (unsigned i=0; i<ObjectiveVector::nObjectives(); i++)
|
||||||
|
{
|
||||||
|
tmp1 = (_moeo1.objectiveVector()[i] - bounds[i].minimum()) / bounds[i].range();
|
||||||
|
tmp2 = (_moeo2.objectiveVector()[i] - bounds[i].minimum()) / bounds[i].range();
|
||||||
|
result += fabs(tmp1-tmp2);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** the bounds for every objective */
|
||||||
|
using moeoNormalizedDistance < MOEOT > :: bounds;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*MOEODISTANCE_H_*/
|
||||||
75
tags/paradiseo-moeo-0.3/src/distance/moeoDistanceMatrix.h
Normal file
75
tags/paradiseo-moeo-0.3/src/distance/moeoDistanceMatrix.h
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// moeoDistanceMatrix.h
|
||||||
|
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||||
|
/*
|
||||||
|
This library...
|
||||||
|
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MOEODISTANCEMATRIX_H_
|
||||||
|
#define MOEODISTANCEMATRIX_H_
|
||||||
|
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
#include <distance/moeoDistance.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A matrix to compute distances between every pair of individuals contained in a population.
|
||||||
|
*/
|
||||||
|
template < class MOEOT , class Type >
|
||||||
|
class moeoDistanceMatrix : public eoUF < const eoPop < MOEOT > &, void > , public std::vector< std::vector < Type > >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
using std::vector< std::vector < Type > > :: size;
|
||||||
|
using std::vector< std::vector < Type > > :: operator[];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _size size for every dimension of the matrix
|
||||||
|
* @param _distance the distance to use
|
||||||
|
*/
|
||||||
|
moeoDistanceMatrix (unsigned _size, moeoDistance < MOEOT , Type > & _distance) : distance(_distance)
|
||||||
|
{
|
||||||
|
this->resize(_size);
|
||||||
|
for (unsigned i=0; i<_size; i++)
|
||||||
|
{
|
||||||
|
this->operator[](i).resize(_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the distance between every pair of individuals contained in the population _pop
|
||||||
|
* @param _pop the population
|
||||||
|
*/
|
||||||
|
void operator()(const eoPop < MOEOT > & _pop)
|
||||||
|
{
|
||||||
|
// 1 - setup the bounds (if necessary)
|
||||||
|
distance.setup(_pop);
|
||||||
|
// 2 - compute distances
|
||||||
|
this->operator[](0).operator[](0) = Type();
|
||||||
|
for (unsigned i=0; i<size(); i++)
|
||||||
|
{
|
||||||
|
this->operator[](i).operator[](i) = Type();
|
||||||
|
for (unsigned j=0; j<i; j++)
|
||||||
|
{
|
||||||
|
this->operator[](i).operator[](j) = distance(_pop[i], _pop[j]);
|
||||||
|
this->operator[](j).operator[](i) = this->operator[](i).operator[](j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** the distance to use */
|
||||||
|
moeoDistance < MOEOT , Type > & distance;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*MOEODISTANCEMATRIX_H_*/
|
||||||
176
tags/paradiseo-moeo-0.3/src/do/make_checkpoint_moeo.h
Executable file
176
tags/paradiseo-moeo-0.3/src/do/make_checkpoint_moeo.h
Executable file
|
|
@ -0,0 +1,176 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// make_checkpoint_moeo.h
|
||||||
|
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||||
|
/*
|
||||||
|
This library...
|
||||||
|
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MAKE_CHECKPOINT_MOEO_H_
|
||||||
|
#define MAKE_CHECKPOINT_MOEO_H_
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include <eoContinue.h>
|
||||||
|
#include <eoEvalFuncCounter.h>
|
||||||
|
#include <utils/checkpointing>
|
||||||
|
#include <utils/selectors.h>
|
||||||
|
#include <utils/eoParser.h>
|
||||||
|
#include <utils/eoState.h>
|
||||||
|
#include <moeoArchiveUpdater.h>
|
||||||
|
#include <moeoArchiveObjectiveVectorSavingUpdater.h>
|
||||||
|
#include <metric/moeoBinaryMetricSavingUpdater.h>
|
||||||
|
#include <metric/moeoContributionMetric.h>
|
||||||
|
#include <metric/moeoEntropyMetric.h>
|
||||||
|
|
||||||
|
bool testDirRes(std::string _dirName, bool _erase);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions allows to build an eoCheckPoint for multi-objective optimization from the parser (partly taken from make_checkpoint_pareto.h)
|
||||||
|
* @param _parser the parser
|
||||||
|
* @param _state to store allocated objects
|
||||||
|
* @param _eval the funtions evaluator
|
||||||
|
* @param _continue the stopping crietria
|
||||||
|
* @param _pop the population
|
||||||
|
* @param _archive the archive of non-dominated solutions
|
||||||
|
*/
|
||||||
|
template < class MOEOT >
|
||||||
|
eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState & _state, eoEvalFuncCounter < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _archive)
|
||||||
|
{
|
||||||
|
eoCheckPoint < MOEOT > & checkpoint = _state.storeFunctor(new eoCheckPoint < MOEOT > (_continue));
|
||||||
|
/* the objective vector type */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
///////////////////
|
||||||
|
// Counters
|
||||||
|
//////////////////
|
||||||
|
// is nb Eval to be used as counter?
|
||||||
|
//bool useEval = _parser.getORcreateParam(true, "useEval", "Use nb of eval. as counter (vs nb of gen.)", '\0', "Output").value();
|
||||||
|
// Create anyway a generation-counter parameter
|
||||||
|
eoValueParam<unsigned> *generationCounter = new eoValueParam<unsigned>(0, "Gen.");
|
||||||
|
// Create an incrementor (sub-class of eoUpdater).
|
||||||
|
eoIncrementor<unsigned> & increment = _state.storeFunctor( new eoIncrementor<unsigned>(generationCounter->value()) );
|
||||||
|
// Add it to the checkpoint
|
||||||
|
checkpoint.add(increment);
|
||||||
|
// dir for DISK output
|
||||||
|
std::string & dirName = _parser.getORcreateParam(std::string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output").value();
|
||||||
|
// shoudl we empty it if exists
|
||||||
|
eoValueParam<bool>& eraseParam = _parser.getORcreateParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output");
|
||||||
|
bool dirOK = false; // not tested yet
|
||||||
|
|
||||||
|
// Dump of the whole population
|
||||||
|
//-----------------------------
|
||||||
|
bool printPop = _parser.getORcreateParam(false, "printPop", "Print sorted pop. every gen.", '\0', "Output").value();
|
||||||
|
eoSortedPopStat<MOEOT> * popStat;
|
||||||
|
if ( printPop ) // we do want pop dump
|
||||||
|
{
|
||||||
|
popStat = & _state.storeFunctor(new eoSortedPopStat<MOEOT>);
|
||||||
|
checkpoint.add(*popStat);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////
|
||||||
|
// State savers
|
||||||
|
//////////////////////////////
|
||||||
|
// feed the state to state savers
|
||||||
|
// save state every N generation
|
||||||
|
eoValueParam<unsigned>& saveFrequencyParam = _parser.createParam(unsigned(0), "saveFrequency", "Save every F generation (0 = only final state, absent = never)", '\0', "Persistence" );
|
||||||
|
if (_parser.isItThere(saveFrequencyParam))
|
||||||
|
{
|
||||||
|
// first make sure dirName is OK
|
||||||
|
if (! dirOK )
|
||||||
|
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||||
|
unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
|
||||||
|
#ifdef _MSVC
|
||||||
|
std::string stmp = dirName + "\generations";
|
||||||
|
#else
|
||||||
|
std::string stmp = dirName + "/generations";
|
||||||
|
#endif
|
||||||
|
eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp);
|
||||||
|
_state.storeFunctor(stateSaver1);
|
||||||
|
checkpoint.add(*stateSaver1);
|
||||||
|
}
|
||||||
|
// save state every T seconds
|
||||||
|
eoValueParam<unsigned>& saveTimeIntervalParam = _parser.getORcreateParam(unsigned(0), "saveTimeInterval", "Save every T seconds (0 or absent = never)", '\0',"Persistence" );
|
||||||
|
if (_parser.isItThere(saveTimeIntervalParam) && saveTimeIntervalParam.value()>0)
|
||||||
|
{
|
||||||
|
// first make sure dirName is OK
|
||||||
|
if (! dirOK )
|
||||||
|
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||||
|
#ifdef _MSVC
|
||||||
|
std::string stmp = dirName + "\time";
|
||||||
|
#else
|
||||||
|
std::string stmp = dirName + "/time";
|
||||||
|
#endif
|
||||||
|
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
|
||||||
|
_state.storeFunctor(stateSaver2);
|
||||||
|
checkpoint.add(*stateSaver2);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////
|
||||||
|
// Archive
|
||||||
|
//////////////////
|
||||||
|
// update the archive every generation
|
||||||
|
bool updateArch = _parser.getORcreateParam(true, "updateArch", "Update the archive at each gen.", '\0', "Evolution Engine").value();
|
||||||
|
if (updateArch)
|
||||||
|
{
|
||||||
|
moeoArchiveUpdater < MOEOT > * updater = new moeoArchiveUpdater < MOEOT > (_archive, _pop);
|
||||||
|
_state.storeFunctor(updater);
|
||||||
|
checkpoint.add(*updater);
|
||||||
|
}
|
||||||
|
// store the objective vectors contained in the archive every generation
|
||||||
|
bool storeArch = _parser.getORcreateParam(false, "storeArch", "Store the archive's objective vectors at each gen.", '\0', "Output").value();
|
||||||
|
if (storeArch)
|
||||||
|
{
|
||||||
|
if (! dirOK )
|
||||||
|
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||||
|
#ifdef _MSVC
|
||||||
|
std::string stmp = dirName + "\arch";
|
||||||
|
#else
|
||||||
|
std::string stmp = dirName + "/arch";
|
||||||
|
#endif
|
||||||
|
moeoArchiveObjectiveVectorSavingUpdater < MOEOT > * save_updater = new moeoArchiveObjectiveVectorSavingUpdater < MOEOT > (_archive, stmp);
|
||||||
|
_state.storeFunctor(save_updater);
|
||||||
|
checkpoint.add(*save_updater);
|
||||||
|
}
|
||||||
|
// store the contribution of the non-dominated solutions
|
||||||
|
bool cont = _parser.getORcreateParam(false, "contribution", "Store the contribution of the archive at each gen.", '\0', "Output").value();
|
||||||
|
if (cont)
|
||||||
|
{
|
||||||
|
if (! dirOK )
|
||||||
|
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||||
|
#ifdef _MSVC
|
||||||
|
std::string stmp = dirName + "\contribution";
|
||||||
|
#else
|
||||||
|
std::string stmp = dirName + "/contribution";
|
||||||
|
#endif
|
||||||
|
moeoContributionMetric < ObjectiveVector > * contribution = new moeoContributionMetric < ObjectiveVector >;
|
||||||
|
moeoBinaryMetricSavingUpdater < MOEOT > * contribution_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*contribution, _archive, stmp);
|
||||||
|
_state.storeFunctor(contribution_updater);
|
||||||
|
checkpoint.add(*contribution_updater);
|
||||||
|
}
|
||||||
|
// store the entropy of the non-dominated solutions
|
||||||
|
bool ent = _parser.getORcreateParam(false, "entropy", "Store the entropy of the archive at each gen.", '\0', "Output").value();
|
||||||
|
if (ent)
|
||||||
|
{
|
||||||
|
if (! dirOK )
|
||||||
|
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||||
|
#ifdef _MSVC
|
||||||
|
std::string stmp = dirName + "\entropy";
|
||||||
|
#else
|
||||||
|
std::string stmp = dirName + "/entropy";
|
||||||
|
#endif
|
||||||
|
moeoEntropyMetric < ObjectiveVector > * entropy = new moeoEntropyMetric < ObjectiveVector >;
|
||||||
|
moeoBinaryMetricSavingUpdater < MOEOT > * entropy_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*entropy, _archive, stmp);
|
||||||
|
_state.storeFunctor(entropy_updater);
|
||||||
|
checkpoint.add(*entropy_updater);
|
||||||
|
}
|
||||||
|
|
||||||
|
// and that's it for the (control and) output
|
||||||
|
return checkpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /*MAKE_CHECKPOINT_MOEO_H_*/
|
||||||
106
tags/paradiseo-moeo-0.3/src/do/make_continue_moeo.h
Executable file
106
tags/paradiseo-moeo-0.3/src/do/make_continue_moeo.h
Executable file
|
|
@ -0,0 +1,106 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// make_continue_moeo.h
|
||||||
|
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||||
|
/*
|
||||||
|
This library...
|
||||||
|
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MAKE_CONTINUE_MOEO_H_
|
||||||
|
#define MAKE_CONTINUE_MOEO_H_
|
||||||
|
|
||||||
|
#include <eoCombinedContinue.h>
|
||||||
|
#include <eoGenContinue.h>
|
||||||
|
#include <eoEvalContinue.h>
|
||||||
|
#include <eoFitContinue.h>
|
||||||
|
#include <eoTimeContinue.h>
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#include <eoCtrlCContinue.h>
|
||||||
|
#endif
|
||||||
|
#include <utils/eoParser.h>
|
||||||
|
#include <utils/eoState.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function
|
||||||
|
* @param _combined the eoCombinedContinue object
|
||||||
|
* @param _cont the eoContinue to add
|
||||||
|
*/
|
||||||
|
template <class MOEOT>
|
||||||
|
eoCombinedContinue<MOEOT> * make_combinedContinue(eoCombinedContinue<MOEOT> *_combined, eoContinue<MOEOT> *_cont)
|
||||||
|
{
|
||||||
|
if (_combined) // already exists
|
||||||
|
_combined->add(*_cont);
|
||||||
|
else
|
||||||
|
_combined = new eoCombinedContinue<MOEOT>(*_cont);
|
||||||
|
return _combined;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions allows to build a eoContinue for multi-objective optimization from the parser (partly taken from make_continue_pareto.h)
|
||||||
|
* @param _parser the parser
|
||||||
|
* @param _state to store allocated objects
|
||||||
|
* @param _eval the funtions evaluator
|
||||||
|
*/
|
||||||
|
template <class MOEOT>
|
||||||
|
eoContinue<MOEOT> & do_make_continue_moeo(eoParser& _parser, eoState& _state, eoEvalFuncCounter<MOEOT> & _eval)
|
||||||
|
{
|
||||||
|
// the combined continue - to be filled
|
||||||
|
eoCombinedContinue<MOEOT> *continuator = NULL;
|
||||||
|
// First the eoGenContinue - need a default value so you can run blind
|
||||||
|
// but we also need to be able to avoid it <--> 0
|
||||||
|
eoValueParam<unsigned>& maxGenParam = _parser.createParam(unsigned(100), "maxGen", "Maximum number of generations (0 = none)",'G',"Stopping criterion");
|
||||||
|
if (maxGenParam.value()) // positive: -> define and store
|
||||||
|
{
|
||||||
|
eoGenContinue<MOEOT> *genCont = new eoGenContinue<MOEOT>(maxGenParam.value());
|
||||||
|
_state.storeFunctor(genCont);
|
||||||
|
// and "add" to combined
|
||||||
|
continuator = make_combinedContinue<MOEOT>(continuator, genCont);
|
||||||
|
}
|
||||||
|
// maxEval
|
||||||
|
eoValueParam<unsigned long>& maxEvalParam = _parser.getORcreateParam((unsigned long)0, "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion");
|
||||||
|
if (maxEvalParam.value())
|
||||||
|
{
|
||||||
|
eoEvalContinue<MOEOT> *evalCont = new eoEvalContinue<MOEOT>(_eval, maxEvalParam.value());
|
||||||
|
_state.storeFunctor(evalCont);
|
||||||
|
// and "add" to combined
|
||||||
|
continuator = make_combinedContinue<MOEOT>(continuator, evalCont);
|
||||||
|
}
|
||||||
|
// maxTime
|
||||||
|
eoValueParam<unsigned long>& maxTimeParam = _parser.getORcreateParam((unsigned long)0, "maxTime", "Maximum running time in seconds (0 = none)", 'T', "Stopping criterion");
|
||||||
|
if (maxTimeParam.value()) // positive: -> define and store
|
||||||
|
{
|
||||||
|
eoTimeContinue<MOEOT> *timeCont = new eoTimeContinue<MOEOT>(maxTimeParam.value());
|
||||||
|
_state.storeFunctor(timeCont);
|
||||||
|
// and "add" to combined
|
||||||
|
continuator = make_combinedContinue<MOEOT>(continuator, timeCont);
|
||||||
|
}
|
||||||
|
// CtrlC
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
// the CtrlC interception (Linux only I'm afraid)
|
||||||
|
eoCtrlCContinue<MOEOT> *ctrlCCont;
|
||||||
|
eoValueParam<bool>& ctrlCParam = _parser.createParam(true, "CtrlC", "Terminate current generation upon Ctrl C",'C', "Stopping criterion");
|
||||||
|
if (_parser.isItThere(ctrlCParam))
|
||||||
|
{
|
||||||
|
ctrlCCont = new eoCtrlCContinue<MOEOT>;
|
||||||
|
// store
|
||||||
|
_state.storeFunctor(ctrlCCont);
|
||||||
|
// add to combinedContinue
|
||||||
|
continuator = make_combinedContinue<MOEOT>(continuator, ctrlCCont);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// now check that there is at least one!
|
||||||
|
if (!continuator)
|
||||||
|
throw std::runtime_error("You MUST provide a stopping criterion");
|
||||||
|
// OK, it's there: store in the eoState
|
||||||
|
_state.storeFunctor(continuator);
|
||||||
|
// and return
|
||||||
|
return *continuator;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /*MAKE_CONTINUE_MOEO_H_*/
|
||||||
263
tags/paradiseo-moeo-0.3/src/do/make_ea_moeo.h
Executable file
263
tags/paradiseo-moeo-0.3/src/do/make_ea_moeo.h
Executable file
|
|
@ -0,0 +1,263 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// make_ea_moeo.h
|
||||||
|
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||||
|
/*
|
||||||
|
This library...
|
||||||
|
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MAKE_EA_MOEO_H_
|
||||||
|
#define MAKE_EA_MOEO_H_
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <eoContinue.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
#include <eoGeneralBreeder.h>
|
||||||
|
#include <eoGenOp.h>
|
||||||
|
#include <utils/eoParser.h>
|
||||||
|
#include <utils/eoState.h>
|
||||||
|
#include <moeoArchive.h>
|
||||||
|
#include <moeoComparator.h>
|
||||||
|
#include <moeoCrowdingDistanceDiversityAssignment.h>
|
||||||
|
#include <moeoDetTournamentSelect.h>
|
||||||
|
#include <moeoDiversityAssignment.h>
|
||||||
|
#include <moeoEA.h>
|
||||||
|
#include <moeoEasyEA.h>
|
||||||
|
#include <moeoElitistReplacement.h>
|
||||||
|
#include <moeoEnvironmentalReplacement.h>
|
||||||
|
#include <moeoFastNonDominatedSortingFitnessAssignment.h>
|
||||||
|
#include <moeoFitnessAssignment.h>
|
||||||
|
#include <moeoGenerationalReplacement.h>
|
||||||
|
#include <moeoIndicatorBasedFitnessAssignment.h>
|
||||||
|
#include <moeoRandomSelect.h>
|
||||||
|
#include <moeoReplacement.h>
|
||||||
|
#include <moeoRouletteSelect.h>
|
||||||
|
#include <moeoSelectOne.h>
|
||||||
|
#include <moeoSharingDiversityAssignment.h>
|
||||||
|
#include <moeoStochTournamentSelect.h>
|
||||||
|
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions allows to build a moeoEA from the parser
|
||||||
|
* @param _parser the parser
|
||||||
|
* @param _state to store allocated objects
|
||||||
|
* @param _eval the funtions evaluator
|
||||||
|
* @param _continue the stopping crietria
|
||||||
|
* @param _op the variation operators
|
||||||
|
* @param _archive the archive of non-dominated solutions
|
||||||
|
*/
|
||||||
|
template < class MOEOT >
|
||||||
|
moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalFunc < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT > & _archive)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* the objective vector type */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
|
||||||
|
/* the fitness assignment strategy */
|
||||||
|
string & fitnessParam = _parser.createParam(string("FastNonDominatedSorting"), "fitness",
|
||||||
|
"Fitness assignment scheme: Dummy, FastNonDominatedSorting or IndicatorBased", 'F',
|
||||||
|
"Evolution Engine").value();
|
||||||
|
string & indicatorParam = _parser.createParam(string("Epsilon"), "indicator",
|
||||||
|
"Binary indicator for IndicatorBased: Epsilon, Hypervolume", 'i',
|
||||||
|
"Evolution Engine").value();
|
||||||
|
double rho = _parser.createParam(1.1, "rho", "reference point for the hypervolume indicator", 'r',
|
||||||
|
"Evolution Engine").value();
|
||||||
|
double kappa = _parser.createParam(0.05, "kappa", "Scaling factor kappa for IndicatorBased", 'k',
|
||||||
|
"Evolution Engine").value();
|
||||||
|
moeoFitnessAssignment < MOEOT > * fitnessAssignment;
|
||||||
|
if (fitnessParam == string("Dummy"))
|
||||||
|
{
|
||||||
|
fitnessAssignment = new moeoDummyFitnessAssignment < MOEOT> ();
|
||||||
|
}
|
||||||
|
else if (fitnessParam == string("FastNonDominatedSorting"))
|
||||||
|
{
|
||||||
|
fitnessAssignment = new moeoFastNonDominatedSortingFitnessAssignment < MOEOT> ();
|
||||||
|
}
|
||||||
|
else if (fitnessParam == string("IndicatorBased"))
|
||||||
|
{
|
||||||
|
// metric
|
||||||
|
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > *metric;
|
||||||
|
if (indicatorParam == string("Epsilon"))
|
||||||
|
{
|
||||||
|
metric = new moeoAdditiveEpsilonBinaryMetric < ObjectiveVector >;
|
||||||
|
}
|
||||||
|
else if (indicatorParam == string("Hypervolume"))
|
||||||
|
{
|
||||||
|
metric = new moeoHypervolumeBinaryMetric < ObjectiveVector > (rho);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string stmp = string("Invalid binary quality indicator: ") + indicatorParam;
|
||||||
|
throw std::runtime_error(stmp.c_str());
|
||||||
|
}
|
||||||
|
fitnessAssignment = new moeoIndicatorBasedFitnessAssignment < MOEOT > (*metric, kappa);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string stmp = string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||||
|
throw std::runtime_error(stmp.c_str());
|
||||||
|
}
|
||||||
|
_state.storeFunctor(fitnessAssignment);
|
||||||
|
|
||||||
|
|
||||||
|
/* the diversity assignment strategy */
|
||||||
|
eoValueParam<eoParamParamType> & diversityParam = _parser.createParam(eoParamParamType("Dummy"), "diversity",
|
||||||
|
"Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding", 'D', "Evolution Engine");
|
||||||
|
eoParamParamType & diversityParamValue = diversityParam.value();
|
||||||
|
moeoDiversityAssignment < MOEOT > * diversityAssignment;
|
||||||
|
if (diversityParamValue.first == string("Dummy"))
|
||||||
|
{
|
||||||
|
diversityAssignment = new moeoDummyDiversityAssignment < MOEOT> ();
|
||||||
|
}
|
||||||
|
else if (diversityParamValue.first == string("Sharing"))
|
||||||
|
{
|
||||||
|
double nicheSize;
|
||||||
|
if (!diversityParamValue.second.size()) // no parameter added
|
||||||
|
{
|
||||||
|
cerr << "WARNING, no niche size given for Sharing, using 0.5" << std::endl;
|
||||||
|
nicheSize = 0.5;
|
||||||
|
diversityParamValue.second.push_back(std::string("0.5"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nicheSize = atoi(diversityParamValue.second[0].c_str());
|
||||||
|
}
|
||||||
|
diversityAssignment = new moeoFrontByFrontSharingDiversityAssignment < MOEOT> (nicheSize);
|
||||||
|
}
|
||||||
|
else if (diversityParamValue.first == string("Crowding"))
|
||||||
|
{
|
||||||
|
diversityAssignment = new moeoFrontByFrontCrowdingDistanceDiversityAssignment < MOEOT> ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string stmp = string("Invalid diversity assignment strategy: ") + diversityParamValue.first;
|
||||||
|
throw std::runtime_error(stmp.c_str());
|
||||||
|
}
|
||||||
|
_state.storeFunctor(diversityAssignment);
|
||||||
|
|
||||||
|
|
||||||
|
/* the comparator strategy */
|
||||||
|
string & comparatorParam = _parser.createParam(string("FitnessThenDiversity"), "comparator",
|
||||||
|
"Comparator scheme: FitnessThenDiversity, DiversityThenFitness or Aggregative", 'C', "Evolution Engine").value();
|
||||||
|
moeoComparator < MOEOT > * comparator;
|
||||||
|
if (comparatorParam == string("FitnessThenDiversity"))
|
||||||
|
{
|
||||||
|
comparator = new moeoFitnessThenDiversityComparator < MOEOT> ();
|
||||||
|
}
|
||||||
|
else if (comparatorParam == string("DiversityThenFitness"))
|
||||||
|
{
|
||||||
|
comparator = new moeoDiversityThenFitnessComparator < MOEOT> ();
|
||||||
|
}
|
||||||
|
else if (comparatorParam == string("Aggregative"))
|
||||||
|
{
|
||||||
|
comparator = new moeoAggregativeComparator < MOEOT> ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string stmp = string("Invalid comparator strategy: ") + comparatorParam;
|
||||||
|
throw std::runtime_error(stmp.c_str());
|
||||||
|
}
|
||||||
|
_state.storeFunctor(comparator);
|
||||||
|
|
||||||
|
|
||||||
|
/* the selection strategy */
|
||||||
|
eoValueParam < eoParamParamType > & selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection",
|
||||||
|
"Selection scheme: DetTour(T), StochTour(t) or Random", 'S', "Evolution Engine");
|
||||||
|
eoParamParamType & ppSelect = selectionParam.value();
|
||||||
|
moeoSelectOne < MOEOT > * select;
|
||||||
|
if (ppSelect.first == string("DetTour"))
|
||||||
|
{
|
||||||
|
unsigned tSize;
|
||||||
|
if (!ppSelect.second.size()) // no parameter added
|
||||||
|
{
|
||||||
|
cerr << "WARNING, no parameter passed to DetTour, using 2" << endl;
|
||||||
|
tSize = 2;
|
||||||
|
// put back 2 in parameter for consistency (and status file)
|
||||||
|
ppSelect.second.push_back(string("2"));
|
||||||
|
}
|
||||||
|
else // parameter passed by user as DetTour(T)
|
||||||
|
{
|
||||||
|
tSize = atoi(ppSelect.second[0].c_str());
|
||||||
|
}
|
||||||
|
select = new moeoDetTournamentSelect < MOEOT > (*comparator, tSize);
|
||||||
|
}
|
||||||
|
else if (ppSelect.first == string("StochTour"))
|
||||||
|
{
|
||||||
|
double tRate;
|
||||||
|
if (!ppSelect.second.size()) // no parameter added
|
||||||
|
{
|
||||||
|
cerr << "WARNING, no parameter passed to StochTour, using 1" << endl;
|
||||||
|
tRate = 1;
|
||||||
|
// put back 1 in parameter for consistency (and status file)
|
||||||
|
ppSelect.second.push_back(string("1"));
|
||||||
|
}
|
||||||
|
else // parameter passed by user as StochTour(T)
|
||||||
|
{
|
||||||
|
tRate = atof(ppSelect.second[0].c_str());
|
||||||
|
}
|
||||||
|
select = new moeoStochTournamentSelect < MOEOT > (*comparator, tRate);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
else if (ppSelect.first == string("Roulette"))
|
||||||
|
{
|
||||||
|
// TO DO !
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
else if (ppSelect.first == string("Random"))
|
||||||
|
{
|
||||||
|
select = new moeoRandomSelect <MOEOT > ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string stmp = string("Invalid selection strategy: ") + ppSelect.first;
|
||||||
|
throw std::runtime_error(stmp.c_str());
|
||||||
|
}
|
||||||
|
_state.storeFunctor(select);
|
||||||
|
|
||||||
|
|
||||||
|
/* the replacement strategy */
|
||||||
|
string & replacementParam = _parser.createParam(string("Elitist"), "replacement",
|
||||||
|
"Replacement scheme: Elitist, Environmental or Generational", 'R', "Evolution Engine").value();
|
||||||
|
moeoReplacement < MOEOT > * replace;
|
||||||
|
if (replacementParam == string("Elitist"))
|
||||||
|
{
|
||||||
|
replace = new moeoElitistReplacement < MOEOT> (*fitnessAssignment, *diversityAssignment, *comparator);
|
||||||
|
}
|
||||||
|
else if (replacementParam == string("Environmental"))
|
||||||
|
{
|
||||||
|
replace = new moeoEnvironmentalReplacement < MOEOT> (*fitnessAssignment, *diversityAssignment, *comparator);
|
||||||
|
}
|
||||||
|
else if (replacementParam == string("Generational"))
|
||||||
|
{
|
||||||
|
replace = new moeoGenerationalReplacement < MOEOT> ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string stmp = string("Invalid replacement strategy: ") + replacementParam;
|
||||||
|
throw std::runtime_error(stmp.c_str());
|
||||||
|
}
|
||||||
|
_state.storeFunctor(replace);
|
||||||
|
|
||||||
|
|
||||||
|
/* the number of offspring */
|
||||||
|
eoValueParam < eoHowMany > & offspringRateParam = _parser.createParam(eoHowMany(1.0), "nbOffspring",
|
||||||
|
"Number of offspring (percentage or absolute)", 'O', "Evolution Engine");
|
||||||
|
|
||||||
|
|
||||||
|
// the general breeder
|
||||||
|
eoGeneralBreeder < MOEOT > * breed = new eoGeneralBreeder < MOEOT > (*select, _op, offspringRateParam.value());
|
||||||
|
_state.storeFunctor(breed);
|
||||||
|
// the eoEasyEA
|
||||||
|
moeoEA < MOEOT > * algo = new moeoEasyEA < MOEOT > (_continue, _eval, *breed, *replace, *fitnessAssignment, *diversityAssignment);
|
||||||
|
_state.storeFunctor(algo);
|
||||||
|
return *algo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /*MAKE_EA_MOEO_H_*/
|
||||||
120
tags/paradiseo-moeo-0.3/src/do/make_ls_moeo.h
Executable file
120
tags/paradiseo-moeo-0.3/src/do/make_ls_moeo.h
Executable file
|
|
@ -0,0 +1,120 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// make_ls_moeo.h
|
||||||
|
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||||
|
/*
|
||||||
|
This library...
|
||||||
|
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MAKE_LS_MOEO_H_
|
||||||
|
#define MAKE_LS_MOEO_H_
|
||||||
|
|
||||||
|
#include <eoContinue.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
#include <eoGenOp.h>
|
||||||
|
#include <utils/eoParser.h>
|
||||||
|
#include <utils/eoState.h>
|
||||||
|
#include <moeoArchive.h>
|
||||||
|
#include <moeoIndicatorBasedFitnessAssignment.h>
|
||||||
|
#include <moeoLS.h>
|
||||||
|
#include <moeoIndicatorBasedLS.h>
|
||||||
|
#include <moeoIteratedIBMOLS.h>
|
||||||
|
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
|
||||||
|
#include <moeoMoveIncrEval.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions allows to build a moeoLS from the parser
|
||||||
|
* @param _parser the parser
|
||||||
|
* @param _state to store allocated objects
|
||||||
|
* @param _eval the funtions evaluator
|
||||||
|
* @param _moveIncrEval the incremental evaluation
|
||||||
|
* @param _continue the stopping crietria
|
||||||
|
* @param _op the variation operators
|
||||||
|
* @param _opInit the initilization operator
|
||||||
|
* @param _moveInit the move initializer
|
||||||
|
* @param _nextMove the move incrementor
|
||||||
|
* @param _archive the archive of non-dominated solutions
|
||||||
|
*/
|
||||||
|
template < class MOEOT, class Move >
|
||||||
|
moeoLS < MOEOT, eoPop<MOEOT> & > & do_make_ls_moeo (
|
||||||
|
eoParser & _parser,
|
||||||
|
eoState & _state,
|
||||||
|
eoEvalFunc < MOEOT > & _eval,
|
||||||
|
moeoMoveIncrEval < Move > & _moveIncrEval,
|
||||||
|
eoContinue < MOEOT > & _continue,
|
||||||
|
eoMonOp < MOEOT > & _op,
|
||||||
|
eoMonOp < MOEOT > & _opInit,
|
||||||
|
moMoveInit < Move > & _moveInit,
|
||||||
|
moNextMove < Move > & _nextMove,
|
||||||
|
moeoArchive < MOEOT > & _archive
|
||||||
|
)
|
||||||
|
{
|
||||||
|
/* the objective vector type */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
/* the fitness assignment strategy */
|
||||||
|
string & fitnessParam = _parser.getORcreateParam(string("IndicatorBased"), "fitness",
|
||||||
|
"Fitness assignment strategy parameter: IndicatorBased...", 'F',
|
||||||
|
"Evolution Engine").value();
|
||||||
|
string & indicatorParam = _parser.getORcreateParam(string("Epsilon"), "indicator",
|
||||||
|
"Binary indicator to use with the IndicatorBased assignment: Epsilon, Hypervolume", 'i',
|
||||||
|
"Evolution Engine").value();
|
||||||
|
double rho = _parser.getORcreateParam(1.1, "rho", "reference point for the hypervolume indicator",
|
||||||
|
'r', "Evolution Engine").value();
|
||||||
|
double kappa = _parser.getORcreateParam(0.05, "kappa", "Scaling factor kappa for IndicatorBased",
|
||||||
|
'k', "Evolution Engine").value();
|
||||||
|
moeoIndicatorBasedFitnessAssignment < MOEOT > * fitnessAssignment;
|
||||||
|
if (fitnessParam == string("IndicatorBased"))
|
||||||
|
{
|
||||||
|
// metric
|
||||||
|
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > *metric;
|
||||||
|
if (indicatorParam == string("Epsilon"))
|
||||||
|
{
|
||||||
|
metric = new moeoAdditiveEpsilonBinaryMetric < ObjectiveVector >;
|
||||||
|
}
|
||||||
|
else if (indicatorParam == string("Hypervolume"))
|
||||||
|
{
|
||||||
|
metric = new moeoHypervolumeBinaryMetric < ObjectiveVector > (rho);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string stmp = string("Invalid binary quality indicator: ") + indicatorParam;
|
||||||
|
throw std::runtime_error(stmp.c_str());
|
||||||
|
}
|
||||||
|
fitnessAssignment = new moeoIndicatorBasedFitnessAssignment < MOEOT> (*metric, kappa);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string stmp = string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||||
|
throw std::runtime_error(stmp.c_str());
|
||||||
|
}
|
||||||
|
_state.storeFunctor(fitnessAssignment);
|
||||||
|
// number of iterations
|
||||||
|
unsigned n = _parser.getORcreateParam(1, "n", "Number of iterations for population Initialization", 'n', "Evolution Engine").value();
|
||||||
|
// LS
|
||||||
|
string & lsParam = _parser.getORcreateParam(string("I-IBMOLS"), "ls",
|
||||||
|
"Local Search: IBMOLS, I-IBMOLS (Iterated-IBMOLS)...", 'L',
|
||||||
|
"Evolution Engine").value();
|
||||||
|
moeoLS < MOEOT, eoPop<MOEOT> & > * ls;
|
||||||
|
if (lsParam == string("IBMOLS"))
|
||||||
|
{
|
||||||
|
ls = new moeoIndicatorBasedLS < MOEOT, Move > (_moveInit, _nextMove, _eval, _moveIncrEval, *fitnessAssignment, _continue);;
|
||||||
|
}
|
||||||
|
else if (lsParam == string("I-IBMOLS"))
|
||||||
|
{
|
||||||
|
ls = new moeoIteratedIBMOLS < MOEOT, Move > (_moveInit, _nextMove, _eval, _moveIncrEval, *fitnessAssignment, _continue, _op, _opInit, n);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string stmp = string("Invalid fitness assignment strategy: ") + fitnessParam;
|
||||||
|
throw std::runtime_error(stmp.c_str());
|
||||||
|
}
|
||||||
|
_state.storeFunctor(ls);
|
||||||
|
// that's it !
|
||||||
|
return *ls;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /*MAKE_LS_MOEO_H_*/
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// moeoBinaryMetricSavingUpdater.h
|
||||||
|
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||||
|
/*
|
||||||
|
This library...
|
||||||
|
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MOEOBINARYMETRICSAVINGUPDATER_H_
|
||||||
|
#define MOEOBINARYMETRICSAVINGUPDATER_H_
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <eoPop.h>
|
||||||
|
#include <utils/eoUpdater.h>
|
||||||
|
#include <metric/moeoMetric.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class allows to save the progression of a binary metric comparing the objective vectors of the current population (or archive)
|
||||||
|
* with the objective vectors of the population (or archive) of the generation (n-1) into a file
|
||||||
|
*/
|
||||||
|
template < class MOEOT >
|
||||||
|
class moeoBinaryMetricSavingUpdater : public eoUpdater
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The objective vector type of a solution
|
||||||
|
*/
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _metric the binary metric comparing two Pareto sets
|
||||||
|
* @param _pop the main population
|
||||||
|
* @param _filename the target filename
|
||||||
|
*/
|
||||||
|
moeoBinaryMetricSavingUpdater (moeoVectorVsVectorBinaryMetric < ObjectiveVector, double > & _metric, const eoPop < MOEOT > & _pop, std::string _filename) :
|
||||||
|
metric(_metric), pop(_pop), filename(_filename), counter(1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the metric's value for the current generation
|
||||||
|
*/
|
||||||
|
void operator()() {
|
||||||
|
if (pop.size()) {
|
||||||
|
if (firstGen) {
|
||||||
|
firstGen = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// creation of the two Pareto sets
|
||||||
|
std::vector < ObjectiveVector > from;
|
||||||
|
std::vector < ObjectiveVector > to;
|
||||||
|
for (unsigned i=0; i<pop.size(); i++)
|
||||||
|
from.push_back(pop[i].objectiveVector());
|
||||||
|
for (unsigned i=0 ; i<oldPop.size(); i++)
|
||||||
|
to.push_back(oldPop[i].objectiveVector());
|
||||||
|
// writing the result into the file
|
||||||
|
std::ofstream f (filename.c_str(), std::ios::app);
|
||||||
|
f << counter++ << ' ' << metric(from,to) << std::endl;
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
oldPop = pop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** binary metric comparing two Pareto sets */
|
||||||
|
moeoVectorVsVectorBinaryMetric < ObjectiveVector, double > & metric;
|
||||||
|
/** main population */
|
||||||
|
const eoPop < MOEOT > & pop;
|
||||||
|
/** (n-1) population */
|
||||||
|
eoPop< MOEOT > oldPop;
|
||||||
|
/** target filename */
|
||||||
|
std::string filename;
|
||||||
|
/** is it the first generation ? */
|
||||||
|
bool firstGen;
|
||||||
|
/** counter */
|
||||||
|
unsigned counter;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*MOEOBINARYMETRICSAVINGUPDATER_H_*/
|
||||||
105
tags/paradiseo-moeo-0.3/src/metric/moeoContributionMetric.h
Normal file
105
tags/paradiseo-moeo-0.3/src/metric/moeoContributionMetric.h
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// moeoContributionMetric.h
|
||||||
|
// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
|
||||||
|
/*
|
||||||
|
This library...
|
||||||
|
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MOEOCONTRIBUTIONMETRIC_H_
|
||||||
|
#define MOEOCONTRIBUTIONMETRIC_H_
|
||||||
|
|
||||||
|
#include <moeoObjectiveVectorComparator.h>
|
||||||
|
#include <metric/moeoMetric.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The contribution metric evaluates the proportion of non-dominated solutions given by a Pareto set relatively to another Pareto set
|
||||||
|
* (Meunier, Talbi, Reininger: 'A multiobjective genetic algorithm for radio network optimization', in Proc. of the 2000 Congress on Evolutionary Computation, IEEE Press, pp. 317-324)
|
||||||
|
*/
|
||||||
|
template < class ObjectiveVector >
|
||||||
|
class moeoContributionMetric : public moeoVectorVsVectorBinaryMetric < ObjectiveVector, double >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the contribution of the Pareto set '_set1' relatively to the Pareto set '_set2'
|
||||||
|
* @param _set1 the first Pareto set
|
||||||
|
* @param _set2 the second Pareto set
|
||||||
|
*/
|
||||||
|
double operator()(const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) {
|
||||||
|
unsigned c = card_C(_set1, _set2);
|
||||||
|
unsigned w1 = card_W(_set1, _set2);
|
||||||
|
unsigned n1 = card_N(_set1, _set2);
|
||||||
|
unsigned w2 = card_W(_set2, _set1);
|
||||||
|
unsigned n2 = card_N(_set2, _set1);
|
||||||
|
return (double) (c / 2.0 + w1 + n1) / (c + w1 + n1 + w2 + n2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** Functor to compare two objective vectors according to Pareto dominance relation */
|
||||||
|
moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of solutions both in '_set1' and '_set2'
|
||||||
|
* @param _set1 the first Pareto set
|
||||||
|
* @param _set2 the second Pareto set
|
||||||
|
*/
|
||||||
|
unsigned card_C (const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) {
|
||||||
|
unsigned c=0;
|
||||||
|
for (unsigned i=0; i<_set1.size(); i++)
|
||||||
|
for (unsigned j=0; j<_set2.size(); j++)
|
||||||
|
if (_set1[i] == _set2[j]) {
|
||||||
|
c++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of solutions in '_set1' dominating at least one solution of '_set2'
|
||||||
|
* @param _set1 the first Pareto set
|
||||||
|
* @param _set2 the second Pareto set
|
||||||
|
*/
|
||||||
|
unsigned card_W (const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) {
|
||||||
|
unsigned w=0;
|
||||||
|
for (unsigned i=0; i<_set1.size(); i++)
|
||||||
|
for (unsigned j=0; j<_set2.size(); j++)
|
||||||
|
if (paretoComparator(_set2[j], _set1[i]))
|
||||||
|
{
|
||||||
|
w++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of solutions in '_set1' having no relation of dominance with those from '_set2'
|
||||||
|
* @param _set1 the first Pareto set
|
||||||
|
* @param _set2 the second Pareto set
|
||||||
|
*/
|
||||||
|
unsigned card_N (const std::vector < ObjectiveVector > & _set1, const std::vector < ObjectiveVector > & _set2) {
|
||||||
|
unsigned n=0;
|
||||||
|
for (unsigned i=0; i<_set1.size(); i++) {
|
||||||
|
bool domin_rel = false;
|
||||||
|
for (unsigned j=0; j<_set2.size(); j++)
|
||||||
|
if ( (paretoComparator(_set2[j], _set1[i])) || (paretoComparator(_set1[i], _set2[j])) )
|
||||||
|
{
|
||||||
|
domin_rel = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (! domin_rel)
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*MOEOCONTRIBUTIONMETRIC_H_*/
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue