diff --git a/src/eva2/server/go/problems/I1Problem.java b/src/eva2/server/go/problems/I1Problem.java new file mode 100644 index 00000000..ba160604 --- /dev/null +++ b/src/eva2/server/go/problems/I1Problem.java @@ -0,0 +1,68 @@ +package eva2.server.go.problems; + + + +import eva2.server.go.strategies.InterfaceOptimizer; + +/** + * The integer hyper-sphere problem. + * + * User: streiche, mkron + */ +public class I1Problem extends AbstractProblemInteger implements java.io.Serializable { + + public I1Problem() { + } + + public I1Problem(I1Problem o) { + super.cloneObjects(o); + } + + /** This method returns a deep clone of the problem. + * @return the clone + */ + public Object clone() { + return (Object) new I1Problem(this); + } + + /** Ths 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. + */ + public double[] eval(int[] x) { + double[] result = new double[1]; + result[0] = 0; + for (int i = 0; i < x.length; i++) { + result[0] += Math.pow(x[i], 2); + } + result[0] += 1; + 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. + */ + public String getStringRepresentationForProblem(InterfaceOptimizer opt) { + String result = ""; + + result += "I1 Problem:\n"; + result += "Here the individual codes a vector of int numbers x and F1(x)= x^2 is to be minimized.\n"; + result += "Parameters:\n"; + result += "Dimension : " + this.m_ProblemDimension +"\n"; + result += "Solution representation:\n"; + return result; + } + +/********************************************************************************************************************** + * These are for GUI + */ + + public String getName() { + return "I1 Problem"; + } + + public static String globalInfo() { + return "I1(x) = x^2 is to be minimized."; + } +} \ No newline at end of file