Technology transfer

Technology transfer  preview image

1 collaborator

Tags

agriculture 

Tagged by William Orjuela-Garzon almost 3 years ago

behavioural decision making 

Tagged by William Orjuela-Garzon almost 3 years ago

capabilities 

Tagged by William Orjuela-Garzon almost 3 years ago

diffusion of innovations 

Tagged by William Orjuela-Garzon almost 3 years ago

diffusion of technology 

Tagged by William Orjuela-Garzon almost 3 years ago

emergent patterns~ 

Tagged by William Orjuela-Garzon almost 3 years ago

emerging technologies 

Tagged by William Orjuela-Garzon almost 3 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 258 times • Downloaded 10 times • Run 0 times
Download the 'Technology transfer ' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

extensions [array csv]


globals[

  newOTS
  newOTSByWhos
  newOTSByExplorer


  radius
  acum_capacidades ;; Promedio de capacidades por posicion de cada uno de los agentes que hacen formulas de exito
  acum_capacidades2 ;; Promedio de capacidades por posicion de cada uno de todos los agentes
  acum_capacidades3 ;; Promedio de capacidades por posicion de cada uno de los agentes que hacen formulas de exito
  acum_capacidades4 ;; Promedio de capacidades por posicion de cada uno de todos los agentes
  acum_learning_capacidades ;; Promedio de capacidades que aprenden por posicion de los agentes que hacen formulas de exito
  acum_unlearning_capacidades ;; Promedio de capacidades que aprenden por posicion de los agentes que hacen formulas de exito

  cont_LE_FE ;; Contador de capacidades que aprenden qcue se utilizan para hacer formulas de exito
  cont_UL_FE ;; Contador de capacidades que desaprenden que se utilizan para hacer formulas de exito

  acum_SExe_FE ;; Promedio de SExe de cada uno de los agentes que hacen formulas de exito
  acum_SExe_System ;; Promedio de capacidades de cada uno de todos los agentes
  acum_SExe_FE_acum ;; Acum de SExe de cada uno de los agentes que hacen formulas de exito
  acum_SExe_System_acum ;; Acum de capacidades de cada uno de todos los agentes

  acum_Costos_FE ;; Promedio de costos de los agentes que hacen formulas de exito
  acum_Costos_System ;; Promedio de costos de todos los agentes
  acum_Costos_FE_acum ;; Acum de costos de los agentes que hacen formulas de exito
  acum_Costos_System_acum ;; Acum de costos de todos los agentes

  acum_Beneficios_FE ;; Promedio de beneficios de los agentes que hacen formulas de exito
  acum_Beneficios_System ;; Promedio beneficios de todos los agentes
  acum_Beneficios_FE_acum ;; Acum de beneficios de los agentes que hacen formulas de exito
  acum_Beneficios_System_acum ;; Acum beneficios de todos los agentes

  profitList ;; Lista de delta de acumulación según el factor "ro"  para adicionar (Aprendizaje)
  profitListNiches ;; Lista de delta de acumulación según el factor "ro"  para adicionar (Aprendizaje)
  profitListOM ;; Lista de delta de acumulación según el factor "ro"  para adicionar (Aprendizaje) * aplica para las oportunidades de mercado
  profitListLess ;; Lista de delta de desacumulacion según el factor "delta" para disminuir (desprendizaje)

  profit ;; Factor

  typesAgents

  IC_System ;; IC ingreso por atributo de los agentes rojos
  CC_System ;; CC costo por cada capacidad de los agentes azules

  posiciones_que_se_utilizan
  posiciones_que_no_se_utilizan

  cont_dies_messages
  cont_dies_OM
  cont_dies_OT
  cont_dies_agents

  sexe_S ;; stock de excedentes en cada tick
  sexe_fe ;; stock de excedentes que hacen formulas de exito en cada tick

  variaciones_capacidades ;; Es una lista que acumula las variaciones de las capacidades
  variaciones_capacidades_aprendizaje ;; Es una lista que acumula las variaciones de las capacidades que aprenden
  variaciones_capacidades_desaprendizaje ;; Es una lista que acumula las variaciones de las capacidades que desaprenden

  listOI ;;Lista de nuevos OI

  cont_links_alto
  cont_links_medio
  cont_links_bajo

]

breed [Agents a-Agents] ;;agentes
breed [OTs a-OTs] ;; oportunidades tecnologicas

;; VC Vector de capacidades, VCP Vector de coeficiente de parametros
agents-own [vc vc_last vcp vcp_last typeAgent costs agentscost costcap benefits myOTs                  direccion capInoTra typedireccion cap cap_anterior lfrom  beneficio_temp SExe hasLinks? rec myMessages myMessagesPositions myMessages_anterior costT] ;; AZULES (SExe - Stock excedentes, rec - Resultado de ejecicio por capacidad)
OTs-own [va va_last vpd vpd_last createdBy createdByExplorer volatility volatilityactual TCV ciclovidaactual benefits                    atr_anterior atr_init ocupado  S beneficios typeOI]

to test

  clear-all
  reset-ticks

  ask patches [ set pcolor white ]

  set CC_System read-from-string CCk
  set IC_System read-from-string ICk

  set newOTS []
  set newOTSByWhos []
  set newOTSByExplorer []

  create-Agents 1 [
    setxy -9.35 3.30
    set size 1
    set myOTs []
    set vc [2 8 3 0 0]
    set vc_last vc
    set typeAgent (setTypeCapacity vc)
    if (typeAgent = ["Explotador"]) [
      set shape "circle"
      set vcp (relativeFrecuency)
      set vcp_last vcp
    ]
    if (typeAgent = ["Explorador"]) [
      set shape "star"
    ]
    ifelse (typeAgent = ["Explorador"]) [ set color 5 ] [
      ifelse (typeAgent = ["Intermediario"]) [ set color 15 ] [
        ifelse (typeAgent = ["Explotador"]) [ set color 25 ] [
          ifelse (typeAgent = ["Gestor"]) [ set color 105 ] [
            ifelse (typeAgent = ["Introductor"]) [ set color 55 ] [
              ifelse (typeAgent = ["Integrado"]) [ set color 125 ] [ set color cyan ]
            ]
          ]
        ]
      ]
    ]
    set costs [ -99 -99 -99 -99 -99 ]
    set agentscost (list who who -1 -1 -1)
    set SExe (random Initial_SS)
    set label who
  ]
  create-Agents 1 [
    setxy 3.30 -3.75
    set size 1
    set myOTs []
    set vc [0 0 8 2 1]
    set vc_last vc
    set typeAgent (setTypeCapacity vc)
    if (typeAgent = ["Explotador"]) [
      set shape "circle"
      set vcp (relativeFrecuency)
      set vcp_last vcp
    ]
    if (typeAgent = ["Explorador"]) [
      set shape "star"
    ]
    ifelse (typeAgent = ["Explorador"]) [ set color 5 ] [
      ifelse (typeAgent = ["Intermediario"]) [ set color 15 ] [
        ifelse (typeAgent = ["Explotador"]) [ set color 25 ] [
          ifelse (typeAgent = ["Gestor"]) [ set color 105 ] [
            ifelse (typeAgent = ["Introductor"]) [ set color 55 ] [
              ifelse (typeAgent = ["Integrado"]) [ set color 125 ] [ set color cyan ]
            ]
          ]
        ]
      ]
    ]
    set costs [ -99 -99 -99 -99 -99 ]
    set agentscost (list who who -1 -1 -1)
    set SExe (random Initial_SS)
    set label who
  ]
  create-Agents 1 [
    setxy 8.29 1.85
    set size 1
    set myOTs []
    set vc [5 6 8 4 1]
    set vc_last vc
    set typeAgent (setTypeCapacity vc)
    if (typeAgent = ["Explotador"]) [
      set shape "circle"
      set vcp (relativeFrecuency)
      set vcp_last vcp
    ]
    if (typeAgent = ["Explorador"]) [
      set shape "star"
    ]
    ifelse (typeAgent = ["Explorador"]) [ set color 5 ] [
      ifelse (typeAgent = ["Intermediario"]) [ set color 15 ] [
        ifelse (typeAgent = ["Explotador"]) [ set color 25 ] [
          ifelse (typeAgent = ["Gestor"]) [ set color 105 ] [
            ifelse (typeAgent = ["Introductor"]) [ set color 55 ] [
              ifelse (typeAgent = ["Integrado"]) [ set color 125 ] [ set color cyan ]
            ]
          ]
        ]
      ]
    ]
    set costs [ -99 -99 -99 -99 -99 ]
    set agentscost (list who who -1 -1 -1)
    set SExe (random Initial_SS)
    set label who
  ]
  create-Agents 1 [
    setxy 14.38 15.05
    set size 1
    set myOTs []
    set vc [3 7 8 0 7]
    set vc_last vc
    set typeAgent (setTypeCapacity vc)
    if (typeAgent = ["Explotador"]) [
      set shape "circle"
      set vcp (relativeFrecuency)
      set vcp_last vcp
    ]
    if (typeAgent = ["Explorador"]) [
      set shape "star"
    ]
    ifelse (typeAgent = ["Explorador"]) [ set color 5 ] [
      ifelse (typeAgent = ["Intermediario"]) [ set color 15 ] [
        ifelse (typeAgent = ["Explotador"]) [ set color 25 ] [
          ifelse (typeAgent = ["Gestor"]) [ set color 105 ] [
            ifelse (typeAgent = ["Introductor"]) [ set color 55 ] [
              ifelse (typeAgent = ["Integrado"]) [ set color 125 ] [ set color cyan ]
            ]
          ]
        ]
      ]
    ]
    set costs [ -99 -99 -99 -99 -99 ]
    set agentscost (list who who -1 -1 -1)
    set SExe (random Initial_SS)
    set label who
  ]

  create-Agents 1 [
    setxy 3.30 4.75
    set size 1
    set myOTs []
    set vc [3 3 2 4 8]
    set vc_last vc
    set typeAgent (setTypeCapacity vc)
    if (typeAgent = ["Explotador"]) [
      set shape "circle"
      set vcp [0.06 0.33 0.36 0.21 0.03] ;; (relativeFrecuency)
      set vcp_last vcp
    ]
    if (typeAgent = ["Explorador"]) [
      set shape "star"
    ]
    ifelse (typeAgent = ["Explorador"]) [ set color 5 ] [
      ifelse (typeAgent = ["Intermediario"]) [ set color 15 ] [
        ifelse (typeAgent = ["Explotador"]) [ set color 25 ] [
          ifelse (typeAgent = ["Gestor"]) [ set color 105 ] [
            ifelse (typeAgent = ["Introductor"]) [ set color 55 ] [
              ifelse (typeAgent = ["Integrado"]) [ set color 125 ] [ set color cyan ]
            ]
          ]
        ]
      ]
    ]
    set costs [ -99 -99 -99 -99 -99 ]
    set agentscost (list who who -1 -1 -1)
    set SExe 138
    set label who
  ]

  tick
end 

to setup

  clear-all
  reset-ticks

  ask patches [ set pcolor white ]

  set CC_System read-from-string CCk
  set IC_System read-from-string ICk

  set cont_links_alto 0
  set cont_links_medio 0
  set cont_links_bajo 0


  set newOTS []
  set newOTSByWhos []
  set newOTSByExplorer []

  create-new-agents count_agents


  ;read_file (word "aprendizaje_0" (learning_factor * 10) ".txt") ;; lee el archivo aprendizaje ro . txt para: llenar lista de profits y ajustar el tiempo de la simulación
  ;read_fileOM (word "aprendizaje_0" (learning_factor_NOPIs * 10) ".txt") ;; lee el archivo aprendizaje ro . txt para: llenar lista de profits para las OM
  ;read_file_UNlearning (word "desaprendizaje_0" (unlearning_factor * 10) ".txt") ;; lee el archivo desaprendizaje ro . txt para: llenar lista de profitsless

  ;create-plots

  ;actualizar_plots

  tick
end 

to setup_grid_10

  clear-all
  reset-ticks
  ask patches [ set pcolor white ]
  set CC_System read-from-string CCk
  set IC_System read-from-string ICk
  set cont_links_alto 0
  set cont_links_medio 0
  set cont_links_bajo 0
  set newOTS []
  set newOTSByWhos []
  set newOTSByExplorer []
  create-agents-grid "agentsgrid_10.txt"
  tick
end 

to setup_grid_5

  clear-all
  reset-ticks
  ask patches [ set pcolor white ]
  set CC_System read-from-string CCk
  set IC_System read-from-string ICk
  set cont_links_alto 0
  set cont_links_medio 0
  set cont_links_bajo 0
  set newOTS []
  set newOTSByWhos []
  set newOTSByExplorer []
  create-agents-grid "agentsgrid_5.txt"
  tick
end 

to setup_grid_now

  clear-all
  reset-ticks
  ask patches [ set pcolor white ]
  set CC_System read-from-string CCk
  set IC_System read-from-string ICk
  set cont_links_alto 0
  set cont_links_medio 0
  set cont_links_bajo 0
  set newOTS []
  set newOTSByWhos []
  set newOTSByExplorer []
  create-agents-grid "agentsgrid.txt"
  tick
end 

to create-agents-grid [file]

  let csv 0
  let fileList []
  file-close-all

  file-open (word file)

  let cont_row 0
  let cont_col 0
  let s_xde 0
  while [not file-at-end?] [
    set csv file-read-line
    set csv word csv "\t"  ; add comma for loop termination
    let mylist []  ; list of values of vc
    let vcplist [] ; list of values of vcp
    set cont_col 0
    set s_xde 0

    while [not empty? csv]
    [
      let $x position "\t" csv
      let $item substring csv 0 $x  ; extract item
      carefully [set $item read-from-string $item][] ; convert if number

      ifelse (cont_col < 5)
      [ set mylist lput $item mylist ]
      [
        ifelse (cont_col < 10)
        [ set vcplist lput $item vcplist ]
        [ set s_xde $item ]
      ]
      set csv substring csv ($x + 1) length csv  ; remove item and comma
      set cont_col (cont_col + 1)
    ]

    create-Agents 1 [
      setxy random-xcor random-ycor
      set color cyan
      set shape "default"
      set size 1
      set myOTs []
      set vc mylist
      set vc_last vc
      show vc
      set typeAgent (setTypeCapacity vc)
      if (typeAgent = ["Explotador"]) [
        set shape "circle"
        set vcp (vcplist)
        ;; set vcp (n-values Chain_length [random-float 1]) ;; TODO la sumatoria de los elementos del vector sea 1
        set vcp_last vcp
      ]

      if (typeAgent = ["Explorador"]) [
        set shape "star"
      ]

      ifelse (typeAgent = ["Explorador"]) [ set color 5 ] [
        ifelse (typeAgent = ["Intermediario"]) [ set color 15 ] [
          ifelse (typeAgent = ["Explotador"]) [ set color 25 ] [
            ifelse (typeAgent = ["Gestor"]) [ set color 105 ] [
              ifelse (typeAgent = ["Introductor"]) [ set color 55 ] [
                ifelse (typeAgent = ["Integrado"]) [ set color 125 ] [ set color cyan ]
              ]
            ]
          ]
        ]
      ]

      set costs [ -99 -99 -99 -99 -99 ]
      set agentscost (list who who -1 -1 -1)

      set SExe s_xde
      set label who
    ]

    set cont_row (cont_row + 1)
  ]
end 

to create-new-agents [num]
  create-Agents num [
    setxy random-xcor random-ycor
    set color cyan
    set shape "default"
    set size 1
    set myOTs []
    set vc (n-values Chain_length [random Chain_magnitude])
    set vc_last vc
    set typeAgent (setTypeCapacity vc)
    if (typeAgent = ["Explotador"]) [
      set shape "circle"
      set vcp (relativeFrecuency)
      ;; set vcp (n-values Chain_length [random-float 1]) ;; TODO la sumatoria de los elementos del vector sea 1
      set vcp_last vcp
    ]

    if (typeAgent = ["Explorador"]) [
      set shape "star"
    ]

    ifelse (typeAgent = ["Explorador"]) [ set color 5 ] [
      ifelse (typeAgent = ["Intermediario"]) [ set color 15 ] [
        ifelse (typeAgent = ["Explotador"]) [ set color 25 ] [
          ifelse (typeAgent = ["Gestor"]) [ set color 105 ] [
            ifelse (typeAgent = ["Introductor"]) [ set color 55 ] [
              ifelse (typeAgent = ["Integrado"]) [ set color 125 ] [ set color cyan ]
            ]
          ]
        ]
      ]
    ]

    set costs [ -99 -99 -99 -99 -99 ]
    set agentscost (list who who -1 -1 -1)

    ;;set cost (reduce + (map [ [ a b ] -> a * b ] CC_System capInoTra))
    ;;set profitself n-values Chain_length [0] ;; Beneficios aleatorio
    set SExe (random Initial_SS)
    ;;set nopiLink -1
    ;;set agentsSuplyLink []
    set label who
  ]
end 

to-report setTypeCapacity [capabilities]
  let point 3; ceiling (Chain_magnitude / 2)
  let midle ((floor (length capabilities / 2))) ;; tamaño impar
  let midleLast ((ceiling (length capabilities / 2))) ;; tamaño impar
  if (length capabilities mod 2 = 0) [ ;; Si el tamaño es par (true)
    set midle ((floor (length capabilities / 2)) - 1)
    set midleLast ((ceiling (length capabilities / 2)) + 1)
  ]
  ;;show (word point " - " midle " - " midleLast " - " length capabilities)
  ;;show (word capabilities " - " (sublist capabilities 0 midle) " - " (sublist capabilities midle midleLast) " - " (sublist capabilities midleLast (length capabilities)))
  set typeAgent []
  ifelse ( (member? true (map [[i] -> i >= point] capabilities ) ) ) [ ;;Por clasificar según vector de capacidades
    if (member? true (map [[j] -> j >= point] (sublist capabilities 0 midle) ) )  [ ;; Explorador
      set typeAgent ( lput "Explorador" typeAgent) ;; Existe algún valor cap mayor o igual a point a lado izq
    ]
    if (member? true (map [[k] -> k >= point] (sublist capabilities (midle) (midleLast)) ) )  [ ;; Intermediario
      set typeAgent ( lput "Intermediario" typeAgent) ;; Existe algún valor cap mayor o igual a point a lado der
    ]
    if (member? true (map [[l] -> l >= point] (sublist capabilities midleLast ((length capabilities))) ) )  [ ;; Explotador
      set typeAgent ( lput "Explotador" typeAgent) ;; Existe algún valor cap mayor o igual a point a lado der
    ]
    if (typeAgent = ["Explorador" "Explotador"]) [
      report ["Primario"] ;; ["Explorador"]
    ]
    if (typeAgent = ["Explorador" "Intermediario"]) [
      report ["Gestor"]
    ]
    if (typeAgent = ["Intermediario" "Explotador"]) [
      report ["Introductor"]
    ]
    if (typeAgent = ["Explorador" "Intermediario" "Explotador"]) [
      report ["Integrado"]
    ]
  ][
    set typeAgent ( lput "Primario" typeAgent)
  ]
  report typeAgent
end 

to-report relativeFrecuency
  let nums (n-values Chain_length [random 100])
  let sums reduce + nums
  report (map[ [ a ] -> a / sums ] nums )
end 

to go

  explorers_interaction

  adoptiontechtransfer

  updateSExe

  tick

  check-death_OT
  check-death_Agents

  resetTick
  if (ticks = max_ticks or (count agents = 0)) [ stop ]

  create-new-agents ((count agents) * rate_birth_agents / 100)

  ask agents [ foreach vc [ x -> if (x > 9 OR x < 0) [ show who ] ]]
  ask OTs [ foreach va [ x -> if (x > 9 OR x < 0) [ show who ] ]]
end 

