bump product version to 4.1.6.2
[LibreOffice.git] / nlpsolver / ThirdParty / EvolutionarySolver / src / net / adaptivebox / goodness / BCHComparator.java
blob695fb6fe8894b1bb210d024c86d71b98ccd6448b
1 /**
2 * Description: For formation the basic goodness landscape.
4 * @ Author Create/Modi Note
5 * Xiaofeng Xie Jun 24, 2003 Created
6 * Xiaofeng Xie May 11, 2004
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * Please acknowledge the author(s) if you use this code in any way.
20 * @version 1.0
21 * @Since MAOS1.2
23 * [1] Deb K. An efficient constraint handling method for genetic algorithms.
24 * Computer Methods in Applied Mechanics and Engineering, 2000, 186(2-4): 311-338
27 package net.adaptivebox.goodness;
29 public class BCHComparator implements IGoodnessCompareEngine {
31 /* check the magnitude of two array, the frontial is more important
32 **/
33 public static int compareArray(double[] fit1, double[] fit2) {
34 for (int i=0; i<fit1.length; i++) {
35 if (fit1[i]>fit2[i]) {
36 return LARGER_THAN; //Large than
37 } else if (fit1[i]<fit2[i]){
38 return LESS_THAN; //Less than
41 return IGoodnessCompareEngine.EQUAL_TO; //same
44 public int compare(double[] fit1, double[] fit2) {
45 return compareArray(fit1, fit2);