bump product version to 4.1.6.2
[LibreOffice.git] / nlpsolver / ThirdParty / EvolutionarySolver / src / net / adaptivebox / goodness / PenaltyComparator.java
blobf0f8da3a2ff6cc4a7c4e9ace07be16d0d47e6093
1 /**
2 * Description: For comparison of goodness in landscape with penalty method.
4 * @Applied domain: efficiently for ridge class feasible space (SF), such as
5 * the problem with eqaulity constraints
7 * @ Author Create/Modi Note
8 * Xiaofeng Xie May 29, 2004
10 * @version 1.0
12 * [1] Runarsson T P, Yao X. Stochastic ranking for constrained evolutionary
13 * optimization. IEEE Trans. on Evolutionary Computation. 2000, 4 (3): 284-294
17 package net.adaptivebox.goodness;
19 import net.adaptivebox.global.*;
21 public class PenaltyComparator implements IGoodnessCompareEngine {
22 public double Rg = 0;
24 public PenaltyComparator() {}
26 public PenaltyComparator(double rg) {
27 this.Rg = rg;
30 public double calcPenaltyValue(double fit1, double fit2) {
31 return fit1+Rg*fit2;
33 /**
34 * check the magnitude of two array, the frontial is more important
35 * Stoch ranking: array size = 2
36 **/
37 public int compare(double[] fit1, double[] fit2) {
38 return GlobalCompare.compare(calcPenaltyValue(fit1[1], fit1[0]), calcPenaltyValue(fit2[1], fit2[0]));