/********************************************************************** # Copyright (c) EWA Systems Inc. 1998 - 2005 All Rights Reserved # No part of this program may be photocopied, reproduced, # or translated to another programming language without # the prior written consent of EWA Systems. **********************************************************************/ package com.ewasystems.opt.ga.test; import com.ewasystems.opt.ga.GeneticAlleleSet; import com.ewasystems.opt.ga.GeneticEngine; import com.ewasystems.opt.ga.GeneticGene; import com.ewasystems.opt.ga.GeneticProblem; import com.ewasystems.opt.ga.GeneticRunTask; /** *
Genetic Algorithm Test Case: Schwefel Function
*Description: Minimize f(x) = 418.9829*n + sum(-x(i)*sin(sqrt(abs(x(i)))) where X = [-500, 500] by .02
*Copyright: EWASystems Copyright (c) 1998 - 2005
*Company: EWASystems
* @author Lincoln Evans-Beauchamp * @version 1.0 */ public class Schwefel extends GeneticProblem { /** * Problem Constructor */ public Schwefel() { super("Schwefel Function", "Minimize f(x) = 418.9829*n + sum(-x(i)*sin(sqrt(abs(x(i)))) where X = [-500, 500] by .02"); } /** * The Objective Function * @param gene The Genetic Gene to Test * @return double: The Genetic Gene's Fitness */ public double f(GeneticGene gene) { double f1 = 0d; for (int i=0; i