modelo t-types c-types

No preview image

1 collaborator

Default-person Emiliano Alvarez (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 363 times • Downloaded 70 times • Run 0 times
Download the 'modelo t-types c-types' 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?

El modelo intenta explicar la manera en la cual los agentes interactúan, bajo ciertos supuestos de comportamiento y de información

HOW IT WORKS

La utilidad de los agentes tiene dos componentes: un componente individual (t-type), que está definido exógenamente; un componente social (c-type), que depende de cuántas personas eligen un determinado producto en el período anterior, en el entorno. En este modelo, en el período t=0 se define aleatoriamente a qué t-type y c-type pertenece cada agente. Esta manera de modelizar la utilidad nos permite estudiar distintas tipologías de agentes: Pavlovianos, conformistas y aversos a la pérdida (también figura el ejemplo de individuos que buscan exclusividad, como ejemplo de un comportamiento agregado inestable). También podemos estudiar este modelo para distintas cantidades de tipos de aglomeración y de preferencias individuales (está más explicado en la sección "Modelo" del proyecto de tesis). La persona también puede elegir de manera aleatoria su decisión de consumo; estudiamos si este modelo es estable frente a mutaciones.

HOW TO USE IT

  • Para cambiar la cantidad de crowding types, mover la barra "ct_opciones" al número deseado (del 1 al 4, en principio)
  • Podemos elegir el tipo de comportamiento de los individuos con el chooser "comport".
  • Si queremos que un cierto porcentaje de los individuos elijan de forma aleatoria, le damos un valor positivo a la barra "prob_mut".
  • Si queremos comenzar con una cantidad determinada del crowding type 1, movemos la barra "c-type1" al porcentaje deseado y seleccionamos ON en el interruptor "ctype_valor?". El resto de los crowding types se dividen el resto de manera aleatoria.
  • En cambio, si queremos tener una cantidad aleatoria de cada tipo en el período t=0, seleccionamos OFF en el interruptor "ctypevalor?".
  • Podemos elegir qué tipo de vecindad queremos, de Moore o de Von Neumann ("Moore" o "VN") en el chooser "vecindad".
  • Luego que seleccionamos las características deseadas, seleccionamos el botón "Setup" para que se configure t=0.
  • Para que el modelo avance un período, presionar el botón "go once". Para que avance continuamente, presionar "go".

THINGS TO NOTICE

El cuadro "c-type = t-type" muestra el porcentaje de agentes cuyas preferencias individuales (t-type) coinciden con la elección realizada (c-type). Se puede ver que la información que obtienen los agentes en el proceso de interacciones, permite aumentar la cantidad de agentes que consumen su bien preferido; las presiones sociales hacen que ese valor se estabilice e incluso baje con el correr del tiempo. Por la manera en que se define el modelo, es razonable suponer que se va a llegar a consensos de forma más rápida en el tipo de comportamiento "conformista", mientras que el tipo de comportamiento Pavloviano, se forman grupos de un radio menor. En este último caso, las preferencias individuales tienen un mayor peso. EL gráfico que figura abajo y a la izquierda de la pantalla, muestra el porcentaje de individuos que consumen cada bien. En color negro, se grafica el porcentaje de agentes para los cuales t-type = c_type. En color gris, se muestra el porcentaje de agentes que cambian su decisión respecto al período anterior. (suggested things for the user to notice while running the model)

EXTENDING THE MODEL

  • Se puede extender agregando porcentajes de cada uno de los tipos de comportamiento.
  • Se puede pensar en cambiar de ubicación a los agentes luego de cada paso y ahí sí calcular su utilidad con los nuevos vecinos (está en etapa de pruebas).
  • Se pueden pensar otro tipo de comportamientos para el modelo
  • El entorno de los individuos puede tener un radio mayor (ver modelo en ejemplos de NetLogo).

RELATED MODELS

El modelo "VOTING" es una primera aproximación a las preferencias sociales. En el modelo "SEGREGATION" los agentes cambian a otra ubicación (no cambian el bien a consumir o sus preferencias).

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

_ citar modelos "VOTING", "SEGREGATION", "patch clusters example", "flocking" (para la versión con movimiento) (a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

Comments and Questions

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

Click to Run Model

extensions [ ]
globals
[
  a ; parámetro del t-type

  b ; parámetro de la cantidad de neighbors con el mismo c-type

  c ; parámetro de la cantidad de neighbors con distinto c-type

  tt_opciones
]
patches-own
[
  c-type ;; crowding type

  c-type_old ; crowding type del período anterior

  t-type ;; taste type

  total_1
  total_2
  total_3
  total_4
  total_5
  u_1
  u_2
  u_3
  u_4
  u_5
  cluster
  clus
  dato_cluster
]

to setup

  clear-all
 set tt_opciones ct_opciones ; para tener la misma cantidad de crowding types y de taste types

if ( comport = "Pavloviano" ) [
  set a 1
  set b 1
  set c 1
  ]
if  ( comport = "conformista" )
  [ set a 0
    set b 0
    set c 1
  ]
 if ( comport = "averso_perdida" )
 [ set a 1
   set b 1
   set c 2
  ]
if ( comport = "exclusivo" )
 [ set a 1
   set b -1
   set c -1
  ]

ask patches [
   set cluster nobody ; para contar los grupos

   ifelse ( c_type_valor? ) [ ; le damos un porcentaje de agentes con c-type 1 y el resto se divide aleatoriamente

    ifelse ( random-float 1.000 <= c-type_1 ) [ set c-type 1 ] [ set c-type ( 2 + random ((ct_opciones - 1)))]
      set t-type 1 + random ( tt_opciones ) ; los taste types se dividen de manera aleatoria

      recolor-patch ]
   ; en este caso, el porcentaje de crowding types también se genera de manera aleatoria

    [ set c-type 1 + random ( ct_opciones )
      set t-type 1 + random ( tt_opciones )
      recolor-patch ]
    ]
; en este caso, se setea el modelo para las vecindades de Moore o Von Neumann

ask patches
[ if ( vecindad = "Moore" )
     [ set total_1 count neighbors with [ c-type = 1 ]
       set total_2 count neighbors with [ c-type = 2 ]
       set total_3 count neighbors with [ c-type = 3 ]
       set total_4 count neighbors with [ c-type = 4 ]
       set total_5 count neighbors with [ c-type = 5 ]
      ; ahora, para cada individuo se calcula la utilidad de cada c-type

      ; notar que cuando coincide el t-type con el c-type, es mayor la utilidad

       set u_1 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 1 ) [ 1 ] [ 0 ] ) + b * ( total_1 / count neighbors ) - c * ( count neighbors with [ c-type != 1 ] / count neighbors )
       set u_2 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 2 ) [ 1 ] [ 0 ] ) + b * ( total_2 / count neighbors ) - c * ( count neighbors with [ c-type != 2 ] / count neighbors )
       set u_3 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 3 ) [ 1 ] [ 0 ] ) + b * ( total_3 / count neighbors ) - c * ( count neighbors with [ c-type != 3 ] / count neighbors )
       set u_4 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 4 ) [ 1 ] [ 0 ] ) + b * ( total_4 / count neighbors ) - c * ( count neighbors with [ c-type != 4 ] / count neighbors )
       set u_5 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 5 ) [ 1 ] [ 0 ] ) + b * ( total_5 / count neighbors ) - c * ( count neighbors with [ c-type != 5 ] / count neighbors ) ]
   if (vecindad = "VN")
     [ set total_1 count neighbors4 with [ c-type = 1 ]
       set total_2 count neighbors4 with [ c-type = 2 ]
       set total_3 count neighbors4 with [ c-type = 3 ]
       set total_4 count neighbors4 with [ c-type = 4 ]
       set total_5 count neighbors4 with [ c-type = 5 ]
       set u_1 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 1 ) [ 1 ] [ 0 ] ) + b * ( total_1 / count neighbors4 ) - c * ( count neighbors with [ c-type != 1 ] / count neighbors4 )
       set u_2 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 2 ) [ 1 ] [ 0 ] ) + b * ( total_2 / count neighbors4 ) - c * ( count neighbors with [ c-type != 2 ] / count neighbors4 )
       set u_3 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 3 ) [ 1 ] [ 0 ] ) + b * ( total_3 / count neighbors4 ) - c * ( count neighbors with [ c-type != 3 ] / count neighbors4 )
       set u_4 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 4 ) [ 1 ] [ 0 ] ) + b * ( total_4 / count neighbors4 ) - c * ( count neighbors with [ c-type != 4 ] / count neighbors4 )
       set u_5 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 5 ) [ 1 ] [ 0 ] ) + b * ( total_5 / count neighbors4 ) - c * ( count neighbors with [ c-type != 5 ] / count neighbors4 ) ]
]
  reset-ticks
end 

to go
; para guardar los valores anteriores

ask patches
[  set c-type_old c-type
   set cluster nobody
   if ( clus > 0 ) [ set dato_cluster clus ]
   set clus  0
]

; con las preferencias individuales (t-types) y los c-types

  ask patches
    [ set c-type ifelse-value (( u_1 > u_2 ) and (u_1 > u_3) and (u_1 > u_4) and (u_1 > u_5)) [ 1 ][
       ifelse-value ((u_2 > u_1) and (u_2 > u_3) and (u_2 > u_4) and (u_2 > u_5)) [ 2 ] [
        ifelse-value ((u_3 > u_1) and (u_3 > u_2) and (u_3 > u_4) and (u_3 > u_5))[ 3 ] [
         ifelse-value ((u_4 > u_1) and (u_4 > u_2) and (u_4 > u_3) and (u_4 > u_5)) [ 4 ] [
          ifelse-value ((u_5 > u_1) and (u_5 > u_2) and (u_5 > u_3) and (u_5 > u_4)) [ 5 ] [ 1 + random ct_opciones ]]]]]
     recolor-patch ]

; mutaciones (existe una probabilidad que ocurra un cambio en las elecciones del agente)

ask patches
 [ if ( random-float 1.000 <= prob_mut ) [ set c-type 1 + random ct_opciones ]
     recolor-patch ]

