simulationnetlogocellular-automata

Determine the Lucky PP (possible position) for each exit Netlgo evacuation simulation


This problem occurred to me. The passengers move, but do not go towards the exit in a smart way and remain in the centre moving around. They also move out of the edge of the room. How can I solve it?

I need to do this thing:

If a cell is a PP (possible position) of an exit, it may be occupied by the occupant at the next time step.

Each exit may have more than one PP. On the other hand, each occupant can only stay in one cell within a time step. In the proposed CA model, the probability of an exit’s PP to be occupied within the next time step is assumed to be equal. The cell to be selected is termed the Lucky PP (LPP). Assuming the number of PP of an exit is M, the probability of each PP to be a LPP is Pu= 1/M

This error appear when pressing the Setup button:

WITH expected input to be an agentset but got the patch (patch 35 -7) instead.
error while passenger 22 running WITH
  called by procedure CHOOSE-EXIT
  called by procedure INITIALIZE-PASSENGERS
  called by procedure SETUP
  called by Button 'setup'
breed [  passengers    passenger]
breed [  fire-spots  a-fire-spot]
breed [ smoke-spots a-smoke-spot]

globals [        exit1            ;;   pID
                 exit2            ;;   pID
                 exits-list       ;; [ pID ... ]
                 passenger_count  ;;   integer
                 exit-probabilities ;; [probability ...]
]

passengers-own [ in-seat?         ;; boolean
                 safe?            ;; boolean
                 dead?            ;; boolean
                 panic?           ;; boolean
                 current-heading  ;; turtleHDG
                 target-exit      ;;   pID
                 my-exits-list    ;; [ pID ... ]
                 item?            ;; boolean
]

patches-own [    accessible?      ;; boolean
                 fire?            ;; boolean
]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FUNZIONI SETUP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to setup

   __clear-all-and-reset-ticks
     ;;;;;; DEBUG
            type "----------------------------[SETUP]\n"
     ;;;;;; DEBUG
     initialize-globals
     initialize-train
     initialize-exits
     initialize-passengers
   ; initialize-fire
     reset-ticks

end


to initialize-globals

   set exit1           patch 64 -13
   set exit2           patch 13 -54
   set exits-list    ( list exit1 exit2 )
   set exit-probabilities (list 0.5 0.5)

end


to initialize-train
   import-pcolors "images/ambiente.png"
   ask patches [
     if pcolor = 86.6 [set pcolor cyan]
     if pcolor =  0   [set pcolor black]
     if pcolor = 64.3 [set pcolor green]
     if pcolor =  9.9 [set pcolor white]

     set fire? false
     set accessible? false ; Imposta tutte le patch come inaccessibili di default
   ]

   ask patches with [pcolor = white] [
     set accessible? true ; Contrassegna le patch verdi come accessibili
   ]
end


to initialize-exits
  set exit1 patch 64 -13
  set exit2 patch 13 -54
  set exits-list (list exit1 exit2)
end


to initialize-passengers
  create-passengers passenger-count [
    set shape "person business"
    set size 2
    set color yellow
    set in-seat? false  ; Cambia da true a false
    set safe? false
    set dead? false
    set panic? true
    set current-heading 0
    set my-exits-list [] ; SET here, it must assign a []-list to this property BEFORE next call to choose-exit
    set target-exit nobody ; SET this as the initial target-exit

    ; Aggiungi il seguente blocco di codice per posizionare casualmente i passeggeri in patch accessibili
    let target one-of patches with [accessible?]
    move-to target
    set target-exit choose-exit patch-here ; Aggiorna il target-exit dopo esserti spostato sulla patch iniziale
    update-exit-probabilities self
  ]
end



