changeset 748:30be4b71c36c

WQ: Guessing increaing w is not based on direct neighbors any more. flys-artifacts/trunk@2254 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 27 Jun 2011 14:06:16 +0000
parents 65dcb5891206
children 72bcbc308501
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQ.java
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Jun 27 13:58:03 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Jun 27 14:06:16 2011 +0000
@@ -1,3 +1,11 @@
+2011-06-27  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/WQ.java:
+	  Guessing increaing w is not based on direct neighbors any more.
+	  The second to be compared with is choosen by random of
+	  the values before the first one. This makes the guessing
+	  more robust against 'plateaus' of equal w values.
+
 2011-06-27  Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/ATWriter.java: Array
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQ.java	Mon Jun 27 13:58:03 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQ.java	Mon Jun 27 14:06:16 2011 +0000
@@ -120,9 +120,10 @@
         Random rand = new Random();
 
         for (int i = 0; i < samples; ++i) {
-            int    pos = rand.nextInt(N-1) + 1;
-            double w1  = w.getQuick(pos-1);
-            double w2  = w.getQuick(pos);
+            int    pos2 = rand.nextInt(N-1) + 1;
+            int    pos1 = rand.nextInt(pos2);
+            double w1   = w.getQuick(pos1);
+            double w2   = w.getQuick(pos2);
             if (w2 > w1) ++up;
         }
 

http://dive4elements.wald.intevation.org