All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.cilib.functions.continuous.bbob.BBOB9 Maven / Gradle / Ivy

/**           __  __
 *    _____ _/ /_/ /_    Computational Intelligence Library (CIlib)
 *   / ___/ / / / __ \   (c) CIRG @ UP
 *  / /__/ / / / /_/ /   http://cilib.net
 *  \___/_/_/_/_.___/
 */
package net.sourceforge.cilib.functions.continuous.bbob;

import net.sourceforge.cilib.functions.ContinuousFunction;
import net.sourceforge.cilib.functions.continuous.unconstrained.Rosenbrock;
import net.sourceforge.cilib.functions.continuous.decorators.RotatedFunctionDecorator;
import net.sourceforge.cilib.type.types.container.Vector;

/*
 * F9: Rosenbrock Function, rotated
 */
public class BBOB9 extends AbstractBBOB {
	private RotatedFunctionDecorator r;

	public BBOB9() {
		this.r = Helper.newRotated(new Inner());
	}

	@Override
	public Double f(Vector input) {
		initialise(input.size());

		return r.f(input) + fOpt;
	}

	private class Inner extends ContinuousFunction {
		private Rosenbrock rosenbrock;

		public Inner() {
			this.rosenbrock = new Rosenbrock();
		}

		@Override
		public Double f(Vector x) {
			double factor = Math.max(1, Math.sqrt(x.size()) / 8);

			Vector z = x.multiply(factor).plus(Vector.fill(0.5, x.size()));
			return rosenbrock.f(z);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy