hello,

i'm a master 2 student and i'm a new user of netlogo, so my simulation is 
modelling a network with mobile agents system for maintenance.

this is the code :

turtles-own
[
  panne?           ;; if true, the turtle is infectious
  veil?          ;; if true, the turtle can't be infected
  network-timer   ;; number of ticks since this turtle's last virus-check
]
breed [agents agent]


to setup
  clear-all
  ask patches [set pcolor 29.9 ]
  set-default-shape agents "default"

    setup-nodes
  setup-spatially-clustered-network
  ask n-of initial-outbreak-size turtles
    [ become-panne ]
  ask links [ set color gray ]
  reset-ticks
end

to setup-nodes
  set-default-shape turtles "circle"
  create-turtles number-of-nodes
  [
    ; for visual reasons, we don't put any nodes *too* close to the edges
    setxy (random-xcor * 0.95) (random-ycor * 0.95)
    become-normal
    set network-timer random panne-frequency
  ]

  ask turtles [
    set size 1.8
  ]
end

to setup-spatially-clustered-network
  let num-links (average-node-panne * number-of-nodes) / 2
  while [count links < num-links ]
  [
    ask one-of turtles
    [
      let choice (min-one-of (other turtles with [not link-neighbor? 
myself])
                   [distance myself])
      if choice != nobody [ create-link-with choice ]
    ]
  ]
  ; make the network look a little prettier
  repeat 10
  [
    layout-spring turtles links 0.3 (world-width / (sqrt number-of-nodes)) 1
  ]
end

to go
  if all? turtles [not panne?]
    [ stop ]
  ask turtles
  [
     set network-timer network-timer + 1
     if network-timer >= panne-frequency
       [ set network-timer 0 ]
  ]
  spread-panne
  do-panne-checks
  tick
end

to become-panne  ;; turtle procedure
  set panne? true
  set veil? false
  set color red
end

to become-normal  ;; turtle procedure
  set panne? false
  set veil? false
  set color green
end

to become-veil  ;; turtle procedure
  set panne? false
  set veil? true
  set color gray

end

to spread-panne
  ask turtles with [panne?]
    [ ask link-neighbors with [not veil?]
        [ if random-float 100 < panne-spread-chance
            [ become-panne ] ] ]
end

to do-panne-checks
  ask turtles with [panne? and network-timer = 0]
  [
    if random 100 < recovery-chance
    [
      ifelse random 100 < gain-resistance-chance
        [ become-normal ]
      [ become-normal ]
    ]
  ]
end


****
the model was represented in the picture

<https://lh3.googleusercontent.com/-4Qh6s0hg06w/V-xE7dcQXuI/AAAAAAAAAHk/XC460ocVl4oCTx-GctyBqtgnjdCWBXFqACLcB/s1600/simulation.PNG>


i want to add breeds agents to some nodes and when a node be red, the 
nearest agent from neighbor nodes will move to this infected node to repare 
it until the node back to normal state (green). can you help me please


-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to