; Para exportar la pantalla o el gráfico

;      export-interface (word "frame_23" but-first (word (100 + ticks)) ".png")

;      export-plot (word ticks ".png")

;      export-interface (word ticks ".png")


      tick

; ahora se calculan utilidades de cada opción, luego de la elección del producto

ask patches
[ if ( vecindad = "Moore" )
     [ set total_1 count neighbors with [ c-type = 1 ]
       set total_2 count neighbors with [ c-type = 2 ]
       set total_3 count neighbors with [ c-type = 3 ]
       set total_4 count neighbors with [ c-type = 4 ]
       set total_5 count neighbors with [ c-type = 5 ]
       set u_1 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 1 ) [ 1 ] [ 0 ] ) + b * ( total_1 / count neighbors ) - c * ( count neighbors with [ c-type != 1 ] / count neighbors )
       set u_2 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 2 ) [ 1 ] [ 0 ] ) + b * ( total_2 / count neighbors ) - c * ( count neighbors with [ c-type != 2 ] / count neighbors )
       set u_3 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 3 ) [ 1 ] [ 0 ] ) + b * ( total_3 / count neighbors ) - c * ( count neighbors with [ c-type != 3 ] / count neighbors )
       set u_4 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 4 ) [ 1 ] [ 0 ] ) + b * ( total_4 / count neighbors ) - c * ( count neighbors with [ c-type != 4 ] / count neighbors )
       set u_5 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 5 ) [ 1 ] [ 0 ] ) + b * ( total_5 / count neighbors ) - c * ( count neighbors with [ c-type != 5 ] / count neighbors ) ]
   if (vecindad = "VN")
     [ set total_1 count neighbors4 with [ c-type = 1 ]
       set total_2 count neighbors4 with [ c-type = 2 ]
       set total_3 count neighbors4 with [ c-type = 3 ]
       set total_4 count neighbors4 with [ c-type = 4 ]
       set total_5 count neighbors4 with [ c-type = 5 ]
       set u_1 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 1 ) [ 1 ] [ 0 ] ) + b * ( total_1 / count neighbors4 ) - c * ( count neighbors with [ c-type != 1 ] / count neighbors4 )
       set u_2 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 2 ) [ 1 ] [ 0 ] ) + b * ( total_2 / count neighbors4 ) - c * ( count neighbors with [ c-type != 2 ] / count neighbors4 )
       set u_3 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 3 ) [ 1 ] [ 0 ] ) + b * ( total_3 / count neighbors4 ) - c * ( count neighbors with [ c-type != 3 ] / count neighbors4 )
       set u_4 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 4 ) [ 1 ] [ 0 ] ) + b * ( total_4 / count neighbors4 ) - c * ( count neighbors with [ c-type != 4 ] / count neighbors4 )
       set u_5 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 5 ) [ 1 ] [ 0 ] ) + b * ( total_5 / count neighbors4 ) - c * ( count neighbors with [ c-type != 5 ] / count neighbors4 ) ]
]

