diff options
Diffstat (limited to 'nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java')
-rw-r--r-- | nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java index 3f11dc59f98d..1721b240217c 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalCompare.java @@ -1,44 +1,44 @@ -/**
- * Description: Global package for comparison.
- *
- * @ Author Create/Modi Note
- * Xiaofeng Xie Jun 15, 2002 xiaofengxie@tsinghua.org.cn
- *
- *
- * @version 1.0
- * @Since MAOS1.0
- */
-
-
-package net.adaptivebox.global;
-
-public class GlobalCompare {
-
-/* compare the data1 and data2, if data1=data2, return 0
- * if data1 < data2, return LESS_THAN, else if data1 > data2, LARGER_THAN
- **/
- static public int compare(double data1, double data2) {
- if (data1 < data2)
- return CompareValue.LESS_THAN;
- else if (data1 > data2)
- return CompareValue.LARGER_THAN;
- else
- return CompareValue.EQUAL_TO;
- }
-
-/* check the magnitude of two array, the frontial is more important
- **/
- public static int compareArray(double[] fit1, double[] fit2) {
- if (fit1.length!=fit2.length) {
- return CompareValue.INVALID; //error
- }
- for (int i=0; i<fit1.length; i++) {
- if (fit1[i]>fit2[i]) {
- return CompareValue.LARGER_THAN; //Large than
- } else if (fit1[i]<fit2[i]){
- return CompareValue.LESS_THAN; //Less than
- }
- }
- return CompareValue.EQUAL_TO; //same
- }
-}
+/** + * Description: Global package for comparison. + * + * @ Author Create/Modi Note + * Xiaofeng Xie Jun 15, 2002 xiaofengxie@tsinghua.org.cn + * + * + * @version 1.0 + * @Since MAOS1.0 + */ + + +package net.adaptivebox.global; + +public class GlobalCompare { + +/* compare the data1 and data2, if data1=data2, return 0 + * if data1 < data2, return LESS_THAN, else if data1 > data2, LARGER_THAN + **/ + static public int compare(double data1, double data2) { + if (data1 < data2) + return CompareValue.LESS_THAN; + else if (data1 > data2) + return CompareValue.LARGER_THAN; + else + return CompareValue.EQUAL_TO; + } + +/* check the magnitude of two array, the frontial is more important + **/ + public static int compareArray(double[] fit1, double[] fit2) { + if (fit1.length!=fit2.length) { + return CompareValue.INVALID; //error + } + for (int i=0; i<fit1.length; i++) { + if (fit1[i]>fit2[i]) { + return CompareValue.LARGER_THAN; //Large than + } else if (fit1[i]<fit2[i]){ + return CompareValue.LESS_THAN; //Less than + } + } + return CompareValue.EQUAL_TO; //same + } +} |