to explorers_interaction

  ask agents with [typeAgent = ["Explorador"]] [ ;; Exploradores buscan otros agentes para hacer OTTs
    let candidates other agents with [ typeAgent != ["Explotador"] ] ;; and typeAgent != ["Explorador"]
    let vcp_origin vcp
    let cost_temp [ 0 0 0 0 0 ]

    ;;show candidates
    foreach [who] of candidates [
      x ->
      ;; Calculate cost
      set cost_temp (getExplorerCost vc ([vc] of turtle x) ([typeAgent] of turtle x))
        if (item 2 costs <= item 2 cost_temp) [
          set costs replace-item 2 costs (item 2 cost_temp)
          set agentscost replace-item 2 agentscost x
        ]
        if (item 3 costs <= item 3 cost_temp) [
          set costs replace-item 3 costs (item 3 cost_temp)
          set agentscost replace-item 3 agentscost x
        ]
        if (item 4 costs <= item 4 cost_temp) [
          set costs replace-item 4 costs (item 4 cost_temp)
          set agentscost replace-item 4 agentscost x
        ]
      ]

    ;; Create links
    ;let pos3 (item 2 agentscost)
    ;create-link-to (turtle pos3) [
    ;  set color getColorByTypeCost (getTypeCost [typeAgent] of turtle pos3)
    ;]
    ;let pos4 (item 3 agentscost)
    ;create-link-to (turtle pos4) [
    ;  set color getColorByTypeCost (getTypeCost [typeAgent] of turtle pos4)
    ;]
    ;let pos5 (item 4 agentscost)
    ;create-link-to (turtle pos5)[
    ;  set color getColorByTypeCost (getTypeCost [typeAgent] of turtle pos5)
    ;]


    ;; Prepare to create OTS

    let VCs (remove-duplicates (map [ a -> [vc] of turtle a ] (filter [ i -> turtle i != NOBODY ] agentscost )))
    let newVA n-values Chain_length [0]
    let newWhoVa n-values Chain_length [0]
    foreach VCs [
      x ->
      foreach [0 1 2 3 4]  [
        y ->
        if (item y newVA < item y x AND item y x < 9 ) [
          set newVA replace-item y newVA (item y x)
          set newWhoVa replace-item y newWhoVa (first ([who] of agents with [vc = x]))
        ]
      ]
    ]

    set newOTS lput newVA newOTS
    set newOTSByWhos lput newWhoVa newOTSByWhos
    set newOTSByExplorer lput who newOTSByExplorer

  ]

  ;; Create OTS
  let i 0
  foreach newOTS [
    x ->
    createOTS x item i newOTSByWhos item i newOTSByExplorer
    set i (i + 1)
  ]
end 

to-report getExplorerCost [vc_origin vc_other typeAgent_other]
  let pos3 ( ((item 2 vc_other) - (item 2 vc_origin)))
  let pos4 ( ((item 3 vc_other) - (item 3 vc_origin)))
  let pos5 ( ((item 4 vc_other) - (item 4 vc_origin)))
  let cost3 0
  let cost4 0
  let cost5 0
  if (getTypeCost typeAgent_other = "low") [
    set cost3 (pos3 * cost_low)
    set cost4 (pos4 * cost_low)
    set cost5 (pos5 * cost_low)
  ]
  if (getTypeCost typeAgent_other = "mid") [
    set cost3 (pos3 * cost_mid)
    set cost4 (pos4 * cost_mid)
    set cost5 (pos5 * cost_mid)
  ]
  if (getTypeCost typeAgent_other = "high") [
    set cost3 (pos3 * cost_high)
    set cost4 (pos4 * cost_high)
    set cost5 (pos5 * cost_high)
  ]
  report (list 0 0 cost3 cost4 cost5)
end 

to-report getTypeCost [typeAgent_other]
  if (typeAgent_other = ["Explorador"]) [
    report "low"
  ]
  if (typeAgent_other = ["Explotador"]) [
    report "high"
  ]
  if (typeAgent_other = ["Intermediario"]) [
    report "low"
  ]
  if (typeAgent_other = ["Gestor"]) [
    report "low"
  ]
  if (typeAgent_other = ["Integrado"]) [
    report "mid"
  ]
  if (typeAgent_other = ["Introductor"]) [
    report "mid"
  ]
  if (typeAgent_other = ["Primario"]) [
    report "high"
  ]
