diff options
Diffstat (limited to 'modules/genetic_algorithms')
141 files changed, 9798 insertions, 0 deletions
diff --git a/modules/genetic_algorithms/Makefile b/modules/genetic_algorithms/Makefile new file mode 100755 index 000000000..f304d9625 --- /dev/null +++ b/modules/genetic_algorithms/Makefile @@ -0,0 +1,1015 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# modules/genetic_algorithms/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2013 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. + + + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2008 - INRIA - Pierre MARECHAL +# +# This file must be used under the terms of the CeCILL. +# This source file is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at +# http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2006-2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +# Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +# +# This file must be used under the terms of the CeCILL. +# This source file is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at +# http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +# + +########## +### Makefile included stuff +### Target, variable, suffixes which are supposed to be useful in every makefile.am +########## + + +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/scilab +pkgincludedir = $(includedir)/scilab +pkglibdir = $(libdir)/scilab +pkglibexecdir = $(libexecdir)/scilab +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +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 = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +DIST_COMMON = $(top_srcdir)/Makefile.incl.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/config/mkinstalldirs +am__append_1 = java +subdir = modules/genetic_algorithms +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/backtrace.m4 \ + $(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/curl.m4 \ + $(top_srcdir)/m4/docbook.m4 $(top_srcdir)/m4/doxygen.m4 \ + $(top_srcdir)/m4/fftw.m4 $(top_srcdir)/m4/fortran.m4 \ + $(top_srcdir)/m4/giws.m4 $(top_srcdir)/m4/hdf5.m4 \ + $(top_srcdir)/m4/intel_compiler.m4 \ + $(top_srcdir)/m4/java-thirdparty.m4 $(top_srcdir)/m4/java.m4 \ + $(top_srcdir)/m4/largefile.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/libsmath.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/libxml2.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/macosx.m4 \ + $(top_srcdir)/m4/mpi.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/m4/pcre.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/relocatable.m4 $(top_srcdir)/m4/swig.m4 \ + $(top_srcdir)/m4/symlinks.m4 $(top_srcdir)/m4/tcltk.m4 \ + $(top_srcdir)/m4/umfpack.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/modules/core/includes/machine.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libgenetic_algorithms_la_etcdir)" \ + "$(DESTDIR)$(libgenetic_algorithms_la_rootdir)" +DATA = $(libgenetic_algorithms_la_etc_DATA) \ + $(libgenetic_algorithms_la_root_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing aclocal-1.14 +ALL_LINGUAS = en_US fr_FR zh_CN zh_TW ru_RU ca_ES de_DE es_ES pt_BR ja_JP it_IT uk_UA pl_PL cs_CZ +ALL_LINGUAS_DOC = en_US fr_FR pt_BR ja_JP ru_RU +AMTAR = $${TAR-tar} +AM_DEFAULT_VERBOSITY = 1 +ANT = /usr/bin/ant +ANTLR = /usr/share/java/antlr.jar +AR = ar +ARPACK_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -larpack +ASM3 = /usr/share/java/asm3-3.3.2.jar +AUTOCONF = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing autoconf +AUTOHEADER = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing autoheader +AUTOMAKE = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing automake-1.14 +AVALON_FRAMEWORK = /home/shashank/scilab-master_5.5.2/thirdparty/avalon-framework.jar +AWK = mawk +BATIK = /home/shashank/scilab-master_5.5.2/thirdparty/batik-all-1.7.jar +BLAS_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lblas +CC = gcc +CCACHE = +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CHECKSTYLE = +COBERTURA = /usr/share/java/cobertura.jar +COMMONS_BEANUTILS = +COMMONS_IO = /home/shashank/scilab-master_5.5.2/thirdparty/commons-io.jar +COMMONS_LOGGING = /home/shashank/scilab-master_5.5.2/thirdparty/commons-logging.jar +CPP = gcc -E +CPPFLAGS = +CURL_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +CURL_CONFIG = /home/shashank/scilab-master_5.5.2/usr/bin/curl-config +CURL_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lcurl -L/home/scilab/work/linux-prerequisites-sources/trunk/Dev-Tools/SE/Prerequirements/linux_x64/usr/lib -L/home/scilab/work/linux-prerequisites-sources/trunk/Dev-Tools/SE/Prerequirements/linux_x64/usr/lib -lssl -lcrypto -lrt -lz +CURL_VERSION = libcurl 7.19.7 +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEMOTOOLS_ENABLE = yes +DEPDIR = .deps +DLLTOOL = false +DOCBOOK_ROOT = /home/shashank/scilab-master_5.5.2/thirdparty/docbook/ +DOXYGEN_BIN = +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +ECJ = /home/shashank/scilab-master_5.5.2/thirdparty/ecj.jar +EGREP = /bin/grep -E +EXEEXT = +F77 = gfortran +FFLAGS = -g -O2 +FFTW3_LIB = -L/home/shashank/scilab-master_5.5.2/usr/lib -lfftw3 +FFTW_ENABLE = yes +FGREP = /bin/grep -F +FLEXDOCK = /home/shashank/scilab-master_5.5.2/thirdparty/flexdock-1.2.4.jar +FLIBS = -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -lpthread -ldl -lcurses -lgfortran -lm -lquadmath +FOP = /home/shashank/scilab-master_5.5.2/thirdparty/fop.jar +FREEHEP_GRAPHICS2D = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-graphics2d.jar +FREEHEP_GRAPHICSIO = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-graphicsio.jar +FREEHEP_GRAPHICSIO_EMF = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-graphicsio-emf.jar +FREEHEP_IO = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-io.jar +FREEHEP_UTIL = /home/shashank/scilab-master_5.5.2/thirdparty/freehep-util.jar +GENHTML = +GETTEXT_MACRO_VERSION = 0.19 +GIWS_BIN = +GLUEGEN2_RT = /home/shashank/scilab-master_5.5.2/thirdparty/gluegen2-rt.jar +GMSGFMT = /usr/bin/msgfmt +GMSGFMT_015 = /usr/bin/msgfmt +GRAPHICS_ENABLE = yes +GREP = /bin/grep +GUI_ENABLE = yes +HDF5_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +HDF5_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lhdf5 -lhdf5_hl +HELP_ENABLE = yes +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +INTLLIBS = +INTL_MACOSX_LIBS = +JAR = /usr/lib/jvm/java-8-openjdk-amd64/bin/jar +JAVA = /usr/lib/jvm/java-8-openjdk-amd64/bin/java +JAVAC = /usr/lib/jvm/java-8-openjdk-amd64/bin/javac +JAVAC_DEBUG = off +JAVADOC = /usr/lib/jvm/java-8-openjdk-amd64/bin/javadoc +JAVAH = /usr/lib/jvm/java-8-openjdk-amd64/bin/javah +JAVASCI_ENABLE = yes +JAVA_ENABLE = yes +JAVA_G = /usr/lib/jvm/java-8-openjdk-amd64/bin/java +JAVA_HOME = /usr/lib/jvm/java-8-openjdk-amd64 +JAVA_JNI_INCLUDE = -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux +JAVA_JNI_LIBS = -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64 -ljava -lverify -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm +JDB = /usr/lib/jvm/java-8-openjdk-amd64/bin/jdb +JEUCLID_CORE = /home/shashank/scilab-master_5.5.2/thirdparty/jeuclid-core.jar +JGRAPHX = /home/shashank/scilab-master_5.5.2/thirdparty/jgraphx.jar +JHALL = /home/shashank/scilab-master_5.5.2/thirdparty/jhall.jar +JLATEXMATH = /home/shashank/scilab-master_5.5.2/thirdparty/jlatexmath-1.0.3.jar +JLATEXMATH_FOP = /home/shashank/scilab-master_5.5.2/thirdparty/jlatexmath-fop-1.0.3.jar +JOGL2 = /home/shashank/scilab-master_5.5.2/thirdparty/jogl2.jar +JROSETTA_API = /home/shashank/scilab-master_5.5.2/thirdparty/jrosetta-API.jar +JROSETTA_ENGINE = /home/shashank/scilab-master_5.5.2/thirdparty/jrosetta-engine.jar +JUNIT4 = /usr/share/java/junit4.jar +LAPACK_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -llapack +LCOV = +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = -Wl,--no-as-needed +LIBICONV = -liconv +LIBINTL = +LIBM = -lm +LIBOBJS = +LIBS = -lpthread -ldl -lcurses -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LOGGING_LEVEL = SEVERE +LOOKS = /home/shashank/scilab-master_5.5.2/thirdparty/looks-2.1.1.jar +LTLIBICONV = -liconv +LTLIBINTL = +LTLIBOBJS = +MAINT = # +MAKEINFO = ${SHELL} /home/shashank/scilab-master_5.5.2/config/missing makeinfo +MANIFEST_TOOL = : +MATIO_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +MATIO_ENABLE = yes +MATIO_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lm -lz -lmatio -lhdf5 +MKDIR_P = /bin/mkdir -p +MPI_ENABLE = no +MSGCAT = /usr/bin/msgcat +MSGFMT = /usr/bin/msgfmt +MSGFMT_015 = /usr/bin/msgfmt +MSGMERGE = /usr/bin/msgmerge +NM = nm +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OCAMLC = ocamlc +OCAMLDEP = ocamldep +OCAMLLEX = ocamllex +OCAMLOPT = ocamlopt +OCAMLYACC = ocamlyacc +OPENMPI_CC = +OPENMPI_CFLAGS = +OPENMPI_CXX = +OPENMPI_CXXFLAGS = +OPENMPI_LIBS = +OPENMP_CFLAGS = -fopenmp +OPENMP_CXXFLAGS = -fopenmp +OPENMP_ENABLE = yes +OPENMP_LIBS = -lgomp -lstdc++ +OTOOL = +OTOOL64 = +PACKAGE = scilab +PACKAGE_BUGREPORT = http://bugzilla.scilab.org/ +PACKAGE_NAME = Scilab +PACKAGE_STRING = Scilab 5 +PACKAGE_TARNAME = scilab +PACKAGE_URL = +PACKAGE_VERSION = 5 +PATH_SEPARATOR = : +PCRE_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +PCRE_CONFIG = /home/shashank/scilab-master_5.5.2/usr/bin/pcre-config +PCRE_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lpcreposix -lpcre +PCRE_VERSION = 8.35 +PKG_CONFIG = /usr/bin/pkg-config +POSUB = po +POW_LIB = +PYTHON = +RANLIB = ranlib +RELOCATABLE = no +RT_LIB = -lrt +SAXON = /home/shashank/scilab-master_5.5.2/thirdparty/saxon9he.jar +SCILAB_BINARY_VERSION = 5.5.2 +SCILAB_LIBRARY_VERSION = 5:5:2 +SCILAB_VERSION_MAINTENANCE = 2 +SCILAB_VERSION_MAJOR = 5 +SCILAB_VERSION_MINOR = 5 +SCIRENDERER = ${modules.dir}/scirenderer/${build.jar.dir}/scirenderer.jar +SCIRENDERER_CP = $SCILAB/modules/scirenderer/jar/scirenderer.jar +SCI_CFLAGS = -D_LARGEFILE64_SOURCE -DNDEBUG -m64 -fno-stack-protector +SCI_CXXFLAGS = -DNDEBUG -fno-stack-protector +SCI_FFLAGS = -DNDEBUG -m64 -fPIC +SCI_LDFLAGS = +SED = /bin/sed +SET_MAKE = +SET_RELOCATABLE = +SHELL = /bin/bash +SKINLF = /home/shashank/scilab-master_5.5.2/thirdparty/skinlf.jar +SPLINT = no +STRIP = strip +SWIG_BIN = +SWIG_JAVA = +SWIG_RUNTIME_LIBS_DIR = +SWIG_SCILAB = +TCLTK_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -ltk8.5 -L/home/shashank/scilab-master_5.5.2/usr/lib -ltcl8.5 -ldl +TCL_INC_PATH = -I/home/shashank/scilab-master_5.5.2/usr/include +TK_INC_PATH = -I/home/shashank/scilab-master_5.5.2/usr/include +UMFPACK_CFLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include +UMFPACK_ENABLE = yes +UMFPACK_LIB = -L/home/shashank/scilab-master_5.5.2/usr/lib -lumfpack -lamd +USE_NLS = yes +VERSION = 5 +WITH_OCAML = +WITH_TKSCI = yes +XCOS_ENABLE = yes +XGETTEXT = /usr/bin/xgettext +XGETTEXT_015 = /usr/bin/xgettext +XGETTEXT_EXTRA_OPTIONS = +XMKMF = +XMLGRAPHICS_COMMONS = /home/shashank/scilab-master_5.5.2/thirdparty/xmlgraphics-commons-1.4.jar +XML_APIS_EXT = /home/shashank/scilab-master_5.5.2/thirdparty/xml-apis-ext.jar +XML_CONFIG = /home/shashank/scilab-master_5.5.2/usr/bin/xml2-config +XML_FLAGS = -I/home/shashank/scilab-master_5.5.2/usr/include/libxml2 +XML_LIBS = -L/home/shashank/scilab-master_5.5.2/usr/lib -lxml2 -L/home/scilab/work/linux-prerequisites-sources/trunk/Dev-Tools/SE/Prerequirements/linux_x64/usr/lib -lz -lm -ldl +XML_VERSION = 2.9.1 +X_CFLAGS = +X_EXTRA_LIBS = +X_LIBS = +X_PRE_LIBS = +abs_builddir = /home/shashank/scilab-master_5.5.2/modules/genetic_algorithms +abs_srcdir = /home/shashank/scilab-master_5.5.2/modules/genetic_algorithms +abs_top_builddir = /home/shashank/scilab-master_5.5.2 +abs_top_srcdir = /home/shashank/scilab-master_5.5.2 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +ac_ct_F77 = gfortran +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +builddir = . +cxx_present = yes +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/shashank/scilab-master_5.5.2/config/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. + +#### Target ###### +modulename = genetic_algorithms + +#### genetic_algorithms : Conf files #### +libgenetic_algorithms_la_rootdir = $(mydatadir) +libgenetic_algorithms_la_root_DATA = license.txt + +#### genetic_algorithms : init scripts #### +libgenetic_algorithms_la_etcdir = $(mydatadir)/etc +libgenetic_algorithms_la_etc_DATA = etc/genetic_algorithms.quit etc/genetic_algorithms.start + +# Where all the Scilab stuff is installed (macros, help, ...) +mydatadir = $(pkgdatadir)/modules/$(modulename) + +# Set AM_* SCI detected settings +AM_CPPFLAGS = $(SCI_CPPFLAGS) +AM_CFLAGS = $(SCI_CFLAGS) +AM_CXXFLAGS = $(SCI_CXXFLAGS) +# append includes to AM_FFLAGS to manage fortran includes +AM_FFLAGS = $(SCI_FFLAGS) -I$(top_srcdir)/modules/core/includes/ + +# Tag shared libraries with the Scilab version +AM_LDFLAGS = $(SCI_LDFLAGS) -version-number $(SCILAB_LIBRARY_VERSION) + +# splint options +SPLINT_OPTIONS = -weak -booltype BOOL + +########################### JAVA ###################################### +#### We are delegating java compilation to ant... Thanks to that +#### the procedure will be the same with Microsoft Windows (C) +#### and Linux/Unix +####################################################################### +TARGETS_ALL = $(am__append_1) + +################ MACROS ###################### +# Rule to build a macro +# NOT USED AT THE MOMENT +SUFFIXES = .sci + +########### INSTALL DOCUMENTATION ################### + +# Install documentation files into the right target +# We do not use the automake mechanism (libxxxx_la_help_fr_DATA) because +# automake needs the html files to be present which is not the case when +# we are building Scilab + +# Where it should be installed +pkgdocdir = $(mydatadir) + +# What is the mask of the help source +DOCMASKXML = *.xml + +# What is the mask of the MathML sources +DOCMASKMML = *.mml + +########### INSTALL DATA ################### +# Install macros, help & demos +# Where it should be installed +pkgmacrosdir = $(mydatadir) +# Which directory we process +MACRODIRS = macros/ +# Mask of the Scilab sources macros +MACROMASK = *.sci +# Mask of the Scilab executable sources macros +MACROBUILDMASK = *.sce +# Mask of the Scilab compiled macros +MACROBINMASK = *.bin +# List of the standard directory for tests +TESTS_DIR = tests/benchmarks tests/nonreg_tests tests/unit_tests tests/java +# Where the demos should be installed +pkgdemosdir = $(mydatadir) +# List of the standard directory for demos +DEMOS_DIR = demos +# List of the standard directory for examples +EXAMPLES_DIR = examples +# Where to export JAVA archives (.jar) +JARDIR = jar/ +# JAR files mask +JARMASK = *.jar +# Chapter file +HELP_CHAPTERDIR = help/ +HELP_CHAPTERFILE = addchapter.sce +HELP_CHAPTERLANG = en_US fr_FR pt_BR +all: all-am + +.SUFFIXES: +.SUFFIXES: .sci .bin +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(top_srcdir)/Makefile.incl.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign modules/genetic_algorithms/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign modules/genetic_algorithms/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_srcdir)/Makefile.incl.am: + +$(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 +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-libgenetic_algorithms_la_etcDATA: $(libgenetic_algorithms_la_etc_DATA) + @$(NORMAL_INSTALL) + @list='$(libgenetic_algorithms_la_etc_DATA)'; test -n "$(libgenetic_algorithms_la_etcdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libgenetic_algorithms_la_etcdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libgenetic_algorithms_la_etcdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(libgenetic_algorithms_la_etcdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(libgenetic_algorithms_la_etcdir)" || exit $$?; \ + done + +uninstall-libgenetic_algorithms_la_etcDATA: + @$(NORMAL_UNINSTALL) + @list='$(libgenetic_algorithms_la_etc_DATA)'; test -n "$(libgenetic_algorithms_la_etcdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libgenetic_algorithms_la_etcdir)'; $(am__uninstall_files_from_dir) +install-libgenetic_algorithms_la_rootDATA: $(libgenetic_algorithms_la_root_DATA) + @$(NORMAL_INSTALL) + @list='$(libgenetic_algorithms_la_root_DATA)'; test -n "$(libgenetic_algorithms_la_rootdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libgenetic_algorithms_la_rootdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libgenetic_algorithms_la_rootdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(libgenetic_algorithms_la_rootdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(libgenetic_algorithms_la_rootdir)" || exit $$?; \ + done + +uninstall-libgenetic_algorithms_la_rootDATA: + @$(NORMAL_UNINSTALL) + @list='$(libgenetic_algorithms_la_root_DATA)'; test -n "$(libgenetic_algorithms_la_rootdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libgenetic_algorithms_la_rootdir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$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 + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile $(DATA) all-local +installdirs: + for dir in "$(DESTDIR)$(libgenetic_algorithms_la_etcdir)" "$(DESTDIR)$(libgenetic_algorithms_la_rootdir)"; 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-data-local \ + install-libgenetic_algorithms_la_etcDATA \ + install-libgenetic_algorithms_la_rootDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: install-html-local + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libgenetic_algorithms_la_etcDATA \ + uninstall-libgenetic_algorithms_la_rootDATA + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am all-local check check-am check-local clean \ + clean-generic clean-libtool clean-local cscopelist-am ctags-am \ + distclean distclean-generic distclean-libtool distclean-local \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-data-local \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-html-local install-info \ + install-info-am install-libgenetic_algorithms_la_etcDATA \ + install-libgenetic_algorithms_la_rootDATA install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am \ + uninstall-libgenetic_algorithms_la_etcDATA \ + uninstall-libgenetic_algorithms_la_rootDATA + + +# This target enables tests for Scilab +check-local: $(top_builddir)/scilab-bin test + if test -d $(mydatadir)/tests; then \ + @COMMAND="try test_run('$(modulename)');catch exit(-1);end;exit(0)"; export LANG=C; $(top_builddir)/bin/scilab -nwni -nb -e "$$COMMAND"; \ + fi +check-code: + if test -f build.xml; then \ + $(ANT) checkstyle; \ + fi + if test -x "$(SPLINT)"; then \ + $(SPLINT) $(SPLINT_OPTIONS) -I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ -I$(top_srcdir)/modules/localization/includes/ $(INCLUDE_FLAGS) $(CHECK_SRC); \ + fi +java: +# Some configurations needs to export JAVA_HOME in the current env + @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \ + if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ + if test -f build.xml -a $$USEANT -eq 1; then \ + $(ANT); \ + fi + +clean-java: +# Some configurations needs to export JAVA_HOME in the current env + @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \ + if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ + if test -f build.xml -a $$USEANT -eq 1; then \ + $(ANT) clean; \ + fi; + +# If the user request for the SWIG generation of the wrappers Java => C/C++ +# We call the target swig-build on the variable SWIG_WRAPPERS + +#swig: $(SWIG_WRAPPERS) +# @SWIG_PACKAGENAME=org.scilab.modules.$(modulename); \ +# SWIG_OUTDIR=src/java/org/scilab/modules/$(modulename)/; \ +# if test -n "$(SWIG_WRAPPERS)"; then \ +# for file in $(SWIG_WRAPPERS) ; do \ +# echo "Swig process of $$file (Java) ..."; \ +# $(SWIG_BIN) $(SWIG_JAVA) -package $$SWIG_PACKAGENAME -outdir $$SWIG_OUTDIR $$file; \ +# done; \ +# fi + +#swig-scilab: $(SWIG_SCILAB_WRAPPERS) +# @SWIG_OUTDIR=src/swig/; \ +# if test -n "$(SWIG_SCILAB_WRAPPERS)"; then \ +# for file in $(SWIG_SCILAB_WRAPPERS) ; do \ +# echo "Swig process of $$file (Scilab) ..."; \ +# $(SWIG_BIN) $(SWIG_SCILAB) -outdir $$SWIG_OUTDIR $$file; \ +# done; \ +# fi + +# If the user request for the SWIG generation of the wrappers Java => C/C++ +# We call the target swig-build on the variable SWIG_WRAPPERS + +#giws: $(GIWS_WRAPPERS) +# @GIWS_OUTPUTDIR=src/jni/; \ +# MANDATORY_OPTIONS="--throws-exception-on-error --description-file"; \ +# if test -n "$(GIWS_WRAPPERS)"; then \ +# for file in $(GIWS_WRAPPERS) ; do \ +# echo "GIWS process of $$file ..."; \ +# if test -z "$(GIWS_OPTIONS)"; then \ +# $(GIWS_BIN) --disable-return-size-array --output-dir $$GIWS_OUTPUTDIR $$MANDATORY_OPTIONS $$file; \ +# else \ +# echo "Custom GIWS call with '$$GIWS_OPTIONS'"; \ +# $(GIWS_BIN) $$GIWS_OPTIONS --output-dir $$GIWS_OUTPUTDIR $$MANDATORY_OPTIONS $$file; \ +# fi \ +# done; \ +# fi + +#giws-exception: +# @GIWS_OUTPUTDIR=src/jni/;\ +# echo "GIWS: Generation of exception class ..."; \ +# $(GIWS_BIN) --generate-exception-class --output-dir $$GIWS_OUTPUTDIR + +macros: + -@( if test ! -x $(top_builddir)/scilab-bin; then \ + echo "Error : Cannot build $< : Scilab has not been built"; \ + else \ + $(top_builddir)/bin/scilab -ns -nwni -e "exec('macros/buildmacros.sce');quit;";\ + fi) + +# Removes the macros +clean-macros: +# Removes macros (*.bin generated from .sci) + @for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ + echo "rm -f $(builddir)/$$dir/$(MACROBINMASK)"; \ + rm -f $(builddir)/$$dir/$(MACROBINMASK); \ + done + +test: +# More tests could be added here + @if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ + if test -f build.xml -a $$USEANT -eq 1; then \ + $(ANT) test; \ + fi + +all-local: $(TARGETS_ALL) + +.sci.bin: + -@( if test ! -x $(top_builddir)/scilab-bin; then \ + echo "Error : Cannot build $< : Scilab has not been build"; \ + else \ + echo "Creating $@"; \ + $(top_builddir)/bin/scilab -ns -nwni -e "exec('$(abs_srcdir)/$<');save('$(abs_srcdir)/$@');exit;"; \ + fi ) + +install-html-local: + +install-data-local-local: +# Mainly for javasci + @if test -d $(srcdir)/javadoc; then \ + cp -R $(srcdir)/javadoc $(DESTDIR)/$(mydatadir)/; \ + fi +# If the user wants the help sources to be installed + @echo "-------- Install of XML sources of help files --------"; \ + for lang in $(ALL_LINGUAS); do \ + if test -d $(srcdir)/help/$$lang; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/$$lang && \ + if ls -lLd $(srcdir)/help/$$lang/$(DOCMASKXML) >/dev/null 2>&1; then \ + for file in $(srcdir)/help/$$lang/$(DOCMASKXML) ; do \ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/$$lang" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/$$lang ; \ + done ; \ + fi; \ + fi; \ + done; \ + @echo "-------- Install of MathML sources --------"; \ + if test -d $(srcdir)/help/mml/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/mml/ && \ + if ls -lLd $(srcdir)/help/mml/$(DOCMASKMML) >/dev/null 2>&1; then \ + for file in $(srcdir)/help/mml/$(DOCMASKMML) ; do \ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/mml" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/mml ; \ + done ; \ + fi; \ + fi +install-data-local: +# Install the tests + @echo "-------- Install tests (if any) --------"; \ + for dir in $(TESTS_DIR) $(TESTS_DIREXT) ; do \ + if test -d $(srcdir)/$$dir/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \ + for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \ + if test -d "$(srcdir)/$$dir/$$file"; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir/$$file; \ + $(mkinstalldirs) "$(DESTDIR)$(pkgmacrosdir)/$$dir/$$file"; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \ + $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \ + fi \ + done; \ + fi; \ + done +# Install the help chapter + @echo "-------- Install the help chapter (if any) --------"; \ + for lang in $(HELP_CHAPTERLANG); do \ + HELPFILE=$(srcdir)/$(HELP_CHAPTERDIR)$$lang/$(HELP_CHAPTERFILE); \ + if test -f $$HELPFILE; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \ + echo $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \ + $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \ + fi; \ + done +# Install the demos & examples + @echo "-------- Install demos & examples (if any) --------"; \ + for dir in $(DEMOS_DIR) $(DEMOS_DIREXT) $(EXAMPLES_DIR) $(EXAMPLES_DIREXT) ; do \ + if test -d $(srcdir)/$$dir/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \ + for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \ + if test -d "$(srcdir)/$$dir/$$file"; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir/$$file; \ + $(mkinstalldirs) "$(DESTDIR)$(pkgdocdir)/$$dir/$$file"; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \ + $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \ + fi \ + done; \ + fi; \ + done +# Install the macros + @echo "-------- Install macros (if any) --------"; \ + for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ + $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \ + if test -d $(srcdir)/$$dir/; then \ + FILELIST="$(srcdir)/$$dir/$(MACROMASK) $(srcdir)/$$dir/$(MACROBINMASK) $(srcdir)/$$dir/$(MACROBUILDMASK) $(srcdir)/$$dir/names $(srcdir)/$$dir/lib";\ + if test -n "$(MACROSSPECIALEXT)"; then \ + specialExtDir=""; \ + for specialExt in $(MACROSSPECIALEXT); do \ + specialExtDir="$$specialExtDir $(srcdir)/$$dir/$$specialExt"; \ + done; \ + FILELIST="$$FILELIST $$specialExtDir"; \ + fi; \ + for file in `ls -1 $$FILELIST 2>/dev/null`; do \ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgmacrosdir)/$$dir" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgmacrosdir)/$$dir ; \ + done; \ + fi; \ + done +# Install java files (.jar) + @if ls -lLd $(srcdir)/$(JARDIR)$(JARMASK) >/dev/null 2>&1; then \ + echo "-------- Install jar files --------"; \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(JARDIR); \ + for file in $(srcdir)/$(JARDIR)$(JARMASK); do\ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$(JARDIR)" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$(JARDIR) ; \ + done ; \ + fi + +########### CLEAN ################### +# Clean help (generated automatically by Scilab) +# It used to clean the macro (clean-macros) but this was causing +# make clean && make to fail Scilab startup +clean-local: clean-java +#clean-local: + +distclean-local: + rm -f $(builddir)/help/*/.last_successful_build_javaHelp $(builddir)/help/*/.list_* + +.PHONY: macros java swig giws + +# 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: diff --git a/modules/genetic_algorithms/Makefile.am b/modules/genetic_algorithms/Makefile.am new file mode 100755 index 000000000..74052796e --- /dev/null +++ b/modules/genetic_algorithms/Makefile.am @@ -0,0 +1,21 @@ +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2008 - INRIA - Pierre MARECHAL +# +# This file must be used under the terms of the CeCILL. +# This source file is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at +# http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +#### Target ###### +modulename=genetic_algorithms + +#### genetic_algorithms : Conf files #### +libgenetic_algorithms_la_rootdir = $(mydatadir) +libgenetic_algorithms_la_root_DATA = license.txt + +#### genetic_algorithms : init scripts #### +libgenetic_algorithms_la_etcdir = $(mydatadir)/etc +libgenetic_algorithms_la_etc_DATA = etc/genetic_algorithms.quit etc/genetic_algorithms.start + +include $(top_srcdir)/Makefile.incl.am diff --git a/modules/genetic_algorithms/Makefile.in b/modules/genetic_algorithms/Makefile.in new file mode 100755 index 000000000..96db57aac --- /dev/null +++ b/modules/genetic_algorithms/Makefile.in @@ -0,0 +1,1015 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 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@ + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2008 - INRIA - Pierre MARECHAL +# +# This file must be used under the terms of the CeCILL. +# This source file is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at +# http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2006-2008 - INRIA - Sylvestre LEDRU <sylvestre.ledru@inria.fr> +# Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +# +# This file must be used under the terms of the CeCILL. +# This source file is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at +# http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +# + +########## +### Makefile included stuff +### Target, variable, suffixes which are supposed to be useful in every makefile.am +########## + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +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 = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(top_srcdir)/Makefile.incl.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/config/mkinstalldirs +@NEED_JAVA_TRUE@am__append_1 = java +subdir = modules/genetic_algorithms +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/backtrace.m4 \ + $(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/curl.m4 \ + $(top_srcdir)/m4/docbook.m4 $(top_srcdir)/m4/doxygen.m4 \ + $(top_srcdir)/m4/fftw.m4 $(top_srcdir)/m4/fortran.m4 \ + $(top_srcdir)/m4/giws.m4 $(top_srcdir)/m4/hdf5.m4 \ + $(top_srcdir)/m4/intel_compiler.m4 \ + $(top_srcdir)/m4/java-thirdparty.m4 $(top_srcdir)/m4/java.m4 \ + $(top_srcdir)/m4/largefile.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/libsmath.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/libxml2.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/macosx.m4 \ + $(top_srcdir)/m4/mpi.m4 $(top_srcdir)/m4/ocaml.m4 \ + $(top_srcdir)/m4/pcre.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/relocatable.m4 $(top_srcdir)/m4/swig.m4 \ + $(top_srcdir)/m4/symlinks.m4 $(top_srcdir)/m4/tcltk.m4 \ + $(top_srcdir)/m4/umfpack.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/modules/core/includes/machine.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libgenetic_algorithms_la_etcdir)" \ + "$(DESTDIR)$(libgenetic_algorithms_la_rootdir)" +DATA = $(libgenetic_algorithms_la_etc_DATA) \ + $(libgenetic_algorithms_la_root_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +ALL_LINGUAS_DOC = @ALL_LINGUAS_DOC@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +ANT = @ANT@ +ANTLR = @ANTLR@ +AR = @AR@ +ARPACK_LIBS = @ARPACK_LIBS@ +ASM3 = @ASM3@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AVALON_FRAMEWORK = @AVALON_FRAMEWORK@ +AWK = @AWK@ +BATIK = @BATIK@ +BLAS_LIBS = @BLAS_LIBS@ +CC = @CC@ +CCACHE = @CCACHE@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECKSTYLE = @CHECKSTYLE@ +COBERTURA = @COBERTURA@ +COMMONS_BEANUTILS = @COMMONS_BEANUTILS@ +COMMONS_IO = @COMMONS_IO@ +COMMONS_LOGGING = @COMMONS_LOGGING@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_CONFIG = @CURL_CONFIG@ +CURL_LIBS = @CURL_LIBS@ +CURL_VERSION = @CURL_VERSION@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEMOTOOLS_ENABLE = @DEMOTOOLS_ENABLE@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOCBOOK_ROOT = @DOCBOOK_ROOT@ +DOXYGEN_BIN = @DOXYGEN_BIN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECJ = @ECJ@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FFTW3_LIB = @FFTW3_LIB@ +FFTW_ENABLE = @FFTW_ENABLE@ +FGREP = @FGREP@ +FLEXDOCK = @FLEXDOCK@ +FLIBS = @FLIBS@ +FOP = @FOP@ +FREEHEP_GRAPHICS2D = @FREEHEP_GRAPHICS2D@ +FREEHEP_GRAPHICSIO = @FREEHEP_GRAPHICSIO@ +FREEHEP_GRAPHICSIO_EMF = @FREEHEP_GRAPHICSIO_EMF@ +FREEHEP_IO = @FREEHEP_IO@ +FREEHEP_UTIL = @FREEHEP_UTIL@ +GENHTML = @GENHTML@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GIWS_BIN = @GIWS_BIN@ +GLUEGEN2_RT = @GLUEGEN2_RT@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GRAPHICS_ENABLE = @GRAPHICS_ENABLE@ +GREP = @GREP@ +GUI_ENABLE = @GUI_ENABLE@ +HDF5_CFLAGS = @HDF5_CFLAGS@ +HDF5_LIBS = @HDF5_LIBS@ +HELP_ENABLE = @HELP_ENABLE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +JAR = @JAR@ +JAVA = @JAVA@ +JAVAC = @JAVAC@ +JAVAC_DEBUG = @JAVAC_DEBUG@ +JAVADOC = @JAVADOC@ +JAVAH = @JAVAH@ +JAVASCI_ENABLE = @JAVASCI_ENABLE@ +JAVA_ENABLE = @JAVA_ENABLE@ +JAVA_G = @JAVA_G@ +JAVA_HOME = @JAVA_HOME@ +JAVA_JNI_INCLUDE = @JAVA_JNI_INCLUDE@ +JAVA_JNI_LIBS = @JAVA_JNI_LIBS@ +JDB = @JDB@ +JEUCLID_CORE = @JEUCLID_CORE@ +JGRAPHX = @JGRAPHX@ +JHALL = @JHALL@ +JLATEXMATH = @JLATEXMATH@ +JLATEXMATH_FOP = @JLATEXMATH_FOP@ +JOGL2 = @JOGL2@ +JROSETTA_API = @JROSETTA_API@ +JROSETTA_ENGINE = @JROSETTA_ENGINE@ +JUNIT4 = @JUNIT4@ +LAPACK_LIBS = @LAPACK_LIBS@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBM = @LIBM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOGGING_LEVEL = @LOGGING_LEVEL@ +LOOKS = @LOOKS@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MATIO_CFLAGS = @MATIO_CFLAGS@ +MATIO_ENABLE = @MATIO_ENABLE@ +MATIO_LIBS = @MATIO_LIBS@ +MKDIR_P = @MKDIR_P@ +MPI_ENABLE = @MPI_ENABLE@ +MSGCAT = @MSGCAT@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAMLC = @OCAMLC@ +OCAMLDEP = @OCAMLDEP@ +OCAMLLEX = @OCAMLLEX@ +OCAMLOPT = @OCAMLOPT@ +OCAMLYACC = @OCAMLYACC@ +OPENMPI_CC = @OPENMPI_CC@ +OPENMPI_CFLAGS = @OPENMPI_CFLAGS@ +OPENMPI_CXX = @OPENMPI_CXX@ +OPENMPI_CXXFLAGS = @OPENMPI_CXXFLAGS@ +OPENMPI_LIBS = @OPENMPI_LIBS@ +OPENMP_CFLAGS = @OPENMP_CFLAGS@ +OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@ +OPENMP_ENABLE = @OPENMP_ENABLE@ +OPENMP_LIBS = @OPENMP_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCRE_CFLAGS = @PCRE_CFLAGS@ +PCRE_CONFIG = @PCRE_CONFIG@ +PCRE_LIBS = @PCRE_LIBS@ +PCRE_VERSION = @PCRE_VERSION@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +POW_LIB = @POW_LIB@ +PYTHON = @PYTHON@ +RANLIB = @RANLIB@ +RELOCATABLE = @RELOCATABLE@ +RT_LIB = @RT_LIB@ +SAXON = @SAXON@ +SCILAB_BINARY_VERSION = @SCILAB_BINARY_VERSION@ +SCILAB_LIBRARY_VERSION = @SCILAB_LIBRARY_VERSION@ +SCILAB_VERSION_MAINTENANCE = @SCILAB_VERSION_MAINTENANCE@ +SCILAB_VERSION_MAJOR = @SCILAB_VERSION_MAJOR@ +SCILAB_VERSION_MINOR = @SCILAB_VERSION_MINOR@ +SCIRENDERER = @SCIRENDERER@ +SCIRENDERER_CP = @SCIRENDERER_CP@ +SCI_CFLAGS = @SCI_CFLAGS@ +SCI_CXXFLAGS = @SCI_CXXFLAGS@ +SCI_FFLAGS = @SCI_FFLAGS@ +SCI_LDFLAGS = @SCI_LDFLAGS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SET_RELOCATABLE = @SET_RELOCATABLE@ +SHELL = @SHELL@ +SKINLF = @SKINLF@ +SPLINT = @SPLINT@ +STRIP = @STRIP@ +SWIG_BIN = @SWIG_BIN@ +SWIG_JAVA = @SWIG_JAVA@ +SWIG_RUNTIME_LIBS_DIR = @SWIG_RUNTIME_LIBS_DIR@ +SWIG_SCILAB = @SWIG_SCILAB@ +TCLTK_LIBS = @TCLTK_LIBS@ +TCL_INC_PATH = @TCL_INC_PATH@ +TK_INC_PATH = @TK_INC_PATH@ +UMFPACK_CFLAGS = @UMFPACK_CFLAGS@ +UMFPACK_ENABLE = @UMFPACK_ENABLE@ +UMFPACK_LIB = @UMFPACK_LIB@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WITH_OCAML = @WITH_OCAML@ +WITH_TKSCI = @WITH_TKSCI@ +XCOS_ENABLE = @XCOS_ENABLE@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XMKMF = @XMKMF@ +XMLGRAPHICS_COMMONS = @XMLGRAPHICS_COMMONS@ +XML_APIS_EXT = @XML_APIS_EXT@ +XML_CONFIG = @XML_CONFIG@ +XML_FLAGS = @XML_FLAGS@ +XML_LIBS = @XML_LIBS@ +XML_VERSION = @XML_VERSION@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +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 = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cxx_present = @cxx_present@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +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@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +#### Target ###### +modulename = genetic_algorithms + +#### genetic_algorithms : Conf files #### +libgenetic_algorithms_la_rootdir = $(mydatadir) +libgenetic_algorithms_la_root_DATA = license.txt + +#### genetic_algorithms : init scripts #### +libgenetic_algorithms_la_etcdir = $(mydatadir)/etc +libgenetic_algorithms_la_etc_DATA = etc/genetic_algorithms.quit etc/genetic_algorithms.start + +# Where all the Scilab stuff is installed (macros, help, ...) +mydatadir = $(pkgdatadir)/modules/$(modulename) + +# Set AM_* SCI detected settings +AM_CPPFLAGS = $(SCI_CPPFLAGS) +AM_CFLAGS = $(SCI_CFLAGS) +AM_CXXFLAGS = $(SCI_CXXFLAGS) +# append includes to AM_FFLAGS to manage fortran includes +AM_FFLAGS = $(SCI_FFLAGS) -I$(top_srcdir)/modules/core/includes/ + +# Tag shared libraries with the Scilab version +AM_LDFLAGS = $(SCI_LDFLAGS) -version-number $(SCILAB_LIBRARY_VERSION) + +# splint options +SPLINT_OPTIONS = -weak -booltype BOOL + +########################### JAVA ###################################### +#### We are delegating java compilation to ant... Thanks to that +#### the procedure will be the same with Microsoft Windows (C) +#### and Linux/Unix +####################################################################### +TARGETS_ALL = $(am__append_1) + +################ MACROS ###################### +# Rule to build a macro +# NOT USED AT THE MOMENT +SUFFIXES = .sci + +########### INSTALL DOCUMENTATION ################### + +# Install documentation files into the right target +# We do not use the automake mechanism (libxxxx_la_help_fr_DATA) because +# automake needs the html files to be present which is not the case when +# we are building Scilab + +# Where it should be installed +pkgdocdir = $(mydatadir) + +# What is the mask of the help source +DOCMASKXML = *.xml + +# What is the mask of the MathML sources +DOCMASKMML = *.mml + +########### INSTALL DATA ################### +# Install macros, help & demos +# Where it should be installed +pkgmacrosdir = $(mydatadir) +# Which directory we process +MACRODIRS = macros/ +# Mask of the Scilab sources macros +MACROMASK = *.sci +# Mask of the Scilab executable sources macros +MACROBUILDMASK = *.sce +# Mask of the Scilab compiled macros +MACROBINMASK = *.bin +# List of the standard directory for tests +TESTS_DIR = tests/benchmarks tests/nonreg_tests tests/unit_tests tests/java +# Where the demos should be installed +pkgdemosdir = $(mydatadir) +# List of the standard directory for demos +DEMOS_DIR = demos +# List of the standard directory for examples +EXAMPLES_DIR = examples +# Where to export JAVA archives (.jar) +JARDIR = jar/ +# JAR files mask +JARMASK = *.jar +# Chapter file +HELP_CHAPTERDIR = help/ +HELP_CHAPTERFILE = addchapter.sce +HELP_CHAPTERLANG = en_US fr_FR pt_BR +all: all-am + +.SUFFIXES: +.SUFFIXES: .sci .bin +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.incl.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign modules/genetic_algorithms/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign modules/genetic_algorithms/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_srcdir)/Makefile.incl.am: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-libgenetic_algorithms_la_etcDATA: $(libgenetic_algorithms_la_etc_DATA) + @$(NORMAL_INSTALL) + @list='$(libgenetic_algorithms_la_etc_DATA)'; test -n "$(libgenetic_algorithms_la_etcdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libgenetic_algorithms_la_etcdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libgenetic_algorithms_la_etcdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(libgenetic_algorithms_la_etcdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(libgenetic_algorithms_la_etcdir)" || exit $$?; \ + done + +uninstall-libgenetic_algorithms_la_etcDATA: + @$(NORMAL_UNINSTALL) + @list='$(libgenetic_algorithms_la_etc_DATA)'; test -n "$(libgenetic_algorithms_la_etcdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libgenetic_algorithms_la_etcdir)'; $(am__uninstall_files_from_dir) +install-libgenetic_algorithms_la_rootDATA: $(libgenetic_algorithms_la_root_DATA) + @$(NORMAL_INSTALL) + @list='$(libgenetic_algorithms_la_root_DATA)'; test -n "$(libgenetic_algorithms_la_rootdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(libgenetic_algorithms_la_rootdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libgenetic_algorithms_la_rootdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(libgenetic_algorithms_la_rootdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(libgenetic_algorithms_la_rootdir)" || exit $$?; \ + done + +uninstall-libgenetic_algorithms_la_rootDATA: + @$(NORMAL_UNINSTALL) + @list='$(libgenetic_algorithms_la_root_DATA)'; test -n "$(libgenetic_algorithms_la_rootdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(libgenetic_algorithms_la_rootdir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$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 + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile $(DATA) all-local +installdirs: + for dir in "$(DESTDIR)$(libgenetic_algorithms_la_etcdir)" "$(DESTDIR)$(libgenetic_algorithms_la_rootdir)"; 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-data-local \ + install-libgenetic_algorithms_la_etcDATA \ + install-libgenetic_algorithms_la_rootDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: install-html-local + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libgenetic_algorithms_la_etcDATA \ + uninstall-libgenetic_algorithms_la_rootDATA + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am all-local check check-am check-local clean \ + clean-generic clean-libtool clean-local cscopelist-am ctags-am \ + distclean distclean-generic distclean-libtool distclean-local \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-data-local \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-html-local install-info \ + install-info-am install-libgenetic_algorithms_la_etcDATA \ + install-libgenetic_algorithms_la_rootDATA install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am \ + uninstall-libgenetic_algorithms_la_etcDATA \ + uninstall-libgenetic_algorithms_la_rootDATA + + +# This target enables tests for Scilab +check-local: $(top_builddir)/scilab-bin test + if test -d $(mydatadir)/tests; then \ + @COMMAND="try test_run('$(modulename)');catch exit(-1);end;exit(0)"; export LANG=C; $(top_builddir)/bin/scilab -nwni -nb -e "$$COMMAND"; \ + fi +check-code: + if test -f build.xml; then \ + $(ANT) checkstyle; \ + fi + if test -x "$(SPLINT)"; then \ + $(SPLINT) $(SPLINT_OPTIONS) -I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ -I$(top_srcdir)/modules/localization/includes/ $(INCLUDE_FLAGS) $(CHECK_SRC); \ + fi +@NEED_JAVA_TRUE@java: +# Some configurations needs to export JAVA_HOME in the current env +@NEED_JAVA_TRUE@ @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \ +@NEED_JAVA_TRUE@ if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ +@NEED_JAVA_TRUE@ if test -f build.xml -a $$USEANT -eq 1; then \ +@NEED_JAVA_TRUE@ $(ANT); \ +@NEED_JAVA_TRUE@ fi + +@NEED_JAVA_TRUE@clean-java: +# Some configurations needs to export JAVA_HOME in the current env +@NEED_JAVA_TRUE@ @if test "$(JAVA_HOME)"; then export JAVA_HOME=$(JAVA_HOME); fi; \ +@NEED_JAVA_TRUE@ if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ +@NEED_JAVA_TRUE@ if test -f build.xml -a $$USEANT -eq 1; then \ +@NEED_JAVA_TRUE@ $(ANT) clean; \ +@NEED_JAVA_TRUE@ fi; + +# If the user request for the SWIG generation of the wrappers Java => C/C++ +# We call the target swig-build on the variable SWIG_WRAPPERS + +@SWIG_TRUE@swig: $(SWIG_WRAPPERS) +@SWIG_TRUE@ @SWIG_PACKAGENAME=org.scilab.modules.$(modulename); \ +@SWIG_TRUE@ SWIG_OUTDIR=src/java/org/scilab/modules/$(modulename)/; \ +@SWIG_TRUE@ if test -n "$(SWIG_WRAPPERS)"; then \ +@SWIG_TRUE@ for file in $(SWIG_WRAPPERS) ; do \ +@SWIG_TRUE@ echo "Swig process of $$file (Java) ..."; \ +@SWIG_TRUE@ $(SWIG_BIN) $(SWIG_JAVA) -package $$SWIG_PACKAGENAME -outdir $$SWIG_OUTDIR $$file; \ +@SWIG_TRUE@ done; \ +@SWIG_TRUE@ fi + +@SWIG_TRUE@swig-scilab: $(SWIG_SCILAB_WRAPPERS) +@SWIG_TRUE@ @SWIG_OUTDIR=src/swig/; \ +@SWIG_TRUE@ if test -n "$(SWIG_SCILAB_WRAPPERS)"; then \ +@SWIG_TRUE@ for file in $(SWIG_SCILAB_WRAPPERS) ; do \ +@SWIG_TRUE@ echo "Swig process of $$file (Scilab) ..."; \ +@SWIG_TRUE@ $(SWIG_BIN) $(SWIG_SCILAB) -outdir $$SWIG_OUTDIR $$file; \ +@SWIG_TRUE@ done; \ +@SWIG_TRUE@ fi + +# If the user request for the SWIG generation of the wrappers Java => C/C++ +# We call the target swig-build on the variable SWIG_WRAPPERS + +@GIWS_TRUE@giws: $(GIWS_WRAPPERS) +@GIWS_TRUE@ @GIWS_OUTPUTDIR=src/jni/; \ +@GIWS_TRUE@ MANDATORY_OPTIONS="--throws-exception-on-error --description-file"; \ +@GIWS_TRUE@ if test -n "$(GIWS_WRAPPERS)"; then \ +@GIWS_TRUE@ for file in $(GIWS_WRAPPERS) ; do \ +@GIWS_TRUE@ echo "GIWS process of $$file ..."; \ +@GIWS_TRUE@ if test -z "$(GIWS_OPTIONS)"; then \ +@GIWS_TRUE@ $(GIWS_BIN) --disable-return-size-array --output-dir $$GIWS_OUTPUTDIR $$MANDATORY_OPTIONS $$file; \ +@GIWS_TRUE@ else \ +@GIWS_TRUE@ echo "Custom GIWS call with '$$GIWS_OPTIONS'"; \ +@GIWS_TRUE@ $(GIWS_BIN) $$GIWS_OPTIONS --output-dir $$GIWS_OUTPUTDIR $$MANDATORY_OPTIONS $$file; \ +@GIWS_TRUE@ fi \ +@GIWS_TRUE@ done; \ +@GIWS_TRUE@ fi + +@GIWS_TRUE@giws-exception: +@GIWS_TRUE@ @GIWS_OUTPUTDIR=src/jni/;\ +@GIWS_TRUE@ echo "GIWS: Generation of exception class ..."; \ +@GIWS_TRUE@ $(GIWS_BIN) --generate-exception-class --output-dir $$GIWS_OUTPUTDIR + +macros: + -@( if test ! -x $(top_builddir)/scilab-bin; then \ + echo "Error : Cannot build $< : Scilab has not been built"; \ + else \ + $(top_builddir)/bin/scilab -ns -nwni -e "exec('macros/buildmacros.sce');quit;";\ + fi) + +# Removes the macros +clean-macros: +# Removes macros (*.bin generated from .sci) + @for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ + echo "rm -f $(builddir)/$$dir/$(MACROBINMASK)"; \ + rm -f $(builddir)/$$dir/$(MACROBINMASK); \ + done + +test: +# More tests could be added here + @if test -z "$(USEANT)"; then USEANT=0; else USEANT=1; fi; \ + if test -f build.xml -a $$USEANT -eq 1; then \ + $(ANT) test; \ + fi + +all-local: $(TARGETS_ALL) + +.sci.bin: + -@( if test ! -x $(top_builddir)/scilab-bin; then \ + echo "Error : Cannot build $< : Scilab has not been build"; \ + else \ + echo "Creating $@"; \ + $(top_builddir)/bin/scilab -ns -nwni -e "exec('$(abs_srcdir)/$<');save('$(abs_srcdir)/$@');exit;"; \ + fi ) + +install-html-local: + +install-data-local-local: +# Mainly for javasci + @if test -d $(srcdir)/javadoc; then \ + cp -R $(srcdir)/javadoc $(DESTDIR)/$(mydatadir)/; \ + fi +# If the user wants the help sources to be installed +@INSTALL_HELP_XML_TRUE@ @echo "-------- Install of XML sources of help files --------"; \ +@INSTALL_HELP_XML_TRUE@ for lang in $(ALL_LINGUAS); do \ +@INSTALL_HELP_XML_TRUE@ if test -d $(srcdir)/help/$$lang; then \ +@INSTALL_HELP_XML_TRUE@ $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/$$lang && \ +@INSTALL_HELP_XML_TRUE@ if ls -lLd $(srcdir)/help/$$lang/$(DOCMASKXML) >/dev/null 2>&1; then \ +@INSTALL_HELP_XML_TRUE@ for file in $(srcdir)/help/$$lang/$(DOCMASKXML) ; do \ +@INSTALL_HELP_XML_TRUE@ echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/$$lang" ; \ +@INSTALL_HELP_XML_TRUE@ $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/$$lang ; \ +@INSTALL_HELP_XML_TRUE@ done ; \ +@INSTALL_HELP_XML_TRUE@ fi; \ +@INSTALL_HELP_XML_TRUE@ fi; \ +@INSTALL_HELP_XML_TRUE@ done; \ +@INSTALL_HELP_XML_TRUE@ @echo "-------- Install of MathML sources --------"; \ +@INSTALL_HELP_XML_TRUE@ if test -d $(srcdir)/help/mml/; then \ +@INSTALL_HELP_XML_TRUE@ $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/help/mml/ && \ +@INSTALL_HELP_XML_TRUE@ if ls -lLd $(srcdir)/help/mml/$(DOCMASKMML) >/dev/null 2>&1; then \ +@INSTALL_HELP_XML_TRUE@ for file in $(srcdir)/help/mml/$(DOCMASKMML) ; do \ +@INSTALL_HELP_XML_TRUE@ echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/help/mml" ; \ +@INSTALL_HELP_XML_TRUE@ $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/help/mml ; \ +@INSTALL_HELP_XML_TRUE@ done ; \ +@INSTALL_HELP_XML_TRUE@ fi; \ +@INSTALL_HELP_XML_TRUE@ fi +install-data-local: +# Install the tests + @echo "-------- Install tests (if any) --------"; \ + for dir in $(TESTS_DIR) $(TESTS_DIREXT) ; do \ + if test -d $(srcdir)/$$dir/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \ + for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \ + if test -d "$(srcdir)/$$dir/$$file"; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir/$$file; \ + $(mkinstalldirs) "$(DESTDIR)$(pkgmacrosdir)/$$dir/$$file"; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \ + $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgmacrosdir)/`dirname $$dir/$$file`" ; \ + fi \ + done; \ + fi; \ + done +# Install the help chapter + @echo "-------- Install the help chapter (if any) --------"; \ + for lang in $(HELP_CHAPTERLANG); do \ + HELPFILE=$(srcdir)/$(HELP_CHAPTERDIR)$$lang/$(HELP_CHAPTERFILE); \ + if test -f $$HELPFILE; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(HELP_CHAPTERDIR)/$$lang/; \ + echo $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \ + $(INSTALL_DATA) $$HELPFILE $(DESTDIR)$(pkgdocdir)/$$HELPFILE; \ + fi; \ + done +# Install the demos & examples + @echo "-------- Install demos & examples (if any) --------"; \ + for dir in $(DEMOS_DIR) $(DEMOS_DIREXT) $(EXAMPLES_DIR) $(EXAMPLES_DIREXT) ; do \ + if test -d $(srcdir)/$$dir/; then \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \ + for file in `find $(srcdir)/$$dir | sed "s|^$(srcdir)/$$dir||" 2>/dev/null`; do \ + if test -d "$(srcdir)/$$dir/$$file"; then \ + echo $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir/$$file; \ + $(mkinstalldirs) "$(DESTDIR)$(pkgdocdir)/$$dir/$$file"; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/$$dir/$$file $(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \ + $(INSTALL_DATA) "$(srcdir)/$$dir/$$file" "$(DESTDIR)$(pkgdocdir)/`dirname $$dir/$$file`" ; \ + fi \ + done; \ + fi; \ + done +# Install the macros + @echo "-------- Install macros (if any) --------"; \ + for dir in $(MACRODIRS) $(MACROSDIRSEXT) ; do \ + $(mkinstalldirs) $(DESTDIR)$(pkgmacrosdir)/$$dir && \ + if test -d $(srcdir)/$$dir/; then \ + FILELIST="$(srcdir)/$$dir/$(MACROMASK) $(srcdir)/$$dir/$(MACROBINMASK) $(srcdir)/$$dir/$(MACROBUILDMASK) $(srcdir)/$$dir/names $(srcdir)/$$dir/lib";\ + if test -n "$(MACROSSPECIALEXT)"; then \ + specialExtDir=""; \ + for specialExt in $(MACROSSPECIALEXT); do \ + specialExtDir="$$specialExtDir $(srcdir)/$$dir/$$specialExt"; \ + done; \ + FILELIST="$$FILELIST $$specialExtDir"; \ + fi; \ + for file in `ls -1 $$FILELIST 2>/dev/null`; do \ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgmacrosdir)/$$dir" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgmacrosdir)/$$dir ; \ + done; \ + fi; \ + done +# Install java files (.jar) + @if ls -lLd $(srcdir)/$(JARDIR)$(JARMASK) >/dev/null 2>&1; then \ + echo "-------- Install jar files --------"; \ + $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$(JARDIR); \ + for file in $(srcdir)/$(JARDIR)$(JARMASK); do\ + echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$(JARDIR)" ; \ + $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$(JARDIR) ; \ + done ; \ + fi + +########### CLEAN ################### +# Clean help (generated automatically by Scilab) +# It used to clean the macro (clean-macros) but this was causing +# make clean && make to fail Scilab startup +@NEED_JAVA_TRUE@clean-local: clean-java +@NEED_JAVA_FALSE@clean-local: + +distclean-local: + rm -f $(builddir)/help/*/.last_successful_build_javaHelp $(builddir)/help/*/.list_* + +.PHONY: macros java swig giws + +# 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: diff --git a/modules/genetic_algorithms/demos/GAIsing2ddemo.sce b/modules/genetic_algorithms/demos/GAIsing2ddemo.sce new file mode 100755 index 000000000..5cbe817b6 --- /dev/null +++ b/modules/genetic_algorithms/demos/GAIsing2ddemo.sce @@ -0,0 +1,82 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) DIGITEO - Yann COLLETTE +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +///////////////////////////////////////////////////////////////// +// example of use of the genetic algorithm on a 2D Ising model // +///////////////////////////////////////////////////////////////// + + +function demo_ising() + + // Loading test problems + + path = get_absolute_file_path("GAIsing2ddemo.sce"); + + getd(path + "/Ising"); + + // Load the crossover and mutation operators for the Ising 2D problem + getd(path + "/."); + + J = 1.1; + H = 0.7; + Magnet = "%T"; + Connect = "%T"; + + clear f; + // For the maximization case, we must have a checker board solution (+1 -1 +1 -1 ....) + deff("y=f(x)","y = - ising2d(x,"+string(J)+","+string(H)+","+Magnet+","+Connect+")"); + + PopSize = 100; + Proba_cross = 0.7; + Proba_mut = 0.1; + NbGen = 10; + NbCouples = 110; + Log = %T; + nb_disp = 10; // Nb point to display from the optimal population + pressure = 0.05; + DisplayIndiv = %T; + + ga_params = init_param(); + // Parameters to adapt to the shape of the optimization problem + ga_params = add_param(ga_params, "dimension", 10); + ga_params = add_param(ga_params, "proba", 0.05); + + // Parameters to fine tune the Genetic algorithm. All these parameters are optional for continuous optimization + // If you need to adapt the GA to a special problem, you + ga_params = add_param(ga_params, "init_func", init_ga_ising2d); + ga_params = add_param(ga_params, "crossover_func", crossover_ga_ising2d); + ga_params = add_param(ga_params, "mutation_func", mutation_ga_ising2d); + ga_params = add_param(ga_params, "codage_func", coding_ga_identity); + ga_params = add_param(ga_params, "selection_func", selection_ga_elitist); + //ga_params = add_param(ga_params, 'selection_func', selection_ga_random); + ga_params = add_param(ga_params, "nb_couples", NbCouples); + ga_params = add_param(ga_params, "pressure", pressure); + + /////////////////////// + // Genetic Algorithm // + /////////////////////// + + printf("\n"); + printf(gettext("%s: optimization starting, please wait ...\n"),"GAIsing"); + + [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + + printf("Genetic Algorithm: %d points from pop_opt\n", nb_disp); + for i = 1 : nb_disp + printf("Individual %d: f = %f\n", i, fobj_pop_opt(i)); + if DisplayIndiv then disp(pop_opt(i)); end + end + + my_handle = scf(100001); + clf(my_handle,"reset"); + plot_ising2d(pop_opt(1)); + demo_viewCode("GAIsing2ddemo.sce"); + +endfunction + +demo_ising(); +clear demo_ising; + diff --git a/modules/genetic_algorithms/demos/GAdemo.sce b/modules/genetic_algorithms/demos/GAdemo.sce new file mode 100755 index 000000000..e5501e3b3 --- /dev/null +++ b/modules/genetic_algorithms/demos/GAdemo.sce @@ -0,0 +1,164 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) DIGITEO - Yann COLLETTE +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. +///////////////////////////////////////////// +// example of use of the genetic algorithm // +///////////////////////////////////////////// + +function demo_genetic_algo() + + // Definition of the Rastrigin test problem + // + // Rastrigin function + // + + function Res = min_bd_rastrigin() + Res = [-1 -1]'; + endfunction + + function Res = max_bd_rastrigin() + Res = [1 1]'; + endfunction + + function Res = opti_rastrigin() + Res = [0 0]'; + endfunction + + function y = rastrigin(x) + y = x(1)^2 + x(2)^2 - cos(12 * x(1)) - cos(18 * x(2)); + endfunction + + func = "rastrigin"; + + deff("y = f(x)","y = " + func + "(x)"); + + PopSize = 100; + Proba_cross = 0.7; + Proba_mut = 0.1; + NbGen = 10; + NbCouples = 110; + Log = %T; + nb_disp = 10; // Nb point to display from the optimal population + pressure = 0.05; + + ga_params = init_param(); + // Parameters to adapt to the shape of the optimization problem + ga_params = add_param(ga_params, "minbound", eval("min_bd_" + func + "()")); + ga_params = add_param(ga_params, "maxbound", eval("max_bd_" + func + "()")); + ga_params = add_param(ga_params, "dimension", 2); + ga_params = add_param(ga_params, "beta", 0); + ga_params = add_param(ga_params, "delta", 0.1); + // Parameters to fine tune the Genetic algorithm. All these parameters are optional for continuous optimization + // If you need to adapt the GA to a special problem, you + ga_params = add_param(ga_params, "init_func", init_ga_default); + ga_params = add_param(ga_params, "crossover_func", crossover_ga_default); + ga_params = add_param(ga_params, "mutation_func", mutation_ga_default); + ga_params = add_param(ga_params, "codage_func", coding_ga_identity); + ga_params = add_param(ga_params, "selection_func", selection_ga_elitist); + ga_params = add_param(ga_params, "nb_couples", NbCouples); + ga_params = add_param(ga_params, "pressure", pressure); + + Min = get_param(ga_params, "minbound"); + Max = get_param(ga_params, "maxbound"); + x0 = (Max - Min) .* rand(size(Min,1),size(Min,2)) + Min; + + ////////////////////////////////////////// + + x = Min(1):(Max(1)-Min(1))/20:Max(1); y = Min(2):(Max(2)-Min(2))/20:Max(2); + + function y = rastriginV(x1 , x2) + // Vectorized function for contouring. + y = x1.^2 + x2.^2 - cos(12 * x1) - cos(18 * x2); + endfunction + + x = linspace(-1, 1, 100); + y = linspace(-1, 1, 100); + [XX1, XX2] = meshgrid(x, y); + Z = rastriginV(XX1, XX2); + + /////////////////////// + // Genetic Algorithm // + /////////////////////// + + printf("\n"); + printf(gettext("%s: optimization starting, please wait ...\n"),"GA"); + + [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + + my_handle = scf(100001); + clf(my_handle, "reset"); + if (size(pop_opt(1)', 2) == 2) then + subplot(2, 1, 1); + drawlater; + xset("fpf", " "); + contour(x, y, Z', 5); + _axes = gca(); + _axes.data_bounds = [Min(1) Max(1) Min(2) Max(2)]; + xtitle("Genetic Algorithm - real variable", "x1", "x2"); + + printf("plotting init population ...\n"); + for i = 1:length(pop_init) + plot(pop_init(i)(1), pop_init(i)(2), "r."); + end + printf("plotting result population ...\n"); + for i = 1:length(pop_opt) + plot(pop_opt(i)(1), pop_opt(i)(2), "g."); + end + drawnow; + end + + printf("Genetic Algorithm: %d points from pop_opt\n", nb_disp); + for i = 1 : nb_disp + printf("Individual %d: x(1) = %f x(2) = %f -> f = %f\n", i, pop_opt(i)(1), pop_opt(i)(2), fobj_pop_opt(i)); + end + + ///////////////////////////////////////// + // Genetic Algorithm for binary codage // + ///////////////////////////////////////// + clear f; + deff("y=f(x)","BinLen = get_param(ga_params,''binary_length''); .. + tmp = convert_to_float(x, BinLen, Max, Min); .. + y = "+func+"(tmp);","n"); + + ga_params = add_param(ga_params, "binary_length", 8); + ga_params = set_param(ga_params, "crossover_func", crossover_ga_binary); + ga_params = set_param(ga_params, "mutation_func", mutation_ga_binary); + ga_params = set_param(ga_params, "codage_func", coding_ga_binary); + ga_params = add_param(ga_params, "multi_cross", %T); + ga_params = add_param(ga_params, "multi_cross_nb", 3); + + printf(gettext("%s: optimization starting, please wait ...\n"),"GA"); + + [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + + if (size(pop_opt(1)',2)==2) then + subplot(2, 1, 2); + drawlater; + xset("fpf", " "); + contour(x, y, Z', 5); + _axes = gca(); + _axes.data_bounds = [Min(1) Max(1) Min(2) Max(2)]; + xtitle("Genetic Algorithm - binary variables","x1","x2"); + + printf("plotting init population ...\n"); + for i = 1 : length(pop_init) + plot(pop_init(i)(1), pop_init(i)(2), "r."); + end + printf("plotting result population ...\n"); + for i = 1 : length(pop_opt) + plot(pop_opt(i)(1), pop_opt(i)(2), "g."); + end + drawnow; + end + + printf("Genetic Algorithm - binary: %d points from pop_opt\n", nb_disp); + for i = 1 : nb_disp + printf("Individual %d: x(1) = %f x(2) = %f -> f = %f\n", i, pop_opt(i)(1), pop_opt(i)(2), fobj_pop_opt(i)); + end + demo_viewCode("GAdemo.sce"); +endfunction + +demo_genetic_algo(); +clear demo_genetic_algo; diff --git a/modules/genetic_algorithms/demos/Ising/init_ising2d.sci b/modules/genetic_algorithms/demos/Ising/init_ising2d.sci new file mode 100755 index 000000000..b201efbf4 --- /dev/null +++ b/modules/genetic_algorithms/demos/Ising/init_ising2d.sci @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function Var = init_ising2d(Size, Proba) + if (~isdef("Proba","local")) then + Proba = 0.5; + end + Var = 2*(rand(Size,Size)<Proba)-1; +endfunction + diff --git a/modules/genetic_algorithms/demos/Ising/init_potts2d.sci b/modules/genetic_algorithms/demos/Ising/init_potts2d.sci new file mode 100755 index 000000000..04a9c9318 --- /dev/null +++ b/modules/genetic_algorithms/demos/Ising/init_potts2d.sci @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function Var = init_potts2d(Size, Level, Proba) + if ~isdef("Level","local") then + Level = 2; + end + if ~isdef("Proba","local") then + Proba = 0.5; + end + Var = zeros(Size,Size); + for i=1:Size + for j=1:Size + Value = floor(rand(1,1)*Level); + if (rand(1,1)<Proba) then + Var(i,j) = -Value; + else + Var(i,j) = Value; + end + end + end +endfunction diff --git a/modules/genetic_algorithms/demos/Ising/ising2d.sci b/modules/genetic_algorithms/demos/Ising/ising2d.sci new file mode 100755 index 000000000..a6aa143cc --- /dev/null +++ b/modules/genetic_algorithms/demos/Ising/ising2d.sci @@ -0,0 +1,97 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [E_Value, M_Value] = ising2d(Var, J, H, Magnet, Connect) + + [nargout, nargin] = argn(); + + M_Value_defined = (nargout==2); + + if (~isdef("Connect","local")) then + Connect = %F; + end + + if (~isdef("Magnet","local")) then + Magnet = %F; + end + + if (~isdef("H","local")) then + H = 1.0; + end + + Value = 0; + //J = J/2; + Size = size(Var,1); + for i=2:Size-1 + for j=2:Size-1 + Value = Value + J*Var(i,j)*(Var(i-1,j) + Var(i+1,j) + Var(i,j-1) + Var(i,j+1)); + end + end + if (~Connect) then + // First line + for j=2:Size-1 + Value = Value + J*Var(1,j)*(Var(2,j) + Var(1,j-1) + Var(1,j+1)); + end + // Last line + for j=2:Size-1 + Value = Value + J*Var(Size,j)*(Var(Size-1,j) + Var(Size,j-1) + Var(Size,j+1)); + end + // First column + for i=2:Size-1 + Value = Value + J*Var(i,1)*(Var(i-1,1) + Var(i+1,1) + Var(i,2)); + end + // Second column + for i=2:Size-1 + Value = Value + J*Var(i,Size)*(Var(i-1,Size) + Var(i+1,Size) + Var(i,Size-1)); + end + // First corner + Value = Value + J*Var(1,1)*(Var(2,1) + Var(1,2)); + // Second corner + Value = Value + J*Var(Size,1)*(Var(Size-1,1) + Var(1,2)); + // Third corner + Value = Value + J*Var(1,Size)*(Var(2,Size) + Var(1,Size-1)); + // Fourth corner + Value = Value + J*Var(Size,Size)*(Var(Size-1,Size) + Var(Size,Size-1)); + else + // First line + for j=2:Size-1 + Value = Value + J*Var(1,j)*(Var(Size,j) + Var(2,j) + Var(1,j-1) + Var(1,j+1)); + end + // Last line + for j=2:Size-1 + Value = Value + J*Var(Size,j)*(Var(Size-1,j) + Var(1,j) + Var(Size,j-1) + Var(Size,j+1)); + end + // First column + for i=2:Size-1 + Value = Value + J*Var(i,1)*(Var(i-1,1) + Var(i+1,1) + Var(i,Size) + Var(i,2)); + end + // Second column + for i=2:Size-1 + Value = Value + J*Var(i,Size)*(Var(i-1,Size) + Var(i+1,Size) + Var(i,Size-1) + Var(i,1)); + end + // First corner + Value = Value + J*Var(1,1)*(Var(Size,1) + Var(2,1) + Var(1,Size) + Var(1,2)); + // Second corner + Value = Value + J*Var(Size,1)*(Var(Size-1,1) + Var(1,1) + Var(1,Size) + Var(1,2)); + // Third corner + Value = Value + J*Var(1,Size)*(Var(Size,Size) + Var(2,Size) + Var(1,1) + Var(1,Size-1)); + // Fourth corner + Value = Value + J*Var(Size,Size)*(Var(Size-1,Size) + Var(1,Size) + Var(Size,Size-1) + Var(Size,1)); + end + + E_Value = - Value; + + if (Magnet) then + M_Value = - H * sum(Var); + if (M_Value_defined) then + E_Value = E_Value + M_Value; + end + end + +endfunction diff --git a/modules/genetic_algorithms/demos/Ising/plot_ising2d.sci b/modules/genetic_algorithms/demos/Ising/plot_ising2d.sci new file mode 100755 index 000000000..941943874 --- /dev/null +++ b/modules/genetic_algorithms/demos/Ising/plot_ising2d.sci @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function plot_ising2d(Var) + drawlater; + a = gca(); + Size = size(Var,1); + a.data_bounds = [0.5,0.5;Size+0.5,Size+0.5]; + for i=1:Size + for j=1:Size + if (Var(i,j)==1) then + plot(i,j,"go"); + else + plot(i,j,"r+"); + end + end + end + xtitle("Ising 2D model"); + drawnow; +endfunction diff --git a/modules/genetic_algorithms/demos/Ising/plot_potts2d.sci b/modules/genetic_algorithms/demos/Ising/plot_potts2d.sci new file mode 100755 index 000000000..99cd69b57 --- /dev/null +++ b/modules/genetic_algorithms/demos/Ising/plot_potts2d.sci @@ -0,0 +1,30 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function plot_potts2d(Var, Level) + Size = size(Var,1); + drawlater; + f=gcf(); + f.color_map = graycolormap(2*Level+1); + a = gca(); + a.data_bounds = [0,0;Size+1,Size+1]; + Z = zeros(Size*Size,3); + Index = 0; + for i=1:Size + for j=1:Size + Index = Index + 1; + Z(Index,1) = i; + Z(Index,2) = j; + Z(Index,3) = Var(i,j); + end + end + param3d1(Z(:,1),Z(:,2),list(Z(:,3),-9)); + xtitle("Potts 2D model"); + drawnow; +endfunction diff --git a/modules/genetic_algorithms/demos/MOGAdemo.sce b/modules/genetic_algorithms/demos/MOGAdemo.sce new file mode 100755 index 000000000..a58e8e6b2 --- /dev/null +++ b/modules/genetic_algorithms/demos/MOGAdemo.sce @@ -0,0 +1,134 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) DIGITEO - Yann COLLETTE +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. +//////////////////////////////////////// +// Demo of the MOGA Genetic Algorithm // +//////////////////////////////////////// + +function demo_MOGA() + + ///////////////////////// + // Deb 1 test function // + // Convex Pareto set // + ///////////////////////// + + function Res = min_bd_deb_1(n) + if ~isdef("n","local") then n = 10; end; + Res = zeros(n, 1); + endfunction + + function Res = max_bd_deb_1(n) + if ~isdef("n","local") then n = 10; end; + Res = ones(n, 1); + endfunction + + function f = get_opti_deb_1(x) + f1_x1 = x(1); + g_x2 = 1; + h = 1 - sqrt(f1_x1 / g_x2); + + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; + endfunction + + function f = deb_1(x) + f1_x1 = x(1); + g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); + h = 1 - sqrt(f1_x1 / g_x2); + + f(1, 1) = f1_x1; + f(1, 2) = g_x2 * h; + endfunction + + funcname = "deb_1"; + + // example of use of the genetic algorithm + + PopSize = 100; + Proba_cross = 0.5; + Proba_mut = 0.3; + NbGen = 4; + NbCouples = 110; + Log = %T; + nb_disp = 10; // Nb point to display from the optimal population + pressure = 0.1; + + ga_params = init_param(); + // Parameters to adapt to the shape of the optimization problem + ga_params = add_param(ga_params, "minbound", eval("min_bd_" + funcname + "(2)")); + ga_params = add_param(ga_params, "maxbound", eval("max_bd_" + funcname + "(2)")); + ga_params = add_param(ga_params, "dimension", 2); + ga_params = add_param(ga_params, "beta", 0); + ga_params = add_param(ga_params, "delta", 0.1); + // Parameters to fine tune the Genetic algorithm. All these parameters are optional for continuous optimization + // If you need to adapt the GA to a special problem, you + ga_params = add_param(ga_params, "init_func", init_ga_default); + ga_params = add_param(ga_params, "crossover_func", crossover_ga_default); + ga_params = add_param(ga_params, "mutation_func", mutation_ga_default); + ga_params = add_param(ga_params, "codage_func", coding_ga_identity); + ga_params = add_param(ga_params, "selection_func", selection_ga_elitist); + //ga_params = add_param(ga_params, 'selection_func', selection_ga_random); + ga_params = add_param(ga_params, "nb_couples", NbCouples); + ga_params = add_param(ga_params, "pressure", pressure); + + deff("y=fobjs(x)","y = " + funcname + "(x);"); + + //////////////////// + // MOGA Algorithm // + //////////////////// + + printf("\n"); + printf(gettext("%s: optimization starting, please wait ...\n"),"MOGA"); + + [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_moga(fobjs, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + + [f_pareto,pop_pareto] = pareto_filter(fobj_pop_opt, pop_opt); + + my_handle = scf(100001); + clf(my_handle,"reset"); + + if (size(fobj_pop_opt,2) == 2) then + drawlater; + subplot(2, 1, 1); + printf("plotting init population ...\n"); + plot(fobj_pop_init(:,1),fobj_pop_init(:,2),"r."); + + if isdef("get_opti_" + funcname) then + t = 0 : 0.01 : 1; + for i = 1 : length(t) + y_t(i,:) = eval("get_opti_" + funcname + "(t(" + string(i) + "))"); + end + plot(y_t(:,1), y_t(:,2), "k-"); + end + + legend(["Init","Pareto front."]); + xtitle("Objective function space","f1","f2"); + + subplot(2,1,2); + printf("plotting final population ...\n"); + plot(fobj_pop_opt(:,1),fobj_pop_opt(:,2),"g."); + printf("plotting Pareto population ...\n"); + plot(f_pareto(:,1),f_pareto(:,2),"k."); + + if isdef("get_opti_"+funcname) then + t = 0:0.01:1; + for i=1:size(t,"*") + y_t(i,:) = eval("get_opti_" + funcname + "(t(" + string(i) + "))"); + end + plot(y_t(:,1), y_t(:,2), "k-"); + end + + legend(["Final pop.","Pareto pop.","Pareto front."]); + xtitle("Objective function space","f1","f2"); + drawnow; + end + + demo_viewCode("MOGAdemo.sce"); + +endfunction + +demo_MOGA(); +clear demo_MOGA; + diff --git a/modules/genetic_algorithms/demos/NSGA2demo.sce b/modules/genetic_algorithms/demos/NSGA2demo.sce new file mode 100755 index 000000000..3cebdc785 --- /dev/null +++ b/modules/genetic_algorithms/demos/NSGA2demo.sce @@ -0,0 +1,133 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) DIGITEO - Yann COLLETTE +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + + +//////////////////////////////////////// +// Demo of the NSGA2 Genetic Algorithm // +//////////////////////////////////////// + +function demo_NSGA2() + + ///////////////////////// + // Deb 1 test function // + // Convex Pareto set // + ///////////////////////// + + function Res = min_bd_deb_1(n) + if ~isdef("n", "local") then n = 10; end; + Res = zeros(n, 1); + endfunction + + function Res = max_bd_deb_1(n) + if ~isdef("n", "local") then n = 10; end; + Res = ones(n, 1); + endfunction + + function f = get_opti_deb_1(x) + f1_x1 = x(1); + g_x2 = 1; + h = 1 - sqrt(f1_x1 / g_x2); + + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; + endfunction + + function f = deb_1(x) + f1_x1 = x(1); + g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); + h = 1 - sqrt(f1_x1 / g_x2); + + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; + endfunction + + funcname = "deb_1"; + + // example of use of the genetic algorithm + + PopSize = 100; + Proba_cross = 0.7; + Proba_mut = 0.1; + NbGen = 5; + NbCouples = 110; + Log = %T; + nb_disp = 10; // Nb point to display from the optimal population + pressure = 0.1; + + ga_params = init_param(); + // Parameters to adapt to the shape of the optimization problem + ga_params = add_param(ga_params, "minbound", eval("min_bd_"+funcname+"(2)")); + ga_params = add_param(ga_params, "maxbound", eval("max_bd_"+funcname+"(2)")); + ga_params = add_param(ga_params, "dimension", 2); + ga_params = add_param(ga_params, "beta", 0); + ga_params = add_param(ga_params, "delta", 0.1); + // Parameters to fine tune the Genetic algorithm. All these parameters are optional for continuous optimization + // If you need to adapt the GA to a special problem, you + ga_params = add_param(ga_params, "init_func", init_ga_default); + ga_params = add_param(ga_params, "crossover_func", crossover_ga_default); + ga_params = add_param(ga_params, "mutation_func", mutation_ga_default); + ga_params = add_param(ga_params, "codage_func", coding_ga_identity); + ga_params = add_param(ga_params, "nb_couples", NbCouples); + ga_params = add_param(ga_params, "pressure", pressure); + + clear y; + deff("y=fobjs(x)","y = " + funcname + "(x);"); + + ///////////////////// + // NSGA2 Algorithm // + ///////////////////// + + printf(gettext("%s: optimization starting, please wait ...\n"),"NSGA2"); + + [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga2(fobjs, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + + [f_pareto, pop_pareto] = pareto_filter(fobj_pop_opt,pop_opt); + + my_handle = scf(100001); + clf(my_handle,"reset"); + + if (size(fobj_pop_opt, 2) == 2) then + drawlater; + subplot(2, 1, 1); + printf("plotting init population ...\n"); + plot(fobj_pop_init(:,1), fobj_pop_init(:,2),"r."); + + if isdef("get_opti_" + funcname) then + t = 0:0.01:1; + for i = 1:length(t) + y_t(i,:) = eval("get_opti_" + funcname + "(t(" + string(i) + "))"); + end + plot(y_t(:,1), y_t(:,2), "k-"); + end + + legend(["Init pop.", "Pareto front."]); + xtitle("Objective function space", "f1", "f2"); + + subplot(2, 1, 2); + printf("plotting final population ...\n"); + plot(fobj_pop_opt(:,1),fobj_pop_opt(:,2),"g."); + printf("plotting Pareto population ...\n"); + plot(f_pareto(:,1), f_pareto(:,2),"k."); + + if isdef("get_opti_" + funcname) then + t = 0:0.01:1; + for i=1:length(t) + y_t(i,:) = eval("get_opti_" + funcname + "(t(" + string(i) + "))"); + end + plot(y_t(:,1), y_t(:,2), "k-"); + end + + legend(["Final pop.", "Pareto pop.", "Pareto front."]); + xtitle("Objective function space", "f1", "f2"); + drawnow; + end + + demo_viewCode("NSGA2demo.sce"); + +endfunction + +demo_NSGA2(); +clear demo_NSGA2; diff --git a/modules/genetic_algorithms/demos/NSGAdemo.sce b/modules/genetic_algorithms/demos/NSGAdemo.sce new file mode 100755 index 000000000..443261a51 --- /dev/null +++ b/modules/genetic_algorithms/demos/NSGAdemo.sce @@ -0,0 +1,135 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) DIGITEO - Yann COLLETTE +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. +//////////////////////////////////////// +// Demo of the NSGA Genetic Algorithm // +//////////////////////////////////////// + +function demo_NSGA() + + ///////////////////////// + // Deb 1 test function // + // Convex Pareto set // + ///////////////////////// + + function Res = min_bd_deb_1(n) + if ~isdef("n","local") then n = 10; end; + Res = zeros(n, 1); + endfunction + + function Res = max_bd_deb_1(n) + if ~isdef("n", "local") then n = 10; end; + Res = ones(n, 1); + endfunction + + function f = get_opti_deb_1(x) + f1_x1 = x(1); + g_x2 = 1; + h = 1 - sqrt(f1_x1 / g_x2); + + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; + endfunction + + function f = deb_1(x) + f1_x1 = x(1); + g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); + h = 1 - sqrt(f1_x1 / g_x2); + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; + endfunction + + funcname = "deb_1"; + + // example of use of the genetic algorithm + + PopSize = 100; + Proba_cross = 0.7; + Proba_mut = 0.1; + NbGen = 4; + NbCouples = 110; + Log = %T; + nb_disp = 10; // Nb point to display from the optimal population + Sigma = 0.02; // Sigma_share = Pareto_length / Pop_Size + Pow = 1; + pressure = 0.1; + + ga_params = init_param(); + // Parameters to adapt to the shape of the optimization problem + ga_params = add_param(ga_params, "minbound", eval("min_bd_" + funcname + "(2)")); + ga_params = add_param(ga_params, "maxbound", eval("max_bd_" + funcname + "(2)")); + ga_params = add_param(ga_params, "dimension", 2); + ga_params = add_param(ga_params, "beta", 0); + ga_params = add_param(ga_params, "delta", 0.1); + // Parameters to fine tune the Genetic algorithm. All these parameters are optional for continuous optimization + // If you need to adapt the GA to a special problem, you + ga_params = add_param(ga_params, "init_func", init_ga_default); + ga_params = add_param(ga_params, "crossover_func", crossover_ga_default); + ga_params = add_param(ga_params, "mutation_func", mutation_ga_default); + ga_params = add_param(ga_params, "codage_func", coding_ga_identity); + ga_params = add_param(ga_params, "selection_func", selection_ga_elitist); + //ga_params = add_param(ga_params, 'selection_func', selection_ga_random); + ga_params = add_param(ga_params, "nb_couples", NbCouples); + ga_params = add_param(ga_params, "pressure", pressure); + + clear y + deff("y = fobjs(x)","y = " + funcname + "(x);"); + + //////////////////// + // NSGA Algorithm // + //////////////////// + + printf("\n"); + printf(gettext("%s: optimization starting, please wait ...\n"),"NSGA"); + + [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga(fobjs, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params, Sigma, Pow); + + [f_pareto,pop_pareto] = pareto_filter(fobj_pop_opt,pop_opt); + + my_handle = scf(100001); + clf(my_handle,"reset"); + + if (size(fobj_pop_opt, 2) == 2) then + drawlater; + subplot(2, 1, 1); + printf("plotting init population ...\n"); + plot(fobj_pop_init(:,1),fobj_pop_init(:,2),"r."); + + if isdef("get_opti_"+funcname) then + t = 0:0.01:1; + for i=1:length(t) + y_t(i,:) = eval("get_opti_" + funcname + "(t(" + string(i) + "))"); + end + plot(y_t(:,1), y_t(:,2), "k-"); + end + + legend(["Init pop.","Pareto front."]); + xtitle("Objective function space","f1","f2"); + + subplot(2, 1, 2); + printf("plotting final population ...\n"); + plot(fobj_pop_opt(:,1), fobj_pop_opt(:,2), "g."); + printf("plotting Pareto population ...\n"); + plot(f_pareto(:,1), f_pareto(:,2), "k."); + + if isdef("get_opti_"+funcname) then + t = 0 : 0.01 : 1; + for i = 1 : size(t,"*") + y_t(i,:) = eval("get_opti_" + funcname + "(t(" + string(i) + "))"); + end + plot(y_t(:,1), y_t(:,2), "k-"); + end + + legend(["Final pop.", "Pareto pop.", "Pareto front."]); + xtitle("Objective function space", "f1", "f2"); + drawnow; + end + + demo_viewCode("NSGAdemo.sce"); + +endfunction + +demo_NSGA(); +clear demo_NSGA; diff --git a/modules/genetic_algorithms/demos/crossover_ga_ising2d.sci b/modules/genetic_algorithms/demos/crossover_ga_ising2d.sci new file mode 100755 index 000000000..6ffd712fd --- /dev/null +++ b/modules/genetic_algorithms/demos/crossover_ga_ising2d.sci @@ -0,0 +1,37 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [Crossed_Indiv1, Crossed_Indiv2] = crossover_ga_ising2d(Indiv1,Indiv2,param) + if ~isdef("param","local") then + param = []; + end + + Index_x_min = ceil(rand()*(size(Indiv1,1)-%eps)+%eps); + Index_x_max = ceil(rand()*(size(Indiv1,1)-%eps)+%eps); + Index_y_min = ceil(rand()*(size(Indiv1,1)-%eps)+%eps); + Index_y_max = ceil(rand()*(size(Indiv1,1)-%eps)+%eps); + + if Index_x_min>Index_x_max then + tmp = Index_x_min; + Index_x_min = Index_x_max; + Index_x_max = tmp; + end + + if Index_y_min>Index_y_max then + tmp = Index_y_min; + Index_y_min = Index_y_max; + Index_y_max = tmp; + end + + + Crossed_Indiv1 = Indiv1; + Crossed_Indiv1(Index_x_min:Index_x_max,Index_y_min:Index_y_max) = Indiv2(Index_x_min:Index_x_max,Index_y_min:Index_y_max); + Crossed_Indiv2 = Indiv2; + Crossed_Indiv2(Index_x_min:Index_x_max,Index_y_min:Index_y_max) = Indiv1(Index_x_min:Index_x_max,Index_y_min:Index_y_max); +endfunction diff --git a/modules/genetic_algorithms/demos/genetic_algorithms.dem.gateway.sce b/modules/genetic_algorithms/demos/genetic_algorithms.dem.gateway.sce new file mode 100755 index 000000000..6f29bf0a9 --- /dev/null +++ b/modules/genetic_algorithms/demos/genetic_algorithms.dem.gateway.sce @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - INRIA +// Copyright (C) 2010 - DIGITEO - Yann COLLETTE +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function subdemolist = gw_genetic_algo() + + demopath = get_absolute_file_path("genetic_algorithms.dem.gateway.sce"); + + subdemolist = [_("Genetic algorithms"), "GAdemo.sce"; .. + _("Genetic algorithms and Ising problem"), "GAIsing2ddemo.sce"; .. + _("MultiObjective Genetic Algorithm"), "MOGAdemo.sce"; .. + _("Niched Sharing Genetic Algorithm"), "NSGAdemo.sce"; .. + _("Niched Sharing Genetic Algorithm II"), "NSGA2demo.sce"]; + + subdemolist(:,2) = demopath + subdemolist(:,2) +endfunction + +subdemolist = gw_genetic_algo(); +clear gw_genetic_algo; diff --git a/modules/genetic_algorithms/demos/init_ga_ising2d.sci b/modules/genetic_algorithms/demos/init_ga_ising2d.sci new file mode 100755 index 000000000..087dbe9be --- /dev/null +++ b/modules/genetic_algorithms/demos/init_ga_ising2d.sci @@ -0,0 +1,23 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function Pop_init = init_ga_ising2d(popsize,param) + if ~isdef("param","local") then + param = []; + end + + // We deal with some parameters to take into account the boundary of the domain and the neighborhood size + Dim = get_param(param,"dimension",10); + + // Pop_init must be a list() + Pop_init = list(); + for i=1:popsize + Pop_init(i) = init_ising2d(Dim,rand()); + end +endfunction diff --git a/modules/genetic_algorithms/demos/mutation_ga_ising2d.sci b/modules/genetic_algorithms/demos/mutation_ga_ising2d.sci new file mode 100755 index 000000000..51533fb3c --- /dev/null +++ b/modules/genetic_algorithms/demos/mutation_ga_ising2d.sci @@ -0,0 +1,20 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function Mut_Indiv = mutation_ga_ising2d(Indiv,param) + if ~isdef("param","local") then + param = []; + end + // We deal with some parameters to take into account the boundary of the domain and the neighborhood size + Proba = get_param(param,"proba",0.1); + ChangeMatrix = rand(size(Indiv,1),size(Indiv,2)); + Index = find(ChangeMatrix<0.1); + Mut_Indiv = Indiv; + Mut_Indiv(Index) = Mut_Indiv(Index)*(-1); +endfunction diff --git a/modules/genetic_algorithms/etc/genetic_algorithms.quit b/modules/genetic_algorithms/etc/genetic_algorithms.quit new file mode 100755 index 000000000..ab83f0c89 --- /dev/null +++ b/modules/genetic_algorithms/etc/genetic_algorithms.quit @@ -0,0 +1,10 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2007-2008 - INRIA +// Copyright (C) 2009 - DIGITEO +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + diff --git a/modules/genetic_algorithms/etc/genetic_algorithms.start b/modules/genetic_algorithms/etc/genetic_algorithms.start new file mode 100755 index 000000000..d389cbac8 --- /dev/null +++ b/modules/genetic_algorithms/etc/genetic_algorithms.start @@ -0,0 +1,13 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// Load functions libraries +// ============================================================================= +load("SCI/modules/genetic_algorithms/macros/lib"); + diff --git a/modules/genetic_algorithms/genetic_algorithms.iss b/modules/genetic_algorithms/genetic_algorithms.iss new file mode 100755 index 000000000..d86a9761f --- /dev/null +++ b/modules/genetic_algorithms/genetic_algorithms.iss @@ -0,0 +1,36 @@ +; +; Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +; Copyright (C) INRIA - Allan CORNET +; Copyright (C) DIGITEO - 2010 - Allan CORNET +; +; This file must be used under the terms of the CeCILL. +; This source file is licensed as described in the file COPYING, which +; you should have received as part of this distribution. The terms +; are also available at +; http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +; +;-------------------------------------------------------------------------------------------------------------- +; Inno Setup Script (5.3 and more) for Scilab (UNICODE version required) +; +;-------------------------------------------------------------------------------------------------------------- +; +#define GENETICALGORITHMS "genetic_algorithms" +; +Source: modules\{#GENETICALGORITHMS}\license.txt; DestDir: {app}\modules\{#GENETICALGORITHMS}; Components: {#COMPN_SCILAB} +; +Source: modules\{#GENETICALGORITHMS}\etc\{#GENETICALGORITHMS}.quit; DestDir: {app}\modules\{#GENETICALGORITHMS}\etc; Components: {#COMPN_SCILAB} +Source: modules\{#GENETICALGORITHMS}\etc\{#GENETICALGORITHMS}.start; DestDir: {app}\modules\{#GENETICALGORITHMS}\etc; Components: {#COMPN_SCILAB} +; +Source: modules\{#GENETICALGORITHMS}\demos\*.*; DestDir: {app}\modules\{#GENETICALGORITHMS}\demos; Flags: recursesubdirs; Components: {#COMPN_SCILAB} +; +Source: modules\{#GENETICALGORITHMS}\macros\lib; DestDir: {app}\modules\{#GENETICALGORITHMS}\macros; Flags: recursesubdirs; Components: {#COMPN_SCILAB} +Source: modules\{#GENETICALGORITHMS}\macros\names; DestDir: {app}\modules\{#GENETICALGORITHMS}\macros; Flags: recursesubdirs; Components: {#COMPN_SCILAB} +Source: modules\{#GENETICALGORITHMS}\macros\*.bin; DestDir: {app}\modules\{#GENETICALGORITHMS}\macros; Flags: recursesubdirs; Components: {#COMPN_SCILAB} +Source: modules\{#GENETICALGORITHMS}\macros\*.sci; DestDir: {app}\modules\{#GENETICALGORITHMS}\macros; Flags: recursesubdirs; Components: {#COMPN_SCILAB} +Source: modules\{#GENETICALGORITHMS}\macros\buildmacros.sce; DestDir: {app}\modules\{#GENETICALGORITHMS}\macros; Flags: recursesubdirs; Components: {#COMPN_SCILAB} +Source: modules\{#GENETICALGORITHMS}\macros\buildmacros.bat; DestDir: {app}\modules\{#GENETICALGORITHMS}\macros; Flags: recursesubdirs; Components: {#COMPN_SCILAB} +Source: modules\{#GENETICALGORITHMS}\macros\cleanmacros.bat; DestDir: {app}\modules\{#GENETICALGORITHMS}\macros; Flags: recursesubdirs; Components: {#COMPN_SCILAB} +; +Source: modules\{#GENETICALGORITHMS}\tests\*.*; DestDir: {app}\modules\{#GENETICALGORITHMS}\tests; Flags: recursesubdirs; Components: {#COMPN_SCILAB} and {#COMPN_TESTS} +; +;-------------------------------------------------------------------------------------------------------------- diff --git a/modules/genetic_algorithms/help/en_US/addchapter.sce b/modules/genetic_algorithms/help/en_US/addchapter.sce new file mode 100755 index 000000000..b124adba9 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +add_help_chapter("Genetic Algorithms",SCI+"/modules/genetic_algorithms/help/en_US",%T); + diff --git a/modules/genetic_algorithms/help/en_US/algorithms/CHAPTER b/modules/genetic_algorithms/help/en_US/algorithms/CHAPTER new file mode 100755 index 000000000..72bf6070b --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/algorithms/CHAPTER @@ -0,0 +1,2 @@ +title = Algorithms + diff --git a/modules/genetic_algorithms/help/en_US/algorithms/optim_ga.xml b/modules/genetic_algorithms/help/en_US/algorithms/optim_ga.xml new file mode 100755 index 000000000..6c2a02951 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/algorithms/optim_ga.xml @@ -0,0 +1,423 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * Copyright (C) 2010 - 2011 - DIGITEO - Michael Baudin + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="optim_ga" xml:lang="en"> + <refnamediv> + <refname>optim_ga</refname> + <refpurpose>A flexible genetic algorithm</refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[pop_opt,fobj_pop_opt,pop_init,fobj_pop_init] = optim_ga(ga_f,pop_size,nb_generation,p_mut,p_cross,Log,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>ga_f</term> + <listitem> + <para> + the function to be optimized. The prototype if y = f(x) or y = + list(f,p1,p2,...). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_size</term> + <listitem> + <para> + the size of the population of individuals (default value: + 100). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_generation</term> + <listitem> + <para> + the number of generations (equivalent to the number of + iterations in classical optimization) to be computed (default value: + 10). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>p_mut</term> + <listitem> + <para>the mutation probability (default value: 0.1).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>p_cross</term> + <listitem> + <para>the crossover probability (default value: 0.7).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Log</term> + <listitem> + <para> + if %T, will call the output function at the end of each + iteration, see <literal>"output_func"</literal> under + <varname>param</varname> variable below. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters.</para> + <itemizedlist> + <listitem> + <para> + "codage_func": the function which will perform the coding + and decoding of individuals (default function: + <link linkend="coding_ga_identity">coding_ga_identity</link>). + </para> + </listitem> + <listitem> + <para> + "init_func": the function which will perform the + initialization of the population (default function: + <link linkend="init_ga_default">init_ga_default</link>). + </para> + </listitem> + <listitem> + <para> + "dimension", "minbounds" and "maxbounds": + parameters used by the initialization function to define the initial population. + </para> + </listitem> + <listitem> + <para> + "crossover_func": the function which will perform the + crossover between two individuals (default function: + <link linkend="crossover_ga_default">crossover_ga_default</link>). + </para> + </listitem> + <listitem> + <para> + "mutation_func": the function which will perform the + mutation of one individual (default function: + <link linkend="mutation_ga_default">mutation_ga_default</link>). + </para> + </listitem> + <listitem> + <para> + "selection_func": the function which will perform the + selection of individuals at the end of a generation (default + function: <link linkend="selection_ga_elitist">selection_ga_elitist</link>). + </para> + </listitem> + <listitem> + <para> + "nb_couples": the number of couples which will be selected + so as to perform the crossover and mutation (default value: + 100). + </para> + </listitem> + <listitem> + <para> + "pressure": the value of the efficiency of the worst + individual (default value: 0.05). + </para> + </listitem> + <listitem> + <para> + "output_func": a callback function called after each + generation if <varname>Log</varname> is %T (default + function <link linkend="output_ga_default">output_ga_default</link>). + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_opt</term> + <listitem> + <para>the population of optimal individuals.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>fobj_pop_opt</term> + <listitem> + <para> + the set of objective function values associated to pop_opt + (optional). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_init</term> + <listitem> + <para>the initial population of individuals (optional).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>fobj_pop_init</term> + <listitem> + <para> + the set of objective function values associated to pop_init + (optional). + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + This function implements the classical genetic algorithm. + </para> + <para> + A great flexibility is authorized in customizing the behaviour of the + <literal>optim_ga</literal> function. + This flexibility is provided by the various functions which + can be set in the <literal>param</literal> variable. + The header of these functions (i.e. + the input and output arguments), can be checked through the help page + corresponding to the default function. + For example, in order to understand what are the input and output arguments of the + <literal>"codage_func"</literal> function, please refer to the help page of the <link linkend="coding_ga_identity">coding_identity</link> function. + </para> + <para> + See the Demonstrations for more examples for this function. + </para> + </refsection> + <refsection> + <title>Examples</title> + <para> + The following session presents the simplest possible example. + We minimize a quadratic function in dimension 3. + By default, all the parameters are taken in the interval + [0,1]^3. + The "dimension" field is passed to the function which computes the + initial population, which is <literal>init_ga_default</literal> + function by default. + In the case where the "dimension" field is not customized, + the default value is used, which is equal to 2. + </para> + <programlisting role="example"><![CDATA[ +function y=f(x) + y = sum(x.^2) +endfunction + +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 10; +Log = %T; + +ga_params = init_param(); +// Parameters to control the initial population. +ga_params = add_param(ga_params,"dimension",3); + +[pop_opt, fobj_pop_opt] = .. + optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + ]]></programlisting> + <para> + Once the algorithm done, we can analyze the results. + In the following script, we compute some basic statistics about the + optimum population and get the best and the worst points. + </para> + <programlisting role="example"><![CDATA[ +// Display basic statistics +// min, mean and max function values of the population. +disp([min(fobj_pop_opt) mean(fobj_pop_opt) max(fobj_pop_opt)]) +// Get the best x (i.e. the one which achieves the minimum function value) +[fmin ,k] = min(fobj_pop_opt) +xmin = pop_opt(k) +// Get the worst x +[fmax ,k] = max(fobj_pop_opt) +xmax = pop_opt(k) + ]]></programlisting> + <para> + In the following example, we customize all the options + in order to show all the features of the algorithm. + </para> + <programlisting role="example"><![CDATA[ +// Objective function +function y=f(x) + y = sum(x.^2) +endfunction + +// Output function with a stop criterion +function stop = output_ga_custom(gen_index, nb_generation, Pop, FObj_Pop, param) + [threshold, err] = get_param(param, "threshold", 1E-10); // default value for the threshold + printf(_("%s: iteration %d / %d \n"), "optim_ga", gen_index, nb_generation); + printf(_(" min / max value found = %.4E / %.4E\n"), min(FObj_Pop), max(FObj_Pop)); + stop = %f + if abs(max(FObj_Pop) - min(FObj_Pop)) < threshold then + printf(_(" Stop criterion reached: Delta Max to Min under threshold")); + stop = %t + end +endfunction + +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 20; +NbCouples = 110; +Log = %T; +pressure = 0.05; + +ga_params = init_param(); +// Parameters to adapt to the shape of the optimization problem +ga_params = add_param(ga_params,"minbound",[-2; -2]); +ga_params = add_param(ga_params,"maxbound",[2; 2]); +ga_params = add_param(ga_params,"dimension",2); +ga_params = add_param(ga_params,"beta",0); +ga_params = add_param(ga_params,"delta",0.1); +// Parameters to fine tune the Genetic algorithm. +// All these parameters are optional for continuous optimization +// If you need to adapt the GA to a special problem, you +ga_params = add_param(ga_params,"init_func",init_ga_default); +ga_params = add_param(ga_params,"crossover_func",crossover_ga_default); +ga_params = add_param(ga_params,"mutation_func",mutation_ga_default); +ga_params = add_param(ga_params,"codage_func",coding_ga_identity); +ga_params = add_param(ga_params,"selection_func",selection_ga_elitist); + +//ga_params = add_param(ga_params,"selection_func",selection_ga_random); +ga_params = add_param(ga_params,"nb_couples",NbCouples); +ga_params = add_param(ga_params,"pressure",pressure); + +// Customized output function with a stop criterion added +ga_params = add_param(ga_params, "threshold", 1E-6); // User defined parameter for the output function +ga_params = add_param(ga_params, "output_func", output_ga_custom); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. + optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + ]]></programlisting> + </refsection> + <refsection> + <title>Customizing the initial population</title> + <para> + In the following example, we customize the init function, + which computes the initial population. + In the <literal>myinitga</literal> function, we use the grand function + (instead of the default rand used in + init_ga_default). + We could use any other type of population generator, including, + for example, a low discrepancy sequence such as the Halton or Sobol + sequence. + </para> + <programlisting role="example"><![CDATA[ +function y=f(x) + y = sum(x.^2) +endfunction + +function Pop_init = myinitga ( popsize , param ) + // This message is to be displayed in the console + // for demonstration purpose only : + // remove it in a real application! + disp("Initializing the Population with grand") + // We deal with some parameters to take into account + // the boundary of the domain and the neighborhood size + [Dim,err] = get_param(param,"dimension",2) + [MinBounds,err] = get_param(param,"minbound",-2*ones(1,Dim)) + [MaxBounds,err] = get_param(param,"maxbound",2*ones(1,Dim)) + + // Pop_init must be a list() + Pop_init = list() + nr = size(MaxBounds,1) + nc = size(MaxBounds,2) + for i=1:popsize + u = grand(nr,nc,"def") + Pop_init(i) = (MaxBounds - MinBounds).*u + MinBounds + end +endfunction + +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 10; +NbCouples = 110; +Log = %T; + +ga_params = init_param(); +// Parameters to adapt to the shape of the optimization problem +ga_params = add_param(ga_params,"minbound",[-2; -2]); +ga_params = add_param(ga_params,"maxbound",[2; 2]); +ga_params = add_param(ga_params,"dimension",2); +ga_params = add_param(ga_params,"init_func",myinitga); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. + optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + ]]></programlisting> + </refsection> + <refsection> + <title>Extra parameters for the function</title> + <para> + In some cases, the objective function needs additional parameters + in order to be evaluated. + In this case, we can pass a list to the <literal>optim_ga</literal> + function, where the first element of the list is the function and the + remaining elements are the extra parameters. + </para> + <para> + This is done in the following script, where the function <literal>f</literal> + needs the two extra parameters <literal>a1</literal> and <literal>a2</literal>. + This is why we define the list <literal>myobjfun</literal> and + pass it to the <literal>optim_ga</literal> solver. + </para> + <programlisting role="example"><![CDATA[ +function y = f ( x , a1 , a2 ) + y = a1*sum(x.^2) + a2 +endfunction + +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 10; +NbCouples = 110; +Log = %T; + +ga_params = init_param(); +// Parameters to control the initial population. +ga_params = add_param(ga_params,"dimension",3); + +// Pass the extra parameters to the objective function +a1 = 12; +a2 = 7; +myobjfun = list(f,a1,a2); + +// Optimize ! +[pop_opt, fobj_pop_opt] = .. + optim_ga(myobjfun, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="optim_moga"> optim_moga </link> + </member> + <member> + <link linkend="optim_nsga"> optim_nsga </link> + </member> + <member> + <link linkend="optim_nsga2"> optim_nsga2 </link> + </member> + </simplelist> + </refsection> + <refsection> + <title>References</title> + <itemizedlist> + <listitem> + <para> + Michalewicz Zbigniew "Genetic Algorithms + Data Structures = Evolution Programs" + </para> + </listitem> + </itemizedlist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/algorithms/optim_moga.xml b/modules/genetic_algorithms/help/en_US/algorithms/optim_moga.xml new file mode 100755 index 000000000..2969120d7 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/algorithms/optim_moga.xml @@ -0,0 +1,227 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="optim_moga" xml:lang="en"> + <refnamediv> + <refname>optim_moga</refname> + <refpurpose>multi-objective genetic algorithm</refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[pop_opt,fobj_pop_opt,pop_init,fobj_pop_init] = optim_moga(ga_f,pop_size,nb_generation,p_mut,p_cross,Log,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>ga_f</term> + <listitem> + <para>the function to be optimized. The header of the function is + the following : + </para> + <programlisting role=""><![CDATA[ +y = f(x) + ]]></programlisting> + <para>or</para> + <programlisting role=""><![CDATA[ +y = list(f,p1,p2,...) + ]]></programlisting> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_size</term> + <listitem> + <para>the size of the population of individuals (default value: + 100). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_generation</term> + <listitem> + <para>the number of generations (equivalent to the number of + iterations in classical optimization) to be computed (default value: + 10). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>p_mut</term> + <listitem> + <para>the mutation probability (default value: 0.1).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>p_cross</term> + <listitem> + <para>the crossover probability (default value: 0.7).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Log</term> + <listitem> + <para> + if %T, will call the output function at the end of each + iteration, see <literal>"output_func"</literal> under + <varname>param</varname> variable below. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters.</para> + <itemizedlist> + <listitem> + <para>'codage_func': the function which will perform the coding + and decoding of individuals (default function: <link linkend="coding_ga_identity">coding_ga_identity</link>). + </para> + </listitem> + <listitem> + <para> 'init_func': the function which will perform the + initialization of the population (default function: + <link linkend="init_ga_default">init_ga_default</link>). + </para> + </listitem> + <listitem> + <para> + 'dimension', 'minbounds' and 'maxbounds': + parameters used by the initialization function to define the initial population. + </para> + </listitem> + <listitem> + <para> 'crossover_func': the function which will perform the + crossover between two individuals (default function: + <link linkend="crossover_ga_default">crossover_ga_default</link>). + </para> + </listitem> + <listitem> + <para> 'mutation_func': the function which will perform the + mutation of one individual (default function: + <link linkend="mutation_ga_default">mutation_ga_default</link>). + </para> + </listitem> + <listitem> + <para> 'selection_func': the function whcih will perform the + selection of individuals at the end of a generation (default + function: <link linkend="selection_ga_elitist">selection_ga_elitist</link>). + </para> + </listitem> + <listitem> + <para>'nb_couples': the number of couples which will be selected + so as to perform the crossover and mutation (default value: + 100). + </para> + </listitem> + <listitem> + <para> 'pressure': the value the efficiency of the worst + individual (default value: 0.05). + </para> + </listitem> + <listitem> + <para> + "output_func": a callback function called after each + generation if <varname>Log</varname> is %T (default + function <literal>output_moga_default</literal>). + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_opt</term> + <listitem> + <para>the population of optimal individuals.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>fobj_pop_opt</term> + <listitem> + <para>the set of multi-objective function values associated to + pop_opt (optional). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_init</term> + <listitem> + <para>the initial population of individuals (optional).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>fobj_pop_init</term> + <listitem> + <para>the set of multi-objective function values associated to + pop_init (optional). + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <itemizedlist> + <listitem> + <para>This function implements the classical "Multi-Objective Genetic + Algorithm". For a demonstration: see + SCI/modules/genetic_algorithms/examples/MOGAdemo.sce. + </para> + </listitem> + </itemizedlist> + </refsection> + + <refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ +function f = deb_1(x) + f1_x1 = x(1); + g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); + h = 1 - sqrt(f1_x1 / g_x2); + + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; +endfunction + +PopSize = 100; +Proba_cross = 0.5; +Proba_mut = 0.3; +NbGen = 4; +NbCouples = 110; +Log = %T; +nb_disp = 10; // Nb point to display from the optimal population +pressure = 0.1; + +ga_params = init_param(); +ga_params = add_param(ga_params,'dimension',2); +ga_params = add_param(ga_params,'minbound',zeros(2,1)); +ga_params = add_param(ga_params,'maxbound',ones(2,1)); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_moga(deb_1, PopSize,NbGen, Proba_mut, Proba_cross, Log, ga_params) + + ]]></programlisting> + </refsection> + + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + <member> + <link linkend="optim_nsga"> optim_nsga </link> + </member> + <member> + <link linkend="optim_nsga2"> optim_nsga2 </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/algorithms/optim_nsga.xml b/modules/genetic_algorithms/help/en_US/algorithms/optim_nsga.xml new file mode 100755 index 000000000..7c4c5ea80 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/algorithms/optim_nsga.xml @@ -0,0 +1,233 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="optim_nsga" xml:lang="en"> + <refnamediv> + <refname>optim_nsga</refname> + <refpurpose>A multi-objective Niched Sharing Genetic + Algorithm + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[pop_opt,fobj_pop_opt,pop_init,fobj_pop_init] = optim_nsga(ga_f,pop_size,nb_generation,p_mut,p_cross,Log,param,sigma,pow)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>ga_f</term> + <listitem> + <para>the function to be optimized. The prototype if y = f(x) or y = + list(f,p1,p2,...). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_size</term> + <listitem> + <para>the size of the population of individuals (default value: + 100). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_generation</term> + <listitem> + <para>the number of generations (equivalent to the number of + iterations in classical optimization) to be computed (default value: + 10). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>p_mut</term> + <listitem> + <para>the mutation probability (default value: 0.1).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>p_cross</term> + <listitem> + <para>the crossover probability (default value: 0.7).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Log</term> + <listitem> + <para> + if %T, will call the output function at the end of each + iteration, see <literal>"output_func"</literal> under + <varname>param</varname> variable below. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters. </para> + <itemizedlist> + <listitem> + <para> 'codage_func': the function which will perform the coding + and decoding of individuals (default function: <link linkend="coding_ga_identity">coding_ga_identity</link>). + </para> + </listitem> + <listitem> + <para> 'init_func': the function which will perform the + initialization of the population (default function: + <link linkend="init_ga_default">init_ga_default</link>). + </para> + </listitem> + <listitem> + <para> + 'dimension', 'minbounds' and 'maxbounds': + parameters used by the initialization function to define the initial population. + </para> + </listitem> + <listitem> + <para> 'crossover_func': the function which will perform the + crossover between two individuals (default function: + <link linkend="crossover_ga_default">crossover_ga_default</link>). + </para> + </listitem> + <listitem> + <para> 'mutation_func': the function which will perform the + mutation of one individual (default function: + <link linkend="mutation_ga_default">mutation_ga_default</link>). + </para> + </listitem> + <listitem> + <para> 'selection_func': the function whcih will perform the + selection of individuals at the end of a generation (default + function: <link linkend="selection_ga_elitist">selection_ga_elitist</link>). + </para> + </listitem> + <listitem> + <para> 'nb_couples': the number of couples which will be + selected so as to perform the crossover and mutation (default + value: 100). + </para> + </listitem> + <listitem> + <para> 'pressure': the value the efficiency of the worst + individual (default value: 0.05). + </para> + </listitem> + <listitem> + <para> + "output_func": a callback function called after each + generation if <varname>Log</varname> is %T (default + function <literal>output_nsga_default</literal>). + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>sigma</term> + <listitem> + <para>the radius of the sharing area.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>pow</term> + <listitem> + <para>the power coefficient of the penalty formula.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_opt</term> + <listitem> + <para>the population of optimal individuals.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>fobj_pop_opt</term> + <listitem> + <para>the set of objective function values associated to pop_opt + (optional). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_init</term> + <listitem> + <para>the initial population of individuals (optional).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>fobj_pop_init</term> + <listitem> + <para>the set of objective function values associated to pop_init + (optional). + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <itemizedlist> + <listitem> + <para>This function implements the classical "Niched Sharing Genetic + Algorithm". For a demonstration, see + SCI/modules/genetic_algorithms/demos/NSGAdemo.sce + </para> + </listitem> + </itemizedlist> + </refsection> + <refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ +function f = deb_1(x) + f1_x1 = x(1); + g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); + h = 1 - sqrt(f1_x1 / g_x2); + + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; +endfunction + +PopSize = 100; +Proba_cross = 0.5; +Proba_mut = 0.3; +NbGen = 4; +NbCouples = 110; +Log = %T; +nb_disp = 10; // Nb point to display from the optimal population +pressure = 0.1; + +ga_params = init_param(); +ga_params = add_param(ga_params,'dimension',2); +ga_params = add_param(ga_params,'minbound',zeros(2,1)); +ga_params = add_param(ga_params,'maxbound',ones(2,1)); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga(deb_1, PopSize,NbGen, Proba_mut, Proba_cross, Log, ga_params) + + ]]></programlisting> + </refsection> + + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="optim_moga">optim_moga</link> + </member> + <member> + <link linkend="optim_ga">optim_ga</link> + </member> + <member> + <link linkend="optim_nsga2">optim_nsga2</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/algorithms/optim_nsga2.xml b/modules/genetic_algorithms/help/en_US/algorithms/optim_nsga2.xml new file mode 100755 index 000000000..dda910cbb --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/algorithms/optim_nsga2.xml @@ -0,0 +1,221 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="optim_nsga2" xml:lang="en"> + <refnamediv> + <refname>optim_nsga2</refname> + <refpurpose>A multi-objective Niched Sharing Genetic Algorithm version + 2 + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[pop_opt,fobj_pop_opt,pop_init,fobj_pop_init] = optim_nsga2(ga_f,pop_size,nb_generation,p_mut,p_cross,Log,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>ga_f</term> + <listitem> + <para>the function to be optimized. The prototype if y = f(x) or y = + list(f,p1,p2,...). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_size</term> + <listitem> + <para>the size of the population of individuals (default value: + 100). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_generation</term> + <listitem> + <para>the number of generations (equivalent to the number of + iterations in classical optimization) to be computed (default value: + 10). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>p_mut</term> + <listitem> + <para>the mutation probability (default value: 0.1).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>p_cross</term> + <listitem> + <para>the crossover probability (default value: 0.7).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Log</term> + <listitem> + <para> + if %T, will call the output function at the end of each + iteration, see <literal>"output_func"</literal> under + <varname>param</varname> variable below. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters. </para> + <itemizedlist> + <listitem> + <para> 'codage_func': the function which will perform the coding + and decoding of individuals (default function: <link linkend="coding_ga_identity">coding_ga_identity</link>). + </para> + </listitem> + <listitem> + <para> 'init_func': the function which will perform the + initialization of the population (default function: + <link linkend="init_ga_default">init_ga_default</link>). + </para> + </listitem> + <listitem> + <para> + 'dimension', 'minbounds' and 'maxbounds': + parameters used by the initialization function to define the initial population. + </para> + </listitem> + <listitem> + <para> 'crossover_func': the function which will perform the + crossover between two individuals (default function: + <link linkend="crossover_ga_default">crossover_ga_default</link>). + </para> + </listitem> + <listitem> + <para> 'mutation_func': the function which will perform the + mutation of one individual (default function: + <link linkend="mutation_ga_default">mutation_ga_default</link>). + </para> + </listitem> + <listitem> + <para> 'selection_func': the function whcih will perform the + selection of individuals at the end of a generation (default + function: <link linkend="selection_ga_elitist">selection_ga_elitist</link>). + </para> + </listitem> + <listitem> + <para> 'nb_couples': the number of couples which will be + selected so as to perform the crossover and mutation (default + value: 100). + </para> + </listitem> + <listitem> + <para> 'pressure': the value the efficiency of the worst + individual (default value: 0.05). + </para> + </listitem> + <listitem> + <para> + "output_func": a callback function called after each + generation if <varname>Log</varname> is %T (default + function <literal>output_nsga2_default</literal>). + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_opt</term> + <listitem> + <para>the population of optimal individuals.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>fobj_pop_opt</term> + <listitem> + <para>the set of objective function values associated to pop_opt + (optional). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_init</term> + <listitem> + <para>the initial population of individuals (optional).</para> + </listitem> + </varlistentry> + <varlistentry> + <term>fobj_pop_init</term> + <listitem> + <para>the set of objective function values associated to pop_init + (optional). + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <itemizedlist> + <listitem> + <para>This function implements the classical "Niched Sharing Genetic + Algorithm". For a demonstration, see + SCI/modules/genetic_algorithms/examples/NSGA2demo.sce. + </para> + </listitem> + </itemizedlist> + </refsection> + <refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ +function f = deb_1(x) + f1_x1 = x(1); + g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); + h = 1 - sqrt(f1_x1 / g_x2); + + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; +endfunction + +PopSize = 100; +Proba_cross = 0.5; +Proba_mut = 0.3; +NbGen = 4; +NbCouples = 110; +Log = %T; +nb_disp = 10; // Nb point to display from the optimal population +pressure = 0.1; + +ga_params = init_param(); +ga_params = add_param(ga_params,'dimension',2); +ga_params = add_param(ga_params,'minbound',zeros(2,1)); +ga_params = add_param(ga_params,'maxbound',ones(2,1)); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga2(deb_1, PopSize,NbGen, Proba_mut, Proba_cross, Log, ga_params) + + ]]></programlisting> + </refsection> + + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="optim_moga"> optim_moga </link> + </member> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + <member> + <link linkend="optim_nsga"> optim_nsga </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/CHAPTER b/modules/genetic_algorithms/help/en_US/utilities/CHAPTER new file mode 100755 index 000000000..1a24f493c --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/CHAPTER @@ -0,0 +1,2 @@ +title = Utilities + diff --git a/modules/genetic_algorithms/help/en_US/utilities/coding_ga_binary.xml b/modules/genetic_algorithms/help/en_US/utilities/coding_ga_binary.xml new file mode 100755 index 000000000..23b9de23f --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/coding_ga_binary.xml @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="coding_ga_binary" xml:lang="en"> + <refnamediv> + <refname>coding_ga_binary</refname> + <refpurpose>A function which performs conversion between binary and + continuous representation + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>pop_out = coding_ga_binary(pop_in,direction,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>pop_in</term> + <listitem> + <para>a list which contains all the individuals in the current + population. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>direction</term> + <listitem> + <para>'code' or 'decode'. If direction == 'code' then we perform a + continuous to binary encoding. Else, we convert from binary to + continuous. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a parameter list.</para> + <itemizedlist> + <listitem> + <para>'binary_length': the number of bits by variables. If + binary_length = 8 and the variable X is of dimension 2 then the + binary code will be 16 bits length. + </para> + </listitem> + <listitem> + <para>'minboun': a vector of minimum bounds for the variable + X. + </para> + </listitem> + <listitem> + <para>'maxbound': a vector of maximum bounds for the variable + X. + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_out</term> + <listitem> + <para>the population coded to binary or decoded to continuous + values. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <itemizedlist> + <listitem> + <para>This function allows to code or decode a population of + individuals from (resp. to) continuous variables to (resp. from) + binary. + </para> + </listitem> + </itemizedlist> + </refsection> + <refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ + +pop_in = list(); +pop_in(1) = 2; + +pop_out = coding_ga_binary(pop_in,'code',[]) +// Will return 11111111 + +pop_in_2 = coding_ga_binary(pop_out,'decode',[]) +// Should be 2 + +]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + <member> + <link linkend="mutation_ga_binary"> mutation_ga_binary + </link> + </member> + <member> + <link linkend="crossover_ga_binary"> crossover_ga_binary + </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/coding_ga_identity.xml b/modules/genetic_algorithms/help/en_US/utilities/coding_ga_identity.xml new file mode 100755 index 000000000..8e6904e0f --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/coding_ga_identity.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * Copyright (C) 2010 - DIGITEO - Michael Baudin + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="coding_ga_identity"> + <refnamediv> + <refname>coding_ga_identity</refname> + <refpurpose> + A "no-operation" conversion function + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title> + Calling Sequence + </title> + <synopsis> + pop_out = coding_ga_identity(pop_in,direction,param) + </synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>pop_in</term> + <listitem> + <para> + the population to be converted. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>direction</term> + <listitem> + <para> + "code" or "decode". This value has no influence of the state of pop_in. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para> + a parameter list. For this function, there are no useful parameters set. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>pop_out</term> + <listitem> + <para> + a population identical to pop_in. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + This function is a do-nothing function. It is essentially useful to implement an evolutionnary algorithm. In an evolutionnary algorithm, we work directly on the variable and not on a binary code. + </para> + </refsection> + + <refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ +pop_in = list(); +pop_in(1) = 2; + +pop_out = coding_ga_identity(pop_in,'code',[]) + +pop_in_2 = coding_ga_identity(pop_out,'decode',[]) +]]></programlisting> + </refsection> + + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="mutation_ga_default"> mutation_ga_default </link> + </member> + <member> + <link linkend="crossover_ga_default"> crossover_ga_default </link> + </member> + <member> + <link linkend="init_ga_default"> init_ga_default </link> + </member> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/crossover_ga_binary.xml b/modules/genetic_algorithms/help/en_US/utilities/crossover_ga_binary.xml new file mode 100755 index 000000000..faec26097 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/crossover_ga_binary.xml @@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * Copyright (C) 2014 - Michael BAUDIN <michael.baudin@contrib.scilab.org> + * Copyright (C) Scilab Enterprises - 2014 - Pierre-Aime AGNEL + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="crossover_ga_binary" xml:lang="en"> + <refnamediv> + <refname>crossover_ga_binary</refname> + <refpurpose>A crossover function for binary code</refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[Crossed_Indiv1, Crossed_Indiv2, mix] = crossover_ga_binary(Indiv1, Indiv2, param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>Indiv1</term> + <listitem> + <para>A string</para> + <para>the first individual (here a binary code) to be + crossed-over. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Indiv2</term> + <listitem> + <para>A string</para> + <para>the second individual to be crossed-over.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters.</para> + <itemizedlist> + <listitem> + <para> + <literal>"binary_length"</literal>: an integer, the length of the binary + code (default 8). + </para> + </listitem> + <listitem> + <para> + <literal>"multi_cross"</literal>: a boolean. If <literal>%T</literal> then we allow several + cuts in the binary code (default <literal>%F</literal>). + </para> + </listitem> + <listitem> + <para> + <literal>"multi_cross_nb"</literal>: an integer, the number of cuts in the binary code. + Only used when multi_cross is set to %T (default 2). + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>Crossed_Indiv1</term> + <listitem> + <para>A string</para> + <para>The first individual obtained by the cross-over + function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Crossed_Indiv2</term> + <listitem> + <para>A string</para> + <para>The second individual obtained by the cross-over + function. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>mix</term> + <listitem> + <para>A vector of integers</para> + <para>The positions the crossover occurred.</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>This function implements a classical binary cross-over.</para> + <para> + <literal>crossover_ga_binary(Indiv1, Indiv2)</literal> generates + the crossover between <varname>Indiv1</varname> and <varname>Indiv2</varname> + by merging the characters from each string. + </para> + <para> + A position <literal>i</literal> is chosen randomly + between 1 and the length of the binary code. + </para> + <para> + Then <literal>Indiv1</literal> and <literal>Indiv2</literal> + are split in two parts: + the first <literal>i</literal> characters (the head), + and the remaining characters (the tail). + The crossover swaps the tails of the binary codes. + </para> + <para> + The following schema presents the crossover: + <programlisting role="explanation"><![CDATA[ + Indiv1=[H1 T1] + Indiv2=[H2 T2] + Crossed_Indiv1=[H1 T2] + Crossed_Indiv2=[H2 T1] + ]]></programlisting> + </para> + <para> + The behaviour of the function can be modified with the use of <varname>param</varname>: + </para> + <variablelist> + <varlistentry> + <term> + binary_length + </term> + <listitem> + <para> + changes the minimal length of the binary code, by default 8 characters. + </para> + <para> + Binary code for <varname>Indiv1</varname> or <varname>Indiv2</varname> + of lower length are zero padded to the right to be of + <literal>binary_length</literal> length or <literal>max([length(Indiv1), length(Indiv2)])</literal> + whichever is greater. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>multi_cross</term> + <listitem> + <para> + if set to <literal>%T</literal> multiple crossovers + can happen (default <literal>%F</literal>) + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>multi_cross_nb</term> + <listitem> + <para> + the number of locations for crossovers. + (default 2 if + multi_cross is set to <literal>%T</literal>, 1 otherwise) + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title> Random number generator </title> + <para> + <literal>crossover_ga_binary</literal> is based + on <link linkend="grand">grand</link> + for generating the random samples. + Use <literal>grand("setsd", seed)</literal> to change the seed + for <literal>crossover_ga_binary</literal>. + </para> + <programlisting role="example"><![CDATA[ + seed = getdate("s"); + grand("setsd", seed); //sets the seed to current date + + seed = 0; + grand("setsd", seed); //sets the seed to default value + ]]> + </programlisting> + </refsection> + <refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ + A = "11100000" + B = "00011111" + [A_crossed, B_crossed, mix] = crossover_ga_binary(A, B) + + C = dec2bin(2^16 - 1, 16) + D = "0" + param = init_param(); + param = add_param(param, "binary_length", 16); // Code of length 16 + param = add_param(param, "multi_cross", %T); // Multiple Crossover + param = add_param(param, "multi_cross_nb", 3); // Occurs over 3 locations + + [C_crossed, D_crossed, mix] = crossover_ga_binary(C, D, param) + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="crossover_ga_binary"> crossover_ga_binary + </link> + </member> + <member> + <link linkend="crossover_ga_default"> crossover_ga_default + </link> + </member> + <member> + <link linkend="mutation_ga_binary"> mutation_ga_binary + </link> + </member> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + <member> + <link linkend="grand">grand</link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/crossover_ga_default.xml b/modules/genetic_algorithms/help/en_US/utilities/crossover_ga_default.xml new file mode 100755 index 000000000..b54a02203 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/crossover_ga_default.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="crossover_ga_default" xml:lang="en"> + <refnamediv> + <refname>crossover_ga_default</refname> + <refpurpose>A crossover function for continuous variable + functions + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[Crossed_Indiv1,Crossed_Indiv2] = crossover_ga_default(Indiv1,Indiv2,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>Indiv1</term> + <listitem> + <para>The first individual to be crossed-over.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Indiv2</term> + <listitem> + <para>The second individual to be crossed-over.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters. </para> + <itemizedlist> + <listitem> + <para>'beta': the range of the random generator. A random value + will be sampled between -beta and 1+beta. This sampled value + will be used to perform a convex combination between Indiv1 and + Indiv2. + </para> + </listitem> + <listitem> + <para> 'minbound': a vector of minimum bounds for the variable + X. + </para> + </listitem> + <listitem> + <para> 'maxbound': a vector of maximum bounds for the variable + X. + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>Crossed_Indiv1</term> + <listitem> + <para>The first individual resulting from the crossover.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Crossed_Indiv2</term> + <listitem> + <para>The second individual resulting from the crossover.</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para>crossover_ga_default is a crossover function for functions with + continuous variables. This crossover function is an extension of a convexe + combination. The crossed individuals are computed with the following + equations : + </para> + <programlisting role=""><![CDATA[ +mix = (1 + 2*Beta)*rand(1,1) - Beta; +Crossed_Indiv1 = mix*Indiv1 + (1-mix)*Indiv2; +Crossed_Indiv2 = (1-mix)*Indiv1 + mix*Indiv2; + ]]></programlisting> + <para>The Beta parameter should be set to a positive value. If Beta is set + to 0, the resulting crossover is a simple convexe combination between the + two parents. That may lead to a too fast convergence of the genetic + algorithm and may decrease the diversity of the individuals of the + population. If Beta is chosen strictly positive, that may allow children + to explore the domain beyond the domain explored by their parents. + </para> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="crossover_ga_binary"> crossover_ga_binary + </link> + </member> + <member> + <link linkend="mutation_ga_default"> mutation_ga_default + </link> + </member> + <member> + <link linkend="init_ga_default"> init_ga_default + </link> + </member> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + </simplelist> + </refsection> + <refsection> + <title>References</title> + <bibliomixed> + <bibliomset relation="book"> + <surname>Michalewicz</surname>, + <firstname>Zbigniew</firstname><title/> + Genetic Algorithms + Data + Structures = Evolution Programs + </bibliomset> + </bibliomixed> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/init_ga_default.xml b/modules/genetic_algorithms/help/en_US/utilities/init_ga_default.xml new file mode 100755 index 000000000..8886af684 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/init_ga_default.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * Copyright (C) 2010 - DIGITEO - Michael Baudin + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="init_ga_default" xml:lang="en"> + <refnamediv> + <refname>init_ga_default</refname> + <refpurpose>A function a initialize a population</refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>Pop_init = init_ga_default(popsize,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>popsize</term> + <listitem> + <para>the number of individuals to generate.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters. </para> + <itemizedlist> + <listitem> + <para> "dimension": the size of the vector X. Default dimension=2. </para> + </listitem> + <listitem> + <para> "minbound": a vector of minimum bounds for the variable + X. Default minbound = -2*ones(1,dimension). + </para> + </listitem> + <listitem> + <para> "maxbound": a vector of maximum bounds for the variable + X. Default maxbound=2*ones(1,dimension). + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>Pop_init</term> + <listitem> + <para>a list which contains the initial population of + individuals. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + This function generate an initial population containing pop_size + individuals. + It uses the rand function to generate the points uniformly distributed in the + bounds. + As a side effect, it modifies the state of the random generator of the rand + function. + Other initial populations might be generated from the grand + function, or any other uniform random generator (including low discrepancy sequences). + In the case were we want to compute another initial population, we + might define our own init function: in this case, we may use the init_ga_default + function as a template and plug our customized population generator. + </para> + </refsection> + <refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ +// Generate 10 points in 2 dimensions, in the +// interval [-2,2]^2. +popsize = 10; +ga_params = init_param(); +ga_params = add_param(ga_params,"dimension",2); +ga_params = add_param(ga_params,"minbound",[-2; -2]); +ga_params = add_param(ga_params,"maxbound",[2; 2]); +Pop_init = init_ga_default(popsize,ga_params); +for k = 1 : popsize + x = Pop_init(k); + xstr = strcat(string(x)," "); + mprintf("x[%d]=[%s]\n",k,xstr); +end + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="crossover_ga_default"> crossover_ga_default + </link> + </member> + <member> + <link linkend="mutation_ga_default"> mutation_ga_default + </link> + </member> + <member> + <link linkend="mutation_ga_binary"> mutation_ga_binary + </link> + </member> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/mutation_ga_binary.xml b/modules/genetic_algorithms/help/en_US/utilities/mutation_ga_binary.xml new file mode 100755 index 000000000..65c507091 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/mutation_ga_binary.xml @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * Copyright (C) 2010 - DIGITEO - Michael Baudin + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="mutation_ga_binary" xml:lang="en"> + <refnamediv> + <refname>mutation_ga_binary</refname> + <refpurpose>A function which performs binary mutation</refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[Mut_Indiv, pos] = mutation_ga_binary(Indiv,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>Indiv</term> + <listitem> + <para>A string.</para> + <para>The individual on which we will perform the mutation.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters.</para> + <itemizedlist> + <listitem> + <para> "binary_length": an integer scalar, the size of the binary code. </para> + </listitem> + <listitem> + <para> "multi_mut": a boolean. If %T, several random bits will + be flipped. + </para> + </listitem> + <listitem> + <para> "multi_mut_nb": an integer scalar, the number of bits to be flipped. + Only used when multi_mut is set to %T (default 2). + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>Mut_Indiv</term> + <listitem> + <para> + A string. + </para> + <para> + The mutated individual. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>pos</term> + <listitem> + <para> + A vector of integers. + </para> + <para> + The positions of the mutated bits. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + This function performs a classical multi-bits binary + mutation. + </para> + <para> + This generates the individual <varname>Mut_Indiv</varname> by inverting bits on random positions. + </para> + <para> + By default <literal>mutation_ga_binary(Indiv)</literal> selects randomly + an index <literal>i</literal> between 1 and <literal>length(Indiv)</literal>. + It then modifies the i-th character of Indiv to 1 if it was 0, or 0 if it was 1. + </para> + <para> + If <literal>"multi_mut"</literal> is set to <literal>%T</literal> multiple mutations may occur. + The maximal number of mutation is given by <literal>"multi_mut_nb"</literal>. + </para> + </refsection> + <refsection> + <title> Random number generator </title> + <para> + <literal>mutation_ga_binary</literal> is based + on <link linkend="grand">grand</link> + for generating the random samples. + Use <literal>grand("setsd", seed)</literal> to change the seed + for <literal>crossover_ga_binary</literal>. + </para> + <programlisting role="example"><![CDATA[ + seed = getdate("s"); + grand("setsd", seed); //sets the seed to current date + + seed = 0; + grand("setsd", seed); //sets the seed to default value + ]]> + </programlisting> + </refsection> + <refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ + Indiv="00010000" + [Mut_Indiv, pos] = mutation_ga_binary(Indiv) + + // With multiple mutation + param=init_param("multi_mut",%t,"multi_mut_nb",3); + Indiv="00010000" + [Mut_Indiv, pos] = mutation_ga_binary(Indiv,param) + ]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="mutation_ga_default"> mutation_ga_default + </link> + </member> + <member> + <link linkend="crossover_ga_binary"> crossover_ga_binary + </link> + </member> + <member> + <link linkend="init_ga_default"> init_ga_default + </link> + </member> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/mutation_ga_default.xml b/modules/genetic_algorithms/help/en_US/utilities/mutation_ga_default.xml new file mode 100755 index 000000000..0732d05a3 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/mutation_ga_default.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="mutation_ga_default" xml:lang="en"> + <refnamediv> + <refname>mutation_ga_default</refname> + <refpurpose>A continuous variable mutation function</refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>Mut_Indiv = mutation_ga_default(Indiv,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>Indiv</term> + <listitem> + <para>The individual to be mutated.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters. </para> + <itemizedlist> + <listitem> + <para> 'delta': a random perturbation will be sampled via an + uniform distribution between -delta and + delta. + </para> + </listitem> + <listitem> + <para> 'minbound': a vector of minimum bound for the variable X. + </para> + </listitem> + <listitem> + <para> 'maxbound': a vector of maximum bound for the variable + X. + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>Mut_Indiv</term> + <listitem> + <para>The resulting mutated individual.</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <itemizedlist> + <listitem> + <para>This function performs the classical continuous variable + mutation function. + </para> + </listitem> + </itemizedlist> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="mutation_ga_binary"> mutation_ga_binary + </link> + </member> + <member> + <link linkend="crossover_ga_default"> crossover_ga_default + </link> + </member> + <member> + <link linkend="init_ga_default"> init_ga_default + </link> + </member> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/output_ga_default.xml b/modules/genetic_algorithms/help/en_US/utilities/output_ga_default.xml new file mode 100755 index 000000000..15e5c7499 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/output_ga_default.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2014 - Michael BAUDIN <michael.baudin@contrib.scilab.org> + * Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime AGNEL + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="output_ga_default" xml:lang="en"> + <refnamediv> + <refname>output_ga_default</refname> + <refpurpose>A simple output function used for logging purposes</refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>stop = output_ga_default(gen_index, nb_generation, Pop, FObj_Pop, param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>gen_index</term> + <listitem> + <para>The index of the current generation.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>nb_generation</term> + <listitem> + <para>The maximum number of generations.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Pop</term> + <listitem> + <para>The current population.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>FObj_Pop</term> + <listitem> + <para>The evaluation for each member of the population.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>A parameter list for optional parameters.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>stop</term> + <listitem> + <para>A boolean. If %F, will stop the execution of the genetic algorithm.</para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <para> + This function displays information on the current step of the genetic algorithm. + </para> + <para> + Use this function to implement a callback after each iteration of the genetic algorithm. + This can be used, for instance, to plot intermediate result or log more information on + the population. + </para> + <para> + The output parameter <varname>stop</varname> can be used to stop the genetic algorithm + altogether if set to %F. + </para> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="optim_moga"> optim_moga </link> + </member> + <member> + <link linkend="optim_nsga"> optim_nsga </link> + </member> + <member> + <link linkend="optim_nsga2"> optim_nsga2 </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/pareto_filter.xml b/modules/genetic_algorithms/help/en_US/utilities/pareto_filter.xml new file mode 100755 index 000000000..d6b1fc3d9 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/pareto_filter.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="pareto_filter"> + <refnamediv> + <refname>pareto_filter</refname> + <refpurpose>A function which extracts non dominated solution from a set </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[F_out,X_out,Ind_out] = pareto_filter(F_in,X_in)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>F_in</term> + <listitem> + <para>the set of multi-objective function values from which we want to extract the non dominated solutions. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>X_in</term> + <listitem> + <para>the associated values in the parameters space. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>F_out</term> + <listitem> + <para>the set of non dominated multi-objective function values. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>X_out</term> + <listitem> + <para>the associated values in the parameters space. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Ind_out</term> + <listitem> + <para>the set of indexes of the non dominated individuals selected from the set X_in. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <itemizedlist> + <listitem> + <para> + This function applies a Pareto filter to extract non dominated solutions from a set of values. + </para> + </listitem> + </itemizedlist> + </refsection> + <refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ +function Res = min_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = zeros(n,1); +endfunction + +function Res = max_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = ones(n,1); +endfunction + +function f = get_opti_deb_1(x) +f1_x1 = x(1); +g_x2 = 1; +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +function f = deb_1(x) +f1_x1 = x(1); +g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +Max = max_bd_deb_1(2); +Min = min_bd_deb_1(2); + +X_in = list(); +for i=1:100 + X_in(i) = (Max - Min) .* rand(size(Max,1),size(Max,2)) + Min; + F_in(i,:) = deb_1(X_in(i)); +end + +[F_out, X_out, Ind_out] = pareto_filter(F_in, X_in) +]]></programlisting> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="optim_moga"> optim_moga </link> + </member> + <member> + <link linkend="optim_nsga"> optim_nsga </link> + </member> + <member> + <link linkend="optim_nsga2"> optim_nsga2 </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/selection_ga_elitist.xml b/modules/genetic_algorithms/help/en_US/utilities/selection_ga_elitist.xml new file mode 100755 index 000000000..45cfe8bdb --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/selection_ga_elitist.xml @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="selection_ga_elitist"> + <refnamediv> + <refname>selection_ga_elitist</refname> + <refpurpose>An 'elitist' selection function </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[Pop_out,FObj_Pop_out,Efficiency,MO_Total_FObj_out] = selection_ga_elitist(Pop_in,Indiv1,Indiv2,FObj_Pop_in,FObj_Indiv1,FObj_Indiv2,MO_Total_FObj_in,MO_FObj_Indiv1,MO_FObj_Indiv2,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>Pop_in</term> + <listitem> + <para>The initial population of individuals. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Indiv1</term> + <listitem> + <para>a first set of children generated via crossover + mutation. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Indiv2</term> + <listitem> + <para>a second set of children generated via crossover + mutation. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>FObj_Pop_in</term> + <listitem> + <para>a vector of objective function values associated to each individuals of Pop_in. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>FObj_Indiv1</term> + <listitem> + <para>a vector of objective function values associated to each individuals of Indiv1. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>FObj_Indiv2</term> + <listitem> + <para>a vector of objective function values associated to each individuals of Indiv2. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>MO_Total_FObj_in</term> + <listitem> + <para>a matrix of multi-objective function values associated to each individuals of Pop_in. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>MO_FObj_Indiv1</term> + <listitem> + <para>a matrix of multi-objective function values associated to each individuals of Indiv1. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>MO_FObj_Indiv2</term> + <listitem> + <para>a matrix of multi-objective function values associated to each individuals of Indiv2. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters. + - 'pressure': the selection pressure coefficient. Each individuals with 0 efficiency will have an efficiency value equal to 'pressure'. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Pop_out</term> + <listitem> + <para>all the selected individuals in a population of size pop_size. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>FObj_Pop_out</term> + <listitem> + <para>all the objective function values associated to each individuals of Pop_out. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Efficiency</term> + <listitem> + <para>all the efficiency values associated to each individuals of Pop_out. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>MO_Total_FObj_out</term> + <listitem> + <para>all the multi-objective function values associated to each individuals of Pop_out. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <itemizedlist> + <listitem> + <para> + This function performs the elitist selection function. We select the best individuals in the set of parents and children individuals. + </para> + </listitem> + </itemizedlist> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="selection_ga_random"> selection_ga_random </link> + </member> + <member> + <link linkend="mutation_ga_default"> mutation_ga_default </link> + </member> + <member> + <link linkend="crossover_ga_default"> crossover_ga_default </link> + </member> + <member> + <link linkend="init_ga_default"> init_ga_default </link> + </member> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/en_US/utilities/selection_ga_random.xml b/modules/genetic_algorithms/help/en_US/utilities/selection_ga_random.xml new file mode 100755 index 000000000..632ff47d1 --- /dev/null +++ b/modules/genetic_algorithms/help/en_US/utilities/selection_ga_random.xml @@ -0,0 +1,180 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + --> +<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="selection_ga_random" xml:lang="en"> + <refnamediv> + <refname>selection_ga_random</refname> + <refpurpose>A function which performs a random selection of + individuals + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <title>Calling Sequence</title> + <synopsis>[Pop_out,FObj_Pop_out,Efficiency,MO_Total_FObj_out] = selection_ga_random(Pop_in,Indiv1,Indiv2,FObj_Pop_in,FObj_Indiv1,FObj_Indiv2,MO_Total_FObj_in,MO_FObj_Indiv1,MO_FObj_Indiv2,param)</synopsis> + </refsynopsisdiv> + <refsection> + <title>Arguments</title> + <variablelist> + <varlistentry> + <term>Pop_in</term> + <listitem> + <para>The initial population of individuals.</para> + </listitem> + </varlistentry> + <varlistentry> + <term>Indiv1</term> + <listitem> + <para>a first set of children generated via crossover + + mutation. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Indiv2</term> + <listitem> + <para>a second set of children generated via crossover + + mutation. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>FObj_Pop_in</term> + <listitem> + <para>a vector of objective function values associated to each + individuals of Pop_in. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>FObj_Indiv1</term> + <listitem> + <para>a vector of objective function values associated to each + individuals of Indiv1. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>FObj_Indiv2</term> + <listitem> + <para>a vector of objective function values associated to each + individuals of Indiv2. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>MO_Total_FObj_in</term> + <listitem> + <para>a matrix of multi-objective function values associated to each + individuals of Pop_in. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>MO_FObj_Indiv1</term> + <listitem> + <para>a matrix of multi-objective function values associated to each + individuals of Indiv1. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>MO_FObj_Indiv2</term> + <listitem> + <para>a matrix of multi-objective function values associated to each + individuals of Indiv2. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>param</term> + <listitem> + <para>a list of parameters. </para> + <itemizedlist> + <listitem> + <para> 'pressure': the selection pressure coefficient. Each + individuals with 0 efficiency will have an efficiency value + equal to 'pressure'. + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + <varlistentry> + <term>Pop_out</term> + <listitem> + <para>all the selected individuals in a population of size + pop_size. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>FObj_Pop_out</term> + <listitem> + <para>all the objective function values associated to each + individuals of Pop_out. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>Efficiency</term> + <listitem> + <para>all the efficiency values associated to each individuals of + Pop_out. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>MO_Total_FObj_out</term> + <listitem> + <para>all the multi-objective function values associated to each + individuals of Pop_out. + </para> + </listitem> + </varlistentry> + </variablelist> + </refsection> + <refsection> + <title>Description</title> + <itemizedlist> + <listitem> + <para>This function performs the random selection function. We select + pop_size individuals in the set of parents and children individuals at + random. + </para> + </listitem> + </itemizedlist> + </refsection> + <refsection role="see also"> + <title>See Also</title> + <simplelist type="inline"> + <member> + <link linkend="selection_ga_elitist"> selection_ga_elitist + </link> + </member> + <member> + <link linkend="mutation_ga_default"> mutation_ga_default + </link> + </member> + <member> + <link linkend="crossover_ga_default"> crossover_ga_default + </link> + </member> + <member> + <link linkend="init_ga_default"> init_ga_default + </link> + </member> + <member> + <link linkend="optim_ga"> optim_ga </link> + </member> + </simplelist> + </refsection> +</refentry> diff --git a/modules/genetic_algorithms/help/fr_FR/addchapter.sce b/modules/genetic_algorithms/help/fr_FR/addchapter.sce new file mode 100755 index 000000000..b500b8d1c --- /dev/null +++ b/modules/genetic_algorithms/help/fr_FR/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +add_help_chapter("Algorithmes génétiques",SCI+"/modules/genetic_algorithms/help/fr_FR",%T); + diff --git a/modules/genetic_algorithms/help/ja_JP/addchapter.sce b/modules/genetic_algorithms/help/ja_JP/addchapter.sce new file mode 100755 index 000000000..2eda86b39 --- /dev/null +++ b/modules/genetic_algorithms/help/ja_JP/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +add_help_chapter("Genetic Algorithms",SCI+"/modules/genetic_algorithms/help/ja_JP",%T); + diff --git a/modules/genetic_algorithms/help/pt_BR/addchapter.sce b/modules/genetic_algorithms/help/pt_BR/addchapter.sce new file mode 100755 index 000000000..05b621fec --- /dev/null +++ b/modules/genetic_algorithms/help/pt_BR/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +add_help_chapter("Algoritmos Genéticos",SCI+"/modules/genetic_algorithms/help/pt_BR",%T); + diff --git a/modules/genetic_algorithms/help/ru_RU/addchapter.sce b/modules/genetic_algorithms/help/ru_RU/addchapter.sce new file mode 100755 index 000000000..56998ba56 --- /dev/null +++ b/modules/genetic_algorithms/help/ru_RU/addchapter.sce @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009 - DIGITEO +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +add_help_chapter("Genetic Algorithms",SCI+"/modules/genetic_algorithms/help/ru_RU",%T); + diff --git a/modules/genetic_algorithms/license.txt b/modules/genetic_algorithms/license.txt new file mode 100755 index 000000000..da3e0b896 --- /dev/null +++ b/modules/genetic_algorithms/license.txt @@ -0,0 +1,9 @@ +Copyright: +Copyright (c) 2008 - Yann Collette + +License: +This module must be used under the terms of the CeCILL. +This module file is licensed as described in the file COPYING, which +you should have received as part of this distribution. The terms +are also available at +http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt diff --git a/modules/genetic_algorithms/locales/ca_ES.po b/modules/genetic_algorithms/locales/ca_ES.po new file mode 100755 index 000000000..52051a154 --- /dev/null +++ b/modules/genetic_algorithms/locales/ca_ES.po @@ -0,0 +1,71 @@ +# Catalan translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2012-04-18 19:14+0000\n" +"Last-Translator: Marc Coll Carrillo <Unknown>\n" +"Language-Team: Catalan <ca@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: ca\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: S'està iniciant l'optimització, espereu ...\n" + +msgid "Genetic algorithms" +msgstr "Algorismes genètics" + +msgid "Genetic algorithms and Ising problem" +msgstr "Algorismes genètics i el problema d'Ising" + +msgid "MultiObjective Genetic Algorithm" +msgstr "Algorisme genètic multiobjectiu" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "Algorisme genètic amb nínxol compartit" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "Algorisme genètic amb nínxol compartit II" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: adreça incorrecta" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: El ga_f és obligatori" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: El ga_f és obligatori" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: Inicialització de la població\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2: El ga_f és obligatori" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: Iteració %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: El F_in és obligatori" diff --git a/modules/genetic_algorithms/locales/cs_CZ.po b/modules/genetic_algorithms/locales/cs_CZ.po new file mode 100755 index 000000000..573fbaff1 --- /dev/null +++ b/modules/genetic_algorithms/locales/cs_CZ.po @@ -0,0 +1,70 @@ +# Czech translation for scilab +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2012-02-22 20:55+0000\n" +"Last-Translator: Zbyněk Schwarz <Unknown>\n" +"Language-Team: Czech <cs@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: spouští se optimalizace, čekejte prosím ...\n" + +msgid "Genetic algorithms" +msgstr "Genetické algoritmy" + +msgid "Genetic algorithms and Ising problem" +msgstr "Genetické algoritmy a Isingův problém" + +msgid "MultiObjective Genetic Algorithm" +msgstr "Víceobjektivní genetický algoritmus" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "Genetický algoritmus sdílení místa" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "Genetický algoritmus sdílení místa II" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: špatný směr" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: ga_f je povinné" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: ga_f je povinné" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: Zavedení populace\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2: ga_f je povinné" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: iterace %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: F_In je povinné" diff --git a/modules/genetic_algorithms/locales/de_DE.po b/modules/genetic_algorithms/locales/de_DE.po new file mode 100755 index 000000000..d8b88e424 --- /dev/null +++ b/modules/genetic_algorithms/locales/de_DE.po @@ -0,0 +1,71 @@ +# German translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2012-02-28 11:53+0000\n" +"Last-Translator: Daniel Dietrich <Unknown>\n" +"Language-Team: German <de@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: de\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: starte Optimierung, bitte warten...\n" + +msgid "Genetic algorithms" +msgstr "Genetische Algorithmen" + +msgid "Genetic algorithms and Ising problem" +msgstr "" + +msgid "MultiObjective Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: falsche Richtung" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: ga_fs ist verpflichtend" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: ga_f ist verpflichtend" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: Initialisierung der Population\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2:ga_f ist verpflichtend" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: Iteration %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: F_in ist verpflichtend" diff --git a/modules/genetic_algorithms/locales/es_ES.po b/modules/genetic_algorithms/locales/es_ES.po new file mode 100755 index 000000000..e0f48b0e5 --- /dev/null +++ b/modules/genetic_algorithms/locales/es_ES.po @@ -0,0 +1,71 @@ +# Spanish translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2012-06-20 20:20+0000\n" +"Last-Translator: Ximena Torres <ximenta@hotmail.com>\n" +"Language-Team: Spanish <es@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: es\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: iniciando la optimización, por favor espere ...\n" + +msgid "Genetic algorithms" +msgstr "Genetic algorithms" + +msgid "Genetic algorithms and Ising problem" +msgstr "" + +msgid "MultiObjective Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: Dirección equivocada" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: ga_f es obligatorio" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: ga_f es obligatorio" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: Inicialización de la población\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2: ga_f es obligatorio" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: iteración %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: F_in es obligatorio" diff --git a/modules/genetic_algorithms/locales/fr_FR.po b/modules/genetic_algorithms/locales/fr_FR.po new file mode 100755 index 000000000..67e0a1d95 --- /dev/null +++ b/modules/genetic_algorithms/locales/fr_FR.po @@ -0,0 +1,71 @@ +# French translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2014-09-09 11:30+0000\n" +"Last-Translator: Vincent Couvert <Unknown>\n" +"Language-Team: French <fr@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: fr\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s : Optimisation en cours, veuillez patienter...\n" + +msgid "Genetic algorithms" +msgstr "Algorithmes génétiques" + +msgid "Genetic algorithms and Ising problem" +msgstr "Algorithmes génétiques et modèle d'Ising" + +msgid "MultiObjective Genetic Algorithm" +msgstr "Algorithme génétique multi-objectif" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "Algorithme génétique à partage de niche" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "Algorithme génétique à partage de niche II" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s : Mauvaise direction" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s : ga_f est obligatoire" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga : ga_f est obligatoire" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s : Initialisation de la population\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2 : ga_f est obligatoire" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "%s : itération %d / %d \n" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr " valeur min / max trouvée = %f / %f\n" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s : Itération %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s : F_in est obligatoire" diff --git a/modules/genetic_algorithms/locales/genetic_algorithms.pot b/modules/genetic_algorithms/locales/genetic_algorithms.pot new file mode 100755 index 000000000..dc8b70a3b --- /dev/null +++ b/modules/genetic_algorithms/locales/genetic_algorithms.pot @@ -0,0 +1,114 @@ +# Localization of the module genetic_algorithms-macros +# Please see in SCI/tools/localization for localization management +# Copyright (C) 2007-2008 - INRIA +# Copyright (C) 2008-2011 - DIGITEO +# Copyright (C) 2012-2014 - Scilab-Enterprises +# This file is distributed under the same license as the Scilab package. +# +msgid "" +msgstr "" +"Project-Id-Version: Scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"Last-Translator: Vincent COUVERT <vincent.couvert@scilab-enterprises.com>\n" +"Language-Team: Scilab Localization <localization@lists.scilab.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"Revision-Date: 2015-03-27 13:54+0100\n" + +# File: demos/GAIsing2ddemo.sce, line: 63 +# File: demos/GAdemo.sce, line: 86 +# File: demos/GAdemo.sce, line: 132 +# File: demos/MOGAdemo.sce, line: 83 +# File: demos/NSGA2demo.sce, line: 83 +# File: demos/NSGAdemo.sce, line: 85 +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "" + +# +# File: demos/genetic_algorithms.dem.gateway.sce, line: 12 +msgid "Genetic algorithms" +msgstr "" + +# +# File: demos/genetic_algorithms.dem.gateway.sce, line: 13 +msgid "Genetic algorithms and Ising problem" +msgstr "" + +# +# File: demos/genetic_algorithms.dem.gateway.sce, line: 14 +msgid "MultiObjective Genetic Algorithm" +msgstr "" + +# +# File: demos/genetic_algorithms.dem.gateway.sce, line: 15 +msgid "Niched Sharing Genetic Algorithm" +msgstr "" + +# +# File: demos/genetic_algorithms.dem.gateway.sce, line: 16 +msgid "Niched Sharing Genetic Algorithm II" +msgstr "" + +# +# File: macros/coding_ga_binary.sci, line: 46 +# File: macros/coding_ga_identity.sci, line: 18 +#, c-format +msgid "%s: wrong direction" +msgstr "" + +# +# File: macros/optim_ga.sci, line: 29 +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "" + +# +# File: macros/optim_moga.sci, line: 29 +# File: macros/optim_nsga.sci, line: 28 +msgid "optim_moga: ga_f is mandatory" +msgstr "" + +# +# File: macros/optim_moga.sci, line: 56 +# File: macros/optim_nsga.sci, line: 61 +# File: macros/optim_nsga2.sci, line: 53 +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "" + +# +# File: macros/optim_nsga2.sci, line: 26 +msgid "optim_nsga2: ga_f is mandatory" +msgstr "" + +# +# File: macros/output_ga_default.sci, line: 13 +# File: macros/output_moga_default.sci, line: 13 +# File: macros/output_nsga_default.sci, line: 13 +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +# +# File: macros/output_ga_default.sci, line: 14 +# File: macros/output_moga_default.sci, line: 14 +# File: macros/output_nsga2_default.sci, line: 14 +# File: macros/output_nsga_default.sci, line: 14 +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +# +# File: macros/output_nsga2_default.sci, line: 13 +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "" + +# +# File: macros/pareto_filter.sci, line: 14 +#, c-format +msgid "%s: F_in is mandatory" +msgstr "" diff --git a/modules/genetic_algorithms/locales/it_IT.po b/modules/genetic_algorithms/locales/it_IT.po new file mode 100755 index 000000000..4b428bd4b --- /dev/null +++ b/modules/genetic_algorithms/locales/it_IT.po @@ -0,0 +1,71 @@ +# Italian translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2015-02-14 21:29+0000\n" +"Last-Translator: Carml <mighty.carml@gmail.com>\n" +"Language-Team: Italian <it@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: it\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: avvio dell'ottimizzazione in corso,attendere...\n" + +msgid "Genetic algorithms" +msgstr "Algoritmi genetici" + +msgid "Genetic algorithms and Ising problem" +msgstr "Algoritmi genetici e problema di Ising" + +msgid "MultiObjective Genetic Algorithm" +msgstr "Algoritmo genetico multi-obiettivo" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: direzione sbagliata" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: ga_f è obbligatorio/a" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: ga_f è obbligatorio/a" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: inizializzazione della popolazione\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_moga: ga_f è obbliagatorio" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "%s: iterazione %d / %d \n" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr " min / max valore trovato = %f / %f\n" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: iterazione %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: F_in è obbligatorio/a" diff --git a/modules/genetic_algorithms/locales/ja_JP.po b/modules/genetic_algorithms/locales/ja_JP.po new file mode 100755 index 000000000..b421c29de --- /dev/null +++ b/modules/genetic_algorithms/locales/ja_JP.po @@ -0,0 +1,91 @@ +# Japanese translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2014-09-15 05:17+0000\n" +"Last-Translator: Rui Hirokawa <Unknown>\n" +"Language-Team: Japanese <z-saito@guitar.ocn.ne.jp>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"X-Poedit-Country: Japan\n" +"Language: ja\n" +"X-Poedit-Language: Japanese\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: 最適化を開始しています, しばらくお待ちください ...\n" + +msgid "Genetic algorithms" +msgstr "遺伝的アルゴリズム" + +msgid "Genetic algorithms and Ising problem" +msgstr "遺伝的アルゴリズムとイジング問題" + +msgid "MultiObjective Genetic Algorithm" +msgstr "多目的遺伝的アルゴリズム" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "ニッチ共有遺伝的アルゴリズム" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "ニッチ共有遺伝的アルゴリズム II" + +# File: macros/coding_ga_binary.sci, line: 46 +# File: macros/coding_ga_identity.sci, line: 18 +#, c-format +msgid "%s: wrong direction" +msgstr "%s: 不正な方向" + +# +# File: macros/optim_ga.sci, line: 27 +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: ga_f は必須です" + +# +# File: macros/optim_moga.sci, line: 27 +# File: macros/optim_nsga.sci, line: 27 +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: ga_f は必須です" + +# +# File: macros/optim_ga.sci, line: 54 +# File: macros/optim_moga.sci, line: 48 +# File: macros/optim_nsga.sci, line: 54 +# File: macros/optim_nsga2.sci, line: 46 +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: 総数の初期化\n" + +# +# File: macros/optim_nsga2.sci, line: 25 +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2: ga_f は必須です" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "%s: 繰り返し %d / %d \n" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr " 見つかった最小/最大値 = %f / %f\n" + +# +# File: macros/optim_nsga2.sci, line: 100 +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: 繰り返し %d / %d\n" + +# +# File: macros/pareto_filter.sci, line: 15 +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: F_in は必須です" diff --git a/modules/genetic_algorithms/locales/pl_PL.po b/modules/genetic_algorithms/locales/pl_PL.po new file mode 100755 index 000000000..c9a08b05f --- /dev/null +++ b/modules/genetic_algorithms/locales/pl_PL.po @@ -0,0 +1,71 @@ +# Polish translation for scilab +# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2010-04-29 23:18+0000\n" +"Last-Translator: ErnestŻyciński <Unknown>\n" +"Language-Team: Polish <pl@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: pl\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: optymalizacja rozpoczęta, proszę czekać ...\n" + +msgid "Genetic algorithms" +msgstr "" + +msgid "Genetic algorithms and Ising problem" +msgstr "" + +msgid "MultiObjective Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: zły kierunek" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: ga_f jest obowiązkowe" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: ga_f jest obowiązkowe" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: Inicjalizacja populacji\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2: ga_f jest obowiązkowe" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: iteracja %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: F_in jest obowiązkowe" diff --git a/modules/genetic_algorithms/locales/pt_BR.po b/modules/genetic_algorithms/locales/pt_BR.po new file mode 100755 index 000000000..d58894948 --- /dev/null +++ b/modules/genetic_algorithms/locales/pt_BR.po @@ -0,0 +1,71 @@ +# Brazilian Portuguese translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2012-06-11 22:20+0000\n" +"Last-Translator: Roberto Coelho de Berredo <rcberredo@gmail.com>\n" +"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: pt_BR\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: iniciando otimização, por favor, aguarde ...\n" + +msgid "Genetic algorithms" +msgstr "Algoritmos genéticos" + +msgid "Genetic algorithms and Ising problem" +msgstr "Algoritmos genéticos e o problema de Ising" + +msgid "MultiObjective Genetic Algorithm" +msgstr "Algoritmo genético multi-objetivo" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "Algoritmos Genéticos com Compartilhamento de Nichos" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "Algoritmos Genéticos com Compartilhamento de Nichos" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: direção errada" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: O parâmetro ga_f é obrigatório" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: O parâmetro ga_f é obrigatório" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: iniciação da população\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2: O parâmetro ga_f é obrigatório" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: iteração %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: o parâmetro F_in é obrigatório" diff --git a/modules/genetic_algorithms/locales/ru_RU.po b/modules/genetic_algorithms/locales/ru_RU.po new file mode 100755 index 000000000..60ba32097 --- /dev/null +++ b/modules/genetic_algorithms/locales/ru_RU.po @@ -0,0 +1,71 @@ +# Russian translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2012-07-13 15:04+0000\n" +"Last-Translator: Stanislav V. Kroter <krotersv@gmail.com>\n" +"Language-Team: Russian <ru@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: ru\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: запускается оптимизация, подождите...\n" + +msgid "Genetic algorithms" +msgstr "Генетические алгоритмы" + +msgid "Genetic algorithms and Ising problem" +msgstr "Генетические алгоритмы и задача Изинга" + +msgid "MultiObjective Genetic Algorithm" +msgstr "Многокритериальный генетический алгоритм" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: неверное направление" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: ga_f обязателен" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: ga_f обязателен" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: Инициализация популяции\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2: ga_f обязателен" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: итерация %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: F_in обязателен" diff --git a/modules/genetic_algorithms/locales/uk_UA.po b/modules/genetic_algorithms/locales/uk_UA.po new file mode 100755 index 000000000..8ec19fa72 --- /dev/null +++ b/modules/genetic_algorithms/locales/uk_UA.po @@ -0,0 +1,73 @@ +# Ukrainian translation for scilab +# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010 +# This file is distributed under the same license as the scilab package. +# +# FIRST AUTHOR <EMAIL@ADDRESS>, 2010. +# Yuri Chornoivan <yurchor@gmail.com>, 2010. +# Yuri Chornoivan <yurchor@ukr.net>, 2012. +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2014-09-30 16:46+0000\n" +"Last-Translator: Yuri Chornoivan <yurchor@gmail.com>\n" +"Language-Team: Ukrainian <translation@linux.org.ua>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: uk\n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: почато оптимізацію, зачекайте…\n" + +msgid "Genetic algorithms" +msgstr "Генетичні алгоритми" + +msgid "Genetic algorithms and Ising problem" +msgstr "Генетичні алгоритми і задача Ізінґа" + +msgid "MultiObjective Genetic Algorithm" +msgstr "Багатоцільові генетичні алгоритми" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "Нішевий генетичний алгоритм зі співучастю" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "Нішевий генетичний алгоритм зі співучастю II" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: помилковий напрям" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: параметр ga_f є обов’язковим" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: параметр ga_f є обов’язковим" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: ініціалізація популяції\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2: параметр ga_f є обов’язковим" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "%s: ітерація %d з %d \n" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr " знайдено мінімальне / максимальне значення = %f / %f\n" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: ітерація %d з %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: параметр F_in є обов’язковим" diff --git a/modules/genetic_algorithms/locales/zh_CN.po b/modules/genetic_algorithms/locales/zh_CN.po new file mode 100755 index 000000000..e09f28fd6 --- /dev/null +++ b/modules/genetic_algorithms/locales/zh_CN.po @@ -0,0 +1,71 @@ +# Simplified Chinese translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2012-05-30 09:26+0000\n" +"Last-Translator: Wesh <Unknown>\n" +"Language-Team: Simplified Chinese <zh_CN@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: \n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s:优化正在开始,请等待...\n" + +msgid "Genetic algorithms" +msgstr "遗传算法" + +msgid "Genetic algorithms and Ising problem" +msgstr "遗传算法和伊辛问题" + +msgid "MultiObjective Genetic Algorithm" +msgstr "多目标遗传算法" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "小生境遗传算法" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "小生境遗传算法II" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s:错误的目录" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s:ga_f是强制的" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga:ga_f是强制的" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s:种群初始化\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2:ga_f是强制的" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s:迭代 %d / %d\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s:F_in是强制的" diff --git a/modules/genetic_algorithms/locales/zh_TW.po b/modules/genetic_algorithms/locales/zh_TW.po new file mode 100755 index 000000000..8dfae1b46 --- /dev/null +++ b/modules/genetic_algorithms/locales/zh_TW.po @@ -0,0 +1,71 @@ +# Traditional Chinese translation for scilab +# Copyright (c) 2009 Rosetta Contributors and Canonical Ltd 2009 +# This file is distributed under the same license as the scilab package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2009. +# +msgid "" +msgstr "" +"Project-Id-Version: scilab\n" +"Report-Msgid-Bugs-To: <localization@lists.scilab.org>\n" +"POT-Creation-Date: 2013-04-16 17:44+0100\n" +"PO-Revision-Date: 2010-06-19 13:44+0000\n" +"Last-Translator: tim loo <timloo0710@gmail.com>\n" +"Language-Team: Traditional Chinese <zh_TW@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Launchpad (build 17413)\n" +"Language: \n" + +#, c-format +msgid "%s: optimization starting, please wait ...\n" +msgstr "%s: 最佳化開啟中.請稍待...\n" + +msgid "Genetic algorithms" +msgstr "" + +msgid "Genetic algorithms and Ising problem" +msgstr "" + +msgid "MultiObjective Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm" +msgstr "" + +msgid "Niched Sharing Genetic Algorithm II" +msgstr "" + +#, c-format +msgid "%s: wrong direction" +msgstr "%s: 方向錯誤" + +#, c-format +msgid "%s: ga_f is mandatory" +msgstr "%s: ga_f 是強制性的" + +msgid "optim_moga: ga_f is mandatory" +msgstr "optim_moga: ga_f 是強制性的" + +#, c-format +msgid "%s: Initialization of the population\n" +msgstr "%s: 母體重置\n" + +msgid "optim_nsga2: ga_f is mandatory" +msgstr "optim_nsga2: ga_f 是強制性的" + +#, c-format +msgid "%s: iteration %d / %d \n" +msgstr "" + +#, c-format +msgid " min / max value found = %f / %f\n" +msgstr "" + +#, c-format +msgid "%s: iteration %d / %d\n" +msgstr "%s: %d / %d 疊代\n" + +#, c-format +msgid "%s: F_in is mandatory" +msgstr "%s: F_in 是強制性的" diff --git a/modules/genetic_algorithms/macros/DominationRank.bin b/modules/genetic_algorithms/macros/DominationRank.bin Binary files differnew file mode 100755 index 000000000..f1cd3eb56 --- /dev/null +++ b/modules/genetic_algorithms/macros/DominationRank.bin diff --git a/modules/genetic_algorithms/macros/DominationRank.sci b/modules/genetic_algorithms/macros/DominationRank.sci new file mode 100755 index 000000000..d900b46d5 --- /dev/null +++ b/modules/genetic_algorithms/macros/DominationRank.sci @@ -0,0 +1,35 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - INRIA - Serge STEER +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function Rank=DominationRank(All_FObj) + Rank = zeros(All_FObj) + if size(All_FObj,2)==1 then + [T,Ind]=gsort(All_FObj,"g","i"); + group_length=diff([0 find(diff(T)>0)]); + Ngroup=size(group_length,"*"); + k=1; + for Count=1:Ngroup + Rank(k:k+group_length(Count)-1)=Count; + k=k+group_length(Count); + end + Rank(Ind)=Rank; + else + MO_All_FObj = All_FObj; + // Compute the domination rank on all the population + Index = 1:size(MO_All_FObj,1); + Count = 1; + while size(MO_All_FObj,1)>1 + [tmp1,tmp2,Index_List] = pareto_filter(MO_All_FObj); + Rank(Index(Index_List)) = Count; + Count = Count + 1; + MO_All_FObj(Index_List,:) = []; + Index(Index_List) = []; + end + end +endfunction diff --git a/modules/genetic_algorithms/macros/buildmacros.bat b/modules/genetic_algorithms/macros/buildmacros.bat new file mode 100755 index 000000000..c4e35ec40 --- /dev/null +++ b/modules/genetic_algorithms/macros/buildmacros.bat @@ -0,0 +1 @@ +@..\..\..\bin\scilex -nwni -ns -e exec('buildmacros.sce');quit;
\ No newline at end of file diff --git a/modules/genetic_algorithms/macros/buildmacros.sce b/modules/genetic_algorithms/macros/buildmacros.sce new file mode 100755 index 000000000..9f57a70ef --- /dev/null +++ b/modules/genetic_algorithms/macros/buildmacros.sce @@ -0,0 +1,14 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +if (isdef("genlib") == %f) then + exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce"); +end + +genlib("genetic_algorithmslib","SCI/modules/genetic_algorithms/macros",%f,%t); diff --git a/modules/genetic_algorithms/macros/cleanmacros.bat b/modules/genetic_algorithms/macros/cleanmacros.bat new file mode 100755 index 000000000..5079dfd71 --- /dev/null +++ b/modules/genetic_algorithms/macros/cleanmacros.bat @@ -0,0 +1,3 @@ +@del *.bin 2>NUL +@del lib 2>NUL +@del names 2>NUL
\ No newline at end of file diff --git a/modules/genetic_algorithms/macros/coding_ga_binary.bin b/modules/genetic_algorithms/macros/coding_ga_binary.bin Binary files differnew file mode 100755 index 000000000..007fb1fde --- /dev/null +++ b/modules/genetic_algorithms/macros/coding_ga_binary.bin diff --git a/modules/genetic_algorithms/macros/coding_ga_binary.sci b/modules/genetic_algorithms/macros/coding_ga_binary.sci new file mode 100755 index 000000000..86e00b710 --- /dev/null +++ b/modules/genetic_algorithms/macros/coding_ga_binary.sci @@ -0,0 +1,48 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [pop_out] = coding_ga_binary(pop_in,direction,param) + // pop_in is a list(). + // pop_out must be a list(). + if ~isdef("param","local") then + param = []; + end + + // We deal with some parameters to take into account the boundary of the domain and the neighborhood size + [BinLen,err] = get_param(param,"binary_length",8); + [MinBounds,err] = get_param(param,"minbound",-2*ones(size(pop_in(1),1),size(pop_in(1),2))); + [MaxBounds,err] = get_param(param,"maxbound",2*ones(size(pop_in(1),1),size(pop_in(1),2))); + + pop_out = list(); + Dimension = length(pop_in(1)); + Max_Bin = 2^BinLen-1; + // A template of '0' so as to be sure that the binary code will be 8 bits long + template = strsubst(dec2bin(Max_Bin,BinLen),"1","0"); + + if (direction=="code") then + for i=1:length(pop_in) + str_tmp = ""; + for j=1:Dimension + tmp = dec2bin(int(Max_Bin * (pop_in(i)(j) - MinBounds(j)) / (MaxBounds(j) - MinBounds(j))),BinLen); + tmp = strcat([part(template,1:BinLen-length(tmp)) tmp]); + str_tmp = strcat([str_tmp, tmp]); + end + pop_out(i) = str_tmp; + end + elseif (direction=="decode") then + for i=1:length(pop_in) + pop_out(i) = zeros(size(MaxBounds,1),size(MaxBounds,2)); + for j=1:length(MaxBounds) + pop_out(i)(j) = (MaxBounds(j) - MinBounds(j)) * (bin2dec(part(pop_in(i),(j-1)*BinLen+1:j*BinLen)) / Max_Bin) + MinBounds(j); + end + end + else + error(sprintf(gettext("%s: wrong direction"),"coding_ga_binary")); + end +endfunction diff --git a/modules/genetic_algorithms/macros/coding_ga_identity.bin b/modules/genetic_algorithms/macros/coding_ga_identity.bin Binary files differnew file mode 100755 index 000000000..d01f963a9 --- /dev/null +++ b/modules/genetic_algorithms/macros/coding_ga_identity.bin diff --git a/modules/genetic_algorithms/macros/coding_ga_identity.sci b/modules/genetic_algorithms/macros/coding_ga_identity.sci new file mode 100755 index 000000000..448ee8af0 --- /dev/null +++ b/modules/genetic_algorithms/macros/coding_ga_identity.sci @@ -0,0 +1,20 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [pop_out] = coding_ga_identity(pop_in,direction,param) + // pop_in is a list(). + // pop_out must be a list(). + if (direction=="code") then + pop_out = pop_in; + elseif (direction=="decode") then + pop_out = pop_in; + else + error(sprintf(gettext("%s: wrong direction"),"coding_ga_identity")); + end +endfunction diff --git a/modules/genetic_algorithms/macros/convert_to_float.bin b/modules/genetic_algorithms/macros/convert_to_float.bin Binary files differnew file mode 100755 index 000000000..5eb9cd2ae --- /dev/null +++ b/modules/genetic_algorithms/macros/convert_to_float.bin diff --git a/modules/genetic_algorithms/macros/convert_to_float.sci b/modules/genetic_algorithms/macros/convert_to_float.sci new file mode 100755 index 000000000..4c1b30789 --- /dev/null +++ b/modules/genetic_algorithms/macros/convert_to_float.sci @@ -0,0 +1,16 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function y = convert_to_float(code, binlen, maxbound, minbound) + Max_Bin = 2^binlen-1; + y = []; + for i=1:length(maxbound) + y(i) = (maxbound(i) - minbound(i)) * (bin2dec(part(code,(i-1)*binlen+1:i*binlen)) / Max_Bin) + minbound(i); + end +endfunction diff --git a/modules/genetic_algorithms/macros/crossover_ga_binary.bin b/modules/genetic_algorithms/macros/crossover_ga_binary.bin Binary files differnew file mode 100755 index 000000000..0b8ee4ea5 --- /dev/null +++ b/modules/genetic_algorithms/macros/crossover_ga_binary.bin diff --git a/modules/genetic_algorithms/macros/crossover_ga_binary.sci b/modules/genetic_algorithms/macros/crossover_ga_binary.sci new file mode 100755 index 000000000..61fa2653e --- /dev/null +++ b/modules/genetic_algorithms/macros/crossover_ga_binary.sci @@ -0,0 +1,90 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// Copyright (C) 2014 - Michael BAUDIN <michael.baudin@contrib.scilab.org> +// Copyright (C) Scilab Enterprises - 2014 - Pierre-Aime AGNEL +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +//============================================================================== +// crossover_ga_binary +//============================================================================== +// INPUT +// Indiv1 = A string representing a binary code +// Indiv2 = A strings representing a binary code +// param = A plist with the following parameters +// binary_length = an integer, the length of the binary code (def. 8) +// multi_cross = a boolean, flag for multiple crossovers (def. %f) +// multi_cross_nb = an integer, number of multiple crossovers (def. 2) +// +// OUTPUT +// Crossed_Indiv1 = A string, +// result of the cross over for Indiv1 +// Crossed_Indiv2 = A string, +// result of the cross over for Indiv2 +// mix = a vector of double, the positions +// where the crossover was done +// +// DESCRIPTION +// Function crossover_ga_binary generates the crossover between +// Indiv1 and Indiv2 taken as binary code. +// +// Without any additional parameters crossover_ga_binary(Indiv1, Indiv2) +// returns the crossover occruring on a single random location +// +// crossover_ga_binary(Indiv1, Indiv2, param) modifies its behaviour +// with the values of param: +// binary_length: +// length of the binary code (default 8) +// multi_cross: +// if set to %t multiple crossover can happen (default %f) +// multi_cross_nb: +// the maximal number of possible crossovers. +// (default 2 if +// multi_cross is set to %t, 1 otherwise) +// At least one crossover will occur. + +function [Crossed_Indiv1, Crossed_Indiv2, mix] = crossover_ga_binary(Indiv1,Indiv2,param) + + fname = "crossover_ga_binary"; + if ~isdef("param","local") then + param = []; + end + + // We deal with some parameters to take into account the boundary of the domain and the neighborhood size + [BinLen, errLen] = get_param(param, "binary_length", 8); + [MultiCross, errMultiCross] = get_param(param, "multi_cross", %F); + if MultiCross + [MultiCrossNb, errMultiCrossNb] = get_param(param, "multi_cross_nb", 2); + else + MultiCrossNb = 1; + end + + len1 = length(Indiv1); + len2 = length(Indiv2); + BinLen = max([len1, len2, BinLen]); + if len1 < BinLen + Indiv1 = strcat(string(zeros(1, BinLen - len1))) + Indiv1; //0 padding on the right + end + if len2 < BinLen + Indiv2 = strcat(string(zeros(1, BinLen - len2))) + Indiv2; //0 padding on the right + end + + // Crossover positions selection + mix = unique(gsort(sample(MultiCrossNb, 1:BinLen-1), "g", "i"))'; + Crossed_Indiv1 = Indiv1; + Crossed_Indiv2 = Indiv2; + + for j = 1:size(mix, "*") + H1 = part(Crossed_Indiv1, 1:mix(j)); //Head for Indiv1 + T1 = part(Crossed_Indiv1, (mix(j) + 1):BinLen); //Tail for Indiv1 + H2 = part(Crossed_Indiv2, 1:mix(j)); //Head for Indiv2 + T2 = part(Crossed_Indiv2, (mix(j) + 1):BinLen); //Tail for Indiv2 + + Crossed_Indiv1 = [H1 + T2]; + Crossed_Indiv2 = [H2 + T1]; + end +endfunction diff --git a/modules/genetic_algorithms/macros/crossover_ga_default.bin b/modules/genetic_algorithms/macros/crossover_ga_default.bin Binary files differnew file mode 100755 index 000000000..6b9045ec5 --- /dev/null +++ b/modules/genetic_algorithms/macros/crossover_ga_default.bin diff --git a/modules/genetic_algorithms/macros/crossover_ga_default.sci b/modules/genetic_algorithms/macros/crossover_ga_default.sci new file mode 100755 index 000000000..bc80c3a35 --- /dev/null +++ b/modules/genetic_algorithms/macros/crossover_ga_default.sci @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [Crossed_Indiv1, Crossed_Indiv2] = crossover_ga_default(Indiv1,Indiv2,param) + if ~isdef("param","local") then + param = []; + end + + // We deal with some parameters to take into account the boundary of the domain and the neighborhood size + [Beta,err] = get_param(param,"beta",0); + [MinBounds,err] = get_param(param,"minbound",-2*ones(size(Indiv1,1),size(Indiv1,2))); + [MaxBounds,err] = get_param(param,"maxbound",2*ones(size(Indiv1,1),size(Indiv1,2))); + + mix = (1 + 2*Beta)*grand(1,1,"def") - Beta; + Crossed_Indiv1 = mix*Indiv1 + (1-mix)*Indiv2; + Crossed_Indiv2 = (1-mix)*Indiv1 + mix*Indiv2; + + Crossed_Indiv1 = max(min(Crossed_Indiv1, MaxBounds),MinBounds); + Crossed_Indiv2 = max(min(Crossed_Indiv2, MaxBounds),MinBounds); +endfunction diff --git a/modules/genetic_algorithms/macros/init_ga_default.bin b/modules/genetic_algorithms/macros/init_ga_default.bin Binary files differnew file mode 100755 index 000000000..38f926f93 --- /dev/null +++ b/modules/genetic_algorithms/macros/init_ga_default.bin diff --git a/modules/genetic_algorithms/macros/init_ga_default.sci b/modules/genetic_algorithms/macros/init_ga_default.sci new file mode 100755 index 000000000..f7239b3da --- /dev/null +++ b/modules/genetic_algorithms/macros/init_ga_default.sci @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function Pop_init = init_ga_default(popsize,param) + if ~isdef("param","local") then + param = []; + end + + // We deal with some parameters to take into account the boundary of the domain and the neighborhood size + [Dim,err] = get_param(param,"dimension",2); + [MinBounds,err] = get_param(param,"minbound",-2*ones(1,Dim)); + [MaxBounds,err] = get_param(param,"maxbound",2*ones(1,Dim)); + + // Pop_init must be a list() + Pop_init = list(); + for i=1:popsize + Pop_init(i) = (MaxBounds - MinBounds).*grand(size(MaxBounds,1),size(MaxBounds,2),"def") + MinBounds; + end +endfunction diff --git a/modules/genetic_algorithms/macros/lib b/modules/genetic_algorithms/macros/lib Binary files differnew file mode 100755 index 000000000..a7a058008 --- /dev/null +++ b/modules/genetic_algorithms/macros/lib diff --git a/modules/genetic_algorithms/macros/mutation_ga_binary.bin b/modules/genetic_algorithms/macros/mutation_ga_binary.bin Binary files differnew file mode 100755 index 000000000..7fd661b70 --- /dev/null +++ b/modules/genetic_algorithms/macros/mutation_ga_binary.bin diff --git a/modules/genetic_algorithms/macros/mutation_ga_binary.sci b/modules/genetic_algorithms/macros/mutation_ga_binary.sci new file mode 100755 index 000000000..1f6a92770 --- /dev/null +++ b/modules/genetic_algorithms/macros/mutation_ga_binary.sci @@ -0,0 +1,38 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) Scilab Enterprises - 2014 - Pierre-Aime Agnel +// Copyright (C) 2014 - Michael Baudin <michael.baudin@contrib.scilab.org> +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [Mut_Indiv, pos] = mutation_ga_binary(Indiv, param) + if ~isdef("param", "local") then + param = []; + end + // We deal with some parameters to take into account the boundary of the domain and the neighborhood size + [BinLen, err] = get_param(param, "binary_length", 8); + [MultiMut, err] = get_param(param, "multi_mut", %F); + if MultiMut + [MultiMutNb, err] = get_param(param, "multi_mut_nb", 2); + else + MultiMutNb = 1; + end + + dim = length(Indiv); + pos = grand(1, MultiMutNb, "uin", 1, dim); + pos = unique(pos); + Mut_Indiv = Indiv; + for i = 1:size(pos, '*'); + Mut_Indiv = [part(Mut_Indiv, 1:pos(i) - 1), part(Mut_Indiv, pos(i)), part(Mut_Indiv, pos(i) + 1:dim)]; + if Mut_Indiv(2) == "0" + Mut_Indiv(2) = "1"; + else + Mut_Indiv(2) = "0"; + end + Mut_Indiv = strcat(Mut_Indiv); + end +endfunction diff --git a/modules/genetic_algorithms/macros/mutation_ga_default.bin b/modules/genetic_algorithms/macros/mutation_ga_default.bin Binary files differnew file mode 100755 index 000000000..08c1652e7 --- /dev/null +++ b/modules/genetic_algorithms/macros/mutation_ga_default.bin diff --git a/modules/genetic_algorithms/macros/mutation_ga_default.sci b/modules/genetic_algorithms/macros/mutation_ga_default.sci new file mode 100755 index 000000000..9de4bf707 --- /dev/null +++ b/modules/genetic_algorithms/macros/mutation_ga_default.sci @@ -0,0 +1,22 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function Mut_Indiv = mutation_ga_default(Indiv,param) + if ~isdef("param","local") then + param = []; + end + // We deal with some parameters to take into account the boundary of the domain and the neighborhood size + [Delta,err] = get_param(param,"delta",0.1); + [MinBounds,err] = get_param(param,"minbound",-2*ones(size(Indiv,1),size(Indiv,2))); + [MaxBounds,err] = get_param(param,"maxbound", 2*ones(size(Indiv,1),size(Indiv,2))); + + Mut_Indiv = Indiv + 2*Delta*grand(size(Indiv,1),size(Indiv,2),"def") - Delta*ones(size(Indiv,1),size(Indiv,2)); + + Mut_Indiv = max(min(Mut_Indiv, MaxBounds),MinBounds); +endfunction diff --git a/modules/genetic_algorithms/macros/names b/modules/genetic_algorithms/macros/names new file mode 100755 index 000000000..8848ce08e --- /dev/null +++ b/modules/genetic_algorithms/macros/names @@ -0,0 +1,20 @@ +DominationRank +coding_ga_binary +coding_ga_identity +convert_to_float +crossover_ga_binary +crossover_ga_default +init_ga_default +mutation_ga_binary +mutation_ga_default +optim_ga +optim_moga +optim_nsga +optim_nsga2 +output_ga_default +output_moga_default +output_nsga2_default +output_nsga_default +pareto_filter +selection_ga_elitist +selection_ga_random diff --git a/modules/genetic_algorithms/macros/optim_ga.bin b/modules/genetic_algorithms/macros/optim_ga.bin Binary files differnew file mode 100755 index 000000000..308d1c10e --- /dev/null +++ b/modules/genetic_algorithms/macros/optim_ga.bin diff --git a/modules/genetic_algorithms/macros/optim_ga.sci b/modules/genetic_algorithms/macros/optim_ga.sci new file mode 100755 index 000000000..7bd0f37e9 --- /dev/null +++ b/modules/genetic_algorithms/macros/optim_ga.sci @@ -0,0 +1,159 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// Copyright (C) 2014 - Michael Baudin <michael.baudin@contrib.scilab.org> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_ga(ga_f, pop_size, nb_generation, p_mut, p_cross, Log, param) + + [nargout, nargin] = argn(); + + if ~isdef("param", "local") then + param = []; + end + + [codage_func, err] = get_param(param, "codage_func", coding_ga_identity); + [init_func, err] = get_param(param, "init_func", init_ga_default); + [crossover_func, err] = get_param(param, "crossover_func", crossover_ga_default); + [mutation_func, err] = get_param(param, "mutation_func", mutation_ga_default); + [selection_func, err] = get_param(param, "selection_func", selection_ga_elitist); + [nb_couples, err] = get_param(param, "nb_couples", 100); + [pressure, err] = get_param(param, "pressure", 0.05); + [output_func, err] = get_param(param, "output_func", output_ga_default); + + if ~isdef("ga_f", "local") then + error(sprintf(gettext("%s: ga_f is mandatory"), "optim_ga")); + else + if typeof(ga_f) == "list" then + deff("y = _ga_f(x)", "y = ga_f(1)(x, ga_f(2:$))"); + else + deff("y = _ga_f(x)", "y = ga_f(x)"); + end + end + + if ~isdef("pop_size", "local") then + pop_size = 100; + end + if ~isdef("nb_generation", "local") then + nb_generation = 10; + end + if ~isdef("p_mut", "local") then + p_mut = 0.1; + end + if ~isdef("p_cross", "local") then + p_cross = 0.7; + end + if ~isdef("Log", "local") then + Log = %F; + end + + // Initialization of the population + Pop = list(); + Pop = init_func(pop_size, param); + + if (nargout >= 3) then + pop_init = Pop; + end + + // Code the individuals + Pop = codage_func(Pop, "code", param); + + for i = 1:length(Pop) + FObj_Pop(i) = _ga_f(Pop(i)); + end + + if (nargout == 4) then + fobj_pop_init = FObj_Pop; + end + + FObj_Pop_Max = max(FObj_Pop); + FObj_Pop_Min = min(FObj_Pop); + + // Normalization of the efficiency + Efficiency = (1 - pressure) * (FObj_Pop_Max - FObj_Pop) / max([FObj_Pop_Max - FObj_Pop_Min %eps]) + pressure; + + // The genetic algorithm + for i = 1:nb_generation + // + // Selection + // + Indiv1 = list(); + Indiv2 = list(); + Wheel = cumsum(Efficiency); + for j = 1:nb_couples + // Selection of the first individual in the couple + Shoot = grand(1, 1, "unf", 0, Wheel($)); + Index = find(Shoot <= Wheel, 1); + Indiv1(j) = Pop(Index); + FObj_Indiv1(j) = FObj_Pop(Index); + // Selection of the second individual in the couple + Shoot = grand(1, 1, "unf", 0, Wheel($)); + Index = 1; + Index = find(Shoot <= Wheel, 1); + Indiv2(j) = Pop(Index); + FObj_Indiv2(j) = FObj_Pop(Index); + end + // + // Crossover + // + for j = 1:nb_couples + if (p_cross>grand(1, 1, "def")) then + [x1, x2] = crossover_func(Indiv1(j), Indiv2(j), param); + Indiv1(j) = x1; + Indiv2(j) = x2; + ToCompute_I1(j) = %T; + ToCompute_I2(j) = %T; + else + ToCompute_I1(j) = %F; + ToCompute_I2(j) = %F; + end + end + // + // Mutation + // + for j = 1:nb_couples + if (p_mut>grand(1, 1, "def")) then + x1 = mutation_func(Indiv1(j), param); + Indiv1(j) = x1; + ToCompute_I1(j) = %T; + end + if (p_mut>grand(1, 1, "def")) then + x2 = mutation_func(Indiv2(j), param); + Indiv2(j) = x2; + ToCompute_I2(j) = %T; + end + end + // + // Computation of the objective functions + // + for j = 1:nb_couples + if ToCompute_I1(j) then FObj_Indiv1(j) = _ga_f(Indiv1(j)); end + if ToCompute_I2(j) then FObj_Indiv2(j) = _ga_f(Indiv2(j)); end + end + + // Reinit ToCompute lists + ToCompute_I1 = ToCompute_I1 & %F; + ToCompute_I2 = ToCompute_I2 & %F; + + // + // Recombination + // + [Pop, FObj_Pop] = selection_func(Pop, Indiv1, Indiv2, FObj_Pop, FObj_Indiv1, FObj_Indiv2, [], [], [], param); + + // Callback for plotting / printing intermediate results or stopping the algorithm + if (Log) then + stop = output_func(i, nb_generation, Pop, FObj_Pop, param); + if (stop) then + break + end + end + end + + pop_opt = Pop; + pop_opt = codage_func(pop_opt, "decode", param); + fobj_pop_opt = FObj_Pop; +endfunction diff --git a/modules/genetic_algorithms/macros/optim_moga.bin b/modules/genetic_algorithms/macros/optim_moga.bin Binary files differnew file mode 100755 index 000000000..19bc22096 --- /dev/null +++ b/modules/genetic_algorithms/macros/optim_moga.bin diff --git a/modules/genetic_algorithms/macros/optim_moga.sci b/modules/genetic_algorithms/macros/optim_moga.sci new file mode 100755 index 000000000..13ff5db5b --- /dev/null +++ b/modules/genetic_algorithms/macros/optim_moga.sci @@ -0,0 +1,209 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// Copyright (C) 2014 - Michael Baudin <michael.baudin@contrib.scilab.org> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_moga(ga_f, pop_size, nb_generation, p_mut, p_cross, Log, param) + + [nargout, nargin] = argn(); + + if ~isdef("param","local") then + param = []; + end + + [codage_func,err] = get_param(param,"codage_func",coding_ga_identity); + [init_func,err] = get_param(param,"init_func",init_ga_default); + [crossover_func,err] = get_param(param,"crossover_func",crossover_ga_default); + [mutation_func,err] = get_param(param,"mutation_func",mutation_ga_default); + [selection_func,err] = get_param(param,"selection_func",selection_ga_elitist); + [nb_couples,err] = get_param(param,"nb_couples",100); + [pressure,err] = get_param(param,"pressure",0.05); + [output_func, err] = get_param(param, "output_func", output_moga_default); + + if ~isdef("ga_f","local") then + error(gettext("optim_moga: ga_f is mandatory")); + else + if typeof(ga_f)=="list" then + deff("y=_ga_f(x)","y=ga_f(1)(x, ga_f(2:$))"); + else + deff("y=_ga_f(x)","y=ga_f(x)"); + end + end + + if ~isdef("pop_size","local") then + pop_size = 100; + end + if ~isdef("nb_generation","local") then + nb_generation = 10; + end + if ~isdef("p_mut","local") then + p_mut = 0.01; + end + if ~isdef("p_cross","local") then + p_cross = 0.7; + end + if ~isdef("Log","local") then + Log = %F; + end + + // Initialization of the population + if (Log) then + printf(gettext("%s: Initialization of the population\n"),"optim_moga"); + end + + Pop = list(); + Pop = init_func(pop_size, param); + + if (nargout>=3) then + pop_init = Pop; + end + + // Code the individuals + Pop = codage_func(Pop,"code",param); + + for i=1:length(Pop) + MO_FObj_Pop(i,:) = _ga_f(Pop(i)); + end + + // Compute the domination rank + for i=1:size(MO_FObj_Pop,1) + Index = 0; + for j=1:size(MO_FObj_Pop,1) + Index = Index + double(and(MO_FObj_Pop(i,:)<=MO_FObj_Pop(j,:)) & or(MO_FObj_Pop(i,:)<MO_FObj_Pop(j,:))); + end + FObj_Pop(i) = - (Index + 1); + end + + FObj_Pop_Max = max(FObj_Pop); + FObj_Pop_Min = min(FObj_Pop); + + // Normalization of the efficiency + + Efficiency = (1 - pressure) * (FObj_Pop_Max - FObj_Pop) / max([FObj_Pop_Max - FObj_Pop_Min %eps]) + pressure; + + if (nargout==4) then + fobj_pop_init = MO_FObj_Pop; + end + + // The genetic algorithm + for i=1:nb_generation + // + // Selection + // + Indiv1 = list(); + Indiv2 = list(); + Wheel = cumsum(Efficiency); + for j=1:nb_couples + // Selection of the first individual in the couple + Shoot = grand(1,1,"unf", 0, Wheel($)); + Index = find(Shoot <= Wheel, 1); + Indiv1(j) = Pop(Index); + MO_FObj_Indiv1(j,:) = MO_FObj_Pop(Index,:); + // Selection of the second individual in the couple + Shoot = grand(1,1,"unf", 0, Wheel($)); + Index = find(Shoot <= Wheel, 1); + Indiv2(j) = Pop(Index); + MO_FObj_Indiv2(j,:) = MO_FObj_Pop(Index,:); + end + // + // Crossover + // + for j=1:nb_couples + if (p_cross>grand(1,1,"def")) then + [x1, x2] = crossover_func(Indiv1(j), Indiv2(j),param); + Indiv1(j) = x1; + Indiv2(j) = x2; + ToCompute_I1(j) = %T; + ToCompute_I2(j) = %T; + else + ToCompute_I1(j) = %F; + ToCompute_I2(j) = %F; + end + end + // + // Mutation + // + for j=1:nb_couples + if (p_mut>grand(1,1,"def")) then + x1 = mutation_func(Indiv1(j),param); + Indiv1(j) = x1; + ToCompute_I1(j) = %T; + end + if (p_mut>grand(1,1,"def")) then + x2 = mutation_func(Indiv2(j),param); + Indiv2(j) = x2; + ToCompute_I2(j) = %T; + end + end + // + // Computation of the objective functions + // + for j=1:length(Indiv1) + if ToCompute_I1(j) then MO_FObj_Indiv1(j,:) = _ga_f(Indiv1(j)); end + if ToCompute_I2(j) then MO_FObj_Indiv2(j,:) = _ga_f(Indiv2(j)); end + end + + // Reinit ToCompute lists + ToCompute_I1 = ToCompute_I1 & %F; + ToCompute_I2 = ToCompute_I2 & %F; + + // Compute the domination rank + for j=1:size(MO_FObj_Indiv1,1) + // We compute the rank for Indiv1 + Index1 = 0; Index2 = 0; Index3 = 0; + for k=1:size(MO_FObj_Indiv1,1) + Index1 = Index1 + double(and(MO_FObj_Indiv1(j,:)<=MO_FObj_Indiv1(k,:)) & or(MO_FObj_Indiv1(j,:)<MO_FObj_Indiv1(k,:))); + Index2 = Index2 + double(and(MO_FObj_Indiv1(j,:)<=MO_FObj_Indiv2(k,:)) & or(MO_FObj_Indiv1(j,:)<MO_FObj_Indiv2(k,:))); + end + for k=1:size(MO_FObj_Pop,1) + Index3 = Index3 + double(and(MO_FObj_Indiv1(j,:)<=MO_FObj_Pop(k,:)) & or(MO_FObj_Indiv1(j,:)<MO_FObj_Pop(k,:))); + end + FObj_Indiv1(j) = - (Index1 + Index2 + Index3 + 1); + + // We compute the rank for Indiv2 + Index1 = 0; Index2 = 0; Index3 = 0; + for k=1:size(MO_FObj_Indiv1,1) + Index1 = Index1 + double(and(MO_FObj_Indiv2(j,:)<=MO_FObj_Indiv1(k,:)) & or(MO_FObj_Indiv2(j,:)<MO_FObj_Indiv1(k,:))); + Index2 = Index2 + double(and(MO_FObj_Indiv2(j,:)<=MO_FObj_Indiv2(k,:)) & or(MO_FObj_Indiv2(j,:)<MO_FObj_Indiv2(k,:))); + end + for k=1:size(MO_FObj_Pop,1) + Index3 = Index3 + double(and(MO_FObj_Indiv2(j,:)<=MO_FObj_Pop(k,:)) & or(MO_FObj_Indiv2(j,:)<MO_FObj_Pop(k,:))); + end + FObj_Indiv2(j) = - (Index1 + Index2 + Index3 + 1); + end + + // We compute the rank for Pop + for j=1:size(MO_FObj_Pop,1) + Index1 = 0; Index2 = 0; Index3 = 0; + for k=1:size(MO_FObj_Indiv1,1) + Index1 = Index1 + double(and(MO_FObj_Pop(j,:)<=MO_FObj_Indiv1(k,:)) & or(MO_FObj_Pop(j,:)<MO_FObj_Indiv1(k,:))); + Index2 = Index2 + double(and(MO_FObj_Pop(j,:)<=MO_FObj_Indiv2(k,:)) & or(MO_FObj_Pop(j,:)<MO_FObj_Indiv2(k,:))); + end + for k=1:size(MO_FObj_Pop,1) + Index3 = Index3 + double(and(MO_FObj_Pop(j,:)<=MO_FObj_Pop(k,:)) & or(MO_FObj_Pop(j,:)<MO_FObj_Pop(k,:))); + end + FObj_Pop(j) = - (Index1 + Index2 + Index3 + 1); + end + + // + // Recombination + // + + [Pop, FObj_Pop, Efficiency, MO_FObj_Pop] = selection_func(Pop, Indiv1, Indiv2, FObj_Pop, FObj_Indiv1, FObj_Indiv2, ... + MO_FObj_Pop, MO_FObj_Indiv1, MO_FObj_Indiv2, param); + if (Log) then + stop = output_func(i, nb_generation, Pop, MO_FObj_Pop, param); + if stop then + break + end + end + end + + pop_opt = codage_func(Pop, 'decode', param); + fobj_pop_opt = MO_FObj_Pop; +endfunction diff --git a/modules/genetic_algorithms/macros/optim_nsga.bin b/modules/genetic_algorithms/macros/optim_nsga.bin Binary files differnew file mode 100755 index 000000000..54172e09e --- /dev/null +++ b/modules/genetic_algorithms/macros/optim_nsga.bin diff --git a/modules/genetic_algorithms/macros/optim_nsga.sci b/modules/genetic_algorithms/macros/optim_nsga.sci new file mode 100755 index 000000000..ed0e320b6 --- /dev/null +++ b/modules/genetic_algorithms/macros/optim_nsga.sci @@ -0,0 +1,233 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga(ga_f, pop_size, nb_generation, p_mut, p_cross, Log, param, sigma, pow) + + [nargout, nargin] = argn(); + + if ~isdef("param", "local") then + param = []; + end + + [codage_func, err] = get_param(param, "codage_func", coding_ga_identity); + [init_func, err] = get_param(param, "init_func", init_ga_default); + [crossover_func, err] = get_param(param, "crossover_func", crossover_ga_default); + [mutation_func, err] = get_param(param, "mutation_func", mutation_ga_default); + [selection_func, err] = get_param(param, "selection_func", selection_ga_elitist); + [nb_couples, err] = get_param(param, "nb_couples", 100); + [pressure, err] = get_param(param, "pressure", 0.05); + [output_func, err] = get_param(param, "output_func", output_nsga_default); + + if ~isdef("ga_f", "local") then + error(gettext("optim_moga: ga_f is mandatory")); + else + if typeof(ga_f)=="list" then + deff("y=_ga_f(x)", "y=ga_f(1)(x, ga_f(2:$))"); + else + deff("y=_ga_f(x)", "y=ga_f(x)"); + end + end + + if ~isdef("pop_size", "local") then + pop_size = 100; + end + if ~isdef("nb_generation", "local") then + nb_generation = 10; + end + if ~isdef("p_mut", "local") then + p_mut = 0.1; + end + if ~isdef("p_cross", "local") then + p_cross = 0.1; + end + if ~isdef("Log", "local") then + Log = %F; + end + if ~isdef("sigma", "local") then + sigma = 0.01; + end + if ~isdef("pow", "local") then + pow = 2; + end + + // Initialization of the population + if (Log) then + printf(gettext("%s: Initialization of the population\n"), "optim_nsga"); + end + + Pop = list(); + Pop = init_func(pop_size, param); + + + if (nargout>=3) then + pop_init = Pop; + end + + // Code the individuals + Pop = codage_func(Pop, "code", param); + + for i=1:length(Pop) + MO_FObj_Pop(i, :) = _ga_f(Pop(i)); + end + + // Compute the domination rank + for i=1:size(MO_FObj_Pop, 1) + Index = 0; + for j=1:size(MO_FObj_Pop, 1) + Index = Index + double(and(MO_FObj_Pop(i, :)<=MO_FObj_Pop(j, :)) & or(MO_FObj_Pop(i, :)<MO_FObj_Pop(j, :))); + end + FObj_Pop(i) = - (Index + 1); + end + + if (nargout==4) then + fobj_pop_init = MO_FObj_Pop; + end + + // The genetic algorithm + for i=1:nb_generation + // Computation of the niching penality + for j=1:size(MO_FObj_Pop, 1) + Niching(j) = 0; + for k=1:size(MO_FObj_Pop, 1) + Distance = sqrt(sum((MO_FObj_Pop(j, :) - MO_FObj_Pop(k, :)).^2)); + if Distance < sigma then + Niching(j) = Niching(j) + (1 - Distance / sigma)^pow; + end + end + end + + // Apply niching penality to fobj + FObj_Pop = FObj_Pop ./ Niching; + + FObj_Pop_Max = max(FObj_Pop); + FObj_Pop_Min = min(FObj_Pop); + + // Normalization of the efficiency + Efficiency = (1 - pressure) * (FObj_Pop_Max - FObj_Pop) / max([FObj_Pop_Max - FObj_Pop_Min %eps]) + pressure; + + // + // Selection + // + Indiv1 = list(); + Indiv2 = list(); + Wheel = cumsum(Efficiency); + + for j=1:nb_couples + // Selection of the first individual in the couple + Shoot = grand(1, 1, "def")*Wheel($); + Index = find(Wheel<=Shoot); + if length(Index)>1 then Index = Index($); end; + if isempty(Index) then Index = 1; end; + Indiv1(j) = Pop(Index); + MO_FObj_Indiv1(j, :) = MO_FObj_Pop(Index, :); + // Selection of the second individual in the couple + Shoot = grand(1, 1, "def")*Wheel($); + Index = find(Wheel<=Shoot); + if length(Index)>1 then Index = Index($); end; + if isempty(Index) then Index = 1; end; + Indiv2(j) = Pop(Index); + MO_FObj_Indiv2(j, :) = MO_FObj_Pop(Index, :); + end + // + // Crossover + // + for j=1:nb_couples + if (p_cross>grand(1, 1, "def")) then + [x1, x2] = crossover_func(Indiv1(j), Indiv2(j), param); + Indiv1(j) = x1; + Indiv2(j) = x2; + ToCompute_I1(j) = %T; + ToCompute_I2(j) = %T; + else + ToCompute_I1(j) = %F; + ToCompute_I2(j) = %F; + end + end + // + // Mutation + // + for j=1:nb_couples + if (p_mut>grand(1, 1, "def")) then + x1 = mutation_func(Indiv1(j), param); + Indiv1(j) = x1; + ToCompute_I1(j) = %T; + end + if (p_mut>grand(1, 1, "def")) then + x2 = mutation_func(Indiv2(j), param); + Indiv2(j) = x2; + ToCompute_I2(j) = %T; + end + end + // + // Computation of the objective functions + // + for j=1:length(Indiv1) + if ToCompute_I1(j) then MO_FObj_Indiv1(j, :) = _ga_f(Indiv1(j)); end + if ToCompute_I2(j) then MO_FObj_Indiv2(j, :) = _ga_f(Indiv2(j)); end + end + + // Reinit ToCompute lists + ToCompute_I1 = ToCompute_I1 & %F; + ToCompute_I2 = ToCompute_I2 & %F; + + // Compute the domination rank + for j=1:size(MO_FObj_Indiv1, 1) + // We compute the rank for Indiv1 + Index1 = 0; Index2 = 0; Index3 = 0; + for k=1:size(MO_FObj_Indiv1, 1) + Index1 = Index1 + double(and(MO_FObj_Indiv1(j, :)<=MO_FObj_Indiv1(k, :)) & or(MO_FObj_Indiv1(j, :)<MO_FObj_Indiv1(k, :))); + Index2 = Index2 + double(and(MO_FObj_Indiv1(j, :)<=MO_FObj_Indiv2(k, :)) & or(MO_FObj_Indiv1(j, :)<MO_FObj_Indiv2(k, :))); + end + for k=1:size(MO_FObj_Pop, 1) + Index3 = Index3 + and(MO_FObj_Indiv1(j, :)<=MO_FObj_Pop(k, :)) & or(MO_FObj_Indiv1(j, :)<MO_FObj_Pop(k, :)); + end + FObj_Indiv1(j) = - (Index1 + Index2 + Index3 + 1); + + // We compute the rank for Indiv2 + Index1 = 0; Index2 = 0; Index3 = 0; + for k=1:size(MO_FObj_Indiv1, 1) + Index1 = Index1 + double(and(MO_FObj_Indiv2(j, :)<=MO_FObj_Indiv1(k, :)) & or(MO_FObj_Indiv2(j, :)<MO_FObj_Indiv1(k, :))); + Index2 = Index2 + double(and(MO_FObj_Indiv2(j, :)<=MO_FObj_Indiv2(k, :)) & or(MO_FObj_Indiv2(j, :)<MO_FObj_Indiv2(k, :))); + end + for k=1:size(MO_FObj_Pop, 1) + Index3 = Index3 + double(and(MO_FObj_Indiv2(j, :)<=MO_FObj_Pop(k, :)) & or(MO_FObj_Indiv2(j, :)<MO_FObj_Pop(k, :))); + end + FObj_Indiv2(j) = - (Index1 + Index2 + Index3 + 1); + end + + // We compute the rank for Pop + for j=1:size(MO_FObj_Pop, 1) + Index1 = 0; Index2 = 0; Index3 = 0; + for k=1:size(MO_FObj_Indiv1, 1) + Index1 = Index1 + double(and(MO_FObj_Pop(j, :)<=MO_FObj_Indiv1(k, :)) & or(MO_FObj_Pop(j, :)<MO_FObj_Indiv1(k, :))); + Index2 = Index2 + double(and(MO_FObj_Pop(j, :)<=MO_FObj_Indiv2(k, :)) & or(MO_FObj_Pop(j, :)<MO_FObj_Indiv2(k, :))); + end + for k=1:size(FObj_Pop, 1) + Index3 = Index3 + double(and(MO_FObj_Pop(j, :)<=MO_FObj_Pop(k, :)) & or(MO_FObj_Pop(j, :)<MO_FObj_Pop(k, :))); + end + FObj_Pop(j) = - (Index1 + Index2 + Index3 + 1); + end + + // + // Recombination + // + + [Pop, FObj_Pop, Efficiency, MO_FObj_Pop] = selection_func(Pop, Indiv1, Indiv2, FObj_Pop, FObj_Indiv1, FObj_Indiv2, ... + MO_FObj_Pop, MO_FObj_Indiv1, MO_FObj_Indiv2, param); + if (Log) then + stop = output_func(i, nb_generation, Pop, MO_FObj_Pop, param); + if stop then + break + end + end + end + + pop_opt = codage_func(Pop, "decode", param); + fobj_pop_opt = MO_FObj_Pop; +endfunction diff --git a/modules/genetic_algorithms/macros/optim_nsga2.bin b/modules/genetic_algorithms/macros/optim_nsga2.bin Binary files differnew file mode 100755 index 000000000..131363c49 --- /dev/null +++ b/modules/genetic_algorithms/macros/optim_nsga2.bin diff --git a/modules/genetic_algorithms/macros/optim_nsga2.sci b/modules/genetic_algorithms/macros/optim_nsga2.sci new file mode 100755 index 000000000..a6099c2eb --- /dev/null +++ b/modules/genetic_algorithms/macros/optim_nsga2.sci @@ -0,0 +1,227 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga2(ga_f, pop_size, nb_generation, p_mut, p_cross, Log, param) + + [nargout, nargin] = argn(); + + if ~isdef("param", "local") then + param = []; + end + + [codage_func, err] = get_param(param, "codage_func", coding_ga_identity); + [init_func, err] = get_param(param, "init_func", init_ga_default); + [crossover_func, err] = get_param(param, "crossover_func", crossover_ga_default); + [mutation_func, err] = get_param(param, "mutation_func", mutation_ga_default); + [nb_couples, err] = get_param(param, "nb_couples", 100); + [output_func, err] = get_param(param, 'output_func', output_nsga2_default); + + if ~isdef("ga_f", "local") then + error(gettext("optim_nsga2: ga_f is mandatory")); + else + if typeof(ga_f)=="list" then + deff("y=_ga_f(x)", "y=ga_f(1)(x, ga_f(2:$))"); + else + deff("y=_ga_f(x)", "y=ga_f(x)"); + end + end + + if ~isdef("pop_size", "local") then + pop_size = 100; + end + if ~isdef("nb_generation", "local") then + nb_generation = 10; + end + if ~isdef("p_mut", "local") then + p_mut = 0.1; + end + if ~isdef("p_cross", "local") then + p_cross = 0.1; + end + if ~isdef("Log", "local") then + Log = %F; + end + + // Initialization of the population + if (Log) then + printf(gettext("%s: Initialization of the population\n"), "optim_nsga2"); + end + + Pop = init_func(pop_size, param); + + if (nargout>=3) then + pop_init = Pop; + end + + // Code the individuals + Pop = codage_func(Pop, "code", param); + + for i=1:length(Pop) + FObj_Pop(i, :) = _ga_f(Pop(i)); + end + + // Compute the domination rank + Rank=DominationRank(FObj_Pop); + + // Compute the crowding distance + MO_FObj_Pop = FObj_Pop; + Index = 1:size(MO_FObj_Pop, 1); + Crowdist = zeros(size(MO_FObj_Pop, 1), 1); + for i=1:size(FObj_Pop, 2) + [tmp, Index_List] = gsort(MO_FObj_Pop(:, i)); + MO_FObj_Pop = MO_FObj_Pop(Index_List, :); + Index = Index(Index_List); + Crowdist(Index_List(1)) = %inf; + Crowdist(Index_List($)) = %inf; + _Max = max(MO_FObj_Pop(:, i)); + _Min = min(MO_FObj_Pop(:, i)); + for j=2:size(MO_FObj_Pop, 1)-1 + Crowdist(Index(j)) = Crowdist(Index(j)) - (MO_FObj_Pop(j+1, i) - MO_FObj_Pop(j-1, i)) / (_Max - _Min); + end + end + + if (nargout==4) then + fobj_pop_init = FObj_Pop; + end + + // The genetic algorithm + for It=1:nb_generation + // + // Selection + // + Indiv1 = list(); + Indiv2 = list(); + for j=1:nb_couples + // Selection of 2 individuals via binary tournament selection to fill Indiv1 + Index1 = ceil((size(FObj_Pop, 1) - 1)*grand(1, 1, "def")+1); + Index2 = ceil((size(FObj_Pop, 1) - 1)*grand(1, 1, "def")+1); + if (Rank(Index1)<Rank(Index2)) | ((Rank(Index1)==Rank(Index2)) & (Crowdist(Index1)>Crowdist(Index2))) then + Indiv1(j) = Pop(Index1); + FObj_Indiv1(j, :) = MO_FObj_Pop(Index1, :); + else + Indiv1(j) = Pop(Index2); + FObj_Indiv1(j, :) = MO_FObj_Pop(Index2, :); + end + // Selection of 2 individuals via binary tournament selection to fill Indiv2 + Index1 = ceil((size(FObj_Pop, 1) - 1)*grand(1, 1, "def")+1); + Index2 = ceil((size(FObj_Pop, 1) - 1)*grand(1, 1, "def")+1); + if (Rank(Index1)<Rank(Index2)) | ((Rank(Index1)==Rank(Index2)) & (Crowdist(Index1)>Crowdist(Index2))) then + Indiv2(j) = Pop(Index1); + FObj_Indiv2(j, :) = MO_FObj_Pop(Index1, :); + else + Indiv2(j) = Pop(Index2); + FObj_Indiv2(j, :) = MO_FObj_Pop(Index2, :); + end + end + // + // Crossover + // + for j=1:nb_couples + if (p_cross>grand(1, 1, "def")) then + [x1, x2] = crossover_func(Indiv1(j), Indiv2(j), param); + Indiv1(j) = x1; + Indiv2(j) = x2; + ToCompute_I1(j) = %T; + ToCompute_I2(j) = %T; + else + ToCompute_I1(j) = %F; + ToCompute_I2(j) = %F; + end + end + // + // Mutation + // + for j=1:nb_couples + if (p_mut>grand(1, 1, "def")) then + x1 = mutation_func(Indiv1(j), param); + Indiv1(j) = x1; + ToCompute_I1(j) = %T; + end + if (p_mut>grand(1, 1, "def")) then + x2 = mutation_func(Indiv2(j), param); + Indiv2(j) = x2; + ToCompute_I2(j) = %T; + end + end + // + // Computation of the objective functions + // + for j=1:length(Indiv1) + if ToCompute_I1(j) then FObj_Indiv1(j, :) = _ga_f(Indiv1(j)); end + if ToCompute_I2(j) then FObj_Indiv2(j, :) = _ga_f(Indiv2(j)); end + end + + // Reinit ToCompute lists + ToCompute_I1 = ToCompute_I1 & %F; + ToCompute_I2 = ToCompute_I2 & %F; + + // We merge all the individuals in one list ... + All_Pop = lstcat(Pop, Indiv1, Indiv2); + All_FObj = [FObj_Pop' FObj_Indiv1' FObj_Indiv2']'; + + // Compute the domination rank on all the population + Rank=DominationRank(All_FObj); + + // Compute the crowding distance + MO_All_FObj = All_FObj; + Index = 1:size(MO_All_FObj, 1); + Crowdist = zeros(size(MO_All_FObj, 1), 1); + for k=1:size(MO_All_FObj, 2) + [tmp, Index_List] = gsort(MO_All_FObj(:, k)); + MO_All_FObj = MO_All_FObj(Index_List, :); + Index = Index(Index_List); + Crowdist(Index_List(1)) = %inf; + Crowdist(Index_List($)) = %inf; + _Max = max(MO_All_FObj(:, k)); + _Min = min(MO_All_FObj(:, k)); + for j=2:size(MO_All_FObj, 1)-1 + Crowdist(Index(j)) = Crowdist(Index(j)) - (MO_All_FObj(j+1, k) - MO_All_FObj(j-1, k)) / (_Max - _Min); + end + end + // + // Recombination + // + // We rank all the individual wrt to the partial order + for k=1:size(All_FObj, 1)-1 + for j=k+1:size(All_FObj, 1) + if (Rank(j)<Rank(k)) | ((Rank(j)==Rank(k)) & (Crowdist(j)>Crowdist(k))) then + tmp = Rank(k); + Rank(k) = Rank(j); + Rank(j) = tmp; + tmp = Crowdist(k); + Crowdist(k) = Crowdist(j); + Crowdist(j) = tmp; + tmp = All_Pop(k); + All_Pop(k) = All_Pop(j); + All_Pop(j) = tmp; + tmp = All_FObj(k, :); + All_FObj(k, :) = All_FObj(j, :); + All_FObj(j, :) = tmp; + end + end + end + // Extraction and selection of the phenotype + FObj_Pop = All_FObj(1:pop_size, :); + // Extraction and selection of the genotype + Pop = list(All_Pop(1:pop_size)); + // Extraction of the ranks and Crow distance + Rank = Rank(1:pop_size); + Crowdist = Crowdist(1:pop_size); + + if (Log) then + stop = output_func(i, nb_generation, Pop, FObj_Pop, param); + if stop then + break + end + end + end + + pop_opt = codage_func(Pop, "decode", param); + fobj_pop_opt = FObj_Pop; +endfunction diff --git a/modules/genetic_algorithms/macros/output_ga_default.bin b/modules/genetic_algorithms/macros/output_ga_default.bin Binary files differnew file mode 100755 index 000000000..4f35d5b3d --- /dev/null +++ b/modules/genetic_algorithms/macros/output_ga_default.bin diff --git a/modules/genetic_algorithms/macros/output_ga_default.sci b/modules/genetic_algorithms/macros/output_ga_default.sci new file mode 100755 index 000000000..66c92e339 --- /dev/null +++ b/modules/genetic_algorithms/macros/output_ga_default.sci @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Michael BAUDIN <michael.baudin@contrib.scilab.org> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +// ============================================================================= + +function stop = output_ga_default(gen_index, nb_generation, Pop, FObj_Pop, param) + printf(gettext("%s: iteration %d / %d \n"), "optim_ga", gen_index, nb_generation); + printf(gettext(" min / max value found = %f / %f\n"), min(FObj_Pop), max(FObj_Pop)); + stop = %f +endfunction diff --git a/modules/genetic_algorithms/macros/output_moga_default.bin b/modules/genetic_algorithms/macros/output_moga_default.bin Binary files differnew file mode 100755 index 000000000..10a2cf82e --- /dev/null +++ b/modules/genetic_algorithms/macros/output_moga_default.bin diff --git a/modules/genetic_algorithms/macros/output_moga_default.sci b/modules/genetic_algorithms/macros/output_moga_default.sci new file mode 100755 index 000000000..607f2c010 --- /dev/null +++ b/modules/genetic_algorithms/macros/output_moga_default.sci @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) Scilab Enterprises - 2014 - Pierre-Aime Agnel +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +// ============================================================================= + +function stop = output_moga_default(gen_index, nb_generation, Pop, FObj_Pop, param) + printf(gettext("%s: iteration %d / %d \n"), "optim_moga", gen_index, nb_generation); + printf(gettext(" min / max value found = %f / %f\n"), min(FObj_Pop), max(FObj_Pop)); + stop = %f +endfunction diff --git a/modules/genetic_algorithms/macros/output_nsga2_default.bin b/modules/genetic_algorithms/macros/output_nsga2_default.bin Binary files differnew file mode 100755 index 000000000..f5413548e --- /dev/null +++ b/modules/genetic_algorithms/macros/output_nsga2_default.bin diff --git a/modules/genetic_algorithms/macros/output_nsga2_default.sci b/modules/genetic_algorithms/macros/output_nsga2_default.sci new file mode 100755 index 000000000..e38472ef1 --- /dev/null +++ b/modules/genetic_algorithms/macros/output_nsga2_default.sci @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) Scilab Enterprises - 2014 - Pierre-Aime Agnel +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +// ============================================================================= + +function stop = output_nsga2_default(gen_index, nb_generation, Pop, FObj_Pop, param) + printf(gettext("%s: iteration %d / %d\n"), "optim_nsga2", It, nb_generation); + printf(gettext(" min / max value found = %f / %f\n"), min(FObj_Pop), max(FObj_Pop)); + stop = %f +endfunction diff --git a/modules/genetic_algorithms/macros/output_nsga_default.bin b/modules/genetic_algorithms/macros/output_nsga_default.bin Binary files differnew file mode 100755 index 000000000..1766e6427 --- /dev/null +++ b/modules/genetic_algorithms/macros/output_nsga_default.bin diff --git a/modules/genetic_algorithms/macros/output_nsga_default.sci b/modules/genetic_algorithms/macros/output_nsga_default.sci new file mode 100755 index 000000000..3fc89a66a --- /dev/null +++ b/modules/genetic_algorithms/macros/output_nsga_default.sci @@ -0,0 +1,17 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) Scilab Enterprises - 2014 - Pierre-Aime Agnel +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +// ============================================================================= + +function stop = output_nsga_default(gen_index, nb_generation, Pop, FObj_Pop, param) + printf(gettext("%s: iteration %d / %d \n"), "optim_nsga", gen_index, nb_generation); + printf(gettext(" min / max value found = %f / %f\n"), min(FObj_Pop), max(FObj_Pop)); + stop = %f +endfunction + diff --git a/modules/genetic_algorithms/macros/pareto_filter.bin b/modules/genetic_algorithms/macros/pareto_filter.bin Binary files differnew file mode 100755 index 000000000..d91da6eef --- /dev/null +++ b/modules/genetic_algorithms/macros/pareto_filter.bin diff --git a/modules/genetic_algorithms/macros/pareto_filter.sci b/modules/genetic_algorithms/macros/pareto_filter.sci new file mode 100755 index 000000000..5dfb5f106 --- /dev/null +++ b/modules/genetic_algorithms/macros/pareto_filter.sci @@ -0,0 +1,44 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// Copyright (C) 2011 - INRIA - Serge STEER +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [F_out, X_out, Ind_out] = pareto_filter(F_in, X_in) + [nargout,nargin] = argn(); + if ~isdef("F_in","local") then + error(sprintf(gettext("%s: F_in is mandatory"),"pareto_filter")); + end + x_defined = (nargout>=2); + Ind_defined = (nargout==3); + + n=size(F_in,1); + Dominating(n)=%f; + for i=2:n + j=find(~Dominating(1:i-1)) + df=ones(size(j,"*"),1)*F_in(i,:)-F_in(j,:); + kd=find(and(df<=0,2) & or(df<0,2)); + if kd<>[] then + Dominating(j(kd))=%t + elseif find(and(df>=0,2) & or(df>0,2),1)<>[] then + Dominating(i) = %t + end + end + + Ind_out=find(~Dominating) + F_out = F_in(Ind_out,:); + + if x_defined & (nargin==2) then + if typeof(X_in)=="list" then + X_out = list(X_in(Ind_out)); + else + X_out = X_in(Ind_out,:); + end + elseif x_defined &(nargin~=2) + X_out = []; + end +endfunction diff --git a/modules/genetic_algorithms/macros/selection_ga_elitist.bin b/modules/genetic_algorithms/macros/selection_ga_elitist.bin Binary files differnew file mode 100755 index 000000000..96ce492aa --- /dev/null +++ b/modules/genetic_algorithms/macros/selection_ga_elitist.bin diff --git a/modules/genetic_algorithms/macros/selection_ga_elitist.sci b/modules/genetic_algorithms/macros/selection_ga_elitist.sci new file mode 100755 index 000000000..7aef5d34d --- /dev/null +++ b/modules/genetic_algorithms/macros/selection_ga_elitist.sci @@ -0,0 +1,52 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [Pop_out,FObj_Pop_out,Efficiency,MO_Total_FObj_out] = selection_ga_elitist(Pop_in,Indiv1,Indiv2,FObj_Pop_in,FObj_Indiv1,FObj_Indiv2, ... + MO_Total_FObj_in,MO_FObj_Indiv1,MO_FObj_Indiv2,param) + + [nargout,nargin] = argn(); + + mo_is_defined = ~isempty("MO_Total_FObj_in"); + + if ~isdef("param","local") then + param = []; + end + + [pressure,err] = get_param(param,"pressure",0.05); + + pop_size = length(Pop_in); + + Total_Pop = lstcat(Pop_in, Indiv1, Indiv2); + Total_FObj = [FObj_Pop_in' FObj_Indiv1' FObj_Indiv2']'; + + // Normalization of the efficiency + FObj_Pop_Max = max(Total_FObj); + FObj_Pop_Min = min(Total_FObj); + + Efficiency = (1 - pressure) * (FObj_Pop_Max - Total_FObj)/max([FObj_Pop_Max - FObj_Pop_Min, %eps]) + pressure; + [Efficiency, Index_sort] = gsort(Efficiency); + Efficiency = Efficiency(1:pop_size); + + // Extraction and selection of the phenotype + Total_FObj = Total_FObj(Index_sort); + FObj_Pop_out = Total_FObj(1:pop_size); + // Extraction and selection of the genotype + Total_Pop = list(Total_Pop(Index_sort)); + Pop_out = list(Total_Pop(1:pop_size)); + // Extraction of the multiobjective values (if defined) + if mo_is_defined then + // MO_Total_FObj for multiobjective function values + MO_Total_FObj_out = [MO_Total_FObj_in' MO_FObj_Indiv1' MO_FObj_Indiv2']'; + MO_Total_FObj_out = MO_Total_FObj_out(Index_sort,:); + MO_Total_FObj_out = MO_Total_FObj_out(1:pop_size,:); + end + + Total_Pop = list(); // Reinitialisation of Total_Pop +endfunction + diff --git a/modules/genetic_algorithms/macros/selection_ga_random.bin b/modules/genetic_algorithms/macros/selection_ga_random.bin Binary files differnew file mode 100755 index 000000000..fc692eb4c --- /dev/null +++ b/modules/genetic_algorithms/macros/selection_ga_random.bin diff --git a/modules/genetic_algorithms/macros/selection_ga_random.sci b/modules/genetic_algorithms/macros/selection_ga_random.sci new file mode 100755 index 000000000..d847df34f --- /dev/null +++ b/modules/genetic_algorithms/macros/selection_ga_random.sci @@ -0,0 +1,52 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +function [Pop_out,FObj_Pop_out,Efficiency,MO_Total_FObj_out] = selection_ga_random(Pop_in,Indiv1,Indiv2,FObj_Pop_in,FObj_Indiv1,FObj_Indiv2, ... + MO_Total_FObj_in,MO_FObj_Indiv1,MO_FObj_Indiv2,param) + + [nargout,nargin] = argn(); + + mo_is_defined = ~isempty("MO_Total_FObj_in"); + + if ~isdef("param","local") then + param = []; + end + + [pressure,err] = get_param(param,"pressure",0.05); + + pop_size = length(Pop_in); + + Total_Pop = lstcat(Pop_in, Indiv1, Indiv2); + Total_FObj = [FObj_Pop_in' FObj_Indiv1' FObj_Indiv2']'; + + // Normalization of the efficiency + FObj_Pop_Max = max(Total_FObj); + FObj_Pop_Min = min(Total_FObj); + + Efficiency = (1 - pressure) * (FObj_Pop_Max - Total_FObj)/max([FObj_Pop_Max - FObj_Pop_Min, %eps]) + pressure; + + // We select at random pop_size individuals + Index_selected = ceil((length(Total_FObj)-1)*grand(pop_size,1,"def") + 1); + + // Extraction and selection of the phenotype + FObj_Pop_out = Total_FObj(Index_selected); + // Extraction and selection of the genotype + Pop_out = list(Total_Pop(Index_selected)); + // Extraction of the efficiencies + Efficiency = Efficiency(Index_selected); + // Extraction of the multiobjective values (if defined) + if mo_is_defined then + // MO_Total_FObj for multiobjective function values + MO_Total_FObj_out = [MO_Total_FObj_in' MO_FObj_Indiv1' MO_FObj_Indiv2']'; + MO_Total_FObj_out = MO_Total_FObj_out(Index_selected,:); + end + + Total_Pop = list(); // Reinitialisation of Total_Pop +endfunction + diff --git a/modules/genetic_algorithms/tests/nonreg_tests/bug_10560.tst b/modules/genetic_algorithms/tests/nonreg_tests/bug_10560.tst new file mode 100755 index 000000000..e2c4e7c9c --- /dev/null +++ b/modules/genetic_algorithms/tests/nonreg_tests/bug_10560.tst @@ -0,0 +1,19 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- NO CHECK REF --> +// +// <-- Non-regression test for bug 10560 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10560 +// +// <-- Short Description --> +// genetic algorithms demos failed + +ierr = exec("SCI/modules/genetic_algorithms/demos/GAdemo.sce", "errcatch", -1); +assert_checkequal(ierr, 0);
\ No newline at end of file diff --git a/modules/genetic_algorithms/tests/nonreg_tests/bug_13420.dia.ref b/modules/genetic_algorithms/tests/nonreg_tests/bug_13420.dia.ref new file mode 100755 index 000000000..734d20e12 --- /dev/null +++ b/modules/genetic_algorithms/tests/nonreg_tests/bug_13420.dia.ref @@ -0,0 +1,26 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13420 +// +// <-- Short Description --> +// mutation_ga_binary did not properly write mutliple mutations +// +// <-- CLI SHELL MODE --> +param = init_param("binary_length", 8, "multi_mut", %t, "multi_mut_nb", 6); +for i = 1:100 + A = "11100011"; + [A_mut, pos] = mutation_ga_binary(A, param); + A = strsplit(A); + A_mut = strsplit(A_mut); + tst_mut = A(pos) <> A_mut(pos); + tst_notmut = A(setdiff(1:8, pos)) == A_mut(setdiff(1:8, pos)); + assert_checktrue(and(tst_mut)); + assert_checktrue(and(tst_notmut)); +end diff --git a/modules/genetic_algorithms/tests/nonreg_tests/bug_13420.tst b/modules/genetic_algorithms/tests/nonreg_tests/bug_13420.tst new file mode 100755 index 000000000..718768914 --- /dev/null +++ b/modules/genetic_algorithms/tests/nonreg_tests/bug_13420.tst @@ -0,0 +1,31 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13420 +// +// <-- Short Description --> +// mutation_ga_binary did not properly write mutliple mutations +// +// <-- CLI SHELL MODE --> + +param = init_param("binary_length", 8, "multi_mut", %t, "multi_mut_nb", 6); + +for i = 1:100 + A = "11100011"; + [A_mut, pos] = mutation_ga_binary(A, param); + + A = strsplit(A); + A_mut = strsplit(A_mut); + + tst_mut = A(pos) <> A_mut(pos); + tst_notmut = A(setdiff(1:8, pos)) == A_mut(setdiff(1:8, pos)); + + assert_checktrue(and(tst_mut)); + assert_checktrue(and(tst_notmut)); +end diff --git a/modules/genetic_algorithms/tests/nonreg_tests/bug_13421.dia.ref b/modules/genetic_algorithms/tests/nonreg_tests/bug_13421.dia.ref new file mode 100755 index 000000000..46e2e3528 --- /dev/null +++ b/modules/genetic_algorithms/tests/nonreg_tests/bug_13421.dia.ref @@ -0,0 +1,87 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13421 +// +// <-- Short Description --> +// Callback functions for genetic algorithms were missing +// +// <-- CLI SHELL MODE --> +// <-- ENGLISH IMPOSED --> +// Objective function +function y=f(x) + y = sum(x.^2) +endfunction +// Output function with a stop criterion +function stop=output_ga_custom(gen_index, nb_generation, Pop, FObj_Pop, param) + [threshold, err] = get_param(param, "threshold", 1E-10); // default value for the threshold + printf(_("%s: iteration %d / %d \n"), "optim_ga", gen_index, nb_generation); + printf(_(" min / max value found = %.4E / %.4E\n"), min(FObj_Pop), max(FObj_Pop)); + stop = %f + if abs(max(FObj_Pop) - min(FObj_Pop)) < threshold then + printf(_(" Stop criterion reached: Delta Max to Min under threshold")); + stop = %t + end +endfunction +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 20; +NbCouples = 110; +Log = %T; +pressure = 0.05; +ga_params = init_param(); +// Parameters to adapt to the shape of the optimization problem +ga_params = add_param(ga_params,"minbound",[-2; -2]); +ga_params = add_param(ga_params,"maxbound",[2; 2]); +ga_params = add_param(ga_params,"dimension",2); +ga_params = add_param(ga_params,"beta",0); +ga_params = add_param(ga_params,"delta",0.1); +// Parameters to fine tune the Genetic algorithm. +// All these parameters are optional for continuous optimization +// If you need to adapt the GA to a special problem, you +ga_params = add_param(ga_params,"init_func",init_ga_default); +ga_params = add_param(ga_params,"crossover_func",crossover_ga_default); +ga_params = add_param(ga_params,"mutation_func",mutation_ga_default); +ga_params = add_param(ga_params,"codage_func",coding_ga_identity); +ga_params = add_param(ga_params,"selection_func",selection_ga_elitist); +//ga_params = add_param(ga_params,"selection_func",selection_ga_random); +ga_params = add_param(ga_params,"nb_couples",NbCouples); +ga_params = add_param(ga_params,"pressure",pressure); +// Customized output function with a stop criterion added +ga_params = add_param(ga_params, "threshold", 1E-6); // User defined parameter for the output function +ga_params = add_param(ga_params, "output_func", output_ga_custom); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. + optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +optim_ga: iteration 1 / 20 + min / max value found = 6.4854E-03 / 1.1026E+00 +optim_ga: iteration 2 / 20 + min / max value found = 4.2909E-03 / 2.8682E-01 +optim_ga: iteration 3 / 20 + min / max value found = 3.1174E-05 / 5.6912E-02 +optim_ga: iteration 4 / 20 + min / max value found = 3.1174E-05 / 1.8523E-02 +optim_ga: iteration 5 / 20 + min / max value found = 3.1174E-05 / 4.2909E-03 +optim_ga: iteration 6 / 20 + min / max value found = 2.0292E-05 / 1.2683E-03 +optim_ga: iteration 7 / 20 + min / max value found = 9.9116E-06 / 2.9666E-04 +optim_ga: iteration 8 / 20 + min / max value found = 1.1124E-06 / 7.9347E-05 +optim_ga: iteration 9 / 20 + min / max value found = 4.0632E-07 / 3.3694E-05 +optim_ga: iteration 10 / 20 + min / max value found = 3.4754E-07 / 9.9116E-06 +optim_ga: iteration 11 / 20 + min / max value found = 3.4470E-08 / 2.2709E-06 +optim_ga: iteration 12 / 20 + min / max value found = 3.4470E-08 / 9.0795E-07 + Stop criterion reached: Delta Max to Min under thresholdassert_checktrue(max(fobj_pop_opt) - min(fobj_pop_opt) <= 1E-6); diff --git a/modules/genetic_algorithms/tests/nonreg_tests/bug_13421.tst b/modules/genetic_algorithms/tests/nonreg_tests/bug_13421.tst new file mode 100755 index 000000000..04d71e801 --- /dev/null +++ b/modules/genetic_algorithms/tests/nonreg_tests/bug_13421.tst @@ -0,0 +1,71 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Pierre-Aime Agnel +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- Non-regression test for bug --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/13421 +// +// <-- Short Description --> +// Callback functions for genetic algorithms were missing +// +// <-- CLI SHELL MODE --> +// <-- ENGLISH IMPOSED --> + +// Objective function +function y=f(x) + y = sum(x.^2) +endfunction + +// Output function with a stop criterion +function stop=output_ga_custom(gen_index, nb_generation, Pop, FObj_Pop, param) + [threshold, err] = get_param(param, "threshold", 1E-10); // default value for the threshold + printf(_("%s: iteration %d / %d \n"), "optim_ga", gen_index, nb_generation); + printf(_(" min / max value found = %.4E / %.4E\n"), min(FObj_Pop), max(FObj_Pop)); + stop = %f + if abs(max(FObj_Pop) - min(FObj_Pop)) < threshold then + printf(_(" Stop criterion reached: Delta Max to Min under threshold")); + stop = %t + end +endfunction + +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 20; +NbCouples = 110; +Log = %T; +pressure = 0.05; + +ga_params = init_param(); +// Parameters to adapt to the shape of the optimization problem +ga_params = add_param(ga_params,"minbound",[-2; -2]); +ga_params = add_param(ga_params,"maxbound",[2; 2]); +ga_params = add_param(ga_params,"dimension",2); +ga_params = add_param(ga_params,"beta",0); +ga_params = add_param(ga_params,"delta",0.1); +// Parameters to fine tune the Genetic algorithm. +// All these parameters are optional for continuous optimization +// If you need to adapt the GA to a special problem, you +ga_params = add_param(ga_params,"init_func",init_ga_default); +ga_params = add_param(ga_params,"crossover_func",crossover_ga_default); +ga_params = add_param(ga_params,"mutation_func",mutation_ga_default); +ga_params = add_param(ga_params,"codage_func",coding_ga_identity); +ga_params = add_param(ga_params,"selection_func",selection_ga_elitist); + +//ga_params = add_param(ga_params,"selection_func",selection_ga_random); +ga_params = add_param(ga_params,"nb_couples",NbCouples); +ga_params = add_param(ga_params,"pressure",pressure); + +// Customized output function with a stop criterion added +ga_params = add_param(ga_params, "threshold", 1E-6); // User defined parameter for the output function +ga_params = add_param(ga_params, "output_func", output_ga_custom); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + +assert_checktrue(max(fobj_pop_opt) - min(fobj_pop_opt) <= 1E-6); diff --git a/modules/genetic_algorithms/tests/nonreg_tests/bug_8415.dia.ref b/modules/genetic_algorithms/tests/nonreg_tests/bug_8415.dia.ref new file mode 100755 index 000000000..cc39fcc50 --- /dev/null +++ b/modules/genetic_algorithms/tests/nonreg_tests/bug_8415.dia.ref @@ -0,0 +1,77 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- ENGLISH IMPOSED --> +// +// <-- Non-regression test for bug 8415 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8415 +// +// <-- Short Description --> +// optim_moga(), optim_nsga() and optim_nsga2() can now take list as arguments, as announced in the doc. +// With a list for cost function +function f = deb_2(x, p1, p2) + f1_x1 = x(1); + g_x2 = p1 + p2 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); + h = 1 - sqrt(f1_x1 / g_x2); + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; +endfunction +PopSize = 100; +Proba_cross = 0.5; +Proba_mut = 0.3; +NbGen = 4; +NbCouples = 110; +Log = %T; +nb_disp = 10; // Nb point to display from the optimal population +pressure = 0.1; +ga_params = init_param(); +ga_params = add_param(ga_params, "dimension", 2); +ga_params = add_param(ga_params, "minbound", zeros(2, 1)); +ga_params = add_param(ga_params, "maxbound", ones(2, 1)); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_moga(list(deb_2, 1, 9), PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +optim_moga: Initialization of the population +optim_moga: iteration 1 / 4 + min / max value found = 0.029324 / 1.259517 +optim_moga: iteration 2 / 4 + min / max value found = 0.098841 / 0.732534 +optim_moga: iteration 3 / 4 + min / max value found = 0.124679 / 0.656770 +optim_moga: iteration 4 / 4 + min / max value found = 0.225319 / 0.525795 +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_nsga(list(deb_2, 1, 9), PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +optim_nsga: Initialization of the population +optim_nsga: iteration 1 / 4 + min / max value found = 0.001301 / 2.440339 +optim_nsga: iteration 2 / 4 + min / max value found = 0.015645 / 0.948523 +optim_nsga: iteration 3 / 4 + min / max value found = 0.093593 / 0.695988 +optim_nsga: iteration 4 / 4 + min / max value found = 0.112577 / 0.665168 +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_nsga2(list(deb_2, 1, 9), PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +optim_nsga2: Initialization of the population +optim_nsga2: iteration 1 / 4 + min / max value found = 0.002139 / 7.982432 +optim_nsga2: iteration 2 / 4 + min / max value found = 0.000000 / 1.777920 +optim_nsga2: iteration 3 / 4 + min / max value found = 0.000000 / 4.417277 +optim_nsga2: iteration 4 / 4 + min / max value found = 0.000000 / 1.323218 +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); diff --git a/modules/genetic_algorithms/tests/nonreg_tests/bug_8415.tst b/modules/genetic_algorithms/tests/nonreg_tests/bug_8415.tst new file mode 100755 index 000000000..7e7a65a96 --- /dev/null +++ b/modules/genetic_algorithms/tests/nonreg_tests/bug_8415.tst @@ -0,0 +1,59 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- CLI SHELL MODE --> +// +// <-- ENGLISH IMPOSED --> +// +// <-- Non-regression test for bug 8415 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8415 +// +// <-- Short Description --> +// optim_moga(), optim_nsga() and optim_nsga2() can now take list as arguments, as announced in the doc. + +// With a list for cost function +function f = deb_2(x, p1, p2) + f1_x1 = x(1); + g_x2 = p1 + p2 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); + h = 1 - sqrt(f1_x1 / g_x2); + f(1,1) = f1_x1; + f(1,2) = g_x2 * h; +endfunction + +PopSize = 100; +Proba_cross = 0.5; +Proba_mut = 0.3; +NbGen = 4; +NbCouples = 110; +Log = %T; +nb_disp = 10; // Nb point to display from the optimal population +pressure = 0.1; + +ga_params = init_param(); +ga_params = add_param(ga_params, "dimension", 2); +ga_params = add_param(ga_params, "minbound", zeros(2, 1)); +ga_params = add_param(ga_params, "maxbound", ones(2, 1)); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_moga(list(deb_2, 1, 9), PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_nsga(list(deb_2, 1, 9), PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_nsga2(list(deb_2, 1, 9), PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); diff --git a/modules/genetic_algorithms/tests/nonreg_tests/bug_8964.dia.ref b/modules/genetic_algorithms/tests/nonreg_tests/bug_8964.dia.ref new file mode 100755 index 000000000..e85a64587 --- /dev/null +++ b/modules/genetic_algorithms/tests/nonreg_tests/bug_8964.dia.ref @@ -0,0 +1,51 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - S/E - Sylvestre Ledru +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- NO CHECK REF --> +// +// <-- Non-regression test for bug 8964 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8964 +// +// <-- Short Description --> +// The optim_* function may not create pop_init. +// 1. Define the Rastrigin function. +function y = rastriginV ( x1 , x2 ) + // Vectorized function for contouring. + y = x1.^2 + x2.^2-cos(12*x1)-cos(18*x2) +endfunction +function y = rastrigin ( x ) + // Non-vectorized function for optimization. + y = rastriginV ( x(1) , x(2) ) +endfunction +// 2. Compute the optimum. +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 10; +NbCouples = 110; +Log = %T; +ga_params = init_param(); +ga_params = add_param(ga_params,"minbound",[-1 -1]'); +ga_params = add_param(ga_params,"maxbound",[1 1]'); +ga_params = add_param(ga_params,"dimension",2); +[pop_opt, fobj_pop_opt, pop_init] = optim_ga(rastrigin, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +optim_ga: Initialization of the population +optim_ga: iteration 1 / 10 - min / max value found = -1.672837 / -0.107933 +optim_ga: iteration 2 / 10 - min / max value found = -1.883604 / -0.526168 +optim_ga: iteration 3 / 10 - min / max value found = -1.906659 / -1.048334 +optim_ga: iteration 4 / 10 - min / max value found = -1.990831 / -1.282218 +optim_ga: iteration 5 / 10 - min / max value found = -1.990831 / -1.479429 +optim_ga: iteration 6 / 10 - min / max value found = -1.990831 / -1.554544 +optim_ga: iteration 7 / 10 - min / max value found = -1.990831 / -1.624791 +optim_ga: iteration 8 / 10 - min / max value found = -1.990831 / -1.774173 +optim_ga: iteration 9 / 10 - min / max value found = -1.994666 / -1.856775 +optim_ga: iteration 10 / 10 - min / max value found = -1.998189 / -1.923837 +// If it fails like in the past, the following tests will fail +assert_checkequal(size(pop_opt),100); +assert_checkequal(size(pop_init),100); diff --git a/modules/genetic_algorithms/tests/nonreg_tests/bug_8964.tst b/modules/genetic_algorithms/tests/nonreg_tests/bug_8964.tst new file mode 100755 index 000000000..d5c2e48c5 --- /dev/null +++ b/modules/genetic_algorithms/tests/nonreg_tests/bug_8964.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - S/E - Sylvestre Ledru +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- NO CHECK REF --> +// +// <-- Non-regression test for bug 8964 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=8964 +// +// <-- Short Description --> +// The optim_* function may not create pop_init. +// 1. Define the Rastrigin function. +function y = rastriginV ( x1 , x2 ) + // Vectorized function for contouring. + y = x1.^2 + x2.^2-cos(12*x1)-cos(18*x2) +endfunction + +function y = rastrigin ( x ) + // Non-vectorized function for optimization. + y = rastriginV ( x(1) , x(2) ) +endfunction + +// 2. Compute the optimum. +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 10; +NbCouples = 110; +Log = %T; + +ga_params = init_param(); +ga_params = add_param(ga_params,"minbound",[-1 -1]'); +ga_params = add_param(ga_params,"maxbound",[1 1]'); +ga_params = add_param(ga_params,"dimension",2); + + +[pop_opt, fobj_pop_opt, pop_init] = optim_ga(rastrigin, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +// If it fails like in the past, the following tests will fail + +assert_checkequal(size(pop_opt),100); +assert_checkequal(size(pop_init),100); diff --git a/modules/genetic_algorithms/tests/unit_tests/coding_ga_binary.dia.ref b/modules/genetic_algorithms/tests/unit_tests/coding_ga_binary.dia.ref new file mode 100755 index 000000000..2c24ba43c --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/coding_ga_binary.dia.ref @@ -0,0 +1,15 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +pop_in = list(); +pop_in(1) = 2; +pop_out = coding_ga_binary(pop_in,'code',[]); +if length(pop_out(1))~=8 then bugmes();quit;end +if pop_out(1)~='11111111' then bugmes();quit;end +pop_in_2 = coding_ga_binary(pop_out,'decode',[]); +if pop_in_2(1)~=2 then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/coding_ga_binary.tst b/modules/genetic_algorithms/tests/unit_tests/coding_ga_binary.tst new file mode 100755 index 000000000..2b2cb6ff7 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/coding_ga_binary.tst @@ -0,0 +1,23 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +pop_in = list(); +pop_in(1) = 2; + +pop_out = coding_ga_binary(pop_in,'code',[]); + +if length(pop_out(1))~=8 then pause,end +if pop_out(1)~='11111111' then pause,end + +pop_in_2 = coding_ga_binary(pop_out,'decode',[]); + +if pop_in_2(1)~=2 then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/coding_ga_identity.dia.ref b/modules/genetic_algorithms/tests/unit_tests/coding_ga_identity.dia.ref new file mode 100755 index 000000000..0565b067c --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/coding_ga_identity.dia.ref @@ -0,0 +1,14 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +pop_in = list(); +pop_in(1) = 2; +pop_out = coding_ga_identity(pop_in,'code',[]); +if pop_out(1)~=2 then bugmes();quit;end +pop_in_2 = coding_ga_identity(pop_out,'decode',[]); +if pop_in_2(1)~=2 then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/coding_ga_identity.tst b/modules/genetic_algorithms/tests/unit_tests/coding_ga_identity.tst new file mode 100755 index 000000000..19b421915 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/coding_ga_identity.tst @@ -0,0 +1,22 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +pop_in = list(); +pop_in(1) = 2; + +pop_out = coding_ga_identity(pop_in,'code',[]); + +if pop_out(1)~=2 then pause,end + +pop_in_2 = coding_ga_identity(pop_out,'decode',[]); + +if pop_in_2(1)~=2 then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/convert_to_float.dia.ref b/modules/genetic_algorithms/tests/unit_tests/convert_to_float.dia.ref new file mode 100755 index 000000000..f4159420b --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/convert_to_float.dia.ref @@ -0,0 +1,10 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +y = convert_to_float('11111111', 8, 2, -2); +if y~=2 then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/convert_to_float.tst b/modules/genetic_algorithms/tests/unit_tests/convert_to_float.tst new file mode 100755 index 000000000..a1c01ac61 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/convert_to_float.tst @@ -0,0 +1,15 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +y = convert_to_float('11111111', 8, 2, -2); + +if y~=2 then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/crossover_ga_binary.dia.ref b/modules/genetic_algorithms/tests/unit_tests/crossover_ga_binary.dia.ref new file mode 100755 index 000000000..37893622b --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/crossover_ga_binary.dia.ref @@ -0,0 +1,86 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// Copyright (C) Scilab Enterprises - 2014 - Pierre-Aime Agnel +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +// <-- CLI SHELL MODE --> +[Crossed_Indiv1, Crossed_Indiv2] = crossover_ga_binary('11111111','00000000',[]); +if (length(Crossed_Indiv1)~=8) | (length(Crossed_Indiv2)~=8) then bugmes();quit;end +//============================================================================== +// Nominal Behaviour +//============================================================================== +param = init_param("binary_length", 8, "multi_cross", %F, "multi_cross_nb", 1); +A = "11111111"; +B = "00000000"; +// Reinitialize the seed +grand("setsd", 0); +[A_crossed, B_crossed, mix] = crossover_ga_binary(A, B); +// Reinitialize the seed +grand("setsd", 0); +[A_crossed_p, B_crossed_p, mix] = crossover_ga_binary(A, B, param); +//====================================== +// Check default behaviour of param +//====================================== +assert_checkequal(A_crossed_p, A_crossed); +assert_checkequal(B_crossed_p, B_crossed); +assert_checkequal(size(mix, "*"), 1); +//====================================== +// Check the crossover occurred +//====================================== +// Heads +assert_checkequal(part(A, 1:mix), part(A_crossed, 1:mix)); +assert_checkequal(part(B, 1:mix), part(B_crossed, 1:mix)); +// Tails +assert_checkequal(part(A, (mix + 1):$), part(B_crossed, (mix + 1):$)); +assert_checkequal(part(B, (mix + 1):$), part(A_crossed, (mix + 1):$)); +//====================================== +// Binary length +//====================================== +param = set_param(param, "binary_length", 16); +A = dec2bin(2^16 - 1, 16); // 11111111 11111111 +B = dec2bin(0, 16); // 00000000 00000000 +[A_crossed, B_crossed, mix] = crossover_ga_binary(A, B, param); +assert_checkequal(length(A_crossed), 16); +assert_checkequal(length(B_crossed), 16); +//====================================== +// Multiple Crossover +//====================================== +param = init_param("binary_length", 16, "multi_cross", %T); +s_mix = 0; +iter = 0; +// By default 2 crossovers +while s_mix < 2 & iter <= 100 + [A_crossed, B_crossed, mix] = crossover_ga_binary(A, B, param); + s_mix = size(mix, "*"); + iter = iter + 1; +end +// Warning probabilistic test +assert_checktrue(s_mix == 2); // we have reached one mix of length 2 +assert_checkfalse(iter>=100); // we have done it under 100 tries +assert_checkequal(part(A_crossed, 1:mix(1)), part(A, 1:mix(1))); +assert_checkequal(part(B_crossed, 1:mix(1)), part(B, 1:mix(1))); +// Swapped +assert_checkequal(part(A_crossed, (mix(1) + 1):mix(2)), part(B, (mix(1) + 1):mix(2))); +assert_checkequal(part(B_crossed, (mix(1) + 1):mix(2)), part(A, (mix(1) + 1):mix(2))); +// Same +assert_checkequal(part(A_crossed, (mix(2) + 1):$), part(A, (mix(2) + 1):$)); +assert_checkequal(part(B_crossed, (mix(2) + 1):$), part(B, (mix(2) + 1):$)); +//====================================== +// Multiple Crossover Number +//====================================== +param = init_param("binary_length", 16, "multi_cross", %T, "multi_cross_nb", 4); +s_mix = 0; +iter = 0; +// By default 2 crossovers +while s_mix < 4 & iter <= 100 + [A_crossed, B_crossed, mix] = crossover_ga_binary(A, B, param); + s_mix = size(mix, "*"); + iter = iter + 1; +end +// Warning probabilistic test +assert_checktrue(s_mix == 4); // we have reached one mix of length 4 +assert_checkfalse(iter>=100); // we have done it under 100 tries diff --git a/modules/genetic_algorithms/tests/unit_tests/crossover_ga_binary.tst b/modules/genetic_algorithms/tests/unit_tests/crossover_ga_binary.tst new file mode 100755 index 000000000..3a9748460 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/crossover_ga_binary.tst @@ -0,0 +1,103 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// Copyright (C) Scilab Enterprises - 2014 - Pierre-Aime Agnel +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +[Crossed_Indiv1, Crossed_Indiv2] = crossover_ga_binary('11111111','00000000',[]); + +if (length(Crossed_Indiv1)~=8) | (length(Crossed_Indiv2)~=8) then pause,end + +//============================================================================== +// Nominal Behaviour +//============================================================================== +param = init_param("binary_length", 8, "multi_cross", %F, "multi_cross_nb", 1); +A = "11111111"; +B = "00000000"; + +// Reinitialize the seed +grand("setsd", 0); +[A_crossed, B_crossed, mix] = crossover_ga_binary(A, B); + +// Reinitialize the seed +grand("setsd", 0); +[A_crossed_p, B_crossed_p, mix] = crossover_ga_binary(A, B, param); + +//====================================== +// Check default behaviour of param +//====================================== +assert_checkequal(A_crossed_p, A_crossed); +assert_checkequal(B_crossed_p, B_crossed); +assert_checkequal(size(mix, "*"), 1); + +//====================================== +// Check the crossover occurred +//====================================== +// Heads +assert_checkequal(part(A, 1:mix), part(A_crossed, 1:mix)); +assert_checkequal(part(B, 1:mix), part(B_crossed, 1:mix)); +// Tails +assert_checkequal(part(A, (mix + 1):$), part(B_crossed, (mix + 1):$)); +assert_checkequal(part(B, (mix + 1):$), part(A_crossed, (mix + 1):$)); + +//====================================== +// Binary length +//====================================== +param = set_param(param, "binary_length", 16); +A = dec2bin(2^16 - 1, 16); // 11111111 11111111 +B = dec2bin(0, 16); // 00000000 00000000 + +[A_crossed, B_crossed, mix] = crossover_ga_binary(A, B, param); +assert_checkequal(length(A_crossed), 16); +assert_checkequal(length(B_crossed), 16); + +//====================================== +// Multiple Crossover +//====================================== +param = init_param("binary_length", 16, "multi_cross", %T); +s_mix = 0; +iter = 0; +// By default 2 crossovers +while s_mix < 2 & iter <= 100 + [A_crossed, B_crossed, mix] = crossover_ga_binary(A, B, param); + s_mix = size(mix, "*"); + iter = iter + 1; +end + +// Warning probabilistic test +assert_checktrue(s_mix == 2); // we have reached one mix of length 2 +assert_checkfalse(iter>=100); // we have done it under 100 tries +assert_checkequal(part(A_crossed, 1:mix(1)), part(A, 1:mix(1))); +assert_checkequal(part(B_crossed, 1:mix(1)), part(B, 1:mix(1))); + +// Swapped +assert_checkequal(part(A_crossed, (mix(1) + 1):mix(2)), part(B, (mix(1) + 1):mix(2))); +assert_checkequal(part(B_crossed, (mix(1) + 1):mix(2)), part(A, (mix(1) + 1):mix(2))); + +// Same +assert_checkequal(part(A_crossed, (mix(2) + 1):$), part(A, (mix(2) + 1):$)); +assert_checkequal(part(B_crossed, (mix(2) + 1):$), part(B, (mix(2) + 1):$)); + +//====================================== +// Multiple Crossover Number +//====================================== +param = init_param("binary_length", 16, "multi_cross", %T, "multi_cross_nb", 4); +s_mix = 0; +iter = 0; +// By default 2 crossovers +while s_mix < 4 & iter <= 100 + [A_crossed, B_crossed, mix] = crossover_ga_binary(A, B, param); + s_mix = size(mix, "*"); + iter = iter + 1; +end + +// Warning probabilistic test +assert_checktrue(s_mix == 4); // we have reached one mix of length 4 +assert_checkfalse(iter>=100); // we have done it under 100 tries diff --git a/modules/genetic_algorithms/tests/unit_tests/crossover_ga_default.dia.ref b/modules/genetic_algorithms/tests/unit_tests/crossover_ga_default.dia.ref new file mode 100755 index 000000000..8830d5046 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/crossover_ga_default.dia.ref @@ -0,0 +1,10 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +[Crossed_Indiv1, Crossed_Indiv2] = crossover_ga_default(1,-1,[]); +if (Crossed_Indiv1<-1) | (Crossed_Indiv1>1) | (Crossed_Indiv2<-1) | (Crossed_Indiv2>1) then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/crossover_ga_default.tst b/modules/genetic_algorithms/tests/unit_tests/crossover_ga_default.tst new file mode 100755 index 000000000..d46e78b6e --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/crossover_ga_default.tst @@ -0,0 +1,15 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +[Crossed_Indiv1, Crossed_Indiv2] = crossover_ga_default(1,-1,[]); + +if (Crossed_Indiv1<-1) | (Crossed_Indiv1>1) | (Crossed_Indiv2<-1) | (Crossed_Indiv2>1) then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/init_ga_default.dia.ref b/modules/genetic_algorithms/tests/unit_tests/init_ga_default.dia.ref new file mode 100755 index 000000000..c9638b981 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/init_ga_default.dia.ref @@ -0,0 +1,11 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +Pop_init = init_ga_default(10,[]); +if length(Pop_init)~=10 then bugmes();quit;end; +if max(size(Pop_init(1)))~=2 then bugmes();quit;end; diff --git a/modules/genetic_algorithms/tests/unit_tests/init_ga_default.tst b/modules/genetic_algorithms/tests/unit_tests/init_ga_default.tst new file mode 100755 index 000000000..bb2fd747f --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/init_ga_default.tst @@ -0,0 +1,16 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +Pop_init = init_ga_default(10,[]); + +if length(Pop_init)~=10 then pause,end; +if max(size(Pop_init(1)))~=2 then pause,end; diff --git a/modules/genetic_algorithms/tests/unit_tests/mutation_ga_binary.dia.ref b/modules/genetic_algorithms/tests/unit_tests/mutation_ga_binary.dia.ref new file mode 100755 index 000000000..6547b168b --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/mutation_ga_binary.dia.ref @@ -0,0 +1,10 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +Mut_Indiv = mutation_ga_binary('11111111',[]); +if length(Mut_Indiv)~=8 then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/mutation_ga_binary.tst b/modules/genetic_algorithms/tests/unit_tests/mutation_ga_binary.tst new file mode 100755 index 000000000..c2df9572a --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/mutation_ga_binary.tst @@ -0,0 +1,15 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +Mut_Indiv = mutation_ga_binary('11111111',[]); + +if length(Mut_Indiv)~=8 then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/mutation_ga_default.dia.ref b/modules/genetic_algorithms/tests/unit_tests/mutation_ga_default.dia.ref new file mode 100755 index 000000000..0cb464989 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/mutation_ga_default.dia.ref @@ -0,0 +1,10 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +Mut_Indiv = mutation_ga_default(2,[]); +if (Mut_Indiv>2) | (Mut_Indiv<-2) then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/mutation_ga_default.tst b/modules/genetic_algorithms/tests/unit_tests/mutation_ga_default.tst new file mode 100755 index 000000000..67fbfdeb0 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/mutation_ga_default.tst @@ -0,0 +1,15 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +Mut_Indiv = mutation_ga_default(2,[]); + +if (Mut_Indiv>2) | (Mut_Indiv<-2) then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/optim_ga.dia.ref b/modules/genetic_algorithms/tests/unit_tests/optim_ga.dia.ref new file mode 100755 index 000000000..fbff95a84 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/optim_ga.dia.ref @@ -0,0 +1,163 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier: standardized and added tests +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +// +// <-- CLI SHELL MODE --> +// <-- ENGLISH IMPOSED --> +// Minimizing a quadratic function in dimension 1. +deff("y = test_func(x)", "y = x^2;"); +ga_params = init_param(); +ga_params = add_param(ga_params, "dimension", 1); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_ga(test_func, 50, 10, 0.1, 0.7, %F, ga_params); +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); +// In the following example, we customize all the options in order to show all the features of the algorithm, +// and we increase the dimension. +function y = f(x) + y = sum(x.^2); +endfunction +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 10; +NbCouples = 110; +Log = %T; +pressure = 0.05; +ga_params = init_param(); +// Parameters to adapt to the shape of the optimization problem +ga_params = add_param(ga_params, "minbound", [-2; -2]); +ga_params = add_param(ga_params, "maxbound", [2; 2]); +ga_params = add_param(ga_params, "dimension", 2); +ga_params = add_param(ga_params, "beta", 0); +ga_params = add_param(ga_params, "delta", 0.1); +// Parameters to fine tune the Genetic algorithm. +// All these parameters are optional for continuous optimization +// If you need to adapt the GA to a special problem, you +ga_params = add_param(ga_params, "init_func", init_ga_default); +ga_params = add_param(ga_params, "crossover_func", crossover_ga_default); +ga_params = add_param(ga_params, "mutation_func", mutation_ga_default); +ga_params = add_param(ga_params, "codage_func", coding_ga_identity); +ga_params = add_param(ga_params, "selection_func", selection_ga_elitist); +//ga_params = add_param(ga_params, "selection_func", selection_ga_random); +ga_params = add_param(ga_params, "nb_couples", NbCouples); +ga_params = add_param(ga_params, "pressure", pressure); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +optim_ga: iteration 1 / 10 + min / max value found = 0.001391 / 0.995046 +optim_ga: iteration 2 / 10 + min / max value found = 0.000341 / 0.177816 +optim_ga: iteration 3 / 10 + min / max value found = 0.000133 / 0.044825 +optim_ga: iteration 4 / 10 + min / max value found = 0.000002 / 0.010889 +optim_ga: iteration 5 / 10 + min / max value found = 0.000002 / 0.001507 +optim_ga: iteration 6 / 10 + min / max value found = 0.000002 / 0.000310 +optim_ga: iteration 7 / 10 + min / max value found = 0.000001 / 0.000089 +optim_ga: iteration 8 / 10 + min / max value found = 0.000000 / 0.000014 +optim_ga: iteration 9 / 10 + min / max value found = 0.000000 / 0.000003 +optim_ga: iteration 10 / 10 + min / max value found = 0.000000 / 0.000001 +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); +// Customizing the init function, which computes the initial population. +function Pop_init = myinitga(popsize, param) + // This message is to be displayed in the console + // for demonstration purpose only : + // remove it in a real application! + disp("Initializing the Population with grand") + // We deal with some parameters to take into account + // the boundary of the domain and the neighborhood size + [Dim, err] = get_param(param, "dimension", 2) + [MinBounds, err] = get_param(param, "minbound", -2*ones(1, Dim)) + [MaxBounds, err] = get_param(param, "maxbound", 2*ones(1, Dim)) + // Pop_init must be a list() + Pop_init = list() + nr = size(MaxBounds, 1) + nc = size(MaxBounds, 2) + for i=1:popsize + u = grand(nr, nc, "def") + Pop_init(i) = (MaxBounds - MinBounds).*u + MinBounds + end +endfunction +ga_params = init_param(); +// Parameters to adapt to the shape of the optimization problem +ga_params = add_param(ga_params, "minbound", [-2; -2]); +ga_params = add_param(ga_params, "maxbound", [2; 2]); +ga_params = add_param(ga_params, "dimension", 2); +ga_params = add_param(ga_params, "init_func", myinitga); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); + + Initializing the Population with grand +optim_ga: iteration 1 / 10 + min / max value found = 0.010016 / 0.928237 +optim_ga: iteration 2 / 10 + min / max value found = 0.001402 / 0.198423 +optim_ga: iteration 3 / 10 + min / max value found = 0.000809 / 0.045008 +optim_ga: iteration 4 / 10 + min / max value found = 0.000053 / 0.013969 +optim_ga: iteration 5 / 10 + min / max value found = 0.000053 / 0.003974 +optim_ga: iteration 6 / 10 + min / max value found = 0.000040 / 0.000922 +optim_ga: iteration 7 / 10 + min / max value found = 0.000005 / 0.000240 +optim_ga: iteration 8 / 10 + min / max value found = 0.000001 / 0.000057 +optim_ga: iteration 9 / 10 + min / max value found = 0.000000 / 0.000020 +optim_ga: iteration 10 / 10 + min / max value found = 0.000000 / 0.000007 +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); +// Passing a list to the optim_ga function, where the first element of the list is +// the function and the remaining elements are the extra parameters. Dimension 3. +function y = f(x, a1, a2) + y = a1*sum(x.^2) + a2; +endfunction +Warning : redefining function: f . Use funcprot(0) to avoid this message + +ga_params = init_param(); +// Parameters to control the initial population. +ga_params = add_param(ga_params, "dimension", 3); +// Pass the extra parameters to the objective function +a1 = 12; +a2 = 7; +myobjfun = list(f, a1, a2); +// Optimize ! +[pop_opt, fobj_pop_opt] = optim_ga(myobjfun, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +optim_ga: iteration 1 / 10 + min / max value found = 7.339791 / 29.150584 +optim_ga: iteration 2 / 10 + min / max value found = 7.054037 / 12.127766 +optim_ga: iteration 3 / 10 + min / max value found = 7.048084 / 9.120917 +optim_ga: iteration 4 / 10 + min / max value found = 7.025101 / 7.630176 +optim_ga: iteration 5 / 10 + min / max value found = 7.007453 / 7.191936 +optim_ga: iteration 6 / 10 + min / max value found = 7.005699 / 7.054037 +optim_ga: iteration 7 / 10 + min / max value found = 7.000896 / 7.020325 +optim_ga: iteration 8 / 10 + min / max value found = 7.000375 / 7.007070 +optim_ga: iteration 9 / 10 + min / max value found = 7.000156 / 7.002255 +optim_ga: iteration 10 / 10 + min / max value found = 7.000112 / 7.000828 +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); diff --git a/modules/genetic_algorithms/tests/unit_tests/optim_ga.tst b/modules/genetic_algorithms/tests/unit_tests/optim_ga.tst new file mode 100755 index 000000000..efdb17b40 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/optim_ga.tst @@ -0,0 +1,111 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier: standardized and added tests +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +// +// <-- CLI SHELL MODE --> + +// <-- ENGLISH IMPOSED --> + +// Minimizing a quadratic function in dimension 1. +deff("y = test_func(x)", "y = x^2;"); +ga_params = init_param(); +ga_params = add_param(ga_params, "dimension", 1); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_ga(test_func, 50, 10, 0.1, 0.7, %F, ga_params); + +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); + + +// In the following example, we customize all the options in order to show all the features of the algorithm, +// and we increase the dimension. +function y = f(x) + y = sum(x.^2); +endfunction +PopSize = 100; +Proba_cross = 0.7; +Proba_mut = 0.1; +NbGen = 10; +NbCouples = 110; +Log = %T; +pressure = 0.05; +ga_params = init_param(); +// Parameters to adapt to the shape of the optimization problem +ga_params = add_param(ga_params, "minbound", [-2; -2]); +ga_params = add_param(ga_params, "maxbound", [2; 2]); +ga_params = add_param(ga_params, "dimension", 2); +ga_params = add_param(ga_params, "beta", 0); +ga_params = add_param(ga_params, "delta", 0.1); +// Parameters to fine tune the Genetic algorithm. +// All these parameters are optional for continuous optimization +// If you need to adapt the GA to a special problem, you +ga_params = add_param(ga_params, "init_func", init_ga_default); +ga_params = add_param(ga_params, "crossover_func", crossover_ga_default); +ga_params = add_param(ga_params, "mutation_func", mutation_ga_default); +ga_params = add_param(ga_params, "codage_func", coding_ga_identity); +ga_params = add_param(ga_params, "selection_func", selection_ga_elitist); +//ga_params = add_param(ga_params, "selection_func", selection_ga_random); +ga_params = add_param(ga_params, "nb_couples", NbCouples); +ga_params = add_param(ga_params, "pressure", pressure); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); + + +// Customizing the init function, which computes the initial population. +function Pop_init = myinitga(popsize, param) + // This message is to be displayed in the console + // for demonstration purpose only : + // remove it in a real application! + disp("Initializing the Population with grand") + // We deal with some parameters to take into account + // the boundary of the domain and the neighborhood size + [Dim, err] = get_param(param, "dimension", 2) + [MinBounds, err] = get_param(param, "minbound", -2*ones(1, Dim)) + [MaxBounds, err] = get_param(param, "maxbound", 2*ones(1, Dim)) + // Pop_init must be a list() + Pop_init = list() + nr = size(MaxBounds, 1) + nc = size(MaxBounds, 2) + for i=1:popsize + u = grand(nr, nc, "def") + Pop_init(i) = (MaxBounds - MinBounds).*u + MinBounds + end +endfunction +ga_params = init_param(); +// Parameters to adapt to the shape of the optimization problem +ga_params = add_param(ga_params, "minbound", [-2; -2]); +ga_params = add_param(ga_params, "maxbound", [2; 2]); +ga_params = add_param(ga_params, "dimension", 2); +ga_params = add_param(ga_params, "init_func", myinitga); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = .. +optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); + + +// Passing a list to the optim_ga function, where the first element of the list is +// the function and the remaining elements are the extra parameters. Dimension 3. +function y = f(x, a1, a2) + y = a1*sum(x.^2) + a2; +endfunction +ga_params = init_param(); +// Parameters to control the initial population. +ga_params = add_param(ga_params, "dimension", 3); +// Pass the extra parameters to the objective function +a1 = 12; +a2 = 7; +myobjfun = list(f, a1, a2); + +// Optimize ! +[pop_opt, fobj_pop_opt] = optim_ga(myobjfun, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params); +assert_checkequal(length(pop_opt), length(pop_init)); +assert_checkequal(size(fobj_pop_opt), size(fobj_pop_init)); diff --git a/modules/genetic_algorithms/tests/unit_tests/optim_moga.dia.ref b/modules/genetic_algorithms/tests/unit_tests/optim_moga.dia.ref new file mode 100755 index 000000000..d0b32d406 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/optim_moga.dia.ref @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +function Res = min_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = zeros(n,1); +endfunction +function Res = max_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = ones(n,1); +endfunction +function f = get_opti_deb_1(x) +f1_x1 = x(1); +g_x2 = 1; +h = 1 - sqrt(f1_x1 / g_x2); +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction +function f = deb_1(x) +f1_x1 = x(1); +g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); +h = 1 - sqrt(f1_x1 / g_x2); +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction +ga_params = init_param(); +ga_params = add_param(ga_params,'minbound',min_bd_deb_1(2)); +ga_params = add_param(ga_params,'maxbound',max_bd_deb_1(2)); +ga_params = add_param(ga_params,'dimension',2); +ga_params = add_param(ga_params,'beta',0); +ga_params = add_param(ga_params,'delta',0.1); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_moga(deb_1, 25, 3, 0.1, 0.7, %F, ga_params); +if length(pop_opt)~=length(pop_init) then bugmes();quit;end +if size(fobj_pop_opt)~=size(fobj_pop_init) then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/optim_moga.tst b/modules/genetic_algorithms/tests/unit_tests/optim_moga.tst new file mode 100755 index 000000000..a07eaf8b3 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/optim_moga.tst @@ -0,0 +1,51 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +function Res = min_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = zeros(n,1); +endfunction + +function Res = max_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = ones(n,1); +endfunction + +function f = get_opti_deb_1(x) +f1_x1 = x(1); +g_x2 = 1; +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +function f = deb_1(x) +f1_x1 = x(1); +g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +ga_params = init_param(); +ga_params = add_param(ga_params,'minbound',min_bd_deb_1(2)); +ga_params = add_param(ga_params,'maxbound',max_bd_deb_1(2)); +ga_params = add_param(ga_params,'dimension',2); +ga_params = add_param(ga_params,'beta',0); +ga_params = add_param(ga_params,'delta',0.1); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_moga(deb_1, 25, 3, 0.1, 0.7, %F, ga_params); + +if length(pop_opt)~=length(pop_init) then pause,end +if size(fobj_pop_opt)~=size(fobj_pop_init) then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/optim_nsga.dia.ref b/modules/genetic_algorithms/tests/unit_tests/optim_nsga.dia.ref new file mode 100755 index 000000000..3043237b7 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/optim_nsga.dia.ref @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +function Res = min_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = zeros(n,1); +endfunction +function Res = max_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = ones(n,1); +endfunction +function f = get_opti_deb_1(x) +f1_x1 = x(1); +g_x2 = 1; +h = 1 - sqrt(f1_x1 / g_x2); +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction +function f = deb_1(x) +f1_x1 = x(1); +g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); +h = 1 - sqrt(f1_x1 / g_x2); +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction +ga_params = init_param(); +ga_params = add_param(ga_params,'minbound',min_bd_deb_1(2)); +ga_params = add_param(ga_params,'maxbound',max_bd_deb_1(2)); +ga_params = add_param(ga_params,'dimension',2); +ga_params = add_param(ga_params,'beta',0); +ga_params = add_param(ga_params,'delta',0.1); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga(deb_1, 25, 3, 0.1, 0.7, %F, ga_params, 0.02, 1); +if length(pop_opt)~=length(pop_init) then bugmes();quit;end +if size(fobj_pop_opt)~=size(fobj_pop_init) then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/optim_nsga.tst b/modules/genetic_algorithms/tests/unit_tests/optim_nsga.tst new file mode 100755 index 000000000..d8b7125b3 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/optim_nsga.tst @@ -0,0 +1,51 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +function Res = min_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = zeros(n,1); +endfunction + +function Res = max_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = ones(n,1); +endfunction + +function f = get_opti_deb_1(x) +f1_x1 = x(1); +g_x2 = 1; +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +function f = deb_1(x) +f1_x1 = x(1); +g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +ga_params = init_param(); +ga_params = add_param(ga_params,'minbound',min_bd_deb_1(2)); +ga_params = add_param(ga_params,'maxbound',max_bd_deb_1(2)); +ga_params = add_param(ga_params,'dimension',2); +ga_params = add_param(ga_params,'beta',0); +ga_params = add_param(ga_params,'delta',0.1); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga(deb_1, 25, 3, 0.1, 0.7, %F, ga_params, 0.02, 1); + +if length(pop_opt)~=length(pop_init) then pause,end +if size(fobj_pop_opt)~=size(fobj_pop_init) then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/optim_nsga2.dia.ref b/modules/genetic_algorithms/tests/unit_tests/optim_nsga2.dia.ref new file mode 100755 index 000000000..c248beee5 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/optim_nsga2.dia.ref @@ -0,0 +1,39 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +function Res = min_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = zeros(n,1); +endfunction +function Res = max_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = ones(n,1); +endfunction +function f = get_opti_deb_1(x) +f1_x1 = x(1); +g_x2 = 1; +h = 1 - sqrt(f1_x1 / g_x2); +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction +function f = deb_1(x) +f1_x1 = x(1); +g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); +h = 1 - sqrt(f1_x1 / g_x2); +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction +ga_params = init_param(); +ga_params = add_param(ga_params,'minbound',min_bd_deb_1(2)); +ga_params = add_param(ga_params,'maxbound',max_bd_deb_1(2)); +ga_params = add_param(ga_params,'dimension',2); +ga_params = add_param(ga_params,'beta',0); +ga_params = add_param(ga_params,'delta',0.1); +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga2(deb_1, 25, 3, 0.1, 0.7, %F, ga_params); +if length(pop_opt)~=length(pop_init) then bugmes();quit;end +if size(fobj_pop_opt)~=size(fobj_pop_init) then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/optim_nsga2.tst b/modules/genetic_algorithms/tests/unit_tests/optim_nsga2.tst new file mode 100755 index 000000000..d0a15241b --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/optim_nsga2.tst @@ -0,0 +1,51 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +function Res = min_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = zeros(n,1); +endfunction + +function Res = max_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = ones(n,1); +endfunction + +function f = get_opti_deb_1(x) +f1_x1 = x(1); +g_x2 = 1; +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +function f = deb_1(x) +f1_x1 = x(1); +g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +ga_params = init_param(); +ga_params = add_param(ga_params,'minbound',min_bd_deb_1(2)); +ga_params = add_param(ga_params,'maxbound',max_bd_deb_1(2)); +ga_params = add_param(ga_params,'dimension',2); +ga_params = add_param(ga_params,'beta',0); +ga_params = add_param(ga_params,'delta',0.1); + +[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga2(deb_1, 25, 3, 0.1, 0.7, %F, ga_params); + +if length(pop_opt)~=length(pop_init) then pause,end +if size(fobj_pop_opt)~=size(fobj_pop_init) then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/pareto_filter.dia.ref b/modules/genetic_algorithms/tests/unit_tests/pareto_filter.dia.ref new file mode 100755 index 000000000..6ff3a2933 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/pareto_filter.dia.ref @@ -0,0 +1,41 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +function Res = min_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = zeros(n,1); +endfunction +function Res = max_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = ones(n,1); +endfunction +function f = get_opti_deb_1(x) +f1_x1 = x(1); +g_x2 = 1; +h = 1 - sqrt(f1_x1 / g_x2); +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction +function f = deb_1(x) +f1_x1 = x(1); +g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); +h = 1 - sqrt(f1_x1 / g_x2); +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction +Max = max_bd_deb_1(2); +Min = min_bd_deb_1(2); +X_in = list(); +for i=1:100 + X_in(i) = (Max - Min) .* rand(size(Max,1),size(Max,2)) + Min; + F_in(i,:) = deb_1(X_in(i)); +end +[F_out, X_out, Ind_out] = pareto_filter(F_in, X_in); +if length(X_out)==0 then bugmes();quit;end +if size(X_out(1))~=size(X_in(1)) then bugmes();quit;end +if length(X_out)~=length(Ind_out) then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/pareto_filter.tst b/modules/genetic_algorithms/tests/unit_tests/pareto_filter.tst new file mode 100755 index 000000000..dbed8241f --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/pareto_filter.tst @@ -0,0 +1,54 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +function Res = min_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = zeros(n,1); +endfunction + +function Res = max_bd_deb_1(n) +if ~isdef('n','local') then n = 10; end; +Res = ones(n,1); +endfunction + +function f = get_opti_deb_1(x) +f1_x1 = x(1); +g_x2 = 1; +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +function f = deb_1(x) +f1_x1 = x(1); +g_x2 = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1); +h = 1 - sqrt(f1_x1 / g_x2); + +f(1,1) = f1_x1; +f(1,2) = g_x2 * h; +endfunction + +Max = max_bd_deb_1(2); +Min = min_bd_deb_1(2); + +X_in = list(); +for i=1:100 + X_in(i) = (Max - Min) .* rand(size(Max,1),size(Max,2)) + Min; + F_in(i,:) = deb_1(X_in(i)); +end + +[F_out, X_out, Ind_out] = pareto_filter(F_in, X_in); + +if length(X_out)==0 then pause,end +if size(X_out(1))~=size(X_in(1)) then pause,end +if length(X_out)~=length(Ind_out) then pause,end diff --git a/modules/genetic_algorithms/tests/unit_tests/selection_ga_elitist.dia.ref b/modules/genetic_algorithms/tests/unit_tests/selection_ga_elitist.dia.ref new file mode 100755 index 000000000..2eab3ab0f --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/selection_ga_elitist.dia.ref @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +deff('y=test_func(x)','y=x^2'); +Pop_in = list(); +Indiv1 = list(); +Indiv2 = list(); +FObj_Pop_in = []; +FObj_Indiv1 = []; +FObj_Indiv2 = []; +for i=1:100 + Pop_in(i) = rand(); + Indiv1(i) = rand(); + Indiv2(i) = rand(); + FObj_Pop_in(i) = test_func(Pop_in(i)); + FObj_Indiv1(i) = test_func(Indiv1(i)); + FObj_Indiv2(i) = test_func(Indiv2(i)); +end +[Pop_out,FObj_Pop_out,Efficiency,MO_Total_FObj_out] = selection_ga_elitist(Pop_in,Indiv1,Indiv2,FObj_Pop_in,FObj_Indiv1,FObj_Indiv2, [],[],[],[]); +if length(Pop_out)~=100 then bugmes();quit;end +if size(Pop_out)~=size(Pop_in) then bugmes();quit;end +if length(Efficiency)~=100 then bugmes();quit;end +if ~isempty(MO_Total_FObj_out) then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/selection_ga_elitist.tst b/modules/genetic_algorithms/tests/unit_tests/selection_ga_elitist.tst new file mode 100755 index 000000000..b2cdb8027 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/selection_ga_elitist.tst @@ -0,0 +1,37 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +deff('y=test_func(x)','y=x^2'); + +Pop_in = list(); +Indiv1 = list(); +Indiv2 = list(); +FObj_Pop_in = []; +FObj_Indiv1 = []; +FObj_Indiv2 = []; + +for i=1:100 + Pop_in(i) = rand(); + Indiv1(i) = rand(); + Indiv2(i) = rand(); + FObj_Pop_in(i) = test_func(Pop_in(i)); + FObj_Indiv1(i) = test_func(Indiv1(i)); + FObj_Indiv2(i) = test_func(Indiv2(i)); +end + +[Pop_out,FObj_Pop_out,Efficiency,MO_Total_FObj_out] = selection_ga_elitist(Pop_in,Indiv1,Indiv2,FObj_Pop_in,FObj_Indiv1,FObj_Indiv2, [],[],[],[]); + +if length(Pop_out)~=100 then pause,end +if size(Pop_out)~=size(Pop_in) then pause,end +if length(Efficiency)~=100 then pause,end +if ~isempty(MO_Total_FObj_out) then pause,end + diff --git a/modules/genetic_algorithms/tests/unit_tests/selection_ga_random.dia.ref b/modules/genetic_algorithms/tests/unit_tests/selection_ga_random.dia.ref new file mode 100755 index 000000000..90df69a48 --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/selection_ga_random.dia.ref @@ -0,0 +1,28 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +deff('y=test_func(x)','y=x^2'); +Pop_in = list(); +Indiv1 = list(); +Indiv2 = list(); +FObj_Pop_in = []; +FObj_Indiv1 = []; +FObj_Indiv2 = []; +for i=1:100 + Pop_in(i) = rand(); + Indiv1(i) = rand(); + Indiv2(i) = rand(); + FObj_Pop_in(i) = test_func(Pop_in(i)); + FObj_Indiv1(i) = test_func(Indiv1(i)); + FObj_Indiv2(i) = test_func(Indiv2(i)); +end +[Pop_out,FObj_Pop_out,Efficiency,MO_Total_FObj_out] = selection_ga_random(Pop_in,Indiv1,Indiv2,FObj_Pop_in,FObj_Indiv1,FObj_Indiv2, [],[],[],[]); +if length(Pop_out)~=100 then bugmes();quit;end +if size(Pop_out)~=size(Pop_in) then bugmes();quit;end +if length(Efficiency)~=100 then bugmes();quit;end +if ~isempty(MO_Total_FObj_out) then bugmes();quit;end diff --git a/modules/genetic_algorithms/tests/unit_tests/selection_ga_random.tst b/modules/genetic_algorithms/tests/unit_tests/selection_ga_random.tst new file mode 100755 index 000000000..9a3b8d79a --- /dev/null +++ b/modules/genetic_algorithms/tests/unit_tests/selection_ga_random.tst @@ -0,0 +1,36 @@ + +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - Yann COLLETTE <yann.collette@renault.com> +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +// <-- CLI SHELL MODE --> + +deff('y=test_func(x)','y=x^2'); + +Pop_in = list(); +Indiv1 = list(); +Indiv2 = list(); +FObj_Pop_in = []; +FObj_Indiv1 = []; +FObj_Indiv2 = []; + +for i=1:100 + Pop_in(i) = rand(); + Indiv1(i) = rand(); + Indiv2(i) = rand(); + FObj_Pop_in(i) = test_func(Pop_in(i)); + FObj_Indiv1(i) = test_func(Indiv1(i)); + FObj_Indiv2(i) = test_func(Indiv2(i)); +end + +[Pop_out,FObj_Pop_out,Efficiency,MO_Total_FObj_out] = selection_ga_random(Pop_in,Indiv1,Indiv2,FObj_Pop_in,FObj_Indiv1,FObj_Indiv2, [],[],[],[]); + +if length(Pop_out)~=100 then pause,end +if size(Pop_out)~=size(Pop_in) then pause,end +if length(Efficiency)~=100 then pause,end +if ~isempty(MO_Total_FObj_out) then pause,end |