summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore19
-rw-r--r--VRP/build.xml73
-rw-r--r--VRP/manifest.mf3
-rw-r--r--VRP/nbproject/build-impl.xml1771
-rw-r--r--VRP/nbproject/genfiles.properties8
-rw-r--r--VRP/nbproject/project.properties95
-rw-r--r--VRP/nbproject/project.xml15
-rw-r--r--VRP/src/Algoritmo/Almacen.java24
-rw-r--r--VRP/src/Algoritmo/Ciudad.java18
-rw-r--r--VRP/src/Algoritmo/Main.java15
-rw-r--r--VRP/src/Algoritmo/PlanTransporte.java14
-rw-r--r--VRP/src/Algoritmo/TipoAlmacen.java15
-rw-r--r--VRP/src/Algoritmo/Tramo.java24
-rw-r--r--VRP/src/Algoritmo/VRP.java57
-rw-r--r--VRP/src/Algoritmo/Vehiculo.java18
-rw-r--r--test/.ipynb_checkpoints/GA-checkpoint.ipynb112
-rw-r--r--test/GA.ipynb361
-rw-r--r--test/LAB_5_ACC_2021_1.ipynb700
-rw-r--r--test/VRPTW_GA.ipynb724
-rw-r--r--test/data/RC101.csv102
20 files changed, 4168 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d69fa8b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+# Jupyter
+.ipynb_checkpoints
+
+# Java
+*.class
+*.log
+*.ctxt
+.mtj.tmp/
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+hs_err_pid*
+replay_pid*
+
+# JS
diff --git a/VRP/build.xml b/VRP/build.xml
new file mode 100644
index 0000000..33b72e9
--- /dev/null
+++ b/VRP/build.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<!-- By default, only the Clean and Build commands use this build script. -->
+<!-- Commands such as Run, Debug, and Test only use this build script if -->
+<!-- the Compile on Save feature is turned off for the project. -->
+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
+<!-- in the project's Project Properties dialog box.-->
+<project name="VRP" default="default" basedir=".">
+ <description>Builds, tests, and runs the project VRP.</description>
+ <import file="nbproject/build-impl.xml"/>
+ <!--
+
+ There exist several targets which are by default empty and which can be
+ used for execution of your tasks. These targets are usually executed
+ before and after some main targets. They are:
+
+ -pre-init: called before initialization of project properties
+ -post-init: called after initialization of project properties
+ -pre-compile: called before javac compilation
+ -post-compile: called after javac compilation
+ -pre-compile-single: called before javac compilation of single file
+ -post-compile-single: called after javac compilation of single file
+ -pre-compile-test: called before javac compilation of JUnit tests
+ -post-compile-test: called after javac compilation of JUnit tests
+ -pre-compile-test-single: called before javac compilation of single JUnit test
+ -post-compile-test-single: called after javac compilation of single JUunit test
+ -pre-jar: called before JAR building
+ -post-jar: called after JAR building
+ -post-clean: called after cleaning build products
+
+ (Targets beginning with '-' are not intended to be called on their own.)
+
+ Example of inserting an obfuscator after compilation could look like this:
+
+ <target name="-post-compile">
+ <obfuscate>
+ <fileset dir="${build.classes.dir}"/>
+ </obfuscate>
+ </target>
+
+ For list of available properties check the imported
+ nbproject/build-impl.xml file.
+
+
+ Another way to customize the build is by overriding existing main targets.
+ The targets of interest are:
+
+ -init-macrodef-javac: defines macro for javac compilation
+ -init-macrodef-junit: defines macro for junit execution
+ -init-macrodef-debug: defines macro for class debugging
+ -init-macrodef-java: defines macro for class execution
+ -do-jar: JAR building
+ run: execution of project
+ -javadoc-build: Javadoc generation
+ test-report: JUnit report generation
+
+ An example of overriding the target for project execution could look like this:
+
+ <target name="run" depends="VRP-impl.jar">
+ <exec dir="bin" executable="launcher.exe">
+ <arg file="${dist.jar}"/>
+ </exec>
+ </target>
+
+ Notice that the overridden target depends on the jar target and not only on
+ the compile target as the regular run target does. Again, for a list of available
+ properties which you can use, check the target you are overriding in the
+ nbproject/build-impl.xml file.
+
+ -->
+</project>
diff --git a/VRP/manifest.mf b/VRP/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/VRP/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/VRP/nbproject/build-impl.xml b/VRP/nbproject/build-impl.xml
new file mode 100644
index 0000000..4367b20
--- /dev/null
+++ b/VRP/nbproject/build-impl.xml
@@ -0,0 +1,1771 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT ***
+*** EDIT ../build.xml INSTEAD ***
+
+For the purpose of easier reading the script
+is divided into following sections:
+
+ - initialization
+ - compilation
+ - jar
+ - execution
+ - debugging
+ - javadoc
+ - test compilation
+ - test execution
+ - test debugging
+ - applet
+ - cleanup
+
+ -->
+<project xmlns:if="ant:if" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" xmlns:unless="ant:unless" basedir=".." default="default" name="VRP-impl">
+ <fail message="Please build using Ant 1.8.0 or higher.">
+ <condition>
+ <not>
+ <antversion atleast="1.8.0"/>
+ </not>
+ </condition>
+ </fail>
+ <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
+ <!--
+ ======================
+ INITIALIZATION SECTION
+ ======================
+ -->
+ <target name="-pre-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="-pre-init" name="-init-private">
+ <property file="nbproject/private/config.properties"/>
+ <property file="nbproject/private/configs/${config}.properties"/>
+ <property file="nbproject/private/private.properties"/>
+ </target>
+ <target depends="-pre-init,-init-private" name="-init-user">
+ <property file="${user.properties.file}"/>
+ <!-- The two properties below are usually overridden -->
+ <!-- by the active platform. Just a fallback. -->
+ <property name="default.javac.source" value="1.6"/>
+ <property name="default.javac.target" value="1.6"/>
+ </target>
+ <target depends="-pre-init,-init-private,-init-user" name="-init-project">
+ <property file="nbproject/configs/${config}.properties"/>
+ <property file="nbproject/project.properties"/>
+ </target>
+ <target name="-init-modules-supported">
+ <condition property="modules.supported.internal" value="true">
+ <not>
+ <matches pattern="1\.[0-8](\..*)?" string="${javac.source}"/>
+ </not>
+ </condition>
+ </target>
+ <target depends="-init-modules-supported" if="modules.supported.internal" name="-init-macrodef-modulename">
+ <macrodef name="modulename" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute name="property"/>
+ <attribute name="sourcepath"/>
+ <sequential>
+ <loadresource property="@{property}" quiet="true">
+ <javaresource classpath="@{sourcepath}" name="module-info.java" parentFirst="false"/>
+ <filterchain>
+ <stripjavacomments/>
+ <linecontainsregexp>
+ <regexp pattern="module .* \{"/>
+ </linecontainsregexp>
+ <tokenfilter>
+ <linetokenizer/>
+ <replaceregex flags="s" pattern="(\s*module\s+)(\S*)(\s*\{.*)" replace="\2"/>
+ </tokenfilter>
+ <striplinebreaks/>
+ </filterchain>
+ </loadresource>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-modules-supported,-init-macrodef-modulename" if="modules.supported.internal" name="-init-source-module-properties">
+ <fail message="Java 9 support requires Ant 1.10.0 or higher.">
+ <condition>
+ <not>
+ <antversion atleast="1.10.0"/>
+ </not>
+ </condition>
+ </fail>
+ <j2seproject3:modulename property="module.name" sourcepath="${src.dir}"/>
+ <condition property="named.module.internal">
+ <and>
+ <isset property="module.name"/>
+ <length length="0" string="${module.name}" when="greater"/>
+ </and>
+ </condition>
+ <condition property="unnamed.module.internal">
+ <not>
+ <isset property="named.module.internal"/>
+ </not>
+ </condition>
+ <property name="javac.modulepath" value=""/>
+ <property name="run.modulepath" value="${javac.modulepath}"/>
+ <property name="module.build.classes.dir" value="${build.classes.dir}"/>
+ <property name="debug.modulepath" value="${run.modulepath}"/>
+ <property name="javac.upgrademodulepath" value=""/>
+ <property name="run.upgrademodulepath" value="${javac.upgrademodulepath}"/>
+ <condition else="" property="javac.systemmodulepath.cmd.line.arg" value="--system '${javac.systemmodulepath}'">
+ <and>
+ <isset property="javac.systemmodulepath"/>
+ <length length="0" string="${javac.systemmodulepath}" when="greater"/>
+ </and>
+ </condition>
+ <property name="dist.jlink.dir" value="${dist.dir}/jlink"/>
+ <property name="dist.jlink.output" value="${dist.jlink.dir}/${application.title}"/>
+ <property name="module.name" value=""/>
+ </target>
+ <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property,-init-modules-supported" name="-do-init">
+ <property name="platform.java" value="${java.home}/bin/java"/>
+ <available file="${manifest.file}" property="manifest.available"/>
+ <condition property="splashscreen.available">
+ <and>
+ <not>
+ <equals arg1="${application.splash}" arg2="" trim="true"/>
+ </not>
+ <available file="${application.splash}"/>
+ </and>
+ </condition>
+ <condition property="main.class.available">
+ <and>
+ <isset property="main.class"/>
+ <not>
+ <equals arg1="${main.class}" arg2="" trim="true"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="profile.available">
+ <and>
+ <isset property="javac.profile"/>
+ <length length="0" string="${javac.profile}" when="greater"/>
+ <not>
+ <matches pattern="1\.[0-7](\..*)?" string="${javac.source}"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="do.archive">
+ <or>
+ <not>
+ <istrue value="${jar.archive.disabled}"/>
+ </not>
+ <istrue value="${not.archive.disabled}"/>
+ </or>
+ </condition>
+ <condition property="do.archive+manifest.available">
+ <and>
+ <isset property="manifest.available"/>
+ <istrue value="${do.archive}"/>
+ </and>
+ </condition>
+ <condition property="do.archive+main.class.available">
+ <and>
+ <isset property="main.class.available"/>
+ <istrue value="${do.archive}"/>
+ </and>
+ </condition>
+ <condition property="do.archive+splashscreen.available">
+ <and>
+ <isset property="splashscreen.available"/>
+ <istrue value="${do.archive}"/>
+ </and>
+ </condition>
+ <condition property="do.archive+profile.available">
+ <and>
+ <isset property="profile.available"/>
+ <istrue value="${do.archive}"/>
+ </and>
+ </condition>
+ <condition property="have.tests">
+ <or>
+ <available file="${test.src.dir}"/>
+ </or>
+ </condition>
+ <condition property="have.sources">
+ <or>
+ <available file="${src.dir}"/>
+ </or>
+ </condition>
+ <condition property="netbeans.home+have.tests">
+ <and>
+ <isset property="netbeans.home"/>
+ <isset property="have.tests"/>
+ </and>
+ </condition>
+ <condition property="no.javadoc.preview">
+ <and>
+ <isset property="javadoc.preview"/>
+ <isfalse value="${javadoc.preview}"/>
+ </and>
+ </condition>
+ <property name="run.jvmargs" value=""/>
+ <property name="run.jvmargs.ide" value=""/>
+ <property name="javac.compilerargs" value=""/>
+ <property name="work.dir" value="${basedir}"/>
+ <condition property="no.deps">
+ <and>
+ <istrue value="${no.dependencies}"/>
+ </and>
+ </condition>
+ <property name="javac.debug" value="true"/>
+ <property name="javadoc.preview" value="true"/>
+ <property name="application.args" value=""/>
+ <property name="source.encoding" value="${file.encoding}"/>
+ <property name="runtime.encoding" value="${source.encoding}"/>
+ <property name="manifest.encoding" value="${source.encoding}"/>
+ <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
+ <and>
+ <isset property="javadoc.encoding"/>
+ <not>
+ <equals arg1="${javadoc.encoding}" arg2=""/>
+ </not>
+ </and>
+ </condition>
+ <property name="javadoc.encoding.used" value="${source.encoding}"/>
+ <property name="includes" value="**"/>
+ <property name="excludes" value=""/>
+ <property name="do.depend" value="false"/>
+ <condition property="do.depend.true">
+ <istrue value="${do.depend}"/>
+ </condition>
+ <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
+ <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
+ <and>
+ <isset property="endorsed.classpath"/>
+ <not>
+ <equals arg1="${endorsed.classpath}" arg2="" trim="true"/>
+ </not>
+ </and>
+ </condition>
+ <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}">
+ <isset property="profile.available"/>
+ </condition>
+ <condition else="false" property="jdkBug6558476">
+ <and>
+ <matches pattern="1\.[56]" string="${java.specification.version}"/>
+ <not>
+ <os family="unix"/>
+ </not>
+ </and>
+ </condition>
+ <condition else="false" property="javac.fork">
+ <or>
+ <istrue value="${jdkBug6558476}"/>
+ <istrue value="${javac.external.vm}"/>
+ </or>
+ </condition>
+ <property name="jar.index" value="false"/>
+ <property name="jar.index.metainf" value="${jar.index}"/>
+ <property name="copylibs.rebase" value="true"/>
+ <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
+ <condition property="junit.available">
+ <or>
+ <available classname="org.junit.Test" classpath="${run.test.classpath}"/>
+ <available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
+ </or>
+ </condition>
+ <condition property="testng.available">
+ <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
+ </condition>
+ <condition property="junit+testng.available">
+ <and>
+ <istrue value="${junit.available}"/>
+ <istrue value="${testng.available}"/>
+ </and>
+ </condition>
+ <condition else="testng" property="testng.mode" value="mixed">
+ <istrue value="${junit+testng.available}"/>
+ </condition>
+ <condition else="" property="testng.debug.mode" value="-mixed">
+ <istrue value="${junit+testng.available}"/>
+ </condition>
+ <property name="java.failonerror" value="true"/>
+ </target>
+ <target name="-post-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
+ <fail unless="src.dir">Must set src.dir</fail>
+ <fail unless="test.src.dir">Must set test.src.dir</fail>
+ <fail unless="build.dir">Must set build.dir</fail>
+ <fail unless="dist.dir">Must set dist.dir</fail>
+ <fail unless="build.classes.dir">Must set build.classes.dir</fail>
+ <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
+ <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
+ <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
+ <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
+ <fail unless="dist.jar">Must set dist.jar</fail>
+ </target>
+ <target name="-init-macrodef-property">
+ <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="name"/>
+ <attribute name="value"/>
+ <sequential>
+ <property name="@{name}" value="${@{value}}"/>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-ap-cmdline-properties,-init-source-module-properties" if="modules.supported.internal" name="-init-macrodef-javac-with-module">
+ <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${src.dir}" name="srcdir"/>
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <attribute default="${javac.classpath}" name="classpath"/>
+ <attribute default="${javac.modulepath}" name="modulepath"/>
+ <attribute default="${javac.upgrademodulepath}" name="upgrademodulepath"/>
+ <attribute default="${javac.processorpath}" name="processorpath"/>
+ <attribute default="${javac.processormodulepath}" name="processormodulepath"/>
+ <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="${javac.debug}" name="debug"/>
+ <attribute default="${empty.dir}" name="sourcepath" unless:set="named.module.internal"/>
+ <attribute default="${src.dir}" if:set="named.module.internal" name="sourcepath"/>
+ <attribute default="${empty.dir}" name="gensrcdir"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <condition property="warn.excludes.internal">
+ <and>
+ <isset property="named.module.internal"/>
+ <length length="0" string="@{excludes}" trim="true" when="greater"/>
+ </and>
+ </condition>
+ <echo if:set="warn.excludes.internal" level="warning" message="The javac excludes are not supported in the JDK 9 Named Module."/>
+ <property location="${build.dir}/empty" name="empty.dir"/>
+ <mkdir dir="${empty.dir}"/>
+ <mkdir dir="@{apgeneratedsrcdir}"/>
+ <condition property="processormodulepath.set">
+ <resourcecount count="0" when="greater">
+ <path>
+ <pathelement path="@{processormodulepath}"/>
+ </path>
+ </resourcecount>
+ </condition>
+ <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
+ <src>
+ <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+ <include name="*"/>
+ </dirset>
+ </src>
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <modulepath>
+ <path path="@{modulepath}"/>
+ </modulepath>
+ <upgrademodulepath>
+ <path path="@{upgrademodulepath}"/>
+ </upgrademodulepath>
+ <compilerarg line="${javac.systemmodulepath.cmd.line.arg}"/>
+ <compilerarg line="${javac.profile.cmd.line.arg}"/>
+ <compilerarg line="${javac.compilerargs}"/>
+ <compilerarg if:set="processormodulepath.set" value="--processor-module-path"/>
+ <compilerarg if:set="processormodulepath.set" path="@{processormodulepath}"/>
+ <compilerarg unless:set="processormodulepath.set" value="-processorpath"/>
+ <compilerarg path="@{processorpath}:${empty.dir}" unless:set="processormodulepath.set"/>
+ <compilerarg line="${ap.processors.internal}"/>
+ <compilerarg line="${annotation.processing.processor.options}"/>
+ <compilerarg value="-s"/>
+ <compilerarg path="@{apgeneratedsrcdir}"/>
+ <compilerarg line="${ap.proc.none.internal}"/>
+ <customize/>
+ </javac>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-ap-cmdline-properties,-init-source-module-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors" unless="modules.supported.internal">
+ <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${src.dir}" name="srcdir"/>
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <attribute default="${javac.classpath}" name="classpath"/>
+ <attribute default="${javac.modulepath}" name="modulepath"/>
+ <attribute default="${javac.upgrademodulepath}" name="upgrademodulepath"/>
+ <attribute default="${javac.processorpath}" name="processorpath"/>
+ <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="${javac.debug}" name="debug"/>
+ <attribute default="${empty.dir}" name="sourcepath"/>
+ <attribute default="${empty.dir}" name="gensrcdir"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <property location="${build.dir}/empty" name="empty.dir"/>
+ <mkdir dir="${empty.dir}"/>
+ <mkdir dir="@{apgeneratedsrcdir}"/>
+ <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
+ <src>
+ <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+ <include name="*"/>
+ </dirset>
+ </src>
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <compilerarg line="${javac.profile.cmd.line.arg}"/>
+ <compilerarg line="${javac.compilerargs}"/>
+ <compilerarg value="-processorpath"/>
+ <compilerarg path="@{processorpath}:${empty.dir}"/>
+ <compilerarg line="${ap.processors.internal}"/>
+ <compilerarg line="${annotation.processing.processor.options}"/>
+ <compilerarg value="-s"/>
+ <compilerarg path="@{apgeneratedsrcdir}"/>
+ <compilerarg line="${ap.proc.none.internal}"/>
+ <customize/>
+ </javac>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-ap-cmdline-properties,-init-source-module-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
+ <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${src.dir}" name="srcdir"/>
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <attribute default="${javac.classpath}" name="classpath"/>
+ <attribute default="${javac.modulepath}" name="modulepath"/>
+ <attribute default="${javac.upgrademodulepath}" name="upgrademodulepath"/>
+ <attribute default="${javac.processorpath}" name="processorpath"/>
+ <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="${javac.debug}" name="debug"/>
+ <attribute default="${empty.dir}" name="sourcepath"/>
+ <attribute default="${empty.dir}" name="gensrcdir"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <property location="${build.dir}/empty" name="empty.dir"/>
+ <mkdir dir="${empty.dir}"/>
+ <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
+ <src>
+ <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+ <include name="*"/>
+ </dirset>
+ </src>
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <compilerarg line="${javac.profile.cmd.line.arg}"/>
+ <compilerarg line="${javac.compilerargs}"/>
+ <customize/>
+ </javac>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-javac-with-module,-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
+ <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${src.dir}" name="srcdir"/>
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <attribute default="${javac.classpath}" name="classpath"/>
+ <sequential>
+ <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ </depend>
+ </sequential>
+ </macrodef>
+ <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <sequential>
+ <fail unless="javac.includes">Must set javac.includes</fail>
+ <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
+ <path>
+ <filelist dir="@{destdir}" files="${javac.includes}"/>
+ </path>
+ <globmapper from="*.java" to="*.class"/>
+ </pathconvert>
+ <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
+ <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
+ <delete>
+ <files includesfile="${javac.includesfile.binary}"/>
+ </delete>
+ <delete>
+ <fileset file="${javac.includesfile.binary}"/>
+ </delete>
+ </sequential>
+ </macrodef>
+ </target>
+ <target if="${junit.available}" name="-init-macrodef-junit-init">
+ <condition else="false" property="nb.junit.batch" value="true">
+ <and>
+ <istrue value="${junit.available}"/>
+ <not>
+ <isset property="test.method"/>
+ </not>
+ </and>
+ </condition>
+ <condition else="false" property="nb.junit.single" value="true">
+ <and>
+ <istrue value="${junit.available}"/>
+ <isset property="test.method"/>
+ </and>
+ </condition>
+ </target>
+ <target name="-init-test-properties">
+ <property name="test.binaryincludes" value="&lt;nothing&gt;"/>
+ <property name="test.binarytestincludes" value=""/>
+ <property name="test.binaryexcludes" value=""/>
+ </target>
+ <target depends="-init-modules-supported" if="modules.supported.internal" name="-init-macrodef-junit-prototype-with-module">
+ <macrodef name="junit-prototype" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <element name="customizePrototype" optional="true"/>
+ <sequential>
+ <property name="junit.forkmode" value="perTest"/>
+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <modulepath>
+ <path path="${run.test.modulepath}"/>
+ </modulepath>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <jvmarg value="-ea"/>
+ <jvmarg line="${run.test.jvmargs}"/>
+ <customizePrototype/>
+ </junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-modules-supported" name="-init-macrodef-junit-prototype-without-module" unless="modules.supported.internal">
+ <macrodef name="junit-prototype" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <element name="customizePrototype" optional="true"/>
+ <sequential>
+ <property name="junit.forkmode" value="perTest"/>
+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <jvmarg value="-ea"/>
+ <customizePrototype/>
+ </junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-test-properties,-init-macrodef-junit-prototype-with-module,-init-macrodef-junit-prototype-without-module" if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
+ <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <j2seproject3:junit-prototype>
+ <customizePrototype>
+ <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
+ <customize/>
+ </customizePrototype>
+ </j2seproject3:junit-prototype>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-test-properties,-init-macrodef-junit-prototype-with-module,-init-macrodef-junit-prototype-without-module" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
+ <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <j2seproject3:junit-prototype>
+ <customizePrototype>
+ <batchtest todir="${build.test.results.dir}">
+ <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+ <filename name="@{testincludes}"/>
+ </fileset>
+ <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
+ <filename name="${test.binarytestincludes}"/>
+ </fileset>
+ </batchtest>
+ <customize/>
+ </customizePrototype>
+ </j2seproject3:junit-prototype>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
+ <target if="${testng.available}" name="-init-macrodef-testng">
+ <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
+ <isset property="test.method"/>
+ </condition>
+ <union id="test.set">
+ <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
+ <filename name="@{testincludes}"/>
+ </fileset>
+ </union>
+ <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
+ <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="VRP" testname="TestNG tests" workingDir="${work.dir}">
+ <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
+ <propertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </propertyset>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <customize/>
+ </testng>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-test-impl">
+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element implicit="true" name="customize" optional="true"/>
+ <sequential>
+ <echo>No tests executed.</echo>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element implicit="true" name="customize" optional="true"/>
+ <sequential>
+ <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customize/>
+ </j2seproject3:junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element implicit="true" name="customize" optional="true"/>
+ <sequential>
+ <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customize/>
+ </j2seproject3:testng>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
+ <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <sequential>
+ <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customize>
+ <jvmarg line="${run.jvmargs}"/>
+ <jvmarg line="${run.jvmargs.ide}"/>
+ </customize>
+ </j2seproject3:test-impl>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
+ <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <element name="customizeDebuggee" optional="true"/>
+ <sequential>
+ <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customize>
+ <jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/>
+ <customizeDebuggee/>
+ </customize>
+ </j2seproject3:junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target if="${testng.available}" name="-init-macrodef-testng-debug">
+ <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${main.class}" name="testClass"/>
+ <attribute default="" name="testMethod"/>
+ <element name="customize2" optional="true"/>
+ <sequential>
+ <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
+ <isset property="test.method"/>
+ </condition>
+ <condition else="-suitename VRP -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
+ <matches pattern=".*\.xml" string="@{testClass}"/>
+ </condition>
+ <delete dir="${build.test.results.dir}" quiet="true"/>
+ <mkdir dir="${build.test.results.dir}"/>
+ <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
+ <customizeDebuggee>
+ <customize2/>
+ <jvmarg value="-ea"/>
+ <arg line="${testng.debug.mode}"/>
+ <arg line="-d ${build.test.results.dir}"/>
+ <arg line="-listener org.testng.reporters.VerboseReporter"/>
+ <arg line="${testng.cmd.args}"/>
+ </customizeDebuggee>
+ </j2seproject3:debug>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
+ <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${main.class}" name="testClass"/>
+ <attribute default="" name="testMethod"/>
+ <element implicit="true" name="customize2" optional="true"/>
+ <sequential>
+ <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
+ <customize2/>
+ </j2seproject3:testng-debug>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
+ <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <attribute default="${main.class}" name="testClass"/>
+ <attribute default="" name="testMethod"/>
+ <sequential>
+ <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
+ <customizeDebuggee>
+ <jvmarg line="${run.jvmargs}"/>
+ <jvmarg line="${run.jvmargs.ide}"/>
+ </customizeDebuggee>
+ </j2seproject3:test-debug-impl>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
+ <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="**" name="testincludes"/>
+ <attribute default="" name="testmethods"/>
+ <attribute default="${main.class}" name="testClass"/>
+ <attribute default="" name="testMethod"/>
+ <sequential>
+ <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
+ <customize2>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ </customize2>
+ </j2seproject3:testng-debug-impl>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
+ <!--
+ pre NB7.2 profiling section; consider it deprecated
+ -->
+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
+ <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
+ <macrodef name="resolve">
+ <attribute name="name"/>
+ <attribute name="value"/>
+ <sequential>
+ <property name="@{name}" value="${env.@{value}}"/>
+ </sequential>
+ </macrodef>
+ <macrodef name="profile">
+ <attribute default="${main.class}" name="classname"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <property environment="env"/>
+ <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
+ <java classname="@{classname}" dir="${profiler.info.dir}" failonerror="${java.failonerror}" fork="true" jvm="${profiler.info.jvm}">
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
+ <arg line="${application.args}"/>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
+ <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
+ <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
+ </target>
+ <!--
+ end of pre NB7.2 profiling section
+ -->
+ <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
+ <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute default="${main.class}" name="name"/>
+ <attribute default="${debug.modulepath}" name="modulepath"/>
+ <attribute default="${debug.classpath}" name="classpath"/>
+ <attribute default="" name="stopclassname"/>
+ <sequential>
+ <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
+ <modulepath>
+ <path path="@{modulepath}"/>
+ </modulepath>
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ </nbjpdastart>
+ </sequential>
+ </macrodef>
+ <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute default="${build.classes.dir}" name="dir"/>
+ <sequential>
+ <nbjpdareload>
+ <fileset dir="@{dir}" includes="${fix.classes}">
+ <include name="${fix.includes}*.class"/>
+ </fileset>
+ </nbjpdareload>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-debug-args">
+ <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
+ <os family="windows"/>
+ </condition>
+ <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
+ <isset property="debug.transport"/>
+ </condition>
+ </target>
+ <target depends="-init-debug-args" name="-init-macrodef-debug">
+ <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${module.name}" name="modulename"/>
+ <attribute default="${main.class}" name="classname"/>
+ <attribute default="${debug.modulepath}" name="modulepath"/>
+ <attribute default="${debug.classpath}" name="classpath"/>
+ <element name="customizeDebuggee" optional="true"/>
+ <sequential>
+ <j2seproject1:java classname="@{classname}" classpath="@{classpath}" modulename="@{modulename}" modulepath="@{modulepath}">
+ <customize>
+ <jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/>
+ <customizeDebuggee/>
+ </customize>
+ </j2seproject1:java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-source-module-properties" if="named.module.internal" name="-init-macrodef-java-with-module">
+ <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute default="${module.name}" name="modulename"/>
+ <attribute default="${main.class}" name="classname"/>
+ <attribute default="${run.modulepath}" name="modulepath"/>
+ <attribute default="${run.upgrademodulepath}" name="upgrademodulepath"/>
+ <attribute default="${run.classpath}" name="classpath"/>
+ <attribute default="jvm" name="jvm"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true" module="@{modulename}">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <modulepath>
+ <pathelement path="@{modulepath}"/>
+ <pathelement location="${module.build.classes.dir}"/>
+ </modulepath>
+ <upgrademodulepath>
+ <path path="@{upgrademodulepath}"/>
+ </upgrademodulepath>
+ <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
+ <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
+ <jvmarg line="${run.jvmargs}"/>
+ <jvmarg line="${run.jvmargs.ide}"/>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-source-module-properties" if="unnamed.module.internal" name="-init-macrodef-java-with-unnamed-module">
+ <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute default="" name="modulename"/>
+ <attribute default="${main.class}" name="classname"/>
+ <attribute default="${run.modulepath}" name="modulepath"/>
+ <attribute default="${run.upgrademodulepath}" name="upgrademodulepath"/>
+ <attribute default="${run.classpath}" name="classpath"/>
+ <attribute default="jvm" name="jvm"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <modulepath>
+ <path path="@{modulepath}"/>
+ </modulepath>
+ <upgrademodulepath>
+ <path path="@{upgrademodulepath}"/>
+ </upgrademodulepath>
+ <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
+ <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
+ <jvmarg line="${run.jvmargs}"/>
+ <jvmarg line="${run.jvmargs.ide}"/>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-source-module-properties" name="-init-macrodef-java-without-module" unless="modules.supported.internal">
+ <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute default="" name="modulename"/>
+ <attribute default="${main.class}" name="classname"/>
+ <attribute default="" name="modulepath"/>
+ <attribute default="${run.classpath}" name="classpath"/>
+ <attribute default="jvm" name="jvm"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
+ <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
+ <jvmarg line="${run.jvmargs}"/>
+ <jvmarg line="${run.jvmargs.ide}"/>
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-macrodef-java-with-module, -init-macrodef-java-with-unnamed-module, -init-macrodef-java-without-module" name="-init-macrodef-java"/>
+ <target name="-init-macrodef-copylibs">
+ <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute default="${manifest.file}" name="manifest"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+ <pathconvert property="run.classpath.without.build.classes.dir">
+ <path path="${run.classpath}"/>
+ <map from="${build.classes.dir.resolved}" to=""/>
+ </pathconvert>
+ <pathconvert pathsep=" " property="jar.classpath">
+ <path path="${run.classpath.without.build.classes.dir}"/>
+ <chainedmapper>
+ <flattenmapper/>
+ <filtermapper>
+ <replacestring from=" " to="%20"/>
+ </filtermapper>
+ <globmapper from="*" to="lib/*"/>
+ </chainedmapper>
+ </pathconvert>
+ <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
+ <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" manifestencoding="UTF-8" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
+ <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
+ <manifest>
+ <attribute name="Class-Path" value="${jar.classpath}"/>
+ <customize/>
+ </manifest>
+ </copylibs>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-presetdef-jar">
+ <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifestencoding="UTF-8">
+ <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
+ </jar>
+ </presetdef>
+ </target>
+ <target name="-init-ap-cmdline-properties">
+ <property name="annotation.processing.enabled" value="true"/>
+ <property name="annotation.processing.processors.list" value=""/>
+ <property name="annotation.processing.processor.options" value=""/>
+ <property name="annotation.processing.run.all.processors" value="true"/>
+ <property name="javac.processorpath" value="${javac.classpath}"/>
+ <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
+ <condition property="ap.supported.internal" value="true">
+ <not>
+ <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
+ </not>
+ </condition>
+ </target>
+ <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
+ <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
+ <isfalse value="${annotation.processing.run.all.processors}"/>
+ </condition>
+ <condition else="" property="ap.proc.none.internal" value="-proc:none">
+ <isfalse value="${annotation.processing.enabled}"/>
+ </condition>
+ </target>
+ <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
+ <property name="ap.cmd.line.internal" value=""/>
+ </target>
+ <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
+ <!--
+ ===================
+ COMPILATION SECTION
+ ===================
+ -->
+ <target name="-deps-jar-init" unless="built-jar.properties">
+ <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
+ <delete file="${built-jar.properties}" quiet="true"/>
+ </target>
+ <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
+ <echo level="warn" message="Cycle detected: VRP was already built"/>
+ </target>
+ <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
+ <mkdir dir="${build.dir}"/>
+ <touch file="${built-jar.properties}" verbose="false"/>
+ <property file="${built-jar.properties}" prefix="already.built.jar."/>
+ <antcall target="-warn-already-built-jar"/>
+ <propertyfile file="${built-jar.properties}">
+ <entry key="${basedir}" value=""/>
+ </propertyfile>
+ </target>
+ <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
+ <target depends="init" name="-check-automatic-build">
+ <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
+ </target>
+ <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
+ <antcall target="clean">
+ <param name="no.dependencies" value="true"/>
+ </antcall>
+ </target>
+ <target depends="init,deps-jar" name="-pre-pre-compile">
+ <mkdir dir="${build.classes.dir}"/>
+ </target>
+ <target name="-pre-compile">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target if="do.depend.true" name="-compile-depend">
+ <pathconvert property="build.generated.subdirs">
+ <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+ <include name="*"/>
+ </dirset>
+ </pathconvert>
+ <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
+ </target>
+ <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
+ <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
+ <copy todir="${build.classes.dir}">
+ <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ </copy>
+ </target>
+ <target if="has.persistence.xml" name="-copy-persistence-xml">
+ <mkdir dir="${build.classes.dir}/META-INF"/>
+ <copy todir="${build.classes.dir}/META-INF">
+ <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
+ </copy>
+ </target>
+ <target name="-post-compile">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
+ <target name="-pre-compile-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
+ <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+ <j2seproject3:force-recompile/>
+ <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}, module-info.java" sourcepath="${src.dir}"/>
+ </target>
+ <target name="-post-compile-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
+ <!--
+ ====================
+ JAR BUILDING SECTION
+ ====================
+ -->
+ <target depends="init" name="-pre-pre-jar">
+ <dirname file="${dist.jar}" property="dist.jar.dir"/>
+ <mkdir dir="${dist.jar.dir}"/>
+ </target>
+ <target name="-pre-jar">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init,compile" name="-check-module-main-class">
+ <pathconvert property="main.class.file">
+ <string value="${main.class}"/>
+ <unpackagemapper from="*" to="*.class"/>
+ </pathconvert>
+ <condition property="do.module.main.class">
+ <and>
+ <isset property="main.class.available"/>
+ <available file="${build.classes.dir}/module-info.class"/>
+ <available file="${build.classes.dir}/${main.class.file}"/>
+ <isset property="libs.CopyLibs.classpath"/>
+ <available classname="org.netbeans.modules.java.j2seproject.moduletask.ModuleMainClass" classpath="${libs.CopyLibs.classpath}"/>
+ </and>
+ </condition>
+ </target>
+ <target depends="-check-module-main-class" if="do.module.main.class" name="-set-module-main-class">
+ <taskdef classname="org.netbeans.modules.java.j2seproject.moduletask.ModuleMainClass" classpath="${libs.CopyLibs.classpath}" name="modulemainclass"/>
+ <modulemainclass failonerror="false" mainclass="${main.class}" moduleinfo="${build.classes.dir}/module-info.class"/>
+ </target>
+ <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available">
+ <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
+ <touch file="${tmp.manifest.file}" verbose="false"/>
+ </target>
+ <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest">
+ <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
+ <copy encoding="${manifest.encoding}" file="${manifest.file}" outputencoding="UTF-8" tofile="${tmp.manifest.file}"/>
+ </target>
+ <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass">
+ <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
+ <attribute name="Main-Class" value="${main.class}"/>
+ </manifest>
+ </target>
+ <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile">
+ <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
+ <attribute name="Profile" value="${javac.profile}"/>
+ </manifest>
+ </target>
+ <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen">
+ <basename file="${application.splash}" property="splashscreen.basename"/>
+ <mkdir dir="${build.classes.dir}/META-INF"/>
+ <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
+ <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
+ <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
+ </manifest>
+ </target>
+ <target depends="init,compile" name="-check-do-mkdist">
+ <condition property="do.mkdist">
+ <and>
+ <isset property="do.archive"/>
+ <isset property="libs.CopyLibs.classpath"/>
+ <not>
+ <istrue value="${mkdist.disabled}"/>
+ </not>
+ <not>
+ <available file="${build.classes.dir}/module-info.class"/>
+ </not>
+ </and>
+ </condition>
+ </target>
+ <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-check-do-mkdist" if="do.mkdist" name="-do-jar-copylibs">
+ <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
+ <echo level="info">To run this application from the command line without Ant, try:</echo>
+ <property location="${dist.jar}" name="dist.jar.resolved"/>
+ <echo level="info">java -jar "${dist.jar.resolved}"</echo>
+ </target>
+ <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-check-do-mkdist" if="do.archive" name="-do-jar-jar" unless="do.mkdist">
+ <j2seproject1:jar manifest="${tmp.manifest.file}"/>
+ <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+ <property location="${dist.jar}" name="dist.jar.resolved"/>
+ <condition else="${dist.jar.resolved}" property="jar.usage.message.class.path.replacement" value="">
+ <isset property="named.module.internal"/>
+ </condition>
+ <pathconvert property="run.classpath.with.dist.jar">
+ <path path="${run.classpath}"/>
+ <map from="${build.classes.dir.resolved}" to="${jar.usage.message.class.path.replacement}"/>
+ </pathconvert>
+ <pathconvert property="run.modulepath.with.dist.jar">
+ <path location="${dist.jar.resolved}"/>
+ <path path="${run.modulepath}"/>
+ <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
+ </pathconvert>
+ <condition else="${run.modulepath}" property="jar.usage.message.run.modulepath.with.dist.jar" value="${run.modulepath.with.dist.jar}">
+ <isset property="named.module.internal"/>
+ </condition>
+ <condition else="" property="jar.usage.message.module.path" value=" -p ${jar.usage.message.run.modulepath.with.dist.jar}">
+ <and>
+ <isset property="modules.supported.internal"/>
+ <length length="0" string="${jar.usage.message.run.modulepath.with.dist.jar}" when="greater"/>
+ </and>
+ </condition>
+ <condition else="" property="jar.usage.message.class.path" value=" -cp ${run.classpath.with.dist.jar}">
+ <length length="0" string="${run.classpath.with.dist.jar}" when="greater"/>
+ </condition>
+ <condition else="/${main.class}" property="jar.usage.message.main.class.class.selector" value="">
+ <isset property="do.module.main.class"/>
+ </condition>
+ <condition else=" ${main.class}" property="jar.usage.message.main.class" value=" -m ${module.name}${jar.usage.message.main.class.class.selector}">
+ <isset property="named.module.internal"/>
+ </condition>
+ <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java}${jar.usage.message.module.path}${jar.usage.message.class.path}${jar.usage.message.main.class}">
+ <isset property="main.class.available"/>
+ </condition>
+ <condition else="debug" property="jar.usage.level" value="info">
+ <isset property="main.class.available"/>
+ </condition>
+ <echo level="${jar.usage.level}" message="${jar.usage.message}"/>
+ </target>
+ <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest">
+ <delete>
+ <fileset file="${tmp.manifest.file}"/>
+ </delete>
+ </target>
+ <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/>
+ <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/>
+ <target name="-post-jar">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init,compile,-pre-jar,-set-module-main-class,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/>
+ <target depends="init,compile,-pre-jar,-do-jar,-post-jar,deploy" description="Build JAR." name="jar"/>
+ <!--
+ =================
+ DEPLOY SECTION
+ =================
+ -->
+ <target name="-pre-deploy">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init" name="-check-jlink">
+ <condition property="do.jlink.internal">
+ <and>
+ <istrue value="${do.jlink}"/>
+ <isset property="do.archive"/>
+ <isset property="named.module.internal"/>
+ </and>
+ </condition>
+ </target>
+ <target depends="init,-do-jar,-post-jar,-pre-deploy,-check-jlink" if="do.jlink.internal" name="-do-deploy">
+ <delete dir="${dist.jlink.dir}" failonerror="false" quiet="true"/>
+ <property name="jlink.launcher.name" value="${application.title}"/>
+ <condition else="${module.name}" property="jlink.add.modules" value="${module.name},${jlink.additionalmodules}">
+ <and>
+ <isset property="jlink.additionalmodules"/>
+ <length length="0" string="${jlink.additionalmodules}" when="greater"/>
+ </and>
+ </condition>
+ <condition property="jlink.do.strip.internal">
+ <and>
+ <isset property="jlink.strip"/>
+ <istrue value="${jlink.strip}"/>
+ </and>
+ </condition>
+ <condition property="jlink.do.additionalparam.internal">
+ <and>
+ <isset property="jlink.additionalparam"/>
+ <length length="0" string="${jlink.additionalparam}" when="greater"/>
+ </and>
+ </condition>
+ <condition property="jlink.do.launcher.internal">
+ <and>
+ <istrue value="${jlink.launcher}"/>
+ <isset property="main.class.available"/>
+ </and>
+ </condition>
+ <property name="platform.jlink" value="${jdk.home}/bin/jlink"/>
+ <property name="jlink.systemmodules.internal" value="${jdk.home}/jmods"/>
+ <exec executable="${platform.jlink}">
+ <arg value="--module-path"/>
+ <arg path="${jlink.systemmodules.internal}:${run.modulepath}:${dist.jar}"/>
+ <arg value="--add-modules"/>
+ <arg value="${jlink.add.modules}"/>
+ <arg if:set="jlink.do.strip.internal" value="--strip-debug"/>
+ <arg if:set="jlink.do.launcher.internal" value="--launcher"/>
+ <arg if:set="jlink.do.launcher.internal" value="${jlink.launcher.name}=${module.name}/${main.class}"/>
+ <arg if:set="jlink.do.additionalparam.internal" line="${jlink.additionalparam}"/>
+ <arg value="--output"/>
+ <arg value="${dist.jlink.output}"/>
+ </exec>
+ </target>
+ <target name="-post-deploy">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="-do-jar,-post-jar,-pre-deploy,-do-deploy,-post-deploy" name="deploy"/>
+ <!--
+ =================
+ EXECUTION SECTION
+ =================
+ -->
+ <target depends="init,compile" description="Run a main class." name="run">
+ <j2seproject1:java>
+ <customize>
+ <arg line="${application.args}"/>
+ </customize>
+ </j2seproject1:java>
+ </target>
+ <target name="-do-not-recompile">
+ <property name="javac.includes.binary" value=""/>
+ </target>
+ <target depends="init,compile-single" name="run-single">
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+ <j2seproject1:java classname="${run.class}"/>
+ </target>
+ <target depends="init,compile-test-single" name="run-test-with-main">
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+ <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
+ </target>
+ <!--
+ =================
+ DEBUGGING SECTION
+ =================
+ -->
+ <target depends="init" if="netbeans.home" name="-debug-start-debugger">
+ <j2seproject1:nbjpdastart name="${debug.class}"/>
+ </target>
+ <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
+ <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
+ </target>
+ <target depends="init,compile" name="-debug-start-debuggee">
+ <j2seproject3:debug>
+ <customizeDebuggee>
+ <arg line="${application.args}"/>
+ </customizeDebuggee>
+ </j2seproject3:debug>
+ </target>
+ <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
+ <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
+ <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
+ </target>
+ <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
+ <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
+ <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+ <j2seproject3:debug classname="${debug.class}"/>
+ </target>
+ <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
+ <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
+ <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+ <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
+ </target>
+ <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
+ <target depends="init" name="-pre-debug-fix">
+ <fail unless="fix.includes">Must set fix.includes</fail>
+ <property name="javac.includes" value="${fix.includes}.java"/>
+ </target>
+ <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
+ <j2seproject1:nbjpdareload/>
+ </target>
+ <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
+ <!--
+ =================
+ PROFILING SECTION
+ =================
+ -->
+ <!--
+ pre NB7.2 profiler integration
+ -->
+ <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
+ <nbprofiledirect>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ </nbprofiledirect>
+ <profile/>
+ </target>
+ <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
+ <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
+ <nbprofiledirect>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ </nbprofiledirect>
+ <profile classname="${profile.class}"/>
+ </target>
+ <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
+ <nbprofiledirect>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ </nbprofiledirect>
+ <profile classname="sun.applet.AppletViewer">
+ <customize>
+ <arg value="${applet.url}"/>
+ </customize>
+ </profile>
+ </target>
+ <target depends="-init-macrodef-junit,profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
+ <nbprofiledirect>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ </nbprofiledirect>
+ <j2seproject3:junit excludes="${excludes}" includes="${includes}" testincludes="${profile.class}" testmethods="">
+ <customize>
+ <jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/>
+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ </customize>
+ </j2seproject3:junit>
+ </target>
+ <!--
+ end of pre NB72 profiling section
+ -->
+ <target if="netbeans.home" name="-profile-check">
+ <condition property="profiler.configured">
+ <or>
+ <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
+ <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
+ </or>
+ </condition>
+ </target>
+ <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
+ <startprofiler/>
+ <antcall target="run"/>
+ </target>
+ <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+ <startprofiler/>
+ <antcall target="run-single"/>
+ </target>
+ <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
+ <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
+ <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+ <startprofiler/>
+ <antcall target="test-single"/>
+ </target>
+ <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+ <startprofiler/>
+ <antcall target="run-test-with-main"/>
+ </target>
+ <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
+ <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+ <startprofiler/>
+ <antcall target="run-applet"/>
+ </target>
+ <!--
+ ===============
+ JAVADOC SECTION
+ ===============
+ -->
+ <target depends="init" if="have.sources" name="-javadoc-build">
+ <mkdir dir="${dist.javadoc.dir}"/>
+ <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
+ <and>
+ <isset property="endorsed.classpath.cmd.line.arg"/>
+ <not>
+ <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
+ </not>
+ </and>
+ </condition>
+ <condition else="" property="bug5101868workaround" value="*.java">
+ <matches pattern="1\.[56](\..*)?" string="${java.version}"/>
+ </condition>
+ <condition else="" property="javadoc.html5.cmd.line.arg" value="-html5">
+ <and>
+ <isset property="javadoc.html5"/>
+ <available file="${jdk.home}${file.separator}lib${file.separator}jrt-fs.jar"/>
+ </and>
+ </condition>
+ <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
+ <classpath>
+ <path path="${javac.classpath}"/>
+ </classpath>
+ <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
+ <filename name="**/*.java"/>
+ </fileset>
+ <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+ <include name="**/*.java"/>
+ <exclude name="*.java"/>
+ </fileset>
+ <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
+ <arg line="${javadoc.html5.cmd.line.arg}"/>
+ </javadoc>
+ <copy todir="${dist.javadoc.dir}">
+ <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
+ <filename name="**/doc-files/**"/>
+ </fileset>
+ <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+ <include name="**/doc-files/**"/>
+ </fileset>
+ </copy>
+ </target>
+ <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
+ <nbbrowse file="${dist.javadoc.dir}/index.html"/>
+ </target>
+ <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
+ <!--
+ =========================
+ TEST COMPILATION SECTION
+ =========================
+ -->
+ <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
+ <mkdir dir="${build.test.classes.dir}"/>
+ </target>
+ <target name="-pre-compile-test">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="-init-source-module-properties" if="named.module.internal" name="-init-test-javac-module-properties-with-module">
+ <j2seproject3:modulename property="test.module.name" sourcepath="${test.src.dir}"/>
+ <condition else="${empty.dir}" property="javac.test.sourcepath" value="${test.src.dir}">
+ <and>
+ <isset property="test.module.name"/>
+ <length length="0" string="${test.module.name}" when="greater"/>
+ </and>
+ </condition>
+ <condition else="--patch-module ${module.name}=${test.src.dir} --add-reads ${module.name}=ALL-UNNAMED" property="javac.test.compilerargs" value="--add-reads ${test.module.name}=ALL-UNNAMED">
+ <and>
+ <isset property="test.module.name"/>
+ <length length="0" string="${test.module.name}" when="greater"/>
+ </and>
+ </condition>
+ </target>
+ <target depends="-init-source-module-properties" if="named.module.internal" name="-init-test-run-module-properties">
+ <condition else="${module.name}" property="run.test.addexport.source.module.internal" value="${test.module.name}">
+ <and>
+ <isset property="test.module.name"/>
+ <length length="0" string="${test.module.name}" when="greater"/>
+ </and>
+ </condition>
+ <fileset dir="${build.test.classes.dir}" id="run.test.packages.internal" includes="**/*.class"/>
+ <property location="${build.test.classes.dir}" name="build.test.classes.dir.abs.internal"/>
+ <pathconvert pathsep=" " property="run.test.addexports.internal" refid="run.test.packages.internal">
+ <chainedmapper>
+ <regexpmapper from="^(.*)\Q${file.separator}\E.*\.class$$" to="\1"/>
+ <filtermapper>
+ <uniqfilter/>
+ <replacestring from="${build.test.classes.dir.abs.internal}" to=""/>
+ </filtermapper>
+ <cutdirsmapper dirs="1"/>
+ <packagemapper from="*" to="--add-exports ${run.test.addexport.source.module.internal}/*=ALL-UNNAMED"/>
+ </chainedmapper>
+ </pathconvert>
+ <condition else="--patch-module ${module.name}=${build.test.classes.dir} --add-modules ${module.name} --add-reads ${module.name}=ALL-UNNAMED ${run.test.addexports.internal}" property="run.test.jvmargs" value="--add-modules ${test.module.name} --add-reads ${test.module.name}=ALL-UNNAMED ${run.test.addexports.internal}">
+ <and>
+ <isset property="test.module.name"/>
+ <length length="0" string="${test.module.name}" when="greater"/>
+ </and>
+ </condition>
+ </target>
+ <target depends="-init-source-module-properties" name="-init-test-module-properties-without-module" unless="named.module.internal">
+ <property name="javac.test.sourcepath" value="${empty.dir}"/>
+ <property name="javac.test.compilerargs" value=""/>
+ <property name="run.test.jvmargs" value=""/>
+ </target>
+ <target depends="-init-test-javac-module-properties-with-module,-init-test-module-properties-without-module" name="-init-test-module-properties"/>
+ <target if="do.depend.true" name="-compile-test-depend">
+ <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
+ </target>
+ <target depends="init,deps-jar,compile,-init-test-module-properties,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" modulepath="${javac.test.modulepath}" processorpath="${javac.test.processorpath}" sourcepath="${javac.test.sourcepath}" srcdir="${test.src.dir}">
+ <customize>
+ <compilerarg line="${javac.test.compilerargs}"/>
+ </customize>
+ </j2seproject3:javac>
+ <copy todir="${build.test.classes.dir}">
+ <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ </copy>
+ </target>
+ <target name="-post-compile-test">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
+ <target name="-pre-compile-test-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init,deps-jar,compile,-init-test-module-properties,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
+ <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+ <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
+ <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}, module-info.java" modulepath="${javac.test.modulepath}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}">
+ <customize>
+ <compilerarg line="${javac.test.compilerargs}"/>
+ </customize>
+ </j2seproject3:javac>
+ <copy todir="${build.test.classes.dir}">
+ <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+ </copy>
+ </target>
+ <target name="-post-compile-test-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
+ <!--
+ =======================
+ TEST EXECUTION SECTION
+ =======================
+ -->
+ <target depends="init" if="have.tests" name="-pre-test-run">
+ <mkdir dir="${build.test.results.dir}"/>
+ </target>
+ <target depends="init,compile-test,-init-test-run-module-properties,-pre-test-run" if="have.tests" name="-do-test-run">
+ <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/>
+ </target>
+ <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+ </target>
+ <target depends="init" if="have.tests" name="test-report"/>
+ <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
+ <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
+ <target depends="init" if="have.tests" name="-pre-test-run-single">
+ <mkdir dir="${build.test.results.dir}"/>
+ </target>
+ <target depends="init,compile-test-single,-init-test-run-module-properties,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
+ <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+ <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
+ </target>
+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+ </target>
+ <target depends="init,compile-test-single,-init-test-run-module-properties,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
+ <fail unless="test.class">Must select some files in the IDE or set test.class</fail>
+ <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
+ <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
+ </target>
+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+ </target>
+ <target depends="init,compile-test-single,-init-test-run-module-properties,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
+ <!--
+ =======================
+ TEST DEBUGGING SECTION
+ =======================
+ -->
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
+ <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
+ <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
+ </target>
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
+ <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
+ <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
+ <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
+ </target>
+ <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
+ <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
+ </target>
+ <target depends="init,compile-test-single,-init-test-run-module-properties,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
+ <target depends="init,compile-test-single,-init-test-run-module-properties,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
+ <target depends="debug-test-method" name="debug-single-method"/>
+ <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
+ <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
+ </target>
+ <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
+ <!--
+ =========================
+ APPLET EXECUTION SECTION
+ =========================
+ -->
+ <target depends="init,compile-single" name="run-applet">
+ <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+ <j2seproject1:java classname="sun.applet.AppletViewer">
+ <customize>
+ <arg value="${applet.url}"/>
+ </customize>
+ </j2seproject1:java>
+ </target>
+ <!--
+ =========================
+ APPLET DEBUGGING SECTION
+ =========================
+ -->
+ <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
+ <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+ <j2seproject3:debug classname="sun.applet.AppletViewer">
+ <customizeDebuggee>
+ <arg value="${applet.url}"/>
+ </customizeDebuggee>
+ </j2seproject3:debug>
+ </target>
+ <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
+ <!--
+ ===============
+ CLEANUP SECTION
+ ===============
+ -->
+ <target name="-deps-clean-init" unless="built-clean.properties">
+ <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
+ <delete file="${built-clean.properties}" quiet="true"/>
+ </target>
+ <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
+ <echo level="warn" message="Cycle detected: VRP was already built"/>
+ </target>
+ <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
+ <mkdir dir="${build.dir}"/>
+ <touch file="${built-clean.properties}" verbose="false"/>
+ <property file="${built-clean.properties}" prefix="already.built.clean."/>
+ <antcall target="-warn-already-built-clean"/>
+ <propertyfile file="${built-clean.properties}">
+ <entry key="${basedir}" value=""/>
+ </propertyfile>
+ </target>
+ <target depends="init" name="-do-clean">
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.jlink.output}"/>
+ <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
+ </target>
+ <target name="-post-clean">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
+ <target name="-check-call-dep">
+ <property file="${call.built.properties}" prefix="already.built."/>
+ <condition property="should.call.dep">
+ <and>
+ <not>
+ <isset property="already.built.${call.subproject}"/>
+ </not>
+ <available file="${call.script}"/>
+ </and>
+ </condition>
+ </target>
+ <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
+ <ant antfile="${call.script}" inheritall="false" target="${call.target}">
+ <propertyset>
+ <propertyref prefix="transfer."/>
+ <mapper from="transfer.*" to="*" type="glob"/>
+ </propertyset>
+ </ant>
+ </target>
+</project>
diff --git a/VRP/nbproject/genfiles.properties b/VRP/nbproject/genfiles.properties
new file mode 100644
index 0000000..1ff5f4f
--- /dev/null
+++ b/VRP/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=e2f7ff6d
+build.xml.script.CRC32=04b6befe
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=e2f7ff6d
+nbproject/build-impl.xml.script.CRC32=0fe6cb3b
diff --git a/VRP/nbproject/project.properties b/VRP/nbproject/project.properties
new file mode 100644
index 0000000..6689d76
--- /dev/null
+++ b/VRP/nbproject/project.properties
@@ -0,0 +1,95 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processor.options=
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.modulepath=\
+ ${run.modulepath}
+debug.test.classpath=\
+ ${run.test.classpath}
+debug.test.modulepath=\
+ ${run.test.modulepath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/VRP.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+dist.jlink.dir=${dist.dir}/jlink
+dist.jlink.output=${dist.jlink.dir}/VRP
+excludes=
+includes=**
+jar.compress=false
+javac.classpath=
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.external.vm=true
+javac.modulepath=
+javac.processormodulepath=
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.modulepath=\
+ ${javac.modulepath}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.html5=false
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+# The jlink additional root modules to resolve
+jlink.additionalmodules=
+# The jlink additional command line parameters
+jlink.additionalparam=
+jlink.launcher=true
+jlink.launcher.name=VRP
+main.class=
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.modulepath=\
+ ${javac.modulepath}
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+run.test.modulepath=\
+ ${javac.test.modulepath}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/VRP/nbproject/project.xml b/VRP/nbproject/project.xml
new file mode 100644
index 0000000..f980bc3
--- /dev/null
+++ b/VRP/nbproject/project.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.java.j2seproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+ <name>VRP</name>
+ <source-roots>
+ <root id="src.dir"/>
+ </source-roots>
+ <test-roots>
+ <root id="test.src.dir"/>
+ </test-roots>
+ </data>
+ </configuration>
+</project>
diff --git a/VRP/src/Algoritmo/Almacen.java b/VRP/src/Algoritmo/Almacen.java
new file mode 100644
index 0000000..52f3f13
--- /dev/null
+++ b/VRP/src/Algoritmo/Almacen.java
@@ -0,0 +1,24 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package Algoritmo;
+
+/**
+ *
+ * @author DAYANA
+ */
+public class Almacen {
+ Ciudad ciudad;
+ String region;
+ TipoAlmacen tipo;
+
+ public Almacen(Ciudad ciudad, String region, TipoAlmacen tipo) {
+ this.ciudad = ciudad;
+ this.region = region;
+ this.tipo = tipo;
+ }
+
+
+}
diff --git a/VRP/src/Algoritmo/Ciudad.java b/VRP/src/Algoritmo/Ciudad.java
new file mode 100644
index 0000000..81ef2c6
--- /dev/null
+++ b/VRP/src/Algoritmo/Ciudad.java
@@ -0,0 +1,18 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package Algoritmo;
+
+/**
+ *
+ * @author DAYANA
+ */
+public class Ciudad {
+ String nombre;
+ String region;
+ double longitud;
+ double latitud;
+
+}
diff --git a/VRP/src/Algoritmo/Main.java b/VRP/src/Algoritmo/Main.java
new file mode 100644
index 0000000..8b8aa93
--- /dev/null
+++ b/VRP/src/Algoritmo/Main.java
@@ -0,0 +1,15 @@
+package Algoritmo;
+
+/**
+ *
+ * @author DAYANA
+ */
+public class Main {
+
+ public static void main (String[] args){
+ int num_iter=45;
+ VRP vrp = new VRP();
+ vrp.init_data();
+ vrp.genetic_algorithm(num_iter);
+ }
+}
diff --git a/VRP/src/Algoritmo/PlanTransporte.java b/VRP/src/Algoritmo/PlanTransporte.java
new file mode 100644
index 0000000..cf5d66b
--- /dev/null
+++ b/VRP/src/Algoritmo/PlanTransporte.java
@@ -0,0 +1,14 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package Algoritmo;
+
+/**
+ *
+ * @author DAYANA
+ */
+public class PlanTransporte {
+
+}
diff --git a/VRP/src/Algoritmo/TipoAlmacen.java b/VRP/src/Algoritmo/TipoAlmacen.java
new file mode 100644
index 0000000..2f107ed
--- /dev/null
+++ b/VRP/src/Algoritmo/TipoAlmacen.java
@@ -0,0 +1,15 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package Algoritmo;
+
+/**
+ *
+ * @author DAYANA
+ */
+public class TipoAlmacen {
+ String nombre;
+ double capacidad;
+}
diff --git a/VRP/src/Algoritmo/Tramo.java b/VRP/src/Algoritmo/Tramo.java
new file mode 100644
index 0000000..eb2955d
--- /dev/null
+++ b/VRP/src/Algoritmo/Tramo.java
@@ -0,0 +1,24 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package Algoritmo;
+
+/**
+ *
+ * @author DAYANA
+ */
+public class Tramo {
+ Ciudad ciudad1;
+ Ciudad ciudad2;
+ double distancia;
+
+ public Tramo(Ciudad ciudad1, Ciudad ciudad2, double distancia) {
+ this.ciudad1 = ciudad1;
+ this.ciudad2 = ciudad2;
+ this.distancia = distancia;
+ }
+
+
+}
diff --git a/VRP/src/Algoritmo/VRP.java b/VRP/src/Algoritmo/VRP.java
new file mode 100644
index 0000000..a512e40
--- /dev/null
+++ b/VRP/src/Algoritmo/VRP.java
@@ -0,0 +1,57 @@
+
+package Algoritmo;
+
+/**
+ *
+ * @author DAYANA
+ */
+
+
+public class VRP {
+
+
+ public static void genetic_algorithm(int max_iter){
+ //generar poblacion inicial aleatoria
+ PlanTransporte poblacion[] = new PlanTransporte[200];
+ PlanTransporte nueva_generacion[] = new PlanTransporte[200];
+
+ poblacion = init_population();
+
+ //evaluar fitness de la poblacion
+ evaluar(poblacion);
+
+ for(int i=1;i<max_iter;i++){
+ nueva_generacion = generar_nueva_generacion(poblacion);
+ //aplicar operadores geneticos a la nueva generacion
+ poblacion = survive(poblacion, nueva_generacion);
+ }
+
+ }
+
+ private static PlanTransporte[] generar_nueva_generacion(PlanTransporte[] poblacion) {
+ return null;
+ }
+
+ private static PlanTransporte[] survive(PlanTransporte[] poblacion, PlanTransporte[] nueva_generacion) {
+ return null;
+ }
+
+ public static PlanTransporte[] init_population(){
+
+
+ for(int i=1;i<10;i++){
+
+ }
+
+ return null;
+ }
+
+ public static void evaluar(PlanTransporte[] poblacion){
+
+
+ }
+
+ public static void init_data() {
+
+ }
+}
diff --git a/VRP/src/Algoritmo/Vehiculo.java b/VRP/src/Algoritmo/Vehiculo.java
new file mode 100644
index 0000000..94efadd
--- /dev/null
+++ b/VRP/src/Algoritmo/Vehiculo.java
@@ -0,0 +1,18 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package Algoritmo;
+
+/**
+ *
+ * @author DAYANA
+ */
+public class Vehiculo {
+ String placa;
+ Ciudad ciudad_origen;
+ int capacidad;
+ double velocidad;
+
+}
diff --git a/test/.ipynb_checkpoints/GA-checkpoint.ipynb b/test/.ipynb_checkpoints/GA-checkpoint.ipynb
new file mode 100644
index 0000000..bab966d
--- /dev/null
+++ b/test/.ipynb_checkpoints/GA-checkpoint.ipynb
@@ -0,0 +1,112 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "2fd45b3a-9a24-4782-812c-08223edb750e",
+ "metadata": {},
+ "source": [
+ "# Prueba del algoritmo genetico"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "f6b4829a-9001-410c-b20c-01c65c777d8a",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "2c3c85e0-a90c-4fda-86f7-778d7328c74d",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "511ff788-0d1a-4ac7-9575-de182d236574",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "078280b5-70ef-4691-8798-a686d85d188c",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b3ad92de-b2ed-4f21-a696-1fa2981f89dc",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def genetic_algorithm(population, fitness_fn, ngen=100, pmut=0.1):\n",
+ " \"Algoritmo Genetico \"\n",
+ " \n",
+ " popsize = len(population)\n",
+ " evaluate_population(population, fitness_fn) # evalua la poblacion inicial\n",
+ " ibest = sorted(range(len(population)), key=lambda i: population[i].fitness, reverse=True)[:1]\n",
+ " bestfitness = [population[ibest[0]].fitness]\n",
+ " print(\"Poblacion inicial, best_fitness = {}\".format(population[ibest[0]].fitness))\n",
+ " \n",
+ " for g in range(ngen): # Por cada generacion\n",
+ " \n",
+ " ## Selecciona las parejas de padres para cruzamiento \n",
+ " mating_pool = []\n",
+ " for i in range(int(popsize/2)): mating_pool.append(select_parents_roulette(population)) \n",
+ " \n",
+ " ## Crea la poblacion descendencia cruzando las parejas del mating pool con Recombinación de 1 punto\n",
+ " offspring_population = []\n",
+ " for i in range(len(mating_pool)): \n",
+ " #offspring_population.extend( mating_pool[i][0].crossover_onepoint(mating_pool[i][1]) )\n",
+ " offspring_population.extend( mating_pool[i][0].crossover_uniform(mating_pool[i][1]) )\n",
+ "\n",
+ " ## Aplica el operador de mutacion con probabilidad pmut en cada hijo generado\n",
+ " for i in range(len(offspring_population)):\n",
+ " if random.uniform(0, 1) < pmut: \n",
+ " offspring_population[i] = offspring_population[i].mutate_position()\n",
+ " \n",
+ " ## Evalua la poblacion descendencia\n",
+ " evaluate_population(offspring_population, fitness_fn) # evalua la poblacion inicial\n",
+ " \n",
+ " ## Selecciona popsize individuos para la sgte. generación de la union de la pob. actual y pob. descendencia\n",
+ " population = select_survivors(population, offspring_population, popsize)\n",
+ "\n",
+ " ## Almacena la historia del fitness del mejor individuo\n",
+ " ibest = sorted(range(len(population)), key=lambda i: population[i].fitness, reverse=True)[:1]\n",
+ " bestfitness.append(population[ibest[0]].fitness)\n",
+ " print(\"generacion {}, best_fitness = {}\".format(g, population[ibest[0]].fitness))\n",
+ " \n",
+ " return population[ibest[0]], bestfitness "
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.9.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/test/GA.ipynb b/test/GA.ipynb
new file mode 100644
index 0000000..9d73164
--- /dev/null
+++ b/test/GA.ipynb
@@ -0,0 +1,361 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "2fd45b3a-9a24-4782-812c-08223edb750e",
+ "metadata": {},
+ "source": [
+ "# Prueba del algoritmo genetico"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "id": "45972b70-b2a6-48f2-aafa-9f660548079a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np\n",
+ "import random"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "34eab22f-a400-4a14-9ac4-047d87dff69f",
+ "metadata": {},
+ "source": [
+ "Data"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 97,
+ "id": "a5736dba-4c38-4b7f-9a1a-963bdb006236",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "class Ciudad:\n",
+ " regiones = {\n",
+ " 'costa': {\n",
+ " 'plazoentrega': 1\n",
+ " },\n",
+ " 'sierra': {\n",
+ " 'plazoentrega': 2\n",
+ " },\n",
+ " 'selva': {\n",
+ " 'plazoentrega': 3\n",
+ " }\n",
+ " }\n",
+ " def __init__(self, nombre, region, longitud, latitud):\n",
+ " self.nombre = nombre\n",
+ " self.region = region\n",
+ " self.x = longitud\n",
+ " self.y = latitud"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 101,
+ "id": "8ee9610f-d128-4d1b-9458-ca9048073f20",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "class Road_network:\n",
+ " def __init__(self, cities, distances):\n",
+ " \"\"\"Grafo completo del pais\n",
+ " \n",
+ " Params\n",
+ " ------\n",
+ " \n",
+ " cities: list\n",
+ " Lista de objetos Ciudad\n",
+ " \n",
+ " routes: dict\n",
+ " (Aun no se como implementar esto)\n",
+ " \"\"\"\n",
+ " \n",
+ " self.cities = cities\n",
+ " self.routes = {}"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 102,
+ "id": "7dd72c93-acba-46f9-ac99-8c3d1a8cfa67",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "class Vehiculo:\n",
+ " tipos = {\n",
+ " 1: {\n",
+ " 'cargamax': 50\n",
+ " },\n",
+ " 2: {\n",
+ " 'cargamax': 100\n",
+ " },\n",
+ " 3: {\n",
+ " 'cargamax': 200\n",
+ " }\n",
+ " }\n",
+ " \n",
+ " def __init__(self):\n",
+ " pass"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 96,
+ "id": "474a3596-f75d-411e-bf4c-20b8b8259434",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "class Pedido:\n",
+ " def __init__(self, cliente, cantidad):\n",
+ " self.cliente = cliente\n",
+ " self.cantidad = cantidad"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 98,
+ "id": "7602722f-9026-44dc-b922-e17a7d3af45b",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "class Cliente:\n",
+ " def __init__(self, nombre, ciudad):\n",
+ " self.nombre = nombre\n",
+ " self.ciudad = ciudad"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 100,
+ "id": "f6b4829a-9001-410c-b20c-01c65c777d8a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "class VRP:\n",
+ " def __init__(self):\n",
+ " # Conjuntos\n",
+ " self.I = range(2)\n",
+ " self.J = range(3)\n",
+ " self.T = range(5) # en horas\n",
+ " self.V = range(3) # 3 tipos de vehiculos\n",
+ " \n",
+ " def init_data(self):\n",
+ " \"\"\"\n",
+ " Lista los parametros iniciales, definidos en \"Modelo Matematico\" en ISA v02\n",
+ " \n",
+ " i: almacen grande (depot)\n",
+ " j: almacen pequeño (customer)\n",
+ " v: tipo de vehiculo\n",
+ " t: tiempo\n",
+ " \"\"\"\n",
+ " # Parametros\n",
+ " # Nombres cortos confunden, pero matrices de varias dimensiones \n",
+ " # sin etiquetas confunden mas\n",
+ " \n",
+ " # Demanda\n",
+ " self.D_jt = [ [ random.choice([0,1,2,3]) for _ in self.I ] for _ in self.T ]\n",
+ " # Capacidades de vehiculos\n",
+ " self.VL_v = [ random.choice([10, 15, 20]) for _ in self.V ]\n",
+ " # distancia entre almacen i, j\n",
+ " self.d_ij = [ random.choice([25,50,100]) for _ in self.V ]\n",
+ " #self.r_ijvt = [ [ 0 for _ in self.V ] for "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 82,
+ "id": "ab559513-5c14-4dd2-a51d-7737114dfba1",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([10, 10, 15])"
+ ]
+ },
+ "execution_count": 82,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "p = VRP()\n",
+ "p.init_data()\n",
+ "np.array(p.VL_v)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 83,
+ "id": "2c3c85e0-a90c-4fda-86f7-778d7328c74d",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[25, 50, 50]"
+ ]
+ },
+ "execution_count": 83,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "p.d_ij"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "511ff788-0d1a-4ac7-9575-de182d236574",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "078280b5-70ef-4691-8798-a686d85d188c",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "611c9a0d-bb1a-48eb-af37-f033abe8ed66",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "64c68216-b9f1-45f9-a0fe-3862ab106c24",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "9cb6bb08-1547-4b64-993f-b2c453535264",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b83d9e98-db8f-45cd-9eff-07d4194f7e07",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b8c06031-9c55-4e13-a27b-91b0886902e6",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "e9483c22-243f-44e5-9a6d-09da92354554",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "12952643-4a10-40bf-8af3-41319c744732",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b0306c4f-eb68-4009-9390-0f881c6a8cb4",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b3ad92de-b2ed-4f21-a696-1fa2981f89dc",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def genetic_algorithm(population, fitness_fn, ngen=100, pmut=0.1):\n",
+ " \"Algoritmo Genetico \"\n",
+ " \n",
+ " popsize = len(population)\n",
+ " evaluate_population(population, fitness_fn) # evalua la poblacion inicial\n",
+ " ibest = sorted(range(len(population)), key=lambda i: population[i].fitness, reverse=True)[:1]\n",
+ " bestfitness = [population[ibest[0]].fitness]\n",
+ " print(\"Poblacion inicial, best_fitness = {}\".format(population[ibest[0]].fitness))\n",
+ " \n",
+ " for g in range(ngen): # Por cada generacion\n",
+ " \n",
+ " ## Selecciona las parejas de padres para cruzamiento \n",
+ " mating_pool = []\n",
+ " for i in range(int(popsize/2)): mating_pool.append(select_parents_roulette(population)) \n",
+ " \n",
+ " ## Crea la poblacion descendencia cruzando las parejas del mating pool con Recombinación de 1 punto\n",
+ " offspring_population = []\n",
+ " for i in range(len(mating_pool)): \n",
+ " #offspring_population.extend( mating_pool[i][0].crossover_onepoint(mating_pool[i][1]) )\n",
+ " offspring_population.extend( mating_pool[i][0].crossover_uniform(mating_pool[i][1]) )\n",
+ "\n",
+ " ## Aplica el operador de mutacion con probabilidad pmut en cada hijo generado\n",
+ " for i in range(len(offspring_population)):\n",
+ " if random.uniform(0, 1) < pmut: \n",
+ " offspring_population[i] = offspring_population[i].mutate_position()\n",
+ " \n",
+ " ## Evalua la poblacion descendencia\n",
+ " evaluate_population(offspring_population, fitness_fn) # evalua la poblacion inicial\n",
+ " \n",
+ " ## Selecciona popsize individuos para la sgte. generación de la union de la pob. actual y pob. descendencia\n",
+ " population = select_survivors(population, offspring_population, popsize)\n",
+ "\n",
+ " ## Almacena la historia del fitness del mejor individuo\n",
+ " ibest = sorted(range(len(population)), key=lambda i: population[i].fitness, reverse=True)[:1]\n",
+ " bestfitness.append(population[ibest[0]].fitness)\n",
+ " print(\"generacion {}, best_fitness = {}\".format(g, population[ibest[0]].fitness))\n",
+ " \n",
+ " return population[ibest[0]], bestfitness "
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.9.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/test/LAB_5_ACC_2021_1.ipynb b/test/LAB_5_ACC_2021_1.ipynb
new file mode 100644
index 0000000..8eed3f8
--- /dev/null
+++ b/test/LAB_5_ACC_2021_1.ipynb
@@ -0,0 +1,700 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "2VP6d4IEg-qk"
+ },
+ "source": [
+ "# APLICACIONES EN CIENCIAS DE COMPUTACION"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "s4LxYBghg-qy"
+ },
+ "source": [
+ "## Laboratorio 5: Algoritmo genético\n",
+ "Indicaciones previas:\n",
+ "- Las respuestas deben tener un buen fundamento teórico, se realizarán descuentos en el puntaje a respuestas que no contesten a lo solicitado\n",
+ "- Cualquier indicio de plagio resultará en la anulación de la prueba.\n",
+ "\n",
+ "La tarea de este laboratorio consiste en comparar métodos en la elaboración de un algoritmo genético para la resolución de la asignación de vuelos.<br>Al final de este notebook se encuentran las preguntas que serán evaluadas en este laboratorio. \n",
+ "\n",
+ "\n",
+ "#### Representacion de Individuo:\n",
+ "\n",
+ "Un objeto Individual representaa una determinada asignacion de un subconjunto de vuelos (almacenado en <b>list_of_flights</b>) a un conjunto de gates (almacenado en <b>chromosome</b>). La lista de gates disponibles que se pueden asignar a los vuelos se almacena en la variable <b>allele_pool</b> del individuo. Ver el siguiente grafico ilustrativo:\n",
+ "\n",
+ "<img src=\"EjemploIndividuo.png\">\n",
+ "\n",
+ "**Usted deberá completar el código en las secciones indicadas con ######### COMPLETAR #########**"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "3BiTFdyNhskY"
+ },
+ "outputs": [],
+ "source": [
+ "from random import seed, randint, sample, uniform, randrange\n",
+ "from copy import deepcopy"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "IRVDEMS3g-q1"
+ },
+ "source": [
+ "### Clase <b>Individual</b>\n",
+ "\n",
+ "Esta es una clase para definir a un individuo de la población. Cada individuo posee un cromosoma, los vuelos a asignar, todos los posibles alelos y su respectivo fitness. Además, los métodos de esta clase permiten realizar el cruzamiento (crossover) y la mutación (mutation) sobre el cromosoma del individuo."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "wD-qU6LnGM8_"
+ },
+ "outputs": [],
+ "source": [
+ "class Individual(object):\n",
+ " \"\"\" Clase que implementa el individuo y sus operadores. El cromosoma de un individuo es una lista de caracteres,\n",
+ " cada elemento de la lista es un gen cuyos alelos (caracteres) posibles se indican en allele_pool\"\"\"\n",
+ "\n",
+ " def __init__(self, chromosome, list_of_flights, allele_pool): # El constructor recibe el cromosoma y el pool de alelos posibles\n",
+ " self.chromosome = chromosome[:]\n",
+ " self.list_of_flights = list_of_flights[:]\n",
+ " self.allele_pool = allele_pool\n",
+ " self.fitness = -1 # -1 indica que el individuo no ha sido evaluado\n",
+ "\n",
+ " def crossover_onepoint(self, other):\n",
+ " \"Retorna dos nuevos individuos del cruzamiento de un punto entre individuos self y other \"\n",
+ " c = randrange(len(self.chromosome))\n",
+ " ind1 = Individual(self.chromosome[:c] + other.chromosome[c:], self.list_of_flights, self.allele_pool)\n",
+ " ind2 = Individual(other.chromosome[:c] + self.chromosome[c:], self.list_of_flights, self.allele_pool)\n",
+ " return [ind1, ind2]\n",
+ " \n",
+ " def crossover_permutation(self, other):\n",
+ " new_list = list(set(self.chromosome + other.chromosome))\n",
+ " flights_to_assign = len(self.list_of_flights)\n",
+ " ind1 = Individual(sample(new_list, flights_to_assign), self.list_of_flights, self.allele_pool)\n",
+ " ind2 = Individual(sample(new_list, flights_to_assign), self.list_of_flights, self.allele_pool)\n",
+ " return [ind1, ind2]\n",
+ " \n",
+ " def crossover_uniform(self, other):\n",
+ " chromosome1 = []\n",
+ " chromosome2 = []\n",
+ " \"Retorna dos nuevos individuos del cruzamiento uniforme entre self y other \"\n",
+ " for i in range(len(self.chromosome)):\n",
+ " if uniform(0, 1) < 0.5:\n",
+ " chromosome1.append(self.chromosome[i])\n",
+ " chromosome2.append(other.chromosome[i])\n",
+ " else:\n",
+ " chromosome1.append(other.chromosome[i])\n",
+ " chromosome2.append(self.chromosome[i])\n",
+ " ind1 = Individual(chromosome1, self.list_of_flights, self.allele_pool)\n",
+ " ind2 = Individual(chromosome2, self.list_of_flights, self.allele_pool)\n",
+ " return [ind1, ind2]\n",
+ "\n",
+ " def mutate_swap(self):\n",
+ " \"Escoge dos genes e intercambia sus alelos\"\n",
+ " mutated_chromosome = deepcopy(self.chromosome)\n",
+ " mutGen1 = randrange(0, len(mutated_chromosome))\n",
+ " mutGen2 = randrange(0, len(mutated_chromosome))\n",
+ " temp = mutated_chromosome[mutGen1]\n",
+ " mutated_chromosome[mutGen1] = mutated_chromosome[mutGen2]\n",
+ " mutated_chromosome[mutGen2] = temp\n",
+ " return Individual(mutated_chromosome, self.list_of_flights, self.allele_pool)\n",
+ " \n",
+ " def mutate_position(self):\n",
+ " \"Cambia aleatoriamente el alelo de un gen.\"\n",
+ " mutated_chromosome = deepcopy(self.chromosome)\n",
+ " ######### COMPLETAR #########\n",
+ " ....\n",
+ " return Individual(mutated_chromosome, self.list_of_flights, self.allele_pool)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "c8x_4uA5i9XT"
+ },
+ "source": [
+ "### Clase <b>Gate</b>\n",
+ "\n",
+ "Esta es una clase abstracta para definir los lugares donde los vuelos serán asignados. Se debe hacer subclases con el fin de diferenciar los tipos de lugar donde un vuelo puede ser asignado."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "rycIj2j6i_PZ"
+ },
+ "outputs": [],
+ "source": [
+ "class Gate(object):\n",
+ " def __init__(self, identifier, x, y, z):\n",
+ " self.identifier = identifier\n",
+ " self.distance = x\n",
+ " self.potential_of_speed = y\n",
+ " self.number_of_persons_every_10m = z\n",
+ " \n",
+ " def __hash__(self):\n",
+ " return self.identifier"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "fbHPYQ4qj6fb"
+ },
+ "source": [
+ "### Clase <b>Sleeve</b>\n",
+ "\n",
+ "Esta clase implementa concretamente el Gate tipo Sleeve (Manga). En este tipo de gate, los pasajeros deben realizar un recorrido a pie hasta abandonar totalmente el Gate. Se tiene en cuenta la longitud de la manga, la velocidad de los pasajeros y la cantidad de personas que pueden estar cada 10m (este valor es variable porque ya refleja el ancho de la manga, puesto que una manga más ancha permite una mayor cantidad de pasajeros)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "E9XCmO-3j472"
+ },
+ "outputs": [],
+ "source": [
+ "class Sleeve(Gate):\n",
+ " def __init__(self, identifier, length_of_sleeve, speed_of_passengers_on_sleeve, number_of_passengers_every_10m):\n",
+ " super().__init__(identifier, length_of_sleeve, speed_of_passengers_on_sleeve, number_of_passengers_every_10m)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "0T5fySg6lytA"
+ },
+ "source": [
+ "### Clase <b>Zone</b>\n",
+ "\n",
+ "Esta clase implementa concretamente el Gate tipo Zone (zona). En este tipo de gate, los pasajeros son recogidos por un bus y son llevados hasta una puerta. Se tiene en cuenta la distancia de la zona a la puerta, la velocidad y capacidad del bus."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "yzwjyLG_l0nz"
+ },
+ "outputs": [],
+ "source": [
+ "class Zone(Gate):\n",
+ " def __init__(self, identifier, distance_zone_door, speed_bus, capacity_of_bus):\n",
+ " super().__init__(identifier, distance_zone_door, speed_bus, capacity_of_bus)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "ieZ9wq8amMgT"
+ },
+ "source": [
+ "### Clase <b>Flight</b>\n",
+ "\n",
+ "Esta es una clase para definir a los vuelos a asignar. Cada vuelo posee una capacidad máxima, la cantidad de pasajeros, el tiempo de estacionamiento que le toma al vuelo, la longitud de las alas del avión, el tiempo de inspección al avión luego de aterrizar, el tiempo que demorarían en bajar las escaleras los pasajeros si el avión estuviera repleto, el momento de llegada al aeropuerto y el momento en que debería irse del aeropuerto."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "3Nt88YPkmLb7"
+ },
+ "outputs": [],
+ "source": [
+ "class Flight(object):\n",
+ " def __init__(self, identifier, maximum_capacity, number_of_passengers, parking_time, length_wings, inspection_time, landing_time_on_stairs, arriving_time, leaving_time):\n",
+ " self.identifier = identifier\n",
+ " self.maximum_capacity = maximum_capacity\n",
+ " self.number_of_passengers = number_of_passengers\n",
+ " self.parking_time = parking_time\n",
+ " self.length_wings = length_wings\n",
+ " self.inspection_time = inspection_time\n",
+ " self.landing_time_on_stairs = landing_time_on_stairs\n",
+ " self.arriving_time = arriving_time\n",
+ " self.leaving_time = leaving_time\n",
+ " \n",
+ " def __hash__(self):\n",
+ " return self.identifier"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "tJ5cKDEOg-q4"
+ },
+ "source": [
+ "### Funciones utilitarias para generar los Gates y Vuelos</b>\n",
+ "Estas son funciones utilitarias para generar automáticamente los Gates y Vuelos"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "k8p8en78FCcq"
+ },
+ "outputs": [],
+ "source": [
+ "def generate_list_of_gates(number_of_gates, max_length_of_sleeve=20, max_speed_of_passengers_on_sleeve=3, max_number_of_passengers_every_10m=12, max_distance_zone_door=50, max_speed_bus=15, max_capacity_of_bus=200):\n",
+ " list_of_gates = list()\n",
+ "\n",
+ " for gate_identifier in range(number_of_gates):\n",
+ " gate_type = randint(0, 1)\n",
+ "\n",
+ " if gate_type == 0:\n",
+ " distance = randint(1, max_length_of_sleeve)\n",
+ " potential_of_speed = randint(1, max_speed_of_passengers_on_sleeve)\n",
+ " number_of_persons_every_10m = randint(1, max_number_of_passengers_every_10m)\n",
+ "\n",
+ " gate = Sleeve(gate_identifier, distance, potential_of_speed, number_of_persons_every_10m)\n",
+ " else:\n",
+ " distance = randint(1, max_distance_zone_door)\n",
+ " potential_of_speed = randint(1, max_speed_bus)\n",
+ " number_of_persons_every_10m = randint(1, max_capacity_of_bus)\n",
+ "\n",
+ " gate = Zone(gate_identifier, distance, potential_of_speed, number_of_persons_every_10m)\n",
+ " \n",
+ " list_of_gates.append(gate)\n",
+ " \n",
+ " return list_of_gates\n",
+ "\n",
+ "def generate_list_of_flights(number_of_flights, max_maximum_capacity=100, max_number_of_passengers_factor=0.8, max_parking_time=30, max_length_wings=25, max_inspection_time=180, max_landing_time_on_stairs=60, max_arriving_time=200, max_leaving_time=1000):\n",
+ " list_of_flights = list()\n",
+ "\n",
+ " max_number_of_passengers = max_number_of_passengers_factor * max_maximum_capacity\n",
+ "\n",
+ " for flight_identifier in range(number_of_flights):\n",
+ " maximum_capacity = randint(max_number_of_passengers, max_maximum_capacity)\n",
+ " number_of_passengers = randint(1, max_number_of_passengers)\n",
+ " parking_time = randint(1, max_parking_time)\n",
+ " length_wings = randint(1, max_length_wings)\n",
+ " inspection_time = randint(1, max_inspection_time)\n",
+ " landing_time_on_stairs = randint(1, max_landing_time_on_stairs)\n",
+ " arriving_time = randint(1, max_arriving_time)\n",
+ " leaving_time = randint(max_arriving_time + 1, max_leaving_time)\n",
+ "\n",
+ " flight = Flight(flight_identifier, maximum_capacity, number_of_passengers, parking_time, length_wings, inspection_time, landing_time_on_stairs, arriving_time, leaving_time)\n",
+ " \n",
+ " list_of_flights.append(flight)\n",
+ " \n",
+ " return list_of_flights"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "uHsytNf6oaXJ"
+ },
+ "source": [
+ "### Funciones utilitarias para ordenar los Vuelos y Gates</b>\n",
+ "Estas son funciones utilitarias para ordenar los Vuelos acorde a su deseabilidad y los Gates por su flujo personas"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "25baejsnob3d"
+ },
+ "outputs": [],
+ "source": [
+ "def process_desirability(n):\n",
+ " return n.number_of_passengers / (n.leaving_time - n.arriving_time)\n",
+ "\n",
+ "def process_flow(n):\n",
+ " return n.number_of_persons_every_10m * n.potential_of_speed * 10 / n.distance"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "Gqws5RELpMG1"
+ },
+ "source": [
+ "### Funciones utilitarias para el Algoritmo Genético</b>\n",
+ "Estas son funciones utilitarias para realizar el Algoritmo Genético que se encargue de la asignación de vuelos"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "Glf8GsaujEF6"
+ },
+ "outputs": [],
+ "source": [
+ "# Inicialización aleatoria de la población\n",
+ "def init_population(population_number, flights_to_assign, allele_pool, list_of_flights):\n",
+ " population = []\n",
+ " for i in range(population_number):\n",
+ " new_chromosome_for_individual = sample(allele_pool, flights_to_assign)\n",
+ " list_of_flights_for_individual = sample(list_of_flights, flights_to_assign)\n",
+ " population.append( Individual(new_chromosome_for_individual, list_of_flights_for_individual, allele_pool) )\n",
+ " return population\n",
+ "\n",
+ "# Funcion de fitness: evalua un individuo dada su lista de vuelos (solution_flights) y los gates asignados (solution_gates)\n",
+ "# El fitness representa la suma total de ratios de numeros de pasajeros desembarcados por unidad de tiempo en cada gate asignado \n",
+ "def fitness(solution_flights, solution_gates):\n",
+ " grace_time = 5/100\n",
+ "\n",
+ " cumulative_time = 0\n",
+ " for flight, gate in zip(solution_flights, solution_gates):\n",
+ " number_of_passengers = flight.number_of_passengers\n",
+ " if isinstance(gate, Sleeve):\n",
+ " disembarkation_time_of_passengers = ( (number_of_passengers * (gate.distance + flight.length_wings) / process_flow(gate)) + flight.parking_time + flight.inspection_time ) * (1 + grace_time)\n",
+ " else:\n",
+ " disembarkation_time_of_passengers = ( (number_of_passengers * gate.distance / process_flow(gate)) + flight.parking_time + (flight.landing_time_on_stairs * number_of_passengers / flight.maximum_capacity) + flight.inspection_time ) * (1 + grace_time)\n",
+ " cumulative_time += number_of_passengers / disembarkation_time_of_passengers\n",
+ " return cumulative_time\n",
+ "\n",
+ "# Evaluar la población con la función fitness\n",
+ "def evaluate_population(population, fitness_fn):\n",
+ " \"\"\" Evalua una poblacion de individuos con la funcion de fitness pasada \"\"\"\n",
+ " population_size = len(population)\n",
+ " for i in range(population_size):\n",
+ " if population[i].fitness == -1: # Evalúa sólo si el individuo no esta evaluado\n",
+ " population[i].fitness = fitness_fn(population[i].list_of_flights, population[i].chromosome)\n",
+ "\n",
+ "# Selección de parientes por el método roulette\n",
+ "def select_parents_roulette(population):\n",
+ " population_size = len(population)\n",
+ " \n",
+ " sumfitness = sum([indiv.fitness for indiv in population])\n",
+ " pickfitness = uniform(0, sumfitness)\n",
+ " cumfitness = 0\n",
+ " for i in range(population_size):\n",
+ " cumfitness += population[i].fitness\n",
+ " if cumfitness > pickfitness: \n",
+ " iParent1 = i\n",
+ " break\n",
+ " \n",
+ " sumfitness = sumfitness - population[iParent1].fitness\n",
+ " pickfitness = uniform(0, sumfitness)\n",
+ " cumfitness = 0\n",
+ " for i in range(population_size):\n",
+ " if i == iParent1:\n",
+ " continue\n",
+ " cumfitness += population[i].fitness\n",
+ " if cumfitness > pickfitness: \n",
+ " iParent2 = i\n",
+ " break\n",
+ " return (population[iParent1], population[iParent2])\n",
+ "\n",
+ "# Selección de parientes por el método tournament\n",
+ "def select_parents_tournament(population, percentage_size):\n",
+ " population_size = len(population)\n",
+ " tournament_size = int(percentage_size*population_size/100)\n",
+ " \n",
+ " # Escoge el primer padre\n",
+ " tournament_pool = sample(population, tournament_size)\n",
+ " max_fitness = -1\n",
+ " for i in range(len(tournament_pool)): # recorre los individuos que participan en el torneo buscando el mejor individuo\n",
+ " if tournament_pool[i].fitness > max_fitness:\n",
+ " max_fitness = tournament_pool[i].fitness\n",
+ " iParent1 = i\n",
+ " \n",
+ " # Escoge el segundo padre\n",
+ " ######### COMPLETAR #########\n",
+ " ....\n",
+ " return (population[iParent1], population[iParent2])\n",
+ "\n",
+ "# Selección de la nueva población\n",
+ "def select_survivors(population, offspring_population, numsurvivors):\n",
+ " next_population = []\n",
+ " population.extend(offspring_population) # Une las dos poblaciones\n",
+ " survivors = sorted(population, key=lambda x: x.fitness, reverse=True)[:numsurvivors]\n",
+ " next_population.extend(survivors)\n",
+ " return next_population\n",
+ "\n",
+ "def genetic_algorithm(list_of_flights, list_of_gates, num_individuals, flights_to_assign, fitness_fn, n_generations, selection_fn=\"roulette\", crossover=\"onepoint\", mutation=\"position\", percentage_size=5, p_mut=0.05):\n",
+ " seed(0)\n",
+ "\n",
+ " allele_pool = list_of_gates\n",
+ "\n",
+ " #Inicializa una poblacion inicial de forma aleatoria\n",
+ " population = init_population(num_individuals, flights_to_assign, allele_pool, list_of_flights)\n",
+ "\n",
+ " population_size = len(population)\n",
+ " ######### COMPLETAR #########\n",
+ " ....\n",
+ " \n",
+ " for _ in range(n_generations): # Por cada generacion\n",
+ " \n",
+ " ## Selecciona las parejas de padres para cruzamiento\n",
+ " mating_pool = []\n",
+ " for i in range(int(population_size/2)):\n",
+ " if selection_fn == \"roulette\":\n",
+ " ######### COMPLETAR #########\n",
+ " ....\n",
+ " elif selection_fn == \"tournament\":\n",
+ " mating_pool.append(select_parents_tournament(population, percentage_size))\n",
+ "\n",
+ " ## Crea la poblacion descendencia cruzando las parejas del mating pool \n",
+ " offspring_population = []\n",
+ " for i in range(len(mating_pool)):\n",
+ " if crossover == \"onepoint\":\n",
+ " offspring_population.extend( mating_pool[i][0].crossover_onepoint(mating_pool[i][1]) )\n",
+ " elif crossover == \"permutation\":\n",
+ " ######### COMPLETAR #########\n",
+ " ....\n",
+ " elif crossover == \"uniform\":\n",
+ " ######### COMPLETAR #########\n",
+ " ....\n",
+ " \n",
+ " ## Aplica el operador de mutacion con probabilidad p_mut en cada hijo generado\n",
+ " for i in range(len(offspring_population)):\n",
+ " if uniform(0, 1) < p_mut: \n",
+ " if mutation == \"swap\":\n",
+ " ######### COMPLETAR #########\n",
+ " ....\n",
+ " elif mutation == \"position\":\n",
+ " offspring_population[i] = offspring_population[i].mutate_position()\n",
+ "\n",
+ " ######### COMPLETAR #########\n",
+ " ....\n",
+ " \n",
+ " best = sorted(population, key=lambda x: x.fitness, reverse=True)[0]\n",
+ "\n",
+ " return best"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "pc90jPukpbwN"
+ },
+ "source": [
+ "### Funciones utilitarias para manejar la solución del Algoritmo Genético</b>\n",
+ "Esta es una función utilitarias que permite mostrar la configuración usada en el Algoritmo Genético y la asignación de Vuelos a Gates encontrada en la solución"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "yb6LUKwKpXDJ"
+ },
+ "outputs": [],
+ "source": [
+ "def make_solution_report(solution, selection_fn, crossover, mutation):\n",
+ " print(\"Selection: {} - Crossover: {} - Mutation: {} - Fitness: {}\".format(selection_fn, crossover, mutation, solution.fitness), flush=True)\n",
+ " print(\" - \".join([\"Flight {} in {} {}\".format(flight.identifier, \"Zone\" if isinstance(gate, Zone) == True else \"Sleeve\", gate.identifier) for flight, gate in zip(solution.list_of_flights, solution.chromosome)]) + \"\\n\", flush=True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "qYjVdTfeg-q6"
+ },
+ "source": [
+ "## <b>Algoritmo Genético</b> "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "1m0pxINHqQ2m"
+ },
+ "source": [
+ "### <b>Generación de Gates y Vuelos</b> \n",
+ "\n",
+ "Implementación para generar los Gates y Vuelos, **sin filtrar los primeros N vuelos más deseables que pueden ser asignados, dejando el trabajo de selección de vuelos al Algoritmo Genético**"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "DaqP5VHngUVg"
+ },
+ "outputs": [],
+ "source": [
+ "seed(0)\n",
+ "\n",
+ "number_of_gates = 7\n",
+ "number_of_flights = 20\n",
+ "\n",
+ "list_of_gates = generate_list_of_gates(number_of_gates)\n",
+ "list_of_flights = generate_list_of_flights(number_of_flights)\n",
+ "\n",
+ "number_of_gates = len(list_of_gates)\n",
+ "number_of_flights = len(list_of_flights)\n",
+ "\n",
+ "flights_to_assign = number_of_flights if number_of_flights <= number_of_gates\telse number_of_gates\n",
+ " \n",
+ "list_of_flights = sorted(list_of_flights, key=process_desirability, reverse=True)\n",
+ "list_of_gates = sorted(list_of_gates, key=process_flow, reverse=True)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "PmmLPnvYrP6v"
+ },
+ "source": [
+ "### <b>Experimentación con el Algoritmo Genético</b> "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "CnfOnMijrP6x"
+ },
+ "outputs": [],
+ "source": [
+ "num_individuals = 100\n",
+ "\n",
+ "fitness_fn = fitness\n",
+ "n_generations = 20\n",
+ "\n",
+ "best_fitness = 0\n",
+ "\n",
+ "selection_fn = \"roulette\"\n",
+ "crossover = \"onepoint\"\n",
+ "mutation = \"position\"\n",
+ "\n",
+ "solution = genetic_algorithm(list_of_flights, list_of_gates, num_individuals, flights_to_assign, fitness_fn, n_generations, selection_fn, crossover, mutation)\n",
+ "\n",
+ "make_solution_report(solution, selection_fn, crossover, mutation)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "wDZA5IJ5gUVh"
+ },
+ "outputs": [],
+ "source": [
+ "num_individuals = 100\n",
+ "\n",
+ "fitness_fn = fitness\n",
+ "n_generations = 20\n",
+ "\n",
+ "best_fitness = 0\n",
+ "\n",
+ "######### COMPLETAR #########\n",
+ "for selection_fn in [\"roulette\", \"tournament\"]: # por cada operador de seleccion\n",
+ " for crossover in [....]: # por cada operador de cruzamiento\n",
+ " for mutation in [....]: # por cada operador de mutacion\n",
+ " ....\n",
+ "\n",
+ "print(\"Best Fitness: {}\".format(best_fitness))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "JnfUrB-aqegj"
+ },
+ "source": [
+ "# Preguntas:"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "yZHjKv4Lyfa2"
+ },
+ "source": [
+ "**1.** Completar el código\n",
+ "\n",
+ "**(4 Puntos)**"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "xCdMlpt1vpJj"
+ },
+ "source": [
+ "**2.** Para la \"Generación de Gates y Vuelos\", experimentar con el algoritmo genético usando las siguientes configuraciones:\n",
+ "\n",
+ "- selection_fn: \"roulette\", \"tournament\"\n",
+ "- crossover: \"onepoint\", \"uniform\", \"permutation\"\n",
+ "- mutation: \"position\", \"swap\"\n",
+ "\n",
+ "En total son 12 combinaciones a realizar. En cada configuración se debe usar la función \"make_solution_report\" para obtener los resultados. La lista de Vuelos y Gates sólo se generan 1 vez, a partir de las cuales se experimenta con cada configuración del Algoritmo Genético.\n",
+ "\n",
+ "**No modificar los valores de \"percentage_size\" y \"p_mut\" al ejecutar el algoritmo genético**\n",
+ "\n",
+ "**Se debe mostrar el código respectivo y la solución generada en cada configuración o se considerará como inválido. Para este fin, puede agregar celdas a su gusto.**\n",
+ "\n",
+ "**(5 Puntos, cada 3 configuraciones realizadas equivale a 1 punto)**"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "iobk9RW2vtcr"
+ },
+ "source": [
+ "**3.** Para la \"Generación de Gates y Vuelos no restringida\", seleccionar las soluciones con el mejor fitness.\n",
+ "\n",
+ "**En total debería tener 5 configuraciones con el mejor fitness (contando todos los decimales devueltos en la impresión de make_solution_report**\n",
+ "\n",
+ "**(5 Puntos, cada configuración explicada equivale a 1 punto)**"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "h1-xDv92SYnF"
+ },
+ "source": [
+ "**4.** Por cada solución (de la pregunta 3), explicar teóricamente porque dicha configuración (\"selection_fn\", \"crossover\" y \"mutation\") obtiene el mejor fitness. Se debe tener en cuenta que en este caso el Algoritmo Genético se encargó de elegir los vuelos a ser asignados.\n",
+ "\n",
+ "**Es necesario que indique en que parte del código el Algoritmo Genético eligió los vuelos, o las justificaciones teóricas no se considerarán válidas.**\n",
+ "\n",
+ "**Se debe explicar teóricamente cada configuración por separado, o se considerará como inválido.**\n",
+ "\n",
+ "**En total debería tener 5 configuraciones con el mejor fitness (contando todos los decimales devueltos en la impresión de make_solution_report**\n",
+ "\n",
+ "**(6 Puntos, indicar la parte del código el Algoritmo Genético eligió los vuelos equivale 1 punto, y cada configuración explicada equivale a 1 punto)**"
+ ]
+ }
+ ],
+ "metadata": {
+ "colab": {
+ "collapsed_sections": [],
+ "name": "LAB_5_ACC_2021_1.ipynb",
+ "provenance": []
+ },
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.8.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 1
+}
diff --git a/test/VRPTW_GA.ipynb b/test/VRPTW_GA.ipynb
new file mode 100644
index 0000000..042836e
--- /dev/null
+++ b/test/VRPTW_GA.ipynb
@@ -0,0 +1,724 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# APLICACIONES EN CIENCIAS DE COMPUTACION\n",
+ "Dr. Edwin Villanueva"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "tags": []
+ },
+ "source": [
+ "## Algoritmo genetico para resolver el VRPTW\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 140,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import random\n",
+ "import matplotlib.pyplot as plt\n",
+ "import csv"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<b>Clase abstracta de un individuo de algoritmo genético</b>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "class Individual:\n",
+ " \"Clase abstracta para individuos de un algoritmo evolutivo.\"\n",
+ "\n",
+ " def __init__(self, chromosome):\n",
+ " self.chromosome = chromosome\n",
+ "\n",
+ " def crossover(self, other):\n",
+ " \"Retorna un nuevo individuo cruzando self y other.\"\n",
+ " raise NotImplementedError\n",
+ " \n",
+ " def mutate(self):\n",
+ " \"Cambia los valores de algunos genes.\"\n",
+ " raise NotImplementedError "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<b>Clase concreta de un individuo del problema de las n-reinas</b>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 105,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "class Individual_VRPTW(Individual):\n",
+ " \"Clase que implementa el individuo en VRPTW.\"\n",
+ "\n",
+ " def __init__(self, chromosome):\n",
+ " self.chromosome = chromosome[:]\n",
+ " self.fitness = -1\n",
+ " \n",
+ " def crossover_order(self, other):\n",
+ " \"\"\"\n",
+ " Copies a part of the child chromosome from the first parent and constructs \n",
+ " the remaining part by following the vertex ordering in the second parent\n",
+ " \"\"\"\n",
+ " cut_point1 = random.randrange(0, len(self.chromosome) + 1)\n",
+ " cut_point2 = random.randrange(cut_point1, len(self.chromosome) + 1)\n",
+ " \n",
+ " c1 = self.chromosome[:]\n",
+ " c2 = other.chromosome[:]\n",
+ " p1_rem = self.chromosome[:cut_point1] + self.chromosome[cut_point2:]\n",
+ " p2_rem = other.chromosome[:cut_point1] + other.chromosome[cut_point2:]\n",
+ " # Change the genes in the remaining part of the child...\n",
+ " for i in range(len(self.chromosome)):\n",
+ " if i not in range(cut_point1, cut_point2):\n",
+ " # ...following the vertex ordering in the second parent\n",
+ " for gene in other.chromosome:\n",
+ " if gene in p1_rem:\n",
+ " c1.chromosome[i] = gene\n",
+ " \n",
+ " # (now for the other child)\n",
+ " for gene in self.chromosome:\n",
+ " if gene in p2_rem:\n",
+ " c2.chromosome[i] = gene\n",
+ " \n",
+ " return [Individual_VRPTW(c1), Individual_VRPTW(c2)]\n",
+ " \n",
+ "\n",
+ " def crossover_onepoint(self, other):\n",
+ " \"Retorna dos nuevos individuos del cruzamiento de un punto entre self y other \"\n",
+ " c = random.randrange(len(self.chromosome))\n",
+ " ind1 = Individual_VRPTW(self.chromosome[:c] + other.chromosome[c:])\n",
+ " ind2 = Individual_VRPTW(other.chromosome[:c] + self.chromosome[c:])\n",
+ " return [ind1, ind2] \n",
+ " \n",
+ " def crossover_uniform(self, other):\n",
+ " chromosome1 = []\n",
+ " chromosome2 = []\n",
+ " \"Retorna dos nuevos individuos del cruzamiento uniforme entre self y other \"\n",
+ " for i in range(len(self.chromosome)):\n",
+ " if random.uniform(0, 1) < 0.5:\n",
+ " chromosome1.append(self.chromosome[i])\n",
+ " chromosome2.append(other.chromosome[i])\n",
+ " else:\n",
+ " chromosome1.append(other.chromosome[i])\n",
+ " chromosome2.append(self.chromosome[i])\n",
+ " ind1 = Individual_VRPTW(chromosome1)\n",
+ " ind2 = Individual_VRPTW(chromosome2)\n",
+ " return [ind1, ind2] \n",
+ "\n",
+ " def mutate_position(self):\n",
+ " mutated_ind = Individual_VRPTW(self.chromosome[:])\n",
+ " indexPos = random.randint(0, len(mutated_ind.chromosome)-1)\n",
+ " newPos = random.randint(0, len(mutated_ind.chromosome)-1)\n",
+ " mutated_ind.chromosome[indexPos] = newPos\n",
+ " return mutated_ind\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<b>Funcion de fitness para evaluar un individuo del problema de las n-reinas</b>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 109,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def fitness_VRPTW(chromosome):\n",
+ " \"\"\"Retorna el fitness de un cromosoma en el problema VRPTW (distancia total de todas las rutas) \"\"\"\n",
+ " n = len(chromosome) # No. of vertices\n",
+ " fitness = 10**6\n",
+ " # feasibility\n",
+ " # TODO: considerar todas las restricciones\n",
+ " # desirability\n",
+ " for i in range(0, n):\n",
+ " fitness -= distancia[i][i + 1]\n",
+ " \n",
+ " return fitness"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<b>Funcion para evaluar toda una población de individuos con la funcion de fitnes especificada</b>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def evaluate_population(population, fitness_fn):\n",
+ " \"\"\" Evalua una poblacion de individuos con la funcion de fitness pasada \"\"\"\n",
+ " popsize = len(population)\n",
+ " for i in range(popsize):\n",
+ " if population[i].fitness == -1: # si el individuo no esta evaluado\n",
+ " population[i].fitness = fitness_fn(population[i].chromosome)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<b>Funcion que selecciona con el metodo de la ruleta un par de individuos de population para cruzamiento </b>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 103,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def select_parents_roulette(population):\n",
+ " popsize = len(population)\n",
+ " \n",
+ " # Escoje el primer padre\n",
+ " sumfitness = sum([indiv.fitness for indiv in population]) # suma total del fitness de la poblacion\n",
+ " pickfitness = random.uniform(0, sumfitness) # escoge un numero aleatorio entre 0 y sumfitness\n",
+ " cumfitness = 0 # fitness acumulado\n",
+ " for i in range(popsize):\n",
+ " cumfitness += population[i].fitness\n",
+ " if cumfitness > pickfitness: \n",
+ " iParent1 = i\n",
+ " break\n",
+ " \n",
+ " # Escoje el segundo padre, desconsiderando el padre ya escogido\n",
+ " sumfitness = sumfitness - population[iParent1].fitness # retira el fitness del padre ya escogido\n",
+ " pickfitness = random.uniform(0, sumfitness) # escoge un numero aleatorio entre 0 y sumfitness\n",
+ " cumfitness = 0 # fitness acumulado\n",
+ " for i in range(popsize):\n",
+ " if i == iParent1: continue # si es el primer padre \n",
+ " cumfitness += population[i].fitness\n",
+ " if cumfitness > pickfitness: \n",
+ " iParent2 = i\n",
+ " break \n",
+ " return (population[iParent1], population[iParent2])"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<b>Funcion que selecciona sobrevivientes para la sgte generacion, dada la poblacion actual y poblacion de hijos </b>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def select_survivors(population, offspring_population, numsurvivors):\n",
+ " next_population = []\n",
+ " population.extend(offspring_population) # une las dos poblaciones\n",
+ " isurvivors = sorted(range(len(population)), key=lambda i: population[i].fitness, reverse=True)[:numsurvivors]\n",
+ " for i in range(numsurvivors): next_population.append(population[isurvivors[i]])\n",
+ " return next_population"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<b>Algoritmo Genetico</b> \n",
+ "Recibe una poblacion inicial, funcion de fitness, numero de generaciones (ngen) y taza de mutación (pmut)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def genetic_algorithm(population, fitness_fn, ngen=100, pmut=0.1):\n",
+ " \"Algoritmo Genetico \"\n",
+ " \n",
+ " popsize = len(population)\n",
+ " evaluate_population(population, fitness_fn) # evalua la poblacion inicial\n",
+ " ibest = sorted(range(len(population)), key=lambda i: population[i].fitness, reverse=True)[:1]\n",
+ " bestfitness = [population[ibest[0]].fitness]\n",
+ " print(\"Poblacion inicial, best_fitness = {}\".format(population[ibest[0]].fitness))\n",
+ " \n",
+ " for g in range(ngen): # Por cada generacion\n",
+ " \n",
+ " ## Selecciona las parejas de padres para cruzamiento \n",
+ " mating_pool = []\n",
+ " for i in range(int(popsize/2)): mating_pool.append(select_parents_roulette(population)) \n",
+ " \n",
+ " ## Crea la poblacion descendencia cruzando las parejas del mating pool con Recombinación de 1 punto\n",
+ " offspring_population = []\n",
+ " for i in range(len(mating_pool)): \n",
+ " #offspring_population.extend( mating_pool[i][0].crossover_onepoint(mating_pool[i][1]) )\n",
+ " #offspring_population.extend( mating_pool[i][0].crossover_uniform(mating_pool[i][1]) )\n",
+ " offspring_population.extend( mating_pool[i][0].crossover_order(mating_pool[i][1]) )\n",
+ "\n",
+ " ## Aplica el operador de mutacion con probabilidad pmut en cada hijo generado\n",
+ " for i in range(len(offspring_population)):\n",
+ " if random.uniform(0, 1) < pmut: \n",
+ " offspring_population[i] = offspring_population[i].mutate_position()\n",
+ " \n",
+ " ## Evalua la poblacion descendencia\n",
+ " evaluate_population(offspring_population, fitness_fn) # evalua la poblacion inicial\n",
+ " \n",
+ " ## Selecciona popsize individuos para la sgte. generación de la union de la pob. actual y pob. descendencia\n",
+ " population = select_survivors(population, offspring_population, popsize)\n",
+ "\n",
+ " ## Almacena la historia del fitness del mejor individuo\n",
+ " ibest = sorted(range(len(population)), key=lambda i: population[i].fitness, reverse=True)[:1]\n",
+ " bestfitness.append(population[ibest[0]].fitness)\n",
+ " print(\"generacion {}, best_fitness = {}\".format(g, population[ibest[0]].fitness))\n",
+ " \n",
+ " return population[ibest[0]], bestfitness "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ " <b>Algoritmo de Busqueda Genetica para el VRPTW</b> "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 117,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def genetic_algorithm_VRPTW(fitness_fn, num_depots=1, num_vehicles=1, vehicle_capacity=200, popsize=10, ngen=1000, pmut=0):\n",
+ " population = []\n",
+ " \n",
+ " # Crea la poblacion inicial con cromosomas aleatorios\n",
+ " for i in range(popsize):\n",
+ " chromosome = [j for j in range(1,num_vertices+1)]\n",
+ " random.shuffle(chromosome)\n",
+ " population.append(Individual_VRPTW(chromosome))\n",
+ " \n",
+ " return genetic_algorithm(population, fitness_fn, ngen, pmut)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def genetic_search_nqueens(fitness_fn, num_queens=10, popsize=10, ngen=100, pmut=0.5):\n",
+ " import random\n",
+ " population = []\n",
+ "\n",
+ " ## Crea la poblacion inicial con cromosomas aleatorios\n",
+ " for i in range(popsize):\n",
+ " chromosome = [j for j in range(1,num_queens+1)]\n",
+ " random.shuffle(chromosome)\n",
+ " population.append( Individual_nqueens(chromosome) )\n",
+ " \n",
+ " ## Crea la poblacion inicial con los siguientes cromosomas \n",
+ " #chromosomes = [[1,3,1,3,1,3,1,3,1,3],\n",
+ " # [2,4,2,4,2,4,2,4,2,4],\n",
+ " # [3,5,3,5,3,5,3,5,3,5],\n",
+ " # [4,6,4,6,4,6,4,6,4,6],\n",
+ " # [5,7,5,7,5,7,5,7,5,7],\n",
+ " # [6,8,6,8,6,8,6,8,6,8],\n",
+ " # [7,9,7,9,7,9,7,9,7,9],\n",
+ " # [8,10,8,10,8,10,8,10,8,10],\n",
+ " # [9,1,9,1,9,1,9,1,9,1],\n",
+ " # [10,2,10,2,10,2,10,2,10,2] ] \n",
+ " #for i in range(popsize):\n",
+ " # population.append( Individual_nqueens(chromosomes[i]) ) \n",
+ " \n",
+ " ## llama al algoritmo genetico para encontrar una solucion al problema de las n reinas\n",
+ " return genetic_algorithm(population, fitness_fn, ngen, pmut)\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Probando el Algoritmo genetico"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 115,
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "NameError",
+ "evalue": "name 'distancia' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Input \u001b[0;32mIn [115]\u001b[0m, in \u001b[0;36m<cell line: 4>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpyplot\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mplt\u001b[39;00m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;66;03m# busca solucion para el problema de 10 reinas. Usa 100 individuos aleatorios, 100 generaciones y taza de mutación de 0.5\u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m best_ind, bestfitness \u001b[38;5;241m=\u001b[39m \u001b[43mgenetic_algorithm_VRPTW\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfitness_VRPTW\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 5\u001b[0m plt\u001b[38;5;241m.\u001b[39mplot(bestfitness)\n\u001b[1;32m 6\u001b[0m plt\u001b[38;5;241m.\u001b[39mshow()\n",
+ "Input \u001b[0;32mIn [113]\u001b[0m, in \u001b[0;36mgenetic_algorithm_VRPTW\u001b[0;34m(fitness_fn, num_vertices, num_depots, num_vehicles, popsize, ngen, pmut)\u001b[0m\n\u001b[1;32m 7\u001b[0m random\u001b[38;5;241m.\u001b[39mshuffle(chromosome)\n\u001b[1;32m 8\u001b[0m population\u001b[38;5;241m.\u001b[39mappend(Individual_VRPTW(chromosome))\n\u001b[0;32m---> 10\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mgenetic_algorithm\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfitness_fn\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mngen\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpmut\u001b[49m\u001b[43m)\u001b[49m\n",
+ "Input \u001b[0;32mIn [10]\u001b[0m, in \u001b[0;36mgenetic_algorithm\u001b[0;34m(population, fitness_fn, ngen, pmut)\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAlgoritmo Genetico \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 4\u001b[0m popsize \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlen\u001b[39m(population)\n\u001b[0;32m----> 5\u001b[0m \u001b[43mevaluate_population\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfitness_fn\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;66;03m# evalua la poblacion inicial\u001b[39;00m\n\u001b[1;32m 6\u001b[0m ibest \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msorted\u001b[39m(\u001b[38;5;28mrange\u001b[39m(\u001b[38;5;28mlen\u001b[39m(population)), key\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mlambda\u001b[39;00m i: population[i]\u001b[38;5;241m.\u001b[39mfitness, reverse\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)[:\u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 7\u001b[0m bestfitness \u001b[38;5;241m=\u001b[39m [population[ibest[\u001b[38;5;241m0\u001b[39m]]\u001b[38;5;241m.\u001b[39mfitness]\n",
+ "Input \u001b[0;32mIn [7]\u001b[0m, in \u001b[0;36mevaluate_population\u001b[0;34m(population, fitness_fn)\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(popsize):\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m population[i]\u001b[38;5;241m.\u001b[39mfitness \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m: \u001b[38;5;66;03m# si el individuo no esta evaluado\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m population[i]\u001b[38;5;241m.\u001b[39mfitness \u001b[38;5;241m=\u001b[39m \u001b[43mfitness_fn\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpopulation\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mchromosome\u001b[49m\u001b[43m)\u001b[49m\n",
+ "Input \u001b[0;32mIn [109]\u001b[0m, in \u001b[0;36mfitness_VRPTW\u001b[0;34m(chromosome)\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# feasibility\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;66;03m# TODO: considerar todas las restricciones\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;66;03m# desirability\u001b[39;00m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;241m0\u001b[39m, n):\n\u001b[0;32m----> 9\u001b[0m fitness \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[43mdistancia\u001b[49m[i][i \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m fitness\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'distancia' is not defined"
+ ]
+ }
+ ],
+ "source": [
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "best_ind, bestfitness = genetic_algorithm_VRPTW(fitness_VRPTW)\n",
+ "plt.plot(bestfitness)\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 141,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Poblacion inicial, best_fitness = 44\n",
+ "generacion 0, best_fitness = 44\n",
+ "generacion 1, best_fitness = 44\n",
+ "generacion 2, best_fitness = 44\n",
+ "generacion 3, best_fitness = 44\n",
+ "generacion 4, best_fitness = 44\n",
+ "generacion 5, best_fitness = 44\n",
+ "generacion 6, best_fitness = 44\n",
+ "generacion 7, best_fitness = 44\n",
+ "generacion 8, best_fitness = 44\n",
+ "generacion 9, best_fitness = 44\n",
+ "generacion 10, best_fitness = 44\n",
+ "generacion 11, best_fitness = 44\n",
+ "generacion 12, best_fitness = 44\n",
+ "generacion 13, best_fitness = 44\n",
+ "generacion 14, best_fitness = 44\n",
+ "generacion 15, best_fitness = 44\n",
+ "generacion 16, best_fitness = 44\n",
+ "generacion 17, best_fitness = 44\n",
+ "generacion 18, best_fitness = 44\n",
+ "generacion 19, best_fitness = 44\n",
+ "generacion 20, best_fitness = 44\n",
+ "generacion 21, best_fitness = 44\n",
+ "generacion 22, best_fitness = 44\n",
+ "generacion 23, best_fitness = 44\n",
+ "generacion 24, best_fitness = 44\n",
+ "generacion 25, best_fitness = 44\n",
+ "generacion 26, best_fitness = 44\n",
+ "generacion 27, best_fitness = 44\n",
+ "generacion 28, best_fitness = 44\n",
+ "generacion 29, best_fitness = 44\n",
+ "generacion 30, best_fitness = 45\n",
+ "generacion 31, best_fitness = 45\n",
+ "generacion 32, best_fitness = 45\n",
+ "generacion 33, best_fitness = 45\n",
+ "generacion 34, best_fitness = 45\n",
+ "generacion 35, best_fitness = 45\n",
+ "generacion 36, best_fitness = 45\n",
+ "generacion 37, best_fitness = 45\n",
+ "generacion 38, best_fitness = 45\n",
+ "generacion 39, best_fitness = 45\n",
+ "generacion 40, best_fitness = 45\n",
+ "generacion 41, best_fitness = 45\n",
+ "generacion 42, best_fitness = 45\n",
+ "generacion 43, best_fitness = 45\n",
+ "generacion 44, best_fitness = 45\n",
+ "generacion 45, best_fitness = 45\n",
+ "generacion 46, best_fitness = 45\n",
+ "generacion 47, best_fitness = 45\n",
+ "generacion 48, best_fitness = 45\n",
+ "generacion 49, best_fitness = 45\n",
+ "generacion 50, best_fitness = 45\n",
+ "generacion 51, best_fitness = 45\n",
+ "generacion 52, best_fitness = 45\n",
+ "generacion 53, best_fitness = 45\n",
+ "generacion 54, best_fitness = 45\n",
+ "generacion 55, best_fitness = 45\n",
+ "generacion 56, best_fitness = 45\n",
+ "generacion 57, best_fitness = 45\n",
+ "generacion 58, best_fitness = 45\n",
+ "generacion 59, best_fitness = 45\n",
+ "generacion 60, best_fitness = 45\n",
+ "generacion 61, best_fitness = 45\n",
+ "generacion 62, best_fitness = 45\n",
+ "generacion 63, best_fitness = 45\n",
+ "generacion 64, best_fitness = 45\n",
+ "generacion 65, best_fitness = 45\n",
+ "generacion 66, best_fitness = 45\n",
+ "generacion 67, best_fitness = 45\n",
+ "generacion 68, best_fitness = 45\n",
+ "generacion 69, best_fitness = 45\n",
+ "generacion 70, best_fitness = 45\n",
+ "generacion 71, best_fitness = 45\n",
+ "generacion 72, best_fitness = 45\n",
+ "generacion 73, best_fitness = 45\n",
+ "generacion 74, best_fitness = 45\n",
+ "generacion 75, best_fitness = 45\n",
+ "generacion 76, best_fitness = 45\n",
+ "generacion 77, best_fitness = 45\n",
+ "generacion 78, best_fitness = 45\n",
+ "generacion 79, best_fitness = 45\n",
+ "generacion 80, best_fitness = 45\n",
+ "generacion 81, best_fitness = 45\n",
+ "generacion 82, best_fitness = 45\n",
+ "generacion 83, best_fitness = 45\n",
+ "generacion 84, best_fitness = 45\n",
+ "generacion 85, best_fitness = 45\n",
+ "generacion 86, best_fitness = 45\n",
+ "generacion 87, best_fitness = 45\n",
+ "generacion 88, best_fitness = 45\n",
+ "generacion 89, best_fitness = 45\n",
+ "generacion 90, best_fitness = 45\n",
+ "generacion 91, best_fitness = 45\n",
+ "generacion 92, best_fitness = 45\n",
+ "generacion 93, best_fitness = 45\n",
+ "generacion 94, best_fitness = 45\n",
+ "generacion 95, best_fitness = 45\n",
+ "generacion 96, best_fitness = 45\n",
+ "generacion 97, best_fitness = 45\n",
+ "generacion 98, best_fitness = 45\n",
+ "generacion 99, best_fitness = 45\n"
+ ]
+ },
+ {
+ "data": {
+ "image/png": "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\n",
+ "text/plain": [
+ "<Figure size 432x288 with 1 Axes>"
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CPU times: user 343 ms, sys: 108 ms, total: 450 ms\n",
+ "Wall time: 329 ms\n"
+ ]
+ }
+ ],
+ "source": [
+ "%%time\n",
+ "# busca solucion para el problema de 10 reinas. Usa 100 individuos aleatorios, 100 generaciones y taza de mutación de 0.5\n",
+ "best_ind, bestfitness = genetic_search_nqueens(fitness_nqueens, 10, 100, 100, 0.90)\n",
+ "plt.plot(bestfitness)\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Lectura de datos"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 139,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CUST NO.XCOORD. YCOORD. DEMAND READY TIME DUE DATE SERVICE TIME\n",
+ "1 40 50 0 0 240 0 \n",
+ "2 25 85 20 145 175 10 \n",
+ "3 22 75 30 50 80 10 \n",
+ "4 22 85 10 109 139 10 \n",
+ "5 20 80 40 141 171 10 \n",
+ "6 20 85 20 41 71 10 \n",
+ "7 18 75 20 95 125 10 \n",
+ "8 15 75 20 79 109 10 \n",
+ "9 15 80 10 91 121 10 \n",
+ "10 10 35 20 91 121 10 \n",
+ "11 10 40 30 119 149 10 \n",
+ "12 8 40 40 59 89 10 \n",
+ "13 8 45 20 64 94 10 \n",
+ "14 5 35 10 142 172 10 \n",
+ "15 5 45 10 35 65 10 \n",
+ "16 2 40 20 58 88 10 \n",
+ "17 0 40 20 72 102 10 \n",
+ "18 0 45 20 149 179 10 \n",
+ "19 44 5 20 87 117 10 \n",
+ "20 42 10 40 72 102 10 \n",
+ "21 42 15 10 122 152 10 \n",
+ "22 40 5 10 67 97 10 \n",
+ "23 40 15 40 92 122 10 \n",
+ "24 38 5 30 65 95 10 \n",
+ "25 38 15 10 148 178 10 \n",
+ "26 35 5 20 154 184 10 \n",
+ "27 95 30 30 115 145 10 \n",
+ "28 95 35 20 62 92 10 \n",
+ "29 92 30 10 62 92 10 \n",
+ "30 90 35 10 67 97 10 \n",
+ "31 88 30 10 74 104 10 \n",
+ "32 88 35 20 61 91 10 \n",
+ "33 87 30 10 131 161 10 \n",
+ "34 85 25 10 51 81 10 \n",
+ "35 85 35 30 111 141 10 \n",
+ "36 67 85 20 139 169 10 \n",
+ "37 65 85 40 43 73 10 \n",
+ "38 65 82 10 124 154 10 \n",
+ "39 62 80 30 75 105 10 \n",
+ "40 60 80 10 37 67 10 \n",
+ "41 60 85 30 85 115 10 \n",
+ "42 58 75 20 92 122 10 \n",
+ "43 55 80 10 33 63 10 \n",
+ "44 55 85 20 128 158 10 \n",
+ "45 55 82 10 64 94 10 \n",
+ "46 20 82 10 37 67 10 \n",
+ "47 18 80 10 113 143 10 \n",
+ "48 2 45 10 45 75 10 \n",
+ "49 42 5 10 151 181 10 \n",
+ "50 42 12 10 104 134 10 \n",
+ "51 72 35 30 116 146 10 \n",
+ "52 55 20 19 83 113 10 \n",
+ "53 25 30 3 52 82 10 \n",
+ "54 20 50 5 91 121 10 \n",
+ "55 55 60 16 139 169 10 \n",
+ "56 30 60 16 140 170 10 \n",
+ "57 50 35 19 130 160 10 \n",
+ "58 30 25 23 96 126 10 \n",
+ "59 15 10 20 152 182 10 \n",
+ "60 10 20 19 42 72 10 \n",
+ "61 15 60 17 155 185 10 \n",
+ "62 45 65 9 66 96 10 \n",
+ "63 65 35 3 52 82 10 \n",
+ "64 65 20 6 39 69 10 \n",
+ "65 45 30 17 53 83 10 \n",
+ "66 35 40 16 11 41 10 \n",
+ "67 41 37 16 133 163 10 \n",
+ "68 64 42 9 70 100 10 \n",
+ "69 40 60 21 144 174 10 \n",
+ "70 31 52 27 41 71 10 \n",
+ "71 35 69 23 180 210 10 \n",
+ "72 65 55 14 65 95 10 \n",
+ "73 63 65 8 30 60 10 \n",
+ "74 2 60 5 77 107 10 \n",
+ "75 20 20 8 141 171 10 \n",
+ "76 5 5 16 74 104 10 \n",
+ "77 60 12 31 75 105 10 \n",
+ "78 23 3 7 150 180 10 \n",
+ "79 8 56 27 90 120 10 \n",
+ "80 6 68 30 89 119 10 \n",
+ "81 47 47 13 192 222 10 \n",
+ "82 49 58 10 86 116 10 \n",
+ "83 27 43 9 42 72 10 \n",
+ "84 37 31 14 35 65 10 \n",
+ "85 57 29 18 96 126 10 \n",
+ "86 63 23 2 87 117 10 \n",
+ "87 21 24 28 87 117 10 \n",
+ "88 12 24 13 90 120 10 \n",
+ "89 24 58 19 67 97 10 \n",
+ "90 67 5 25 144 174 10 \n",
+ "91 37 47 6 86 116 10 \n",
+ "92 49 42 13 167 197 10 \n",
+ "93 53 43 14 14 44 10 \n",
+ "94 61 52 3 178 208 10 \n",
+ "95 57 48 23 95 125 10 \n",
+ "96 56 37 6 34 64 10 \n",
+ "97 55 54 26 132 162 10 \n",
+ "98 4 18 35 120 150 10 \n",
+ "99 26 52 9 46 76 10 \n",
+ "100 26 35 15 77 107 10 \n",
+ "101 31 67 3 180 210 10 \n"
+ ]
+ }
+ ],
+ "source": [
+ "with open('data/RC101.csv', newline='') as csvfile:\n",
+ " orders = csv.reader(csvfile)\n",
+ " for row in orders:\n",
+ " print(f\"{row[0]:8}{row[1]:8}{row[2]:8}{row[3]:8}{row[4]:12}{row[5]:12}{row[6]:12}\")\n",
+ " #print(\", \".join(row))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.9.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/test/data/RC101.csv b/test/data/RC101.csv
new file mode 100644
index 0000000..ff64970
--- /dev/null
+++ b/test/data/RC101.csv
@@ -0,0 +1,102 @@
+CUST NO.,XCOORD.,YCOORD.,DEMAND,READY TIME,DUE DATE,SERVICE TIME
+1,40,50,0,0,240,0
+2,25,85,20,145,175,10
+3,22,75,30,50,80,10
+4,22,85,10,109,139,10
+5,20,80,40,141,171,10
+6,20,85,20,41,71,10
+7,18,75,20,95,125,10
+8,15,75,20,79,109,10
+9,15,80,10,91,121,10
+10,10,35,20,91,121,10
+11,10,40,30,119,149,10
+12,8,40,40,59,89,10
+13,8,45,20,64,94,10
+14,5,35,10,142,172,10
+15,5,45,10,35,65,10
+16,2,40,20,58,88,10
+17,0,40,20,72,102,10
+18,0,45,20,149,179,10
+19,44,5,20,87,117,10
+20,42,10,40,72,102,10
+21,42,15,10,122,152,10
+22,40,5,10,67,97,10
+23,40,15,40,92,122,10
+24,38,5,30,65,95,10
+25,38,15,10,148,178,10
+26,35,5,20,154,184,10
+27,95,30,30,115,145,10
+28,95,35,20,62,92,10
+29,92,30,10,62,92,10
+30,90,35,10,67,97,10
+31,88,30,10,74,104,10
+32,88,35,20,61,91,10
+33,87,30,10,131,161,10
+34,85,25,10,51,81,10
+35,85,35,30,111,141,10
+36,67,85,20,139,169,10
+37,65,85,40,43,73,10
+38,65,82,10,124,154,10
+39,62,80,30,75,105,10
+40,60,80,10,37,67,10
+41,60,85,30,85,115,10
+42,58,75,20,92,122,10
+43,55,80,10,33,63,10
+44,55,85,20,128,158,10
+45,55,82,10,64,94,10
+46,20,82,10,37,67,10
+47,18,80,10,113,143,10
+48,2,45,10,45,75,10
+49,42,5,10,151,181,10
+50,42,12,10,104,134,10
+51,72,35,30,116,146,10
+52,55,20,19,83,113,10
+53,25,30,3,52,82,10
+54,20,50,5,91,121,10
+55,55,60,16,139,169,10
+56,30,60,16,140,170,10
+57,50,35,19,130,160,10
+58,30,25,23,96,126,10
+59,15,10,20,152,182,10
+60,10,20,19,42,72,10
+61,15,60,17,155,185,10
+62,45,65,9,66,96,10
+63,65,35,3,52,82,10
+64,65,20,6,39,69,10
+65,45,30,17,53,83,10
+66,35,40,16,11,41,10
+67,41,37,16,133,163,10
+68,64,42,9,70,100,10
+69,40,60,21,144,174,10
+70,31,52,27,41,71,10
+71,35,69,23,180,210,10
+72,65,55,14,65,95,10
+73,63,65,8,30,60,10
+74,2,60,5,77,107,10
+75,20,20,8,141,171,10
+76,5,5,16,74,104,10
+77,60,12,31,75,105,10
+78,23,3,7,150,180,10
+79,8,56,27,90,120,10
+80,6,68,30,89,119,10
+81,47,47,13,192,222,10
+82,49,58,10,86,116,10
+83,27,43,9,42,72,10
+84,37,31,14,35,65,10
+85,57,29,18,96,126,10
+86,63,23,2,87,117,10
+87,21,24,28,87,117,10
+88,12,24,13,90,120,10
+89,24,58,19,67,97,10
+90,67,5,25,144,174,10
+91,37,47,6,86,116,10
+92,49,42,13,167,197,10
+93,53,43,14,14,44,10
+94,61,52,3,178,208,10
+95,57,48,23,95,125,10
+96,56,37,6,34,64,10
+97,55,54,26,132,162,10
+98,4,18,35,120,150,10
+99,26,52,9,46,76,10
+100,26,35,15,77,107,10
+101,31,67,3,180,210,10