From 15e7bbe6e92d6149e56f3adbd328659b6f2bd44c Mon Sep 17 00:00:00 2001
From: ThibautDemare <fdhp_76@hotmail.com>
Date: Mon, 28 Jan 2019 17:24:38 +0100
Subject: [PATCH] Debug buildNeighborsList when there is no neighbor in the
 range

---
 models/FinalConsignee.gaml | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/models/FinalConsignee.gaml b/models/FinalConsignee.gaml
index 9911564..0ec80aa 100644
--- a/models/FinalConsignee.gaml
+++ b/models/FinalConsignee.gaml
@@ -327,9 +327,13 @@ species FinalConsignee { // Used to be called FinalDestinationManager with assoc
 	}
 
 	action buildNeighborsList {
-		neighbors <- at_distance(FinalConsignee, neighborsDistance);
-		if(length(neighbors) = 0){
-			write "Error : not enough neighbor";
+		int i <- 1;
+		loop while: length(neighbors) = 0 {
+			neighbors <- at_distance(FinalConsignee, neighborsDistance * i);
+			i <- i + 1;
+		}
+		if(i > 2 ){
+			write "Error: not enough neighbors. i = "+i;
 		}
 	}
 }
-- 
GitLab