to-report choose-exit [current-position]

   let possible-exits        []
   let shortest-distance 10000
   let nearest-exit          nobody

   foreach exits-list [ exitUnderTest ->

           let exit-coords (list [pxcor] of exitUnderTest [pycor] of exitUnderTest) ;; Get exit coordinates as a list
           let exit-distance distance exitUnderTest

           if  exit-distance < shortest-distance [
               set shortest-distance exit-distance
               set nearest-exit      exitUnderTest
               set possible-exits    []
           ]

           if  exit-distance = shortest-distance [

               set possible-exits lput exit-coords possible-exits ;; Use exit coordinates instead of the patch object

           ]
   ]

   if length possible-exits = 0 [
       print "No exits found."
       report nobody
   ]

   ; Use the updated exit probabilities to choose the exit
   let lucky-exit-coords one-of weighted-n-of 1 possible-exits exit-probabilities
   let lucky-exit patch-at (item 0 lucky-exit-coords) (item 1 lucky-exit-coords) ;; Get the object using the coordinates
   set target-exit lucky-exit

   ; Calculate the possible positions (PP) around the lucky exit
   let pp-list (patch-set [neighbors4] of lucky-exit with [accessible?])

   ; Calculate the probability of each PP to be a LPP
   let M count pp-list
   let P 1 / M

   ; Select a LPP for the passenger
   let lpp one-of pp-list
   face lpp

   set my-exits-list   lput lucky-exit my-exits-list

   report lpp
end

to update-exit-probabilities [passenger1]
  let kie 1.5
  let initial-exit [target-exit] of passenger
  let initial-exit-index position initial-exit exits-list
  let initial-exit-probability item initial-exit-index exit-probabilities
  let pie kie * initial-exit-probability

  if pie > 1 [ set pie 1 ]
  let delta-pi pie - initial-exit-probability

  let updated-exit-probabilities []
  foreach exit-probabilities [p ->
    let index position p exit-probabilities
    if index = initial-exit-index [
      set updated-exit-probabilities lput pie updated-exit-probabilities
    ] [
      let pje p - (p / (1 - initial-exit-probability)) * delta-pi
      set updated-exit-probabilities lput pje updated-exit-probabilities
    ]
  ]
  set exit-probabilities updated-exit-probabilities
end

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FUNZIONI GO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to go
   ;;;;;; DEBUG
          type "----------------------------[GO.tick]\n"
   ;;;;;; DEBUG

   ask passengers [
       if panic? [
          let  target-to-exit choose-exit patch-here
          face target-to-exit
       ]
       move
   ]
   tick
end
;;;go()

to move
  if panic? [
    let next-patch patch-ahead 1
    if [accessible?] of next-patch and not any? other passengers-here [
      move-to next-patch
      if member? patch-here exits-list [
        set safe? true
        set in-seat? false
      ]
    ]
  ]
end

