package eva2.problems.simple;

import eva2.util.annotation.Description;

@Description("A simple F1 implementation, find the minimum of a hyper parabola.")
public class SimpleF1 extends SimpleProblemDouble {

    @Override
    public double[] evaluate(double[] x) {
        double res[] = new double[1];
        // this defines the dimension of the fitness vector, which should be always the same

        double sum = 0;
        // calculate the fitness value
        for (int i = 0; i < getProblemDimension(); i++) {
            sum += (x[i] * x[i]);
        }

        // setting the return vector and return it
        res[0] = Math.sqrt(sum);
        return res;
    }

    @Override
    public int getProblemDimension() {
        return 20;
    }
}
