Various bugfixes.
- Properly handle loading/searching of classes with EvA prefix - Properly open Main window and set Logger when invoked from within JVM - New F22Problem
This commit is contained in:
parent
668dcb6974
commit
0202692844
@ -98,6 +98,7 @@ public class EvAInfo {
|
||||
}
|
||||
|
||||
public static String propDefaultModule() {
|
||||
return getProperty("DefaultModule");
|
||||
String defaultModule = getProperty("DefaultModule");
|
||||
return defaultModule;
|
||||
}
|
||||
}
|
||||
|
@ -406,6 +406,9 @@ public class Main extends JFrame implements OptimizationStateListener {
|
||||
statusBarControls.setLayout(new BoxLayout(statusBarControls, BoxLayout.LINE_AXIS));
|
||||
|
||||
statusBarControls.add(Box.createHorizontalGlue());
|
||||
|
||||
/* Set default logging level to INFO */
|
||||
Logger.getLogger("eva2").setLevel(Level.INFO);
|
||||
/* Logging settings drop down */
|
||||
LoggingLevelLabel loggingOption = new LoggingLevelLabel();
|
||||
|
||||
@ -490,6 +493,9 @@ public class Main extends JFrame implements OptimizationStateListener {
|
||||
} else {
|
||||
if (parentWindow == null) {
|
||||
System.exit(1);
|
||||
} else {
|
||||
this.setVisible(false);
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
*
|
||||
* @param className
|
||||
* @return
|
||||
* @see ReflectPackage.getAssignableClassesInPackage
|
||||
* @see ReflectPackage#getAssignableClassesInPackage
|
||||
*/
|
||||
public static ArrayList<String> getClassesFromClassPath(String className, ArrayList<Class<?>> instances) {
|
||||
ArrayList<String> classes = new ArrayList<>();
|
||||
|
@ -231,8 +231,8 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
*
|
||||
* @param dim
|
||||
* @return the lower bound of the double range in the given dimension
|
||||
* @see makeRange()
|
||||
* @see getRangeUpperBound(int dim)
|
||||
* @see #makeRange()
|
||||
* @see #getRangeUpperBound(int dim)
|
||||
*/
|
||||
@Override
|
||||
public double getRangeLowerBound(int dim) {
|
||||
@ -246,8 +246,8 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
*
|
||||
* @param dim
|
||||
* @return the upper bound of the double range in the given dimension
|
||||
* @see makeRange()
|
||||
* @see getRangeLowerBound(int dim)
|
||||
* @see #makeRange()
|
||||
* @see #getRangeLowerBound(int dim)
|
||||
*/
|
||||
@Override
|
||||
public double getRangeUpperBound(int dim) {
|
||||
|
@ -88,7 +88,7 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F10 Problem";
|
||||
return "Weierstrass-Mandelbrot Fractal";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F11-Problem";
|
||||
return "Griewank";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,6 +73,6 @@ public class F12Problem extends AbstractProblemDoubleOffset implements Serializa
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F12 Problem";
|
||||
return "Galar";
|
||||
}
|
||||
}
|
@ -108,7 +108,7 @@ public class F13Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F13-Problem";
|
||||
return "Schwefel 2.26";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,7 +88,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F1-Problem";
|
||||
return "Sphere";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,7 @@ public class F21Problem extends AbstractProblemDouble implements InterfaceMultim
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Langerman-Function";
|
||||
return "Langerman";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
99
src/eva2/problems/F22Problem.java
Normal file
99
src/eva2/problems/F22Problem.java
Normal file
@ -0,0 +1,99 @@
|
||||
package eva2.problems;
|
||||
|
||||
import eva2.optimization.strategies.InterfaceOptimizer;
|
||||
import eva2.tools.math.Mathematics;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
/**
|
||||
* F22 Schwefel 2.22 Problem
|
||||
*/
|
||||
@Description(value ="Schwefel 2.22")
|
||||
public class F22Problem extends AbstractProblemDoubleOffset implements InterfaceHasInitRange, java.io.Serializable {
|
||||
|
||||
public F22Problem() {
|
||||
super();
|
||||
setDefaultRange(10);
|
||||
}
|
||||
|
||||
public F22Problem(F22Problem b) {
|
||||
super();
|
||||
super.cloneObjects(b);
|
||||
}
|
||||
|
||||
public F22Problem(int dim) {
|
||||
super(dim);
|
||||
}
|
||||
|
||||
public F22Problem(int dim, double defRange) {
|
||||
this(dim);
|
||||
setDefaultRange(defRange);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a deep clone of the problem.
|
||||
*
|
||||
* @return the clone
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new F22Problem(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows you to evaluate a simple bit string to determine the fitness
|
||||
*
|
||||
* @param x The n-dimensional input vector
|
||||
* @return The m-dimensional output vector.
|
||||
*/
|
||||
@Override
|
||||
public double[] evaluate(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = yOffset;
|
||||
double sum = 0.0, product = 1.0;
|
||||
// add an offset in solution space
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
sum += Math.abs(x[i]);
|
||||
product *= Math.abs(x[i]);
|
||||
}
|
||||
result[0] = sum + product;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a string describing the optimization problem.
|
||||
*
|
||||
* @param opt The Optimizer that is used or had been used.
|
||||
* @return The description.
|
||||
*/
|
||||
@Override
|
||||
public String getStringRepresentationForProblem(InterfaceOptimizer opt) {
|
||||
StringBuilder sb = new StringBuilder(200);
|
||||
sb.append("F22 Schwefel 2.22 model:\n");
|
||||
sb.append("Here the individual codes a vector of real number x and F22(x) is to be minimized.\nParameters:\n");
|
||||
sb.append("Dimension : ");
|
||||
sb.append(this.problemDimension);
|
||||
sb.append("\nNoise level : ");
|
||||
sb.append(this.getNoise());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows the CommonJavaObjectEditorPanel to read the
|
||||
* name to the current object.
|
||||
*
|
||||
* @return The name.
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Schwefel 2.22";
|
||||
}
|
||||
|
||||
/**
|
||||
* If initialRangeRatio<1, produce a reduced initial range in the negative corner of the range.
|
||||
*/
|
||||
@Override
|
||||
public Object getInitializationRange() {
|
||||
return makeRange();
|
||||
}
|
||||
}
|
@ -100,7 +100,7 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F2-Problem";
|
||||
return "Generalized Rosenbrock";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,6 +69,6 @@ public class F3Problem extends AbstractProblemDoubleOffset implements java.io.Se
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F3-Problem";
|
||||
return "Step";
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class F4Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
String result = "";
|
||||
|
||||
result += "F4 Quadratic Function with noise:\n";
|
||||
result += "This problem is noisey.\n";
|
||||
result += "This problem is noisy.\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.problemDimension + "\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
@ -73,6 +73,6 @@ public class F4Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F4 Problem";
|
||||
return "Noisy Quaric";
|
||||
}
|
||||
}
|
@ -77,6 +77,6 @@ public class F5Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F5-Problem";
|
||||
return "Schwefel 1.2";
|
||||
}
|
||||
}
|
@ -97,7 +97,7 @@ public class F6Problem extends AbstractProblemDoubleOffset
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F6-Problem";
|
||||
return "Generalized Rastrigin";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,7 +118,7 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F7 Problem";
|
||||
return "Changing Sphere";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,7 +112,7 @@ public class F8Problem extends AbstractProblemDoubleOffset
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F8-Problem";
|
||||
return "Ackley";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,6 +69,6 @@ public class F9Problem extends AbstractProblemDoubleOffset implements java.io.Se
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "F9 Problem";
|
||||
return "Weighted Sphere";
|
||||
}
|
||||
}
|
@ -228,7 +228,7 @@ public class ReflectPackage {
|
||||
// Skip JARs that don't start with the EvA substring.
|
||||
// This improves performance a lot when having a lot of JARs on the classpath
|
||||
int index = aDynCP.lastIndexOf(System.getProperty("file.separator"));
|
||||
if (index != -1 && !aDynCP.substring(0, index).contains("EvA")) {
|
||||
if (index != -1 && !aDynCP.substring(index).contains("EvA")) {
|
||||
continue;
|
||||
}
|
||||
getClassesFromJarFltr(set, aDynCP, pkg, includeSubs, reqSuperCls);
|
||||
|
Loading…
x
Reference in New Issue
Block a user