diff --git a/ant/build.xml b/ant/build.xml
index b76f5a6b..0b2544d9 100644
--- a/ant/build.xml
+++ b/ant/build.xml
@@ -26,6 +26,7 @@
+
@@ -33,6 +34,10 @@
+
+
+
+
@@ -170,13 +175,15 @@
+
+
-
+
@@ -184,7 +191,7 @@
-
+
@@ -212,8 +219,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
@@ -265,7 +294,7 @@
-
+
diff --git a/resources/images/icon4.gif b/resources/images/icon4.gif
new file mode 100644
index 00000000..02b92ec1
Binary files /dev/null and b/resources/images/icon4.gif differ
diff --git a/resources/lgpl-3.0.txt b/resources/lgpl-3.0.txt
new file mode 100644
index 00000000..fc8a5de7
--- /dev/null
+++ b/resources/lgpl-3.0.txt
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/src/eva2/client/EvAClient.java b/src/eva2/client/EvAClient.java
index a4a6d6c5..c0d5de24 100644
--- a/src/eva2/client/EvAClient.java
+++ b/src/eva2/client/EvAClient.java
@@ -76,7 +76,7 @@ import wsi.ra.tool.BasicResourceLoader;
public class EvAClient implements RemoteStateListener, Serializable {
public static final String EVA_PROPERTY_FILE = "resources/EvA2.props";
private static Properties EVA_PROPERTIES;
- public static final String iconLocation = "resources/images/icon3.gif";
+ public static final String iconLocation = "resources/images/icon4.gif";
private static final String splashLocation = "resources/images/splashScreen2.png";
private static final String infoTitle = "EvA2 Information";
final int splashScreenTime = 1500;
@@ -478,6 +478,10 @@ public class EvAClient implements RemoteStateListener, Serializable {
}
+ public static String getProductName() {
+ return m_ProductName;
+ }
+
protected void logMessage(String msg) {
if (TRACE || m_LogPanel == null) System.out.println(msg);
if (m_LogPanel != null) m_LogPanel.logMessage(msg);
diff --git a/src/eva2/gui/PropertyFilePath.java b/src/eva2/gui/PropertyFilePath.java
index 7867fe2f..bbfa3933 100644
--- a/src/eva2/gui/PropertyFilePath.java
+++ b/src/eva2/gui/PropertyFilePath.java
@@ -1,5 +1,7 @@
package eva2.gui;
+import eva2.tools.ReflectPackage;
+
/**
* Created by IntelliJ IDEA.
* User: streiche
@@ -13,16 +15,43 @@ public class PropertyFilePath implements java.io.Serializable {
public String FilePath = "";
public String FileExtension = "";
- public PropertyFilePath(String s) {
+ /**
+ * Constructor setting the absolute path. F
+ *
+ * @param s
+ */
+ private PropertyFilePath(String s) {
this.setCompleteFilePath(s);
}
-
+
public PropertyFilePath(PropertyFilePath d) {
this.FileName = d.FileName;
this.FilePath = d.FilePath;
this.FileExtension = d.FileExtension;
}
+ /**
+ * Get an instance by an absolute path.
+ *
+ * @param path
+ * @return
+ */
+ public static PropertyFilePath getFilePathAbsolute(String path) {
+ return new PropertyFilePath(path);
+ }
+
+ /**
+ * Get an instance by a relative path.
+ *
+ * @param relPath
+ * @return
+ */
+ public static PropertyFilePath getFilePathFromResource(String relPath) {
+ String fName = ReflectPackage.getResourcePathFromCP(relPath);
+ if (fName == null) return null;
+ else return new PropertyFilePath(fName);
+ }
+
public Object clone() {
return (Object) new PropertyFilePath(this);
}
diff --git a/src/eva2/server/go/operators/mutation/MutateESSuccessRule.java b/src/eva2/server/go/operators/mutation/MutateESSuccessRule.java
index f1b9a073..a197d30f 100644
--- a/src/eva2/server/go/operators/mutation/MutateESSuccessRule.java
+++ b/src/eva2/server/go/operators/mutation/MutateESSuccessRule.java
@@ -26,6 +26,9 @@ public class MutateESSuccessRule extends MutateESStandard implements InterfaceMu
protected double m_SuccessRate = 0.2;
protected double m_Alpha = 1.2;
+ public MutateESSuccessRule() {
+ }
+
public MutateESSuccessRule(MutateESSuccessRule mutator) {
this.m_MutationStepSize = mutator.m_MutationStepSize;
this.m_SuccessRate = mutator.m_SuccessRate;
diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricD1ApproxParetoFront.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricD1ApproxParetoFront.java
index 9b5aa0d9..bf60b778 100644
--- a/src/eva2/server/go/operators/paretofrontmetrics/MetricD1ApproxParetoFront.java
+++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricD1ApproxParetoFront.java
@@ -20,10 +20,7 @@ import eva2.server.go.tools.FileLoader;
* To change this template use File | Settings | File Templates.
*/
public class MetricD1ApproxParetoFront implements eva2.server.go.operators.paretofrontmetrics.InterfaceParetoFrontMetric, java.io.Serializable {
-
- private String base = System.getProperty("user.dir");
- private String FS = System.getProperty("file.separator");
- private PropertyFilePath m_InputFilePath = new PropertyFilePath(base+FS+"resources"+FS+"MOPReference"+FS+"T1_250.txt");
+ private PropertyFilePath m_InputFilePath = PropertyFilePath.getFilePathFromResource("resources/MOPReference/T1_250.txt");
private String[] m_Titles;
private double[][] m_Reference;
diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricD1TrueParetoFront.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricD1TrueParetoFront.java
index e8aadb01..ec5f7628 100644
--- a/src/eva2/server/go/operators/paretofrontmetrics/MetricD1TrueParetoFront.java
+++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricD1TrueParetoFront.java
@@ -21,9 +21,9 @@ import eva2.server.go.tools.FileLoader;
*/
public class MetricD1TrueParetoFront implements eva2.server.go.operators.paretofrontmetrics.InterfaceParetoFrontMetric, java.io.Serializable {
- private String base = System.getProperty("user.dir");
- private String FS = System.getProperty("file.separator");
- private PropertyFilePath m_InputFilePath = new PropertyFilePath(base+FS+"resources"+FS+"MOPReference"+FS+"T1_250.txt");
+// private String base = System.getProperty("user.dir");
+// private String FS = System.getProperty("file.separator");
+ private PropertyFilePath m_InputFilePath = PropertyFilePath.getFilePathFromResource("resources/MOPReference/T1_250.txt");
private String[] m_Titles;
private double[][] m_Reference;
diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricErrorRatio.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricErrorRatio.java
index 4fb26c88..528198da 100644
--- a/src/eva2/server/go/operators/paretofrontmetrics/MetricErrorRatio.java
+++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricErrorRatio.java
@@ -24,10 +24,7 @@ import eva2.server.go.tools.FileLoader;
* To change this template use File | Settings | File Templates.
*/
public class MetricErrorRatio implements eva2.server.go.operators.paretofrontmetrics.InterfaceParetoFrontMetric, java.io.Serializable {
-
- private String base = System.getProperty("user.dir");
- private String FS = System.getProperty("file.separator");
- private PropertyFilePath m_InputFilePath = new PropertyFilePath(base+FS+"resources"+FS+"MOPReference"+FS+"T1_250.txt");
+ private PropertyFilePath m_InputFilePath = PropertyFilePath.getFilePathFromResource("resources/MOPReference/T1_250.txt");
private double m_Epsilon = 0.0001;
private String[] m_Titles;
private double[][] m_Reference;
diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricMaximumParetoFrontError.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricMaximumParetoFrontError.java
index 8062ebb2..cefd6ab1 100644
--- a/src/eva2/server/go/operators/paretofrontmetrics/MetricMaximumParetoFrontError.java
+++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricMaximumParetoFrontError.java
@@ -19,10 +19,7 @@ import eva2.server.go.tools.FileLoader;
* To change this template use File | Settings | File Templates.
*/
public class MetricMaximumParetoFrontError implements eva2.server.go.operators.paretofrontmetrics.InterfaceParetoFrontMetric, java.io.Serializable {
-
- private String base = System.getProperty("user.dir");
- private String FS = System.getProperty("file.separator");
- private PropertyFilePath m_InputFilePath = new PropertyFilePath(base+FS+"resources"+FS+"MOPReference"+FS+"T1_250.txt");
+ private PropertyFilePath m_InputFilePath = PropertyFilePath.getFilePathFromResource("resources/MOPReference/T1_250.txt");
private String[] m_Titles;
private double[][] m_Reference;
diff --git a/src/eva2/server/go/operators/paretofrontmetrics/MetricSWithReference.java b/src/eva2/server/go/operators/paretofrontmetrics/MetricSWithReference.java
index f48e6613..1c8be8ec 100644
--- a/src/eva2/server/go/operators/paretofrontmetrics/MetricSWithReference.java
+++ b/src/eva2/server/go/operators/paretofrontmetrics/MetricSWithReference.java
@@ -20,11 +20,8 @@ import eva2.server.go.tools.FileLoader;
* To change this template use File | Settings | File Templates.
*/
public class MetricSWithReference implements InterfaceParetoFrontMetric, java.io.Serializable {
-
private double[][] m_ObjectiveSpaceRange;
- private String base = System.getProperty("user.dir");
- private String FS = System.getProperty("file.separator");
- private PropertyFilePath m_InputFilePath = new PropertyFilePath(base+FS+"resources"+FS+"MOPReference"+FS+"T1_250.txt");
+ private PropertyFilePath m_InputFilePath = PropertyFilePath.getFilePathFromResource("resources/MOPReference/T1_250.txt");
private String[] m_Titles;
private double[][] m_Reference;
private double m_ReferenceSMetric = -1;
@@ -42,8 +39,6 @@ public class MetricSWithReference implements InterfaceParetoFrontMetric, java.io
}
}
this.m_InputFilePath = b.m_InputFilePath;
- this.base = System.getProperty("user.dir");
- this.FS = System.getProperty("file.separator");
if (b.m_Titles != null) {
this.m_Titles = new String[b.m_Titles.length];
System.arraycopy(b.m_Titles, 0, this.m_Titles, 0, this.m_Titles.length);
diff --git a/src/eva2/server/go/problems/AbstractProblemBinary.java b/src/eva2/server/go/problems/AbstractProblemBinary.java
index 85207f35..bf3c33fe 100644
--- a/src/eva2/server/go/problems/AbstractProblemBinary.java
+++ b/src/eva2/server/go/problems/AbstractProblemBinary.java
@@ -51,7 +51,17 @@ public abstract class AbstractProblemBinary extends AbstractOptimizationProblem
* @return the problem dimension
*/
public abstract int getProblemDimension();
-
+
+ /**
+ * Initialize a single individual with index k in the
+ * initPopulation cycle.
+ * @param k
+ * @param indy
+ */
+ protected void initIndy(int k, AbstractEAIndividual indy) {
+ indy.init(this);
+ }
+
@Override
public void initPopulation(Population population) {
AbstractEAIndividual tmpIndy;
@@ -61,7 +71,7 @@ public abstract class AbstractProblemBinary extends AbstractOptimizationProblem
for (int i = 0; i < population.getPopulationSize(); i++) {
tmpIndy = (AbstractEAIndividual)((AbstractEAIndividual)this.m_Template).clone();
- tmpIndy.init(this);
+ initIndy(i, tmpIndy);
population.add(tmpIndy);
}
// population init must be last
diff --git a/src/eva2/server/go/problems/B1Problem.java b/src/eva2/server/go/problems/B1Problem.java
index a285c384..94304e6f 100644
--- a/src/eva2/server/go/problems/B1Problem.java
+++ b/src/eva2/server/go/problems/B1Problem.java
@@ -36,25 +36,6 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ
return (Object) new B1Problem(this);
}
- /** This method inits a given population
- * @param population The populations that is to be inited
- */
- public void initPopulation(Population population) {
- AbstractEAIndividual tmpIndy;
-
- population.clear();
-
- ((InterfaceDataTypeBinary)this.m_Template).setBinaryDataLength(this.m_ProblemDimension);
- for (int i = 0; i < population.getPopulationSize(); i++) {
- tmpIndy = (AbstractEAIndividual)((AbstractEAIndividual)this.m_Template).clone();
- tmpIndy.init(this);
- population.add(tmpIndy);
- }
- // population init must be last
- // it set's fitcalls and generation to zero
- population.init();
- }
-
/** This is a simple method that evaluates a given Individual. The fitness
* values of the individual will be set inside this method.
* @param b The BitSet that is to be evaluated.
diff --git a/src/eva2/server/go/problems/BKnapsackProblem.java b/src/eva2/server/go/problems/BKnapsackProblem.java
index 0243fa9b..f855a8e0 100644
--- a/src/eva2/server/go/problems/BKnapsackProblem.java
+++ b/src/eva2/server/go/problems/BKnapsackProblem.java
@@ -2,14 +2,13 @@ package eva2.server.go.problems;
-import java.util.*;
+import java.util.BitSet;
-import eva2.server.go.individuals.AbstractEAIndividual;
-import eva2.server.go.individuals.GAIndividualBinaryData;
-import eva2.server.go.individuals.InterfaceDataTypeBinary;
-import eva2.server.go.populations.Population;
-import eva2.server.go.strategies.InterfaceOptimizer;
import wsi.ra.math.RNG;
+import eva2.server.go.individuals.AbstractEAIndividual;
+import eva2.server.go.individuals.InterfaceDataTypeBinary;
+import eva2.server.go.strategies.InterfaceOptimizer;
+import eva2.server.go.problems.AbstractProblemBinary;
/**
* Created by IntelliJ IDEA.
@@ -18,7 +17,7 @@ import wsi.ra.math.RNG;
* Time: 15:12:46
* To change this template use Options | File Templates.
*/
-public class BKnapsackProblem extends AbstractOptimizationProblem implements java.io.Serializable {
+public class BKnapsackProblem extends AbstractProblemBinary implements java.io.Serializable {
private int m_Limit = 5000;
private double m_Punish = 2.0;
@@ -128,12 +127,12 @@ public class BKnapsackProblem extends AbstractOptimizationProblem implements jav
{392,-386}};
public BKnapsackProblem() {
- this.m_Template = new GAIndividualBinaryData();
+ super();
}
+
public BKnapsackProblem(BKnapsackProblem b) {
//AbstractOptimizationProblem
- if (b.m_Template != null)
- this.m_Template = (AbstractEAIndividual)((AbstractEAIndividual)b.m_Template).clone();
+ cloneObjects(b);
// BKnapsackProblem
this.m_Limit = b.m_Limit;
this.m_Punish = b.m_Punish;
@@ -141,6 +140,10 @@ public class BKnapsackProblem extends AbstractOptimizationProblem implements jav
this.m_Lamarkism = b.m_Lamarkism;
}
+ public int getProblemDimension() {
+ return items.length;
+ }
+
/** This method returns a deep clone of the problem.
* @return the clone
*/
@@ -154,45 +157,28 @@ public class BKnapsackProblem extends AbstractOptimizationProblem implements jav
// nothing to init here
}
- /** This method inits a given population
- * @param population The populations that is to be inited
- */
- public void initPopulation(Population population) {
- AbstractEAIndividual tmpIndy;
+ protected void initIndy(int k, AbstractEAIndividual indy) {
+ indy.init(this);
+ if (RNG.flipCoin(this.m_ProblemSpecificInit)) {
+ BitSet tmpSet = new BitSet();
+ tmpSet.clear();
- population.clear();
-
- ((InterfaceDataTypeBinary)this.m_Template).setBinaryDataLength(items.length);
- for (int i = 0; i < population.getPopulationSize(); i++) {
- tmpIndy = (AbstractEAIndividual)((AbstractEAIndividual)this.m_Template).clone();
- tmpIndy.init(this);
- if (RNG.flipCoin(this.m_ProblemSpecificInit)) {
- BitSet tmpSet = new BitSet();
- tmpSet.clear();
-
- while (evaluate(tmpSet, items.length)[1] > 0) {
- tmpSet.set(RNG.randomInt(0,items.length-1));
- }
- ((InterfaceDataTypeBinary)tmpIndy).SetBinaryDataLamarkian(tmpSet);
- }
- population.add(tmpIndy);
- }
- // population init must be last
- // it set's fitcalls and generation to zero
- population.init();
+ while (eval(tmpSet)[1] > 0) {
+ tmpSet.set(RNG.randomInt(0,items.length-1));
+ }
+ ((InterfaceDataTypeBinary)indy).SetBinaryDataLamarkian(tmpSet);
+ }
}
-
+
/** This method evaluates a single individual and sets the fitness values
* @param individual The individual that is to be evalutated
*/
public void evaluate(AbstractEAIndividual individual) {
BitSet tmpBitSet;
double[] result;
- InterfaceDataTypeBinary tmpIndy;
- tmpIndy = (InterfaceDataTypeBinary) individual;
- tmpBitSet = tmpIndy.getBinaryData();
- result = this.evaluate(tmpBitSet, tmpIndy.size());
+ tmpBitSet = ((InterfaceDataTypeBinary) individual).getBinaryData();
+ result = this.eval(tmpBitSet);
if (RNG.flipCoin(this.m_LocalSearch)) {
// first remove surplus assets
while (result[1] > 0) {
@@ -210,7 +196,7 @@ public class BKnapsackProblem extends AbstractOptimizationProblem implements jav
}
// remove the weakest
tmpBitSet.clear(weakest);
- result = this.evaluate(tmpBitSet, tmpIndy.size());
+ result = this.eval(tmpBitSet);
}
// now lets see if we can replace some guy with a more efficient one
int weakest = tmpBitSet.nextSetBit(0);
@@ -228,7 +214,7 @@ public class BKnapsackProblem extends AbstractOptimizationProblem implements jav
}
tmpBitSet.clear(weakest);
- result = this.evaluate(tmpBitSet, tmpIndy.size());
+ result = this.eval(tmpBitSet);
int weight = 0;
for (int i = 0; i < items.length; i++) {
if (tmpBitSet.get(i)) weight += items[i][0];
@@ -244,11 +230,11 @@ public class BKnapsackProblem extends AbstractOptimizationProblem implements jav
}
}
if (stronger >= 0) tmpBitSet.set(stronger);
- result = this.evaluate(tmpBitSet, tmpIndy.size());
+ result = this.eval(tmpBitSet);
}
if (this.m_Lamarkism) {
- tmpIndy.SetBinaryDataLamarkian(tmpBitSet);
+ ((InterfaceDataTypeBinary) individual).SetBinaryDataLamarkian(tmpBitSet);
}
}
result[0] += 5100;
@@ -261,9 +247,11 @@ public class BKnapsackProblem extends AbstractOptimizationProblem implements jav
* @param l The length of the BitSet.
* @return Double[]
*/
- public double[] evaluate(BitSet b, int l) {
+ public double[] eval(BitSet b) {
double[] result = new double[3];
+ int l = items.length;
+ if (getProblemDimension() != l) System.err.println("Error in BKnapsack!");
result[0] = 0;
result[1] = 0; // the weight exceed
result[2] = 0; // net worth
@@ -292,7 +280,7 @@ public class BKnapsackProblem extends AbstractOptimizationProblem implements jav
tmpIndy = (InterfaceDataTypeBinary) individual;
tmpBitSet = tmpIndy.getBinaryData();
- report = this.evaluate(tmpBitSet, tmpIndy.size());
+ report = this.eval(tmpBitSet);
result += individual.getStringRepresentation() + "\n";
result += "Is worth: " + Math.abs(report[2]) + " and ";
if (report[1] == 0) result += "does not exceed the weight limit!";
diff --git a/src/eva2/server/go/problems/MatlabProblem.java b/src/eva2/server/go/problems/MatlabProblem.java
index 0287afe0..a936b425 100644
--- a/src/eva2/server/go/problems/MatlabProblem.java
+++ b/src/eva2/server/go/problems/MatlabProblem.java
@@ -13,7 +13,6 @@ import eva2.gui.BeanInspector;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.ESIndividualDoubleData;
import eva2.server.go.individuals.InterfaceDataTypeDouble;
-import eva2.server.go.operators.distancemetric.PhenotypeMetric;
import eva2.server.go.operators.postprocess.InterfacePostProcessParams;
import eva2.server.go.operators.postprocess.PostProcess;
import eva2.server.go.operators.postprocess.PostProcessParams;
@@ -38,7 +37,7 @@ public class MatlabProblem extends AbstractProblemDouble implements InterfaceTex
public static boolean hideFromGOE = true;
- private F1Problem f1 = new F1Problem(); // TODO
+// private F1Problem f1 = new F1Problem(); // TODO
// transient private double[] currArray = null;
// private String mtCmd = null;
@@ -194,11 +193,11 @@ public class MatlabProblem extends AbstractProblemDouble implements InterfaceTex
public double[] eval(double[] x) {
log("evaluating " + BeanInspector.toString(x) + "\n");
double[] res = handler.requestEval(this, x);
- double diff = PhenotypeMetric.euclidianDistance(res, f1.eval(x));
- log("result: " + BeanInspector.toString(res) + " compared to " + BeanInspector.toString(f1.eval(x)) + "\n");
- if (diff != 0) {
- log("!!! diff is " + diff + "\n");
- }
+// double diff = PhenotypeMetric.euclidianDistance(res, f1.eval(x));
+// log("result: " + BeanInspector.toString(res) + " compared to " + BeanInspector.toString(f1.eval(x)) + "\n");
+// if (diff != 0) {
+// log("!!! diff is " + diff + "\n");
+// }
return res;
// synchronized (this) {
diff --git a/src/eva2/server/go/problems/TF1Problem.java b/src/eva2/server/go/problems/TF1Problem.java
index 22930323..f46393fd 100644
--- a/src/eva2/server/go/problems/TF1Problem.java
+++ b/src/eva2/server/go/problems/TF1Problem.java
@@ -299,7 +299,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
int points = 500;
String base = System.getProperty("user.dir");
String FS = System.getProperty("file.separator");
- PropertyFilePath fileOutPath = new PropertyFilePath(base+FS+"resources"+FS+"MOPReference"+FS+"T1_"+points+".txt");
+ PropertyFilePath fileOutPath = PropertyFilePath.getFilePathFromResource("resources/MOPReference"+FS+"T1_"+points+".txt");
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(fileOutPath.getCompleteFilePath()));
diff --git a/src/eva2/server/go/strategies/CHCAdaptiveSearchAlgorithm.java b/src/eva2/server/go/strategies/CHCAdaptiveSearchAlgorithm.java
index 251a9402..8463387e 100644
--- a/src/eva2/server/go/strategies/CHCAdaptiveSearchAlgorithm.java
+++ b/src/eva2/server/go/strategies/CHCAdaptiveSearchAlgorithm.java
@@ -7,7 +7,7 @@ import eva2.server.go.InterfacePopulationChangedEventListener;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.individuals.InterfaceGAIndividual;
import eva2.server.go.operators.selection.InterfaceSelection;
-import eva2.server.go.operators.selection.SelectBest;
+import eva2.server.go.operators.selection.SelectBestSingle;
import eva2.server.go.operators.selection.SelectRandom;
import eva2.server.go.populations.PBILPopulation;
import eva2.server.go.populations.Population;
@@ -38,7 +38,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
private Population m_Population = new Population();
private InterfaceOptimizationProblem m_Problem = new B1Problem();
private InterfaceSelection m_RecombSelectionOperator = new SelectRandom();
- private InterfaceSelection m_PopulSelectionOperator = new SelectBest();
+ private InterfaceSelection m_PopulSelectionOperator = new SelectBestSingle();
transient private String m_Identifier = "";
transient private InterfacePopulationChangedEventListener m_Listener;
diff --git a/src/eva2/server/go/strategies/ClusterBasedNichingEA.java b/src/eva2/server/go/strategies/ClusterBasedNichingEA.java
index 607f989b..126b5566 100644
--- a/src/eva2/server/go/strategies/ClusterBasedNichingEA.java
+++ b/src/eva2/server/go/strategies/ClusterBasedNichingEA.java
@@ -19,6 +19,7 @@ import eva2.server.go.operators.cluster.ClusteringDensityBased;
import eva2.server.go.operators.cluster.InterfaceClustering;
import eva2.server.go.operators.mutation.InterfaceMutation;
import eva2.server.go.operators.mutation.MutateESGlobal;
+//import eva2.server.go.populations.Distraction;
import eva2.server.go.populations.Population;
import eva2.server.go.problems.B1Problem;
import eva2.server.go.problems.Interface2DBorderProblem;
@@ -65,7 +66,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis
private int m_PopulationSize = 50;
private int convergedCnt = 0;
- private static boolean TRACE = true;
+ private static boolean TRACE = false;
private int m_ShowCycle = 100;
transient private TopoPlot m_Topology;
private int haltingWindow = 15;
@@ -586,12 +587,10 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis
this.m_Population.addPopulation((Population)this.m_Species.get(i));
}
if (TRACE) System.out.println("Population size: " + this.m_Population.size());
- if (TRACE) {
-// for (int i=0; i0) distr.calcDistractionFor(m_Undifferentiated.getBestEAIndividual());
+// }
this.firePropertyChangedEvent("NextGenerationPerformed");
}
diff --git a/src/eva2/server/go/strategies/DifferentialEvolution.java b/src/eva2/server/go/strategies/DifferentialEvolution.java
index 17dadfd4..8488738b 100644
--- a/src/eva2/server/go/strategies/DifferentialEvolution.java
+++ b/src/eva2/server/go/strategies/DifferentialEvolution.java
@@ -10,6 +10,7 @@ import eva2.server.go.problems.AbstractOptimizationProblem;
import eva2.server.go.problems.F1Problem;
import eva2.server.go.problems.InterfaceOptimizationProblem;
import wsi.ra.math.RNG;
+import eva2.tools.EVAERROR;
import eva2.tools.SelectedTag;
import eva2.tools.Tag;
@@ -241,7 +242,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
indy1 = (InterfaceESIndividual)pop.get(RNG.randomInt(0, pop.size()-1));
indy2 = (InterfaceESIndividual)pop.get(RNG.randomInt(0, pop.size()-1));
} catch (java.lang.ClassCastException e) {
- System.out.println("Differential Evolution currently requires InterfaceESIndividual as basic data type!");
+ EVAERROR.errorMsgOnce("Differential Evolution currently requires InterfaceESIndividual as basic data type!");
}
xk = indy1.getDGenotype();
xl = indy2.getDGenotype();
diff --git a/src/eva2/server/go/strategies/IslandModelEA.java b/src/eva2/server/go/strategies/IslandModelEA.java
index fce569b0..d5cc1d71 100644
--- a/src/eva2/server/go/strategies/IslandModelEA.java
+++ b/src/eva2/server/go/strategies/IslandModelEA.java
@@ -21,7 +21,7 @@ import wsi.ra.jproxy.RMIServer;
/** The one and only island model for parallelization. Since parallelization based
* on the RMIProxyRemoteThread is on the one hand much slower than benchmark function
* evaluation and on the other hand the GUI based distribution scheme is rather prone
- * to config errors (the correct ssh version is required, the JOpt.jar needs to be in
+ * to config errors (the correct ssh version is required, the jar needs to be in
* the working dir and possible problem data must be on the servers to) an implicit
* island-model has been implemented too to allow fast and reliabel computation.
* This is still usefull, since it is less prone to premature convergence and also
diff --git a/src/eva2/server/go/strategies/Tribes.java b/src/eva2/server/go/strategies/Tribes.java
index 166b7dc2..08c6ebed 100644
--- a/src/eva2/server/go/strategies/Tribes.java
+++ b/src/eva2/server/go/strategies/Tribes.java
@@ -146,7 +146,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable {
public static int[] strategies = new int[10]; // Just for information
public static int[] status = new int[9]; // Just for information
- public static boolean testBC = false; // TODO project to JOpt
+ public static boolean testBC = false; // TODO project to EvA2
public static int adaptOption = 2;
public static double blind=0; // 0.5 //"Blind" move for very good particles, with a probability Tribes.blind
public static boolean repel=false; // If 1, use a "repelling" strategy (see moveExplorer() )
@@ -625,7 +625,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable {
/**
* As TRIBES manages an own structured set of particles (the list of Tribes containing explorers
* and memories), the setPopulation method is only telling Tribes the range
- * of the indiviuals in the beginning of the run, the indiviudals will be discarded.
+ * of the indiviuals in the beginning of the run, the individuals will be discarded.
*/
public void setPopulation(Population pop) {
if (pop == null) return;
diff --git a/src/eva2/server/modules/GOParameters.java b/src/eva2/server/modules/GOParameters.java
index 1e38b0eb..2e2734ad 100644
--- a/src/eva2/server/modules/GOParameters.java
+++ b/src/eva2/server/modules/GOParameters.java
@@ -2,11 +2,10 @@ package eva2.server.modules;
import java.io.Serializable;
-import eva2.gui.BeanInspector;
import eva2.server.go.InterfaceGOParameters;
-import eva2.server.go.InterfacePopulationChangedEventListener;
+import eva2.server.go.individuals.GAIndividualDoubleData;
import eva2.server.go.operators.terminators.EvaluationTerminator;
-import eva2.server.go.problems.B1Problem;
+import eva2.server.go.problems.F1Problem;
import eva2.server.go.strategies.GeneticAlgorithm;
import eva2.tools.Serializer;
@@ -45,7 +44,8 @@ public class GOParameters extends AbstractGOParameters implements InterfaceGOPar
*
*/
public GOParameters() {
- super(new GeneticAlgorithm(), new B1Problem(), new EvaluationTerminator(1000));
+ super(new GeneticAlgorithm(), new F1Problem(), new EvaluationTerminator(1000));
+ ((F1Problem)m_Problem).setEAIndividual(new GAIndividualDoubleData());
}
/**
diff --git a/src/eva2/server/modules/Processor.java b/src/eva2/server/modules/Processor.java
index 1c648190..a0e2550e 100644
--- a/src/eva2/server/modules/Processor.java
+++ b/src/eva2/server/modules/Processor.java
@@ -195,7 +195,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
this.goParams.getOptimizer().optimize();
// registerPopulationStateChanged *SHOULD* be fired by the optimizer or resp. the population
// as we are event listener
-// System.out.println(this.goParams.getOptimizer().getPopulation().getIndyList());
+ //System.out.println(this.goParams.getOptimizer().getPopulation().getIndyList());
} while (isOptRunning() && !this.goParams.getTerminator().isTerminated(this.goParams.getOptimizer().getPopulation()));
runCounter++;
diff --git a/src/eva2/tools/ReflectPackage.java b/src/eva2/tools/ReflectPackage.java
index 2099dca5..1ca4529d 100644
--- a/src/eva2/tools/ReflectPackage.java
+++ b/src/eva2/tools/ReflectPackage.java
@@ -3,15 +3,18 @@ package eva2.tools;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
+import wsi.ra.tool.BasicResourceLoader;
+
//import wsi.ra.tool.BasicResourceLoader;
/**
@@ -238,74 +241,117 @@ public class ReflectPackage {
classPath = System.getProperty("java.class.path",".");
if (useFilteredClassPath) {
try {
- String[] pathElements = getClassPathElements();
- File f;
- ArrayList valids = new ArrayList(pathElements.length);
- for (int i=0; i pathes = pathMap.get(pckg);
-// System.err.println("stored objects: " + ((pathes != null) ? pathes.size() : 0));
-// if (pathes == null) {
-// pathes = new ArrayList();
-// for (int i=0; i 0) pathes.add(dynCP[i]);
-// }
-// pathMap.put(pckg, pathes);
-// } else {
-// for (int i=0; i getValidCPEntries() {
+ String[] pathElements = getClassPathElements();
+ File f;
+ ArrayList valids = new ArrayList(pathElements.length);
+ for (int i=0; i valids = getValidCPEntries();
+// vp = valids.toArray(dynCP); // this causes Matlab to crash meanly.
+ String[] vp = new String[valids.size()];
+ for (int i=0; i 1) &&
(resourceLocation.charAt(1) == ':')))
{
- return getBytesFromFile(resourceLocation);
+ return getStreamFromFile(resourceLocation);
}
InputStream in = ClassLoader.getSystemResourceAsStream(resourceLocation);
@@ -346,10 +345,23 @@ public class BasicResourceLoader implements ResourceLoader
{
logger.debug("Stream opened for " + resourceLocation);
}
+ return in;
+ }
+
+ /**
+ * Gets the byte data from a file at the given resource location.
+ *
+ * @param rawResrcLoc Description of the Parameter
+ * @return the byte array of file.
+ */
+ public byte[] getBytesFromResourceLocation(String rawResrcLoc)
+ {
+ InputStream in = getStreamFromResourceLocation(rawResrcLoc);
- byte[] bytes = getBytesFromStream(in);
-
- return bytes;
+ if (in == null) {
+ return null;
+ }
+ return getBytesFromStream(in);
}
/**
@@ -442,7 +454,7 @@ public class BasicResourceLoader implements ResourceLoader
* @param fileName Description of the Parameter
* @return the byte array of the file.
*/
- private byte[] getBytesFromFile(String fileName)
+ private FileInputStream getStreamFromFile(String fileName)
{
if (fileName.startsWith("/cygdrive/"))
{
@@ -462,6 +474,7 @@ public class BasicResourceLoader implements ResourceLoader
try
{
fis = new FileInputStream(file);
+ return fis;
}
catch (Exception e)
{
@@ -470,11 +483,25 @@ public class BasicResourceLoader implements ResourceLoader
return null;
}
+ }
+
+ /**
+ * Gets the byte data from a file.
+ *
+ * @param fileName Description of the Parameter
+ * @return the byte array of the file.
+ */
+ private byte[] getBytesFromFile(String fileName) {
+ FileInputStream fis = getStreamFromFile(fileName);
+ if (fis == null) {
+ System.err.println("couldnt get file input stream!");
+ return null;
+ }
BufferedInputStream bis = new BufferedInputStream(fis);
// only files with <65536 bytes are allowed
//if( file.length() > 65536 ) System.out.println("Resource files should be smaller than 65536 bytes...");
- int size = (int) file.length();
+ int size = (int) new File(fileName).length();
byte[] b = new byte[size];
int rb = 0;
int chunk = 0;