if (ticks = 1 or ticks = 5 or ticks = 10 or ticks = 15 or ticks = 20 or ticks = 25 or ticks = 30 or ticks = 35 or ticks = 40 or ticks = 45 or ticks = 50 or ticks = 55 or ticks = 60) [ find-clusters ]
end 

to go-global
; este caso sirve para mostrar el desarrollo del modelo cuando los individuos toman en cuenta la información de todos los agentes

; es igual que "GO" pero la vecindad es el conjunto de todos los individuos

ask patches
  [ set total_1 count patches with [ c-type = 1 ]
    set total_2 count patches with [ c-type = 2 ]
    set total_3 count patches with [ c-type = 3 ]
    set total_4 count patches with [ c-type = 4 ]
    set total_5 count patches with [ c-type = 5 ]
    set u_1 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 1 ) [ 1 ] [ 0 ] ) + b * ( total_1 / count patches ) - c * ( count patches with [ c-type != 1 ] / count patches )
    set u_2 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 2 ) [ 1 ] [ 0 ] ) + b * ( total_2 / count patches ) - c * ( count patches with [ c-type != 2 ] / count patches )
    set u_3 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 3 ) [ 1 ] [ 0 ] ) + b * ( total_3 / count patches ) - c * ( count patches with [ c-type != 3 ] / count patches )
    set u_4 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 4 ) [ 1 ] [ 0 ] ) + b * ( total_4 / count patches ) - c * ( count patches with [ c-type != 4 ] / count patches )
    set u_5 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 5 ) [ 1 ] [ 0 ] ) + b * ( total_5 / count patches ) - c * ( count patches with [ c-type != 5 ] / count patches ) ]

ask patches
[  set c-type_old c-type ]
  ask patches
    [ set c-type ifelse-value (( u_1 > u_2 ) and (u_1 > u_3) and (u_1 > u_4) and (u_1 > u_5)) [ 1 ][
       ifelse-value ((u_2 > u_1) and (u_2 > u_3) and (u_2 > u_4) and (u_2 > u_5)) [ 2 ] [
        ifelse-value ((u_3 > u_1) and (u_3 > u_2) and (u_3 > u_4) and (u_3 > u_5))[ 3 ] [
         ifelse-value ((u_4 > u_1) and (u_4 > u_2) and (u_4 > u_3) and (u_4 > u_5)) [ 4 ] [
          ifelse-value ((u_5 > u_1) and (u_5 > u_2) and (u_5 > u_3) and (u_5 > u_4)) [ 5 ] [ 1 + random ct_opciones ]]]]]
     recolor-patch ]