Solution

  • The ABM-simulation code as-was, after MCVE-reproducibility-GAPs fixed, experiences many further conceptual gaps (even without further creeping of the posted code-updates and ideas, do not creep post-content. This is not considered correct here). As the as-was code is being heavily (if not exclusively) Agents'-properties data-driven,

    Post-mortem crash-report scene

    but not properly equipped with detecting the Agents' in-scene locality context and some Simulation-goal consistent and relevant self-adaptive behaviour re-evaluation, the execution keeps headbanging and will keep doing so into many further collisions, until properly refactored.

    TRY let pp-list ( patch-set [neighbors4] of lucky-exit with [accessible?]
                                           WITH lucky-exit      : nobody
               WITH ( patch-set ...                           ) : (agentset, 0 patches)
    
    Zero Possible Positions for PNR(  15 ) at (  (patch 16 -37)  )
    
    observer> ask passenger 15 [ report-passenger-state who ]
    
    PNR(  15 ) in-seat?  false safe?  false panic?  true dead?  false
    HDG( 305 ) current-heading  0
    LoX( nobody nobody ) target-exit  nobody
    

    Best start with revision & re-design all data-driving assignments, where proper fusing for !DIV0 and/or empty list-instances, void agentSet-s or NOBODY objects result and must result in crashing the syntax-expectations of the simulation-language ( NetLogo ).

    You have been provided both tools, bonuses and other insights to improve your re-factored design, to develop the global simulation strategy further on.

    breed [  passengers    passenger]
    breed [  fire-spots  a-fire-spot]
    breed [ smoke-spots a-smoke-spot]
    
    globals [        exit1            ;;   pID
                     exit2            ;;   pID
                     exits-list       ;; [ pID ... ]
                   ; passenger_count  ;;   integer
                     passenger-count  ;;   integer  ;;; MCVE reproducibility GAP#2 ( UNDEFINED Var )
                   ; comment : The number of passengers is set in the GUI via sliders, for the environment try this link: imgur.com/ZafKcNc.
                   ; – accismns
                   ; 39 mins ago
    
    ]
    
    passengers-own [ in-seat?         ;; boolean
                     safe?            ;; boolean
                     dead?            ;; boolean
                     panic?           ;; boolean
                     current-heading  ;; turtleHDG
                     target-exit      ;;   pID
                     my-exits-list    ;; [ pID ... ]
                     item?            ;; boolean
    ]
    
    patches-own [    accessible?      ;; boolean
                     fire?            ;; boolean
    ]
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FUNZIONI SETUP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    to setup
    
       __clear-all-and-reset-ticks
         ;;;;;; DEBUG
                type "----------------------------[SETUP]\n"
         ;;;;;; DEBUG
    
         ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MCVE reproducibility GAP#4
         ;;;;;;;;;;;;;;;;;;;;;; GUESSTIMATES derived from PNG
         resize-world    0   ;; min-pxcor
                        69   ;; max-pxcor
                       -59   ;; min-pycor
                         0   ;; max-pycor
         ;;;;;; DEBUG
                type "----------------------------[SETUP] will initialize-globals() \n"
         initialize-globals
         ;;;;;; DEBUG
                type "----------------------------[SETUP] will initialize-train() \n"
         initialize-train
         ;;;;;; DEBUG
                type "----------------------------[SETUP] will initialize-exits() \n"
         initialize-exits
         ;;;;;; DEBUG
                type "----------------------------[SETUP] will initialize-passengers() \n"
         initialize-passengers
       ; initialize-fire
         reset-ticks
         ;;;;;; DEBUG
                type "----------------------------[SETUP].done\n"
         ;;;;;; DEBUG
    
    end
    ;;;setup()
    
    to initialize-globals
    
       set exit1           patch 64 -13
       set exit2           patch 13 -54
       set exits-list    ( list exit1 exit2 )
    
       set passenger-count 42 ;;   integer  ;;; MCVE reproducibility GAP#2 ( perhaps GUI injected Var setup )
    end
    ;;;initialize-globals()
    
    to initialize-train
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MCVE reproducibility GAP#1
     ; import-pcolors "C:/Users/palli/OneDrive/Desktop/Modello_base/images/ambiente.png"
     ;
     ; Welcome as always @accismns
     ; Would you mind to actually post the whole, complete, reproducible MCVE code?
     ; Incompleteness prevents the code as-is from representing the as-is ( as-are )
     ; problem(s), so does not form a standard MCVE that Stack Overflow is working
     ; for decades on.
     ; Thank you for your kind reconsideration & update
     ; -- inter alia still missing the hard-coded file to get imported
     ; -- "C:/Users/palli/OneDrive/Desktop/Modello_base/images/ambiente.png"
     ; -- so kindly try to do so, as otherwise your code moves nowhere near a standard MCVE-reproducibility.
     ; That is fair, isn't it?
     ; – user3666197
     ; 1 hour ago
     ;
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MCVE reproducibility GAP#4
     ; world was not initialised as a system-default,
     ;       but the import-pcolors matching setup has to de deducted and implemented ex-post
     ;
     ; GUESSTIMATE: a non-toroidal world (see move()-requirements below
     ; 70px × 60px ( as was in https://i.imgur.com/ZafKcNc.png )
     ; ______________________________________________________________ IMPLEMENTED ABOVE
       import-pcolors "~projects/NetLogo 6.2.2/StackOverflow_accismns_ZafKcNc.png" ;; PROXY for ambiente.png
    
       ask patches [
         if pcolor = 86.6 [set pcolor cyan]
         if pcolor =  0   [set pcolor black]
         if pcolor = 64.3 [set pcolor green]
         if pcolor =  9.9 [set pcolor white]
    
         set fire?       false
         set accessible? false    ; Imposta tutte le patch come inaccessibili di default
       ]
    
       ask patches with [pcolor = white] [
           set accessible? true   ; Contrassegna le patch verdi come accessibili
       ]
    end
    ;;;initialize-train()
    
    to initialize-exits
      set exit1 patch 64 -13
      set exit2 patch 13 -54
      set exits-list (list exit1 exit2)
    end
    ;;;initialize-exits() -- why replicate already initialise intialize-globals() setup globals again?
    
    to initialize-passengers
       create-passengers passenger-count [
       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MCVE reproducibility GAP#5
       ; set shape          "person business"
       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;      observer: ["default" "airplane" "arrow" "box" "bug" "butterfly" "car" "circle" "circle 2" "cow" "cylinder" "dot" "face happy" "face neutral" "face sad" "fish" "flag" "flower" "house" "leaf" "line" "line half" "pentagon" "person" "plant" "sheep" "square" "square 2" "star" "target" "tree" "triangle" "triangle 2" "truck" "turtle" "wheel" "wolf" "x"]
         set shape          "person"
         set size            4      ; 2
         set color           yellow
         set in-seat?        false  ; Cambia da true a false
         set safe?           false  ; yes, the life is dangerous
         set dead?           false  ; hopefully will stay so ...
         set panic?          true   ; why all when no fire and no smoke present?
         set current-heading 0      ; why all HDG the same direction? not common in common trains
         set my-exits-list   []     ; SET here, it must assign a []-list to this property BEFORE next call to choose-exit
         set target-exit     nobody ; SET this as the initial target-exit
    
       ; Aggiungi il seguente blocco di codice per posizionare casualmente i passeggeri in patch accessibili
       ; let     target one-of patches with [accessible?]
       ; move-to target
         move-to one-of patches with [ accessible? ]; Aggiungi il seguente blocco di codice per posizionare casualmente i passeggeri in patch accessibili
         set     target-exit choose-exit patch-here ; Aggiorna il target-exit dopo esserti spostato sulla patch iniziale
         ]
      ;;;;;;;; DEBUG
               ask passengers [ type ( sentence "W: " who
                                                "x:"  xcor
                                                "y:"  ycor
                                                 )
               ]
             ; [W:  28 x:  0 y:   0]  [W:  16 x: 0 y: 0]  [W:   4 x: 0 y: 0]
             ; [W:   2 x:  0 y:   0]  [W:  35 x: 0 y: 0]  [W:   7 x: 0 y: 0]
             ; [W:  32 x:  0 y:   0]  [W:   1 x: 0 y: 0]  [W:  10 x: 0 y: 0]
             ; [W:  13 x:  0 y:   0]  [W:  37 x: 0 y: 0]  [W:  15 x: 0 y: 0]
             ; [W:  27 x:  0 y:   0]  [W:  12 x: 0 y: 0]  [W:  19 x: 0 y: 0]
             ; [W:  17 x:  0 y:   0]  [W:  14 x: 0 y: 0]  [W:   5 x: 0 y: 0]
             ; [W:   9 x:  0 y:   0]  [W:  36 x: 0 y: 0]  [W:  30 x: 0 y: 0]
             ; [W:  29 x:  0 y:   0]  [W:  24 x: 0 y: 0]  [W:   8 x: 0 y: 0]
             ; [W:  31 x:  0 y:   0]  [W:  40 x: 0 y: 0]  [W:  11 x: 0 y: 0]
             ; [W:  21 x:  0 y:   0]  [W:   0 x: 0 y: 0]  [W:   3 x: 0 y: 0]
             ; [W:   6 x:  0 y:   0]  [W:  26 x: 0 y: 0]  [W:  18 x: 0 y: 0]
             ; [W:  39 x:  0 y:   0]  [W:  20 x: 0 y: 0]  [W:  38 x: 0 y: 0]
             ; [W:  33 x:  0 y:   0]  [W:  25 x: 0 y: 0]  [W:  22 x: 0 y: 0]
             ; [W:  41 x: 59 y: -31]  [W:  23 x: 0 y: 0]  [W:  34 x: 0 y: 0]
             ;       ^_x:_59 y:_-31
       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
             ; type count patches                        4200
             ; type count patches with [accessible?]     2784
             ; type count patches with [not accessible?] 1416
    end
    ;;;initialize-passengers()
    
    to-report choose-exit [current-position]
    
       let possible-exits        []
       let shortest-distance 10000
       let nearest-exit          nobody
    
       foreach exits-list [ exitUnderTest ->
    
               let exit-coords (list [pxcor] of exitUnderTest [pycor] of exitUnderTest) ;; Get exit coordinates as a list
               let exit-distance distance exitUnderTest
    
               if  exit-distance < shortest-distance [
                   set shortest-distance exit-distance
                   set nearest-exit      exitUnderTest
                   set possible-exits    []
               ]
    
               if  exit-distance = shortest-distance [
    
                   set possible-exits lput exit-coords possible-exits ;; Use exit coordinates instead of the patch object
               ]
       ]
    
       if length possible-exits = 0 [
           print "No exits found."
           report patch-here
         ; report nobody ;;------------------------------------------ JIT-exit --^ reporting NOBODY
       ]                 ;;                                                      ? WAS CALLER READY TO RECEIVE NOBODY as an answer ?
    
       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DEBUG
                                              type ( sentence "TRY let lucky-exit-coords    one-of     possible-exits\n"
                                                              "WITH possible-exits  :" possible-exits "\n"
                                                              )
       let lucky-exit-coords    one-of     possible-exits
       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DEBUG
                                              type ( sentence "TRY let lucky-exit      patch-at ( item 0 lucky-exit-coords ) ( item 1 lucky-exit-coords )\n"
                                                              "WITH patch-at  :"       patch-at ( item 0 lucky-exit-coords ) ( item 1 lucky-exit-coords ) "\n"
                                                              )
       let lucky-exit           patch-at ( item 0 lucky-exit-coords )
                                         ( item 1 lucky-exit-coords ) ;; Get the object using the coordinates
    
       set target-exit          lucky-exit
    
       ; Calculate the possible positions (PP) around the lucky exit
       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DEBUG
                                              type ( sentence "TRY let pp-list ( patch-set [neighbors4] of lucky-exit with [accessible?]\n"
                                                              "WITH lucky-exit      :" lucky-exit "\n"
                                                              )
                                            ; type ( sentence "WITH lucky-exit with :" lucky-exit with [accessible?] "\n"
                                            ;                 )
                                            ; type ( sentence "WITH [neighbors4] of :" [neighbors4] of lucky-exit with [accessible?] "\n"
                                            ;                 )
                                              type ( sentence "WITH ( patch-set ...):" patch-set [neighbors4] of ( patch-set lucky-exit ) with [accessible?] "\n"
                                                              )
       ;                                   ;; PROTECT CASES WHERE possible-exits[] is empty
       let pp-list            ( patch-set [neighbors4] of ( patch-set lucky-exit )
                                     with [accessible?]
                                     )
    
       set my-exits-list lput lucky-exit my-exits-list
    
       ; Calculate the probability of each PP to be a LPP
     ; let  M   count pp-list
     ; let  P   1 / M                      ;; PROTECT !DIV0
    
       ifelse count pp-list > 0 [          ;; PROTECT from empty pp-list
          ;; IF   ::
                     let  M   count pp-list
                     let  P   1 / M        ;; PROTECT'd from DIV0 as lengt
    
                   ; Select a LPP for the passenger
                     let    lpp one-of pp-list
                     face   lpp
    
                     report lpp ;;------------------------------------ JIT-exit --^ reporting lpp
       ][ ;; ELSE ::
                     type ( sentence "Zero Possible Positions for PNR( " who ") at ( " patch-here " )\n" )
                     let    lpp patch-here
                     report lpp ;;------------------------------------ JIT-exit --^ reporting lpp
       ]
    ;;;a pair of MUTEX-JIT-exits --^ will cause the code-execution will never continue beyond this
    end
    ;;;report choose-exit
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FUNZIONI GO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    to go
       ;;;;;; DEBUG
              type "----------------------------[GO.tick]\n"
       ;;;;;; DEBUG
    
       ask passengers [
           if panic? [
              let  target-to-exit choose-exit patch-here
              face target-to-exit
           ]
           move
       ]
       tick
    end
    ;;;go()
    
    to move ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MCVE reproducibility GAP#3
    
       if panic? [
          move-to target-exit                ;; PROTECT from empty - MOVE-TO expected input to be an agent but got NOBODY instead.
          if  patch-here = target-exit [
              set safe?    true
              set in-seat? false
          ]
       ]
       ;;;
       ;;; MOVE-TO expected input to be an agent but got NOBODY instead.
       ;;;         error while passenger 34 running MOVE-TO
       ;;;         called by procedure MOVE
       ;;;
       ;;; ask passenger 34 [ report-passenger-state ]
       ;;; ...
       ;;; WITH ( patch-set ...): (agentset, 0 patches)
       ;;; Zero Possible Positions for PNR(  15 ) at (  (patch 16 -37)  )
       ;;; --post-mortem--
       ;;; observer> ask passenger 15 [ report-passenger-state who ]
       ;;; [
       ;;;  PNR( 15 ) in-seat?  false safe?  false panic?  true dead?  false
       ;;;  HDG( 305 ) current-heading  0
       ;;;  LoX( nobody nobody ) target-exit  nobody
       ;;; ]
       ;;; --OBSERVAION:-current-code-relies-on-data-driven-behaviour-but-maintains-Agents'-data-inconsistently-resulting-in-syntax-crashes--
       ;;; --SOLUTION:-revise-the-strategy-of-data-driven-Agents'-behaviour-and-add-fuse-protected-code-that-does-not-run-Agents'-behaviour-driving-data-out-of-expected-syntax
       ;;;
       ;;; aha:
       ;;;
       ;;; This problem occurred to me, the passengers move /// how? ^^^^
       ;;;      but do not go towards the exit in a smart way
       ;;;      and remain in the centre moving around,
       ;;; they also move out of the edge of the room.
       ;;;      How can I solve it?
       ;;;
       ;;; I need to do this thing:
       ;;;      If a cell is a PP (possible position) of an exit,
       ;;;                        it may be occupied by the occupant
       ;;;                        at the next time step.
       ;;;      Each exit may have more than one PP.
       ;;;                        On the other hand,
       ;;;      each occupant can only stay in one cell within a time step.
       ;;;
       ;;; In the proposed CA model, the probability of an exit’s
       ;;;                        PP to be occupied within the next time step
       ;;;                        is assumed to be equal.
       ;;;
       ;;; The cell to be selected is termed the Lucky PP (LPP).
       ;;;
       ;;; Assuming the number of PP of an exit is M, the probability of each
       ;;;                        PP to be a LPP is Pu = 1/M
    
    end
    ;;;move()
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MCVE reproducibility run outputs
    ;
    ;----------------------------[SETUP]
    ; TRY let lucky-exit-coords    one-of     possible-exits
    ; WITH possible-exits  : [13 -54]
    ;
    ; TRY let lucky-exit      patch-at ( item 0 lucky-exit-coords ) ( item 1 lucky-exit-coords )
    ; WITH patch-at        : nobody
    ;
    ; TRY let pp-list ( patch-set [neighbors4] of lucky-exit with [accessible?]
    ; WITH lucky-exit      : nobody
    
    to report-passenger-state [ PNR ]
    
         set shape          "arrow" ; in-sim: "person"
         set size            8      ; in-sim: 4        ; was 2
         set color           red    ; in-sim  yellow
         type ( sentence "\nPNR(" who ") in-seat? " in-seat?
                                           "safe? "    safe?
                                          "panic? "   panic?
                                           "dead? "    dead?
                         "\nHDG(" heading   ") current-heading " current-heading
                         "\nLoX(" my-exits-list ") target-exit " target-exit
         )
    end
    ;;;report-passenger-state( who )
    
    to reset-passenger-state [ PNR ]
         set shape          "person"
         set size            4        ; was 2
         set color           yellow
         type ( sentence "\nPNR(" who ") state set back to in-sim"
         )
    end
    ;;;reset-passenger-state( who )
    

    (for previous release of the NetLogo code -- see post-revisions)

    The original post went through review (naturally not reflecting the last minute changes, announced right now) and after obvious repairs of reproducibility GAPs, the code is reproducing some other kind of data-driven errors.

    Enter image description here

    Feel free to use the tools offered and continue debugging further on, also perhaps resolving some bonus-inlined remarks that indicate future problems your ABM-simulation will sooner or later experience.