bump product version to 4.1.6.2
[LibreOffice.git] / nlpsolver / ThirdParty / EvolutionarySolver / src / net / adaptivebox / goodness / SRComparator.java
blob7a8e59d74f596732a34b3680a9ad2ec54cf3d0e0
1 /**
2 * Description: For comparison of goodness in landscape with stoch. ranking.
4 * @ Author Create/Modi Note
5 * Xiaofeng Xie May 29, 2004
7 * [1] Runarsson T P, Yao X. Stochastic ranking for constrained evolutionary
8 * optimization. IEEE Trans. on Evolutionary Computation. 2000, 4 (3): 284-294
12 package net.adaptivebox.goodness;
14 import net.adaptivebox.global.*;
16 public class SRComparator implements IGoodnessCompareEngine, IUpdateCycleEngine {
17 public double Pf = 0.5;
19 public SRComparator() {}
21 public SRComparator(double pf) {
22 this.Pf = pf;
25 public void updateCycle(int t) {
26 Pf *=0.995;
29 /**
30 * check the magnitude of two array, the frontial is more important
31 * Stoch ranking: array size = 2
32 **/
33 public int compare(double[] fit1, double[] fit2) {
34 if((fit1[0]==fit2[0])||Pf>Math.random()) {
35 return GlobalCompare.compare(fit1[1], fit2[1]);
36 } else {
37 return GlobalCompare.compare(fit1[0], fit2[0]);