FoodAndSocialNetwork

FoodAndSocialNetwork preview image

This model is seeking new collaborators — would you please help?

1 collaborator

Tags

food 

Tagged by Diego Díaz Córdova about 15 hours ago

networks 

Tagged by Diego Díaz Córdova about 15 hours ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 7.0.0 • Viewed 6 times • Downloaded 0 times • Run 0 times
Download the 'FoodAndSocialNetwork' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

The model compares two conditions: one in which agents are embedded in a family support network, and a control condition without such network. Agents move randomly on a toroidal grid, consuming one energy unit per step. When an agent steps onto an orange-colored patch, it gains 4 energy units. Agents with zero energy are removed from the simulation (i.e., they die). In the network condition, whenever an agent's energy falls to exactly 1 unit, it issues a request to its network. The network member with the highest current energy is forced to transfer 1 unit to the requesting agent; transfers are mandatory and non-reciprocal (no repayment is expected). In the no-network condition, agents have no alternative source of energy and must rely exclusively on encountering orange patches to survive.

HOW IT WORKS

At initialization, agents are placed randomly on a toroidal grid and assigned an initial energy level drawn from a uniform distribution ranging from 0 to a maximum of 40 units. During each time step, agents move in a random direction and expend 1 unit of energy per movement. Agents whose energy falls to zero are removed from the simulation (i.e., they die). Whenever an agent steps onto an orange-colored patch, it gains 4 energy units. The model is implemented under two experimental conditions: (i) a treatment condition in which agents are connected through a random Erdős–Rényi network, and (ii) a control condition with no network. The objective is to assess and compare the emergent system-level performance across both configurations.

HOW TO USE IT

The model interface allows the user to specify the number of agents via a slider, with a maximum of 100 turtles. A switch determines whether the simulation runs under the network or no-network condition. The setup procedure initializes the world by randomly distributing agents on the grid, assigning their initial energy levels, and generating orange-colored recharge patches. Pressing go starts the simulation loop: agents move stochastically, consuming one energy unit per step, and regain 4 units whenever they step onto an orange patch. Under the network condition, whenever an agent's energy falls to 1 unit, it issues a request to the member of its network with the highest current energy. In this implementation, requests are non-repayable, and the selected network member cannot decline the transfer.

THINGS TO NOTICE

The interface monitors display the current turtle count, mean energy, and standard deviation of energy. This allows the user to examine whether system behavior varies with different population sizes, as well as to compare performance between the two experimental conditions (network vs. no-network).

EXTENDING THE MODEL

Future extensions of the model could explore alternative network topologies, such as small-world or preferential attachment structures. Likewise, the energy transfer rule could be refined by introducing reciprocity (i.e., repayment obligations) and by allowing network members to decline requests.

NETLOGO FEATURES

This model relies on a NetLogo extension —the nw extension— which provides built-in primitives for network generation and basic analytical calculations.

CREDITS AND REFERENCES

This model was created as part of the Informatics course at the School of Nutrition, University of Buenos Aires Diego Díaz Córdova

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

extensions [ nw ]
;; este programa esta hecho por lxs alumnxs de la escuela de nutrición
;; FMED - UBA - copyright 2025
;; agregar un umbral de hambre
;; que las tortugas ya sepan donde está la comida y salgan a buscarla
;; que las tortugas le pregunten a una tortuga que pasó cerca si conoce donde se puede comer
;; que las tortugas le pregunten a otra tortuga relacionada
;; que las tortugas tengan un rango de visión y que evalúen donde hay comida
;; que las tortugas se sigan moviendo al azar

;; la idea es comparar una situación con una red de otra sin red

globals [
  p ;;  para cada posible par de nodos, se calcula si se conectarán basándose en una probabilidad 'p'
]

turtles-own 
   [energia ;;variable que indica cuando cada tortuga tiene que ir a comer
   id-nodo ;; variable para nodos de la red
   ]

to setup
  clear-ticks
  clear-all
  set p 0.04
  ;;create-turtles ntortugas 
  ifelse network = true
  [ 
    nw:generate-random turtles links ntortugas p 
    [  
     set id-nodo who  
    ]
  ]
  [ 
    create-turtles ntortugas
  ]
  ask turtles
   [ 
    set energia random 40  
    set shape "person"
    set color green 
    setxy random-xcor random-ycor   
   ]
  ask patches 
   [
  ;; tablas de verdad a y b (a = v, b = v -> v)   
   if pxcor > 5 and pxcor < 10 and pycor > 5 and pycor < 10
      [set pcolor orange 
      ] 
   if pxcor > 5 and pxcor < 10 and pycor < -5 and pycor > -10
      [set pcolor orange 
      ]
   if pxcor < -5 and pxcor > -10 and pycor < -5 and pycor > -10
      [set pcolor orange 
      ]   
   if pxcor < -5 and pxcor > -10 and pycor > 5 and pycor < 10
      [set pcolor orange 
      ] 
   if pxcor > -2 and pxcor < 3 and pycor > -2 and pycor < 3
      [set pcolor orange 
      ]   
   if pxcor > -15 and pxcor < -10 and pycor > -2 and pycor < 3
      [set pcolor orange 
      ]
   if pxcor > 10 and pxcor < 15 and pycor > -2 and pycor < 3
      [set pcolor orange 
      ]
   if pxcor > -2 and pxcor < 3 and pycor > 10 and pycor < 15
      [set pcolor orange 
      ]   
   if pxcor > -2 and pxcor < 3 and pycor < -10 and pycor > -15
      [set pcolor orange 
      ]
   if pxcor > -15 and pxcor < -10 and pycor > 10 and pycor < 15
      [set pcolor orange 
      ]
   if pxcor > -15 and pxcor < -10 and pycor < -10 and pycor > -15
      [set pcolor orange 
      ]   
   if pxcor > 10 and pxcor < 15 and pycor > 10 and pycor < 15
      [set pcolor orange 
      ]   
    if pxcor > 10 and pxcor < 15 and pycor < -10 and pycor > -15
      [set pcolor orange 
      ]     
   ]
  reset-ticks
end 

to go
  if not any? turtles 
     [stop]
  ask turtles
  [
    set heading random 360 
    forward 1
    set energia (energia - 1)
    if pcolor = orange
       [set energia (energia + 5)]
    ;; debajo de un threshold de energía le pide a su red
    ;; le da el que tiene mas en ese momento, no queda deuda; el que da tiene que tener un mínimo de energia (u opcion altruista)
    if energia = 1
        [ 
          if network = true
            [pidecomida self]  ;;llama la rutina donde se fija de su red quien puede darle comida
        ]
    if energia <= 0
       [die]
  ]
  tick
end 

to pidecomida [id]
  let familia nw:turtles-in-radius 1 ;;guardo en esta variable toda su familia (los lazos desde la tortuga llamadora)
  ask max-one-of familia [energia] ;;se fija en su familia quien tiene comida que le puda prestar, aquel que tiene más
   [
     set energia energia - 1
     ask id [set energia energia + 1]
   ]
end 

There is only one version of this model, created about 15 hours ago by Diego Díaz Córdova.

Attached files

File Type Description Last updated
FoodAndSocialNetwork.png preview Preview for 'FoodAndSocialNetwork' about 15 hours ago, by Diego Díaz Córdova Download

This model does not have any ancestors.

This model does not have any descendants.