From 422f1d5bb505795e5194dc35604673ac14502853 Mon Sep 17 00:00:00 2001 From: EEva Date: Wed, 17 Jul 2013 01:07:58 +0200 Subject: [PATCH] Some slight changes --- Source/romania-gis.nlogo | 13 +++++---- Source/utilityfunc.nlogo | 63 ++++++++++++++++++---------------------- 2 files changed, 36 insertions(+), 40 deletions(-) diff --git a/Source/romania-gis.nlogo b/Source/romania-gis.nlogo index 8923584..f01f398 100644 --- a/Source/romania-gis.nlogo +++ b/Source/romania-gis.nlogo @@ -20,20 +20,21 @@ to setup ask county-labels [ die ] foreach gis:feature-list-of romanian-county-borders-dataset - [ ;gis:set-drawing-color item random 14 base-colors - ;gis:fill ? 0 - let county-color item random 14 base-colors + [ gis:set-drawing-color item random 14 base-colors + gis:fill ? 0 + + ;let county-color item random 14 base-colors ask patches gis:intersecting ? [ set county-name gis:property-value ? "NAME_1" - set pcolor county-color ] ] + ;set pcolor county-color ] ] end @#$#@#$#@ GRAPHICS-WINDOW 463 5 -708 -223 +877 +440 -1 -1 4.0 diff --git a/Source/utilityfunc.nlogo b/Source/utilityfunc.nlogo index 4a9b55e..750a446 100644 --- a/Source/utilityfunc.nlogo +++ b/Source/utilityfunc.nlogo @@ -1,4 +1,5 @@ -globals [ +globals +[ nx ny nb-beekeepers max-distance-of-moving @@ -8,7 +9,6 @@ globals [ sunflower-price hivesProd fuelPriceByKm ;;; euros by km - ] breed [ beekeepers beekeeper ] @@ -172,36 +172,31 @@ end to follow-strategy ;;; its depends of the strategy of the turtle , calibrate in the initialisation if strategy-of-turtle = 1 [ ;;; choose a random spot - let counties-around other counties in-radius max-distance-of-moving - set chosen-county one-of counties-around - ;;;;; - cost-of-moving - ;;;;; - move-to chosen-county - - ask chosen-county[ ;;;;;;;;; PROBELMMMMMMMMMMMMMMMMMMMMMM;;;;;;;;;;;;;; - - let spots-on-county turtles-here - let available-spots spots with [availability = 0] ;; free - ifelse any? available-spots - [ ;;; there are available spots - let best-spot max-one-of available-spots [ utility ] - - set current-spot best-spot - move-to best-spot - ask best-spot [ set availability 1] - - - [;;;; there arent available spots - - follow-strategy - ] - - ] - - ] - - ] + let counties-around other counties in-radius max-distance-of-moving + set chosen-county one-of counties-around + ;;;;; + cost-of-moving + ;;;;; + move-to chosen-county + + ask chosen-county[ ;;;;;;;;; PROBELMMMMMMMMMMMMMMMMMMMMMM;;;;;;;;;;;;;; + + let spots-on-county turtles-here + let available-spots spots with [availability = 0] ;; free + ifelse any? available-spots + [ ;;; there are available spots + let best-spot max-one-of available-spots [ utility ] + + set current-spot best-spot + move-to best-spot + ask best-spot [ set availability 1] ] + + + [;;;; there arent available spots + + follow-strategy + ] ] ] + if strategy-of-turtle = 2 [ ;;;; choose the nearest county ] @@ -272,8 +267,8 @@ GRAPHICS-WINDOW 1 1 0 -0 -0 +1 +1 1 -23 23