end 

to-report getColorByTypeCost [typeCost]
  if (typeCost = "low") [
    report 65
  ]
  if (typeCost = "mid") [
    report 45
  ]
  if (typeCost = "high") [
    report 15
  ]
end 

to createOTS [ newVA newWhoVa explorer]
  ; TODO setTypeOT : Emergente | En crecimiento | Madura | En declive
  set newWhoVa reduce sentence newWhoVa
  create-OTs 1 [
    ; TODO set xy near to explorer
    setxy random-xcor random-ycor ;;(5 + ([xcor] of turtle explorer)) (5 + ([ycor] of turtle explorer))
    set color red
    set shape "square"
    set size 1
    set va newVA
    set va_last newVA
    set vpd (n-values Chain_length [random Chain_magnitude])
    set vpd_last vpd
    set createdBy newWhoVa
    set createdByExplorer explorer
    set volatility max_volatility
    set volatilityactual 0
    set TCV ((random tilc) + 1)
    set ciclovidaactual 0
    set label who

    set benefits (map [ [a b] -> a * b * exp(-((ciclovidaactual - (TCV / 2)) ^ 2)/(2 * ((TCV / sigma) ^ 2)))] IC_System va)

    if (turtle explorer != NOBODY ) [
      create-link-to (turtle explorer)[
        set color black
      ]
    ]
  ]

  ;; reward process
  let index 0
  let candidates []
  foreach (reduce sentence newWhoVa) [
    x ->
    if (turtle x != nobody) [
      ask turtle x [ ;; positive reward
        let adding ((item index vc) + reward_by_position)
        if (adding <= 9) [
          set vc (replace-item index vc adding)
        ]
      ]


      set candidates remove x (remove-duplicates newWhoVa)
      foreach candidates [
        y ->
        if (turtle y != nobody) [
          ask turtle y [ ;; negative reward
            let substract ((item index vc) - punish_by_position)
            if (substract >= 0) [
              set vc (replace-item index vc substract)
            ]
          ]
        ]
      ]
    ]
    set index (index + 1)
  ]
end 

to adoptiontechtransfer
  ask agents with [typeAgent = ["Explotador"]] [ ;; Explotadores buscan OTTs para verificar si adopta o no
    let candidates other OTs
    let VCP_agent vcp
    let VC_agent vc

    foreach [who] of candidates [
      x ->
      ;; Calculate utility function
      let pt (reduce + (map [ [ a b ] -> a * b ] ([vpd] of turtle x) VCP_agent)) ; potencial de transferencia tecnológica (PT), “función de utilidad multi-atributo”
      if (pt < potential_adoption AND (length myOTs) < max_ots_related AND turtle x != nobody) [ ; Si se adopta
        set myOTs (lput x myOTs)
        create-link-to (turtle x)[
          set color green
          set shape "default"
        ]

        ;; Compensaciones
        let VA_ot [va] of turtle x
        let cont 0
        foreach VA_ot [
          y ->
          let adding (item cont VC_agent + reward_by_position)
          if ((y >= item cont VC_agent) AND (adding < 9)) [
            set VC_agent (replace-item cont VC_agent adding)
          ]
          set cont (cont + 1)
        ]

        set vc VC_agent
      ]
    ]
  ]
end 

to adoptiontechtransfer_temp
  ask agents with [typeAgent = ["Explotador"]] [ ;; Explotadores buscan OTTs para verificar si adopta o no
    let candidates other OTs
    let VCP_agent vcp
    let VC_agent vc

    foreach [who] of candidates [
      x ->
      ;; Calculate utility function
      let pt (reduce + (map [ [ a b ] -> a * b ] ([vpd] of turtle x) VCP_agent)) ; potencial de transferencia tecnológica (PT), “función de utilidad multi-atributo”
      if (pt < potential_adoption AND (length myOTs) < max_ots_related AND turtle x != nobody) [ ; Si se adopta
        set myOTs (lput x myOTs)
        ask link who x [
          set color green
          set shape "default"
        ]

        ;; Compensaciones
        let VA_ot [va] of turtle x
        let cont 0
        foreach VA_ot [
          y ->
          let adding (item cont VC_agent + reward_by_position)
          if ((y >= item cont VC_agent) AND (adding < 9)) [
            set VC_agent (replace-item cont VC_agent adding)
          ]
          set cont (cont + 1)
        ]

        set vc VC_agent
      ]
    ]
  ]
end 

to updateSExe
  ask agents [

    ;; addCostByMaintainCapacitiesOfAgents
    set costcap (reduce + (map [ [ a b ] -> a * b ] CC_System vc_last))
    ;; update SExe
    set SExe (SExe - costcap)

    if (member? "Explotador" typeAgent) [
      ;; Beneficios de las OTs
      foreach myOTs [
        otlink ->
        ;; show turtle otlink
        ifelse (turtle otlink != NOBODY) [ ;; Si el VA de la OT es mayor a VC del Explotador, entonces recibe beneficio
          set SExe (SExe + (reduce + (map [[i j k] -> ifelse-value (i >= j) [k] [0]] ([va] of turtle otlink) vc ([benefits] of turtle otlink))))
        ][
          set myOTs (remove otlink myOTs)
        ]
      ]
    ]
  ]


  ask OTs [
    let whoOT who
    let index 0
    ;; Beneficios por crear la OT
    foreach createdBy [
      ag ->
      ;; show (word ag index [benefits] of turtle whoOT)
      if (turtle ag != NOBODY) [ ;; Agentes que crearon a la OT reciben beneficios
        updateSExeAgentsByOTs ag index [benefits] of turtle whoOT
      ]
      set index (index + 1)
    ]

    ;; agregar beneficio si la OT se ha adoptado por explotadores
    set index 0
    if (count (my-in-links with [ color = 55 ]) > 0) [
      foreach createdBy [
        ag ->
        ;; show (word ag index [benefits] of turtle whoOT)
        if (turtle ag != NOBODY) [ ;; Agentes que crearon a la OT reciben beneficios
          updateSExeAgentsByOTs ag index [benefits] of turtle whoOT
        ]
        set index (index + 1)
      ]
    ]
  ]
end 

to updateSExeAgentsByOTs [age ind ben]
  ask turtle age [
    set SExe (SExe + item ind ben)
  ]
end 

to resetTick
  ask links with [color != 55] [ die ]
  ask agents [
    set vc_last vc
    set costs [ -99 -99 -99 -99 -99 ]
    set agentscost (list who who -1 -1 -1)
    ; set myots []
  ]
  ;; ask OTs [
    ;;set myAgentslinks []
  ;; ]

  set newOTS []
  set newOTSByWhos []
  set newOTSByExplorer []
end 

to check-death_OT
  ask OTs [
    if (ciclovidaactual >= TCV) [
      removeOTsInAgents who
      die
    ]
    set ciclovidaactual (ciclovidaactual + 1)

    if (volatilityactual >= volatility) [
      removeOTsInAgents who
      die
    ]
    set volatilityactual (volatilityactual + 1)
  ]
end 

to check-death_Agents
  ask agents [
    if (SExe <= 0) [ ;; Stock de recursos en cero
      die
    ]
    if (mean vc = 0) [ ;; sus capacidades estan todos en cero
      die
    ]
  ]
end 

to removeOTsInAgents [OT]
  ask agents with [member? OT myOTs] [
    set myOTs (remove OT myOTs)
  ]
end 

;ask agents [ foreach vc [ x -> if (x > 9 OR x < 0) [ show who ] ]]

There is only one version of this model, created almost 3 years ago by William Orjuela-Garzon.

Attached files

File Type Description Last updated
Technology transfer .png preview Preview for 'Technology transfer ' almost 3 years ago, by William Orjuela-Garzon Download

This model does not have any ancestors.

This model does not have any descendants.