; mutaciones

ask patches
 [ if ( random-float 1.000 <= prob_mut ) [ set c-type 1 + random ct_opciones ]
     recolor-patch ]

; Para exportar la pantalla

;      export-interface (word "frame_2" but-first (word (100000 + ticks)) ".png")

;      export-plot (word ticks ".png")



      tick


;      export-interface (word ticks ".png")

  ask patches
     [ set total_1 count patches with [ c-type = 1 ]
       set total_2 count patches with [ c-type = 2 ]
       set total_3 count patches with [ c-type = 3 ]
       set total_4 count patches with [ c-type = 4 ]
       set total_5 count patches with [ c-type = 5 ]
       set u_1 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 1 ) [ 1 ] [ 0 ] ) + b * ( total_1 / count patches ) - c * ( count patches with [ c-type != 1 ] / count patches )
       set u_2 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 2 ) [ 1 ] [ 0 ] ) + b * ( total_2 / count patches ) - c * ( count patches with [ c-type != 2 ] / count patches )
       set u_3 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 3 ) [ 1 ] [ 0 ] ) + b * ( total_3 / count patches ) - c * ( count patches with [ c-type != 3 ] / count patches )
       set u_4 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 4 ) [ 1 ] [ 0 ] ) + b * ( total_4 / count patches ) - c * ( count patches with [ c-type != 4 ] / count patches )
       set u_5 a * ( 1 / ct_opciones ) * ( ifelse-value (t-type = 5 ) [ 1 ] [ 0 ] ) + b * ( total_5 / count patches ) - c * ( count patches with [ c-type != 5 ] / count patches )

       ]
end 

to recolor-patch  ;; colores diferentes para cada c-type

  ifelse c-type = 1 [ set pcolor red + 1] [
   ifelse c-type = 2 [ set pcolor green + 1 ][
    ifelse c-type = 3 [ set pcolor blue ][
     ifelse c-type = 4 [ set pcolor yellow ] [ set pcolor magenta ]
   ]
  ]
 ]
end 

;;; para contar la cantidad de clusters


to find-clusters
  loop [
    ;; pick a random patch that isn't in a cluster yet

    let seed one-of patches with [cluster = nobody]
    ;; if we can't find one, then we're done!

    if seed = nobody
    [ show-clusters
      stop ]
    ;; otherwise, make the patch the "leader" of a new cluster

    ;; by assigning itself to its own cluster, then call

    ;; grow-cluster to find the rest of the cluster

    ask seed
    [ set cluster self
      grow-cluster ]
  ]
 display
end 

to grow-cluster  ;; patch procedure

  ask neighbors4 with [(cluster = nobody) and
    (pcolor = [pcolor] of myself)]
  [ set cluster [cluster] of myself
    grow-cluster ]
end 

;; once all the clusters have been found, this is called

;; to put numeric labels on them so the user can see

;; that the clusters were identified correctly


to show-clusters
  let counter 1
  loop
  [ ;; pick a random patch we haven't labeled yet

    let p one-of patches with [ clus = 0 ]
    if p = nobody
      [ stop ]
    ;; give all patches in the chosen patch's cluster

    ;; the same label

    ask p
    [ ask patches with [cluster = [cluster] of myself]
      [ set clus counter ] ]
    set counter counter + 1 ]
end 

There are 4 versions of this model.

Uploaded by When Description Download
Emiliano Alvarez almost 9 years ago MEJORA EN INTERFAZ Download this version
Emiliano Alvarez almost 9 years ago comentarios Download this version
Emiliano Alvarez almost 9 years ago cambios en la interfaz gráfica Download this version
Emiliano Alvarez almost 9 years ago Initial upload Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.