The Garbage Can Model of Organizational Choice

The Garbage Can Model of Organizational Choice preview image

1 collaborator

Foto-v-bn Guido Fioretti (Author)

Tags

decision theory 

Tagged by Guido Fioretti about 12 years ago

organizational behavior 

Tagged by Guido Fioretti about 12 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.4 • Viewed 1130 times • Downloaded 62 times • Run 0 times
Download the 'The Garbage Can Model of Organizational Choice' 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 Garbage Can Model (GCM) of Organizational Choice (Cohen, March and Olsen 1972) is the most famous model of organizational decision-making. We previously reproduced the original Garbage Can model in an agent-based setting (Fioretti and Lomi 2008a, 2008b). With this code, we added an additional feature to the original model and, furthermore, we eliminated some unnecessary indicators.

In the GCM, decision is made when the members of an organization apply a solution to an opportunity for making a choice. Note that solutions exist before problems, and that decisions can be made even without solving any problem. Eventually, a problem may be there to be solved, but this is not necessarily the case.

In this decision process, choice opportunities take the role of "garbage cans" where solutions and problems are dumped. Hence the name of the model.

The GCM can be seen as a sort of chemical reactor where participants (decision-makers), choice opportunities, solutions and problems have been dumped. Through random meetings of these elements, decisions are made. The space where these components meet represents the organization where decisions are made.

We interpreted the GCM as an agent-based model where participants, opportunities, solutions and problems are four classes of agents. Participants are denoted by yellow men. Opportunities are denoted by orange squares. Solutions are denoted by red circles. Problems are denoted by violet triangles.

Exogenous structures may be imposed on participants, opportunities, solutions and problems:

  • If "decision-structure = anarchy" participants move freely within the organization;
  • If "availability-structure = anarchy" solutions move freely within the organization;
  • If "access-structure = anarchy" problems move freely within the organization. Furthermore:
  • If "decision-structure = hierarchy" participants and choice opportunities are ranked in order of importance and participants are only allowed to move on to opportunities of less or equal importance;
  • If "availability-structure = hierarchy" solutions and choice opportunities are ranked in order of importance and solutions are only allowed to move on to opportunities of less or equal importance;
  • If "access-structure = hierarchy" problems and opportunities are ranked in order of importance and problems are only allowed to move on to opportunities of less or equal importance.

Participants are characterized by their ability in solving problems. Solutions are characterized by their efficiency. Problems are characterized by their difficulty.

Ability, efficiency and difficulty take values within a range specified by the sliders "min-ability" and "max-ability", "min-efficiency" and "max-efficiency", "min-difficulty" and "max-difficulty", respectively. They may be assigned to participants, solutions and problems according to one the following three criteria, to be selected by means of the the sliders "dist-ability", "dist-efficiency" and "dist-difficulty", respectively:

Random: The values of ability, efficiency and difficulty are assigned at random according to a uniform distribution that spans the range between minimum and maximum values;

Competence: The participants, solutions or problems with lowest identification number (conventionally, the most important participants, problems and solutions) receive the highest values of ability, efficiency or difficulty, respectively;

Incompetence: The participants, solutions or problems with lowest identification number (conventionally, the most important participants, solutions and problems) receive the lowest values of ability, efficiency or difficulty, respectively.

A problem is solved when a participant has sufficient ability and a sufficiently efficient solution such that their product is greater or equal to the difficulty of the problem. When a problem is solved, the GCM says that a decision is made "by resolution".

However, a key feature of the Garbage Can model is that a lot of decision-making may not solve any problem at all. For instance, choice opportunities may be used as showrooms in corporate politics rather than as occasions to solve problems. In these cases, decision is made "by oversight".

Decision-making by resolution takes place when at least one participant, at least one opportunity, at least one solution, at least one problem are on the same patch and the sum of the abilities of the participants on the patch, multiplied by the efficiency of the most efficient solution on the patch, is greater or equal to the sum of the difficulties of the problems on the patch. Most often, decision-making by resolution occurs when just one participant, one choice opportunity, one solution and one problem happen to be on the same patch and the ability of the participant, multiplied by the efficiency of the solution, is greater or equal to the difficulty of the problem. The patch where a decision by resolution is made takes a green color.

Decision-making by oversight takes place when at least one participant, at least one choice opportunity and at least one solution are on the same patch. No problem must be there to be solved. Thus, decision-making by oversight occurs most often when a participant, a solution and a choice opportunity happen to be on the same patch. The patch where a decision by oversight is made takes a sky-blue color.

An organization starts its life with a given number of participants, opportunities, solutions and problems. These initial values are set by means of the sliders "initial-participants", "initial-opportunities", initial-solutions" and "initial-problems", respectively. These parameters may take any integer value between 0 and 500.

Participants, opportunities, solutions and problems may be required to exit the organization after decision-making. This option is chosen by means of the switches "participants-exit?", "opportunities-exit?", "solutions-exit?" and "problems-exit?", respectively.

If the switch "participants-exit?" is ON, on each patch where a decision is made, all participants exit. If the switch "opportunities-exit?" is ON, on each patch where a decision is made one opportunity exits. If the switch "solutions-exit?" is ON, on each patch where a decision is made one solution exits: the most efficient solution if it is a decision by resolution, or a randomly chosen solution if it is a decision by oversight. If the switch "problems-exit?" is ON, all problems on the patches where a decision by resolution is made, exit.

If the switch "replace-participants?" is ON, any leaving participant is immediately replaced. The switches "replace-opportunities?", "replace-solutions?" and "replace-problems?" have a similar meaning.

If problems are on the same patch with participants, solutions and choice opportunities, but the sum of the abilities of the participants multiplied by the efficiency of the most efficient solution is less than the sum of the difficulties of the problems, all agents on the patch are blocked and no decision is made. The patch where a decision process is blocked takes a white color.

Participants can fly away from the most difficult problem involved in a blocked decision process. This is called "flight".

In the original GCM, a flight is obtained by postponing the most difficult problem. This is accomplished if an additional opportunity walks on the patch where a decision process is blocked. The most difficult problem on the patch is bound to the least important opportunity on the patch (a choice that has no effect if no hierarchical structure was imposed), and the two start walking together. The patch where they find themselves takes a brown color. The possibility of postponing decision-making is enabled by the switch "postpone?".

We added to the GCM the possibility that a flight is obtained by buck-passing. This is accomplished if only one participant is on the patch where a decision process is blocked, and an additional participant walks on it: the most difficult problem is bound to the least able among the participants on the patch, and the two start walking together. The patch where they find themselves takes a brown color. The possibility of buck-passing is enabled by the switch "buckpass?".

Once the most difficult problem left, the remaining agents may be able to make a decision, either by resolution or by oversight. Thus, flight is very important in organizational decision-making.

The switch "show-details?" allows to visualize ability, efficiency and difficulty of each agent. Furthermore, it prints an information line each time a decision is made. Each line says whether the decision was made by oversight or resolution, which agents it involved as well as the time step when they were created. If the option "show-details?" is chosen, it is advisable to enlarge the Command Center.

In previous versions, we reproduced all the indicators of the original GCM. However, our experiment highlighted that most of these indicators are redundant (Fioretti and Lomi 2008a, 2008b). At the same time, other indicators are in required in order to derive all the features of the model as emergent properties. In the end, we ended up with the following set of indicators:

  • The number of participants, opportunities, solutions and problems that are in the organization at any point in time;

  • The number of decisions by oversight and the number of decisions by resolution;

  • The number of flights by postponement and the number of flights by buck-passing;

  • The number of blocked decision processes, the number of postponed problems and the number of passed problems in the organization;

  • The average life of blocked decision processes, of postponements and of buck-passings;

  • The percent of times that a participant meets an opportunity that (s)he has already met, the percent of times that a participant meets a solution that (s)he has already met, and the percent of times that a participant meets a problem that (s)he has already met;

  • The ratio of oversights to resolutions at high hierarchical levels, the ratio of oversights to resolutions at low hierarchical levels, and the ratio of decisions (either by oversight or by resolution) at low hierarchical levels to decisions (either by oversight or by resolution) at high hierarchical levels.

Finally, the following graphs are available:

  • Decisions by oversight, decisions by resolution, flights by postponement and flights by buck-passing at each simulation step;
  • Overall balance between the total ability of participants, the total efficiency of solutions, the product between total ability and average efficiency, and the total difficulty of problems.

HOW TO USE IT

The population of participants, opportunities, solutions and problems should collectively not exceed 1000 units, unless the simulation space is enlarged. Conversely, at least a few tens of each breed are needed in order to obtain interesting outcomes.

The difficulty of problems should not be too different from the ability of participants multiplied by the efficiency of solutions. Depending on configurations, maximum differences of one or two units are recommended.

With hierarchical or specialized decision structures, availability structures or access structures, the number of decisions and particularly the number of decisions by resolution tends to be small. Thus, it is advisable to run the model with many opportunities, many problems, sufficiently high values of participant ability, sufficiently high values of solution efficiency and sufficiently low values of problem difficulty.

THINGS TO NOTICE

The most important and most robust conclusion of the Garbage Can model is that most decisions are made by oversight, few problems are solved and flight is widespread. A large number of flights do not cause decision-making. Most, but not all configurations are such that flights that cause decisions by oversight are many more than the flights causing decisions by resolution.

Participants eventually meet the same problems more often that they meet the same opportunities or the same solutions. This can be seen by comparing the indicator "% Deja-vu Problems" with "% Deja-vu Opportunities" and "% Deja-vu Solutions" when participants do not exit the organization after decision-making whereas opportunities, solutions and problems do.

Another interesting conclusion is that the most important opportunities are less likely to solve problems than the least important opportunities. This can be seen by experimenting with hierarchical decision, availability and access structures. Compare the indicators "Ove/Res" at low and high hierarchical levels.

THINGS TO TRY

The default values of parameters have been chosen in order to resemble the original model by Cohen, March and Olsen as closely as possible. The user is invited to move away fron default values exploring alternative combinations.

The user can try different combinations of:
1)
Population, through the initial number of participants, opportunities, solutions and problems, their flows in or out of the organization and the time when these flows stop;
2)
Structures of interaction, through the decision structure and the access structure;
3)
Energy endowments, through minimum and maximum values as well as their distribution.

EXTENDING THE MODEL

This is an agent-based version of the original Garbage Can model. A common criticism of this model is that organizational structures (decision structure, access structure) are not endogenous, which is weird for a model of organizational decision-making. In subsequent variations of the original model, we shall overcome this shortcoming.

NETLOGO FEATURES

This model was originally developed NetLogo 4.0.4. It has been updated to NetLogo 5.0.4. A previous version, available under the rubric "User Community Models" with the name "GarbageCan", was developed on NetLogo 2.1.0. Its NetLogo 4.0.4 version is available under the rubric "User Community Models" with the name "GarbageCan_docker"

With respect to the previous version, the following changes have been made:

  • Agents stay always at the center of their patch;
  • Colored patches mark resolutions (green), oversights (sky-blue), blocked decision processes (white), postponed decision problems (brown) and problems passed on to participants (brown);
  • The opportunity to which a problem is eventually attached is not chosen randomly among those involved in a blocked decision process; rather, the least important opportunity is chosen;
  • The possibility of flight by buck-passing is introduced;
  • Flights by postponement and by buck-passing can be disabled, and separately from one another;
  • A bug concerning the movements of opportunities and problems bound to one another has been discovered, and fixed.

This and many other implementations of the Garbage Can Model are available at www.cs.unibo.it/fioretti.

CREDITS AND REFERENCES

Cohen M.D., March J.G. and Olsen J.P. (1972) A Garbage Can Model of Organizational Choice. Administrative Science Quarterly, 17 (1): 1-25.

Fioretti G. and Lomi A. (2008a) The Garbage Can Model of Organizational Choice: An agent-based reconstruction. Simulation Modelling Practice and Theory, 16 (): 192-217.

Fioretti G. and Lomi A. (2008b) An Agent-Based Representation of the Garbage Can Model of Organizational Choice. Journal of Artificial Societies and Social Simulation, 11.

This model was built by:
Guido Fioretti
University of Bologna

Comments and Questions

How does it work?

Hi Guido, thanks very much for sharing this great model. I tried to run it in NetLogo 6.2 but it doesn't work. Could you kindly let me know how I can solve the problem? Thanks a lot!

Posted over 4 years ago

A more recent version (Question)

Dear John, thank you for your interest in this model of mine. Its most recent version is in NetLogo 6.1. You find it here: https://www.comses.net/codebases/f0613922-9cb1-4656-a26c-af57f823fb69/releases/3.1.1/ Please contact me for further details: guido.fioretti AATT unibo.it

Posted over 4 years ago

Click to Run Model

;; THE GARBAGE CAN MODEL




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Variables declaration ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
globals [
          ;; Agents available for decision-making
          free-participants ;; cumulative number of non-blocked participants
          ave-free-participants ;; average number of non-blocked participants
          free-opportunities ;; cumulative number of non-blocked opportunities
          ave-free-opportunities ;; average number of non-blocked opportunities
          free-solutions ;; cumulative number of non-blocked solutions
          ave-free-solutions ;; average number of non-blocked solutions
          free-problems ;; cumulative number of non-blocked problems
          ave-free-problems ;; average number of non-blocked problems
          
          ;; Kinds of decision-making and kinds of flights.
          num-oversight ;; cumulative number of decisions by oversight
          num-blocked-oversight ;; cumulative number of decisions by oversight following a blocked decision process
          num-resolution ;; cumulative number of decisions by resolution
          num-blocked-resolution ;; cumulative number of decisions by resolution following a blocked decision process
          num-postponement ;; cumulative number of flights by postponement
          num-buck-passing ;; cumulative number of flights by buck-passing
          
          ;; Blocked decisions, postponed problems, passed problems.
          num-blocked ;; cumulative number of blocked decision processes
          ave-num-blocked ;; average number of blocked decision processes
          size-blocked ;; cumulative size of blocked decision processes
          ave-size-blocked ;; average size of blocked decision processes
          life-blocked ;; cumulative lives of blocked decision processes
          ave-life-blocked ;; average life of blocked decision processes
          num-postponed ;; cumulative number of postponed problems
          ave-num-postponed ;; average number of postponed problems
          life-postponed ;; cumulative lives of pairs opportunity-problem
          ave-life-postponed ;; average life of pairs opportunity-problem
          num-passed ;; cumulative number of passed problems
          ave-num-passed ;; average number of passed problems
          life-passed ;; cumulative lives of pairs participant-problem
          ave-life-passed ;; average life of pairs participant-problem
          
          ;; The counters of meetings with already-met opportunities, solutions and problems.
          meetings-known-opp
          meetings-opp
          meetings-known-sol
          meetings-sol
          meetings-known-pro
          meetings-pro
          
          ;; These are necessary in order to impose decision structure and access structure.
          arrivals-departures_par ;; the number of arrivals minus the number of departures of participants
          arrivals-departures_opp ;; the number of arrivals minus the number of departures of opportunities
          arrivals-departures_sol ;; the number of arrivals minus the number of departures of solutions
          arrivals-departures_pro ;; the number of arrivals minus the number of departures of problems
          
          ;; Indicators of decision-making by oversight and resolution at different hierarchical levels.
          countOveHigh ;; the number of oversights making use of opportunities at high hierarchical levels
          countOveLow ;; the number of oversights making use of opportunities at low hierarchical levels
          countResHigh ;; the number of resolutions making use of opportunities at high hierarchical levels
          countResLow ;; the number of resolutions making use of opportunities at low hierarchical levels          
        ]
patches-own [pcolor-white-since] ;; since when it hosts a blocked decision process
turtles-own [blocked?] ;; whether an agent is allowed to move
breed [solution]
breed [opportunity]
breed [participant]
breed [problem] 
participant-own [ participant_id ;; the identification number of participants
                  ability ;; the ability of participants
                  charged? ;; eventually, this participant is charged...
                  with-problem ;; ...with this problem
                  encountered ;; the agents this participant has already met
                ]
opportunity-own [ opportunity_id ;; the identification number of opportunities
                  charged? ;; eventually, this opportunity is charged...
                  with-problem ;; ...with this problem
                ]
solution-own [ solution_id ;; the identification number of solutions
               efficiency ;; the efficiency of solutions
             ] 
problem-own [ problem_id ;; the identification number of problems
              difficulty ;; the difficulty of problems
              postponed? ;; eventually, this problem has been postponed...
              to-opportunity ;; ...to this opportunity
              passed? ;; eventually, this problem has been passed...
              to-participant ;; ...to this participant
              since ;; when the flight began
            ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;







;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;; What is done when the "Setup" button is pressed ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup 
  clear-all
  reset-ticks  
  
  ;; Initializes the counters of the variations of the number of agents.
  set arrivals-departures_par 0
  set arrivals-departures_opp 0
  set arrivals-departures_sol 0
  set arrivals-departures_pro 0
  
  ;; Initializes the counters of agents avaiilable for decision-making.
  set free-participants 0
  set free-opportunities 0
  set free-solutions 0
  set free-problems 0
  
  ;; Initializes the number of kinds of decision-making and flights.
  set num-oversight 0
  set num-blocked-oversight 0
  set num-resolution 0
  set num-blocked-resolution 0
  set num-postponement 0
  set num-buck-passing 0

  ;; Initializes the number of blocked decisions, the number of postponed problems and the number of passed problems.
  set num-blocked 0
  set size-blocked 0
  set life-blocked 0
  set num-postponed 0
  set life-postponed 0
  set num-passed 0
  set life-passed 0

  ;; Initializes the counters of the meetings with opportunities, solutions and problems that had already been met.
  set meetings-known-opp 0
  set meetings-opp 0
  set meetings-known-sol 0
  set meetings-sol 0
  set meetings-known-pro 0
  set meetings-pro 0
  
  ;; Initializes the counters of oversights and resolutions at high and low hierarchical levels.
  ifelse (opportunities-exit? and (decision-structure != "anarchy" or availability-structure != "anarchy" or access-structure != "anarchy")) [
    set countOveHigh 0
    set countOveLow 0
    set countResHigh 0
    set countResLow 0
  ] [
    set countOveHigh "N/A"
    set countOveLow "N/A"
    set countResHigh "N/A"
    set countResLow "N/A"
  ]
  
  ;; Initializes the counter of how long a decision process stays blocked.
  ask patches
    [set pcolor-white-since 0]

  ;; Creates the agents that are initially present in the organization.
  set-default-shape participant "participant"
  create-participant initial-participants  ;; creates the participants and initializes their variables
  [ 
    setxy random world-width random world-height
    set blocked? false
    set charged? false
    set with-problem nobody
    set participant_id who
    set encountered []
  ]
  set-default-shape opportunity "opportunity"
  create-opportunity initial-opportunities  ;; creates the choice opportunities and initializes their variables
  [ 
    setxy random world-width random world-height
    set blocked? false
    set charged? false
    set with-problem nobody
    set opportunity_id (who - initial-participants)
  ]
  set-default-shape solution "solution"
  create-solution initial-solutions  ;; creates the solutions and initializes their variables
  [ 
    setxy random world-width random world-height
    set blocked? false
    set solution_id (who - initial-participants - initial-opportunities)
  ]
  set-default-shape problem "problem"
  create-problem initial-problems  ;; creates the problems and initializes their variables
  [ 
    setxy random world-width random world-height
    set blocked? false
    set postponed? false
    set to-opportunity nobody
    set passed? false
    set to-participant nobody
    set since 0
    set problem_id (who - initial-participants - initial-opportunities - initial-solutions)
  ]
  
  ;; Participants and problems are endowed with energy, solutions are endowed with efficiency
  assign-ability
  assign-difficulty
  assign-efficiency
end 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;












;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; What is done when the "Go Step" button is pressed and what is repeated at each step when the "Go Until" button is pressed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go







  ;;;;;;;;;;;;;;;;;;;;;; MISCELLANEOUS
        
  ;; The number of ticks is updated. Eventually, the simulation is stopped.
  tick
  if ((stop-at > 0) and (ticks = stop-at)) [
    if (show-details?)
      [write-survivors]
    stop
  ]
  
  ;; Eventually, labels are depicted near the agents. Labels show participants' ability, solutions' efficiency and problems' difficulty, respectively.
  if (show-details?)
    [show-labels]




  
  
  
  
  
  ;;; THE SIMULATION IS NOT ALLOWED TO BEGIN IF MINIMUM VALUES OF ABILITY, EFFICIENCY AND DIFFICULTY ARE GREATER THAN THE CORRESPONDING MAXIMUM VALUES

  if (min-ability > max-ability) [
    type "MINIMUM ABILITY SHOULD NOT BE GREATER THAN MAXIMUM ABILITY"
    stop
  ]
  if (min-efficiency > max-efficiency) [
    type "MINIMUM EFFICIENCY SHOULD NOT BE GREATER THAN MAXIMUM EFFICIENCY"
    stop
  ]
  if (min-difficulty > max-difficulty) [
    type "MINIMUM DIFFICULTY SHOULD NOT BE GREATER THAN MAXIMUM DIFFICULTY"
    stop
  ]












  ;;;;;;;;;;;;;;; ABILITY, EFFICIENCY AND DIFFICULTY MAY NEED TO BE ASSIGNED AGAIN
  
  ;; If ability, efficiency and difficulty are distributed according to the numbering of agents (competence or incompetence)
  ;; and if some participants, problems or solutions exit, then ability, efficiency and difficulty must be re-distributed to all of them.
  ;; Note that this may impact on the number of flights, since blocked agents may be assigned new values of ability, efficiency or difficulty.

  if ((dist-ability = "competence" or dist-ability = "incompetence") and participants-exit?) [
    assign-ability
  ]
  if ((dist-efficiency = "competence" or dist-efficiency = "incompetence") and solutions-exit?) [
    assign-efficiency
  ]
  if ((dist-difficulty = "competence" or dist-difficulty = "incompetence") and problems-exit?) [
    assign-difficulty
  ]











;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DECISION - MAKING

  ;; Though decisions are made by participants, it is more convenient to let patches operate.
  ask patches [
    ;; Resets the world on black, except flying couples.
    ifelse (any? problem-here with [postponed? or passed?])
      [set pcolor brown] [
        if (pcolor != white)
          [set pcolor black]
      ]
    ;; If there is at least one participant, one choice opportunity and one solution, then a decision is made.
    if (any? participant-here and any? opportunity-here and any? solution-here) [
      ;; Agents paired because of a flight enter the decision process on equal status with the others.
      ask participant-here [
        if (charged?) [
          set charged? false
          set with-problem nobody
        ]
      ]
      ask opportunity-here [
        if (charged?) [
          set charged? false
          set with-problem nobody
        ]
      ]
      ask problem-here [
        if (postponed?) [
          set postponed? false
          set to-opportunity nobody
        ]
        if (passed?) [
          set passed? false
          set to-participant nobody
        ]
      ]
      ;; If there are problems as well, either they are resolved if their ability is sufficient or all agents stay put until another opportunity or another participant passes by and takes a problem away.
      ifelse (any? problem-here) [
        ;; If the sum of the ability of all participants on a patch, multiplied by the efficiency of the most efficient solution on the
        ;; same patch, is greater or equal than the sum of the difficulty of all problems on the same patch, then decisions are made by resolution.
        ifelse ((sum [ability] of participant-here)*([efficiency] of max-one-of solution-here [efficiency]) >= (sum [difficulty] of problem-here)) [
          set num-resolution num-resolution + 1
          ;; A decision by resolution is marked by a green square. The counters of the life of blocked decisions and flying pairs are reset.
          if (pcolor = white)
            [set num-blocked-resolution num-blocked-resolution + 1]
          set pcolor lime
          set pcolor-white-since 0
          ask problem-here [set since 0]
          ;; Write information on the control center.
          if (show-details?)
            [write-resolutions]
          ;; The indicators of the percentages of resolutions on low and high hierarchical levels.
          let chosenOppRes one-of opportunity-here
          if (opportunities-exit? and (decision-structure != "anarchy" or availability-structure != "anarchy" or access-structure != "anarchy")) [ 
            ifelse ([opportunity_id] of chosenOppRes < (count opportunity) * 0.5)
              [set countResHigh countResHigh + 1]
              [set countResLow countResLow + 1]
          ]
          ;; If participants exit after a decision is made, all participants on the patch are killed.
          if (participants-exit?) [
            kill participant-here
          ]
          ;; If opportunities exit after a decision is made, one of the opportunities that are on the patch is picked up and killed.
          if (opportunities-exit?) [
            kill chosenOppRes
          ]
          ;; If solutions exit after a decision is made, the most efficient solution on the patch is killed.
          if (solutions-exit?) [
            kill max-one-of solution-here [efficiency]
          ]
          ;; If problems exit after a decision is made, all problems on the patch are killed.
          if (problems-exit?) [
            kill problem-here
          ]
          ;; If there are still agents on the patch, they must be free to move. This is not obvious, because they may stem from a flight.
          ask turtles-here [
            if (blocked?) [set blocked? false]
          ]
        ]
        ;; If the ability of the participants is not sufficient to make a decision, all agents on the patch are blocked.
        ;; Eventually, a flight might enable the remaining agents to make a decision either by resolution or by oversight.
        [
          ask turtles-here [set blocked? true]
          ;; A blocked decision process is marked by a white square.
          if (pcolor != white) [
            set pcolor white
            set pcolor-white-since ticks
          ]
          ;; Eventually, a flight by postponement takes place.
          ifelse (postpone? and count opportunity-here > 1) [
            ;; An opportunity and a problem are chosen to be paired to one another.
            let which-opportunity max-one-of opportunity-here [opportunity_id]
            let which-problem-for-opportunity max-one-of problem-here [difficulty]
            ;; Checks that there is at least one place to which the chosen opportunity can move.
            if (
                (decision-structure = "anarchy" and access-structure = "anarchy" and availability-structure = "anarchy") or

                (decision-structure = "anarchy" and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-at 1 0) with [solution_id > [opportunity_id] of which-opportunity])) or   
                (decision-structure = "anarchy" and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-at 0 1) with [solution_id > [opportunity_id] of which-opportunity])) or   
                (decision-structure = "anarchy" and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-at -1 0) with [solution_id > [opportunity_id] of which-opportunity])) or   
                (decision-structure = "anarchy" and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-at 0 -1) with [solution_id > [opportunity_id] of which-opportunity])) or   

                (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-at 1 0) with [problem_id > [opportunity_id] of which-opportunity]) and availability-structure = "anarchy") or
                (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-at 0 1) with [problem_id > [opportunity_id] of which-opportunity]) and availability-structure = "anarchy") or
                (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-at -1 0) with [problem_id > [opportunity_id] of which-opportunity]) and availability-structure = "anarchy") or
                (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-at 0 -1) with [problem_id > [opportunity_id] of which-opportunity]) and availability-structure = "anarchy") or

                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 1 0) with [participant_id > [opportunity_id] of which-opportunity]) and access-structure = "anarchy" and availability-structure = "anarchy") or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 0 1) with [participant_id > [opportunity_id] of which-opportunity]) and access-structure = "anarchy" and availability-structure = "anarchy") or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at -1 0) with [participant_id > [opportunity_id] of which-opportunity]) and access-structure = "anarchy" and availability-structure = "anarchy") or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 0 -1) with [participant_id > [opportunity_id] of which-opportunity]) and access-structure = "anarchy" and availability-structure = "anarchy") or


                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 1 0) with [participant_id > [opportunity_id] of which-opportunity]) and (access-structure = "hierarchy" and not any? (problem-on patch-at 1 0) with [problem_id > [opportunity_id] of which-opportunity]) and availability-structure = "anarchy") or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 0 1) with [participant_id > [opportunity_id] of which-opportunity]) and (access-structure = "hierarchy" and not any? (problem-on patch-at 0 1) with [problem_id > [opportunity_id] of which-opportunity]) and availability-structure = "anarchy") or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at -1 0) with [participant_id > [opportunity_id] of which-opportunity]) and (access-structure = "hierarchy" and not any? (problem-on patch-at -1 0) with [problem_id > [opportunity_id] of which-opportunity]) and availability-structure = "anarchy") or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 0 -1) with [participant_id > [opportunity_id] of which-opportunity]) and (access-structure = "hierarchy" and not any? (problem-on patch-at 0 -1) with [problem_id > [opportunity_id] of which-opportunity]) and availability-structure = "anarchy") or

                (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-at 1 0) with [problem_id > [opportunity_id] of which-opportunity]) and (availability-structure = "hierarchy" and not any? (solution-on patch-at 1 0) with [solution_id > [opportunity_id] of which-opportunity])) or
                (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-at 0 1) with [problem_id > [opportunity_id] of which-opportunity]) and (availability-structure = "hierarchy" and not any? (solution-on patch-at 0 1) with [solution_id > [opportunity_id] of which-opportunity])) or
                (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-at -1 0) with [problem_id > [opportunity_id] of which-opportunity]) and (availability-structure = "hierarchy" and not any? (solution-on patch-at -1 0) with [solution_id > [opportunity_id] of which-opportunity])) or
                (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-at 0 -1) with [problem_id > [opportunity_id] of which-opportunity]) and (availability-structure = "hierarchy" and not any? (solution-on patch-at 0 -1) with [solution_id > [opportunity_id] of which-opportunity])) or

                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 1 0) with [participant_id > [opportunity_id] of which-opportunity]) and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-at 1 0) with [solution_id > [opportunity_id] of which-opportunity])) or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 0 1) with [participant_id > [opportunity_id] of which-opportunity]) and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-at 0 1) with [solution_id > [opportunity_id] of which-opportunity])) or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at -1 0) with [participant_id > [opportunity_id] of which-opportunity]) and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-at -1 0) with [solution_id > [opportunity_id] of which-opportunity])) or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 0 -1) with [participant_id > [opportunity_id] of which-opportunity]) and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-at 0 -1) with [solution_id > [opportunity_id] of which-opportunity])) or


                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 1 0) with [participant_id > [opportunity_id] of which-opportunity]) and (access-structure = "hierarchy" and not any? (problem-on patch-at 1 0) with [problem_id > [opportunity_id] of which-opportunity]) and (availability-structure = "hierarchy" and not any? (solution-on patch-at 1 0) with [solution_id > [opportunity_id] of which-opportunity])) or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 0 1) with [participant_id > [opportunity_id] of which-opportunity]) and (access-structure = "hierarchy" and not any? (problem-on patch-at 0 1) with [problem_id > [opportunity_id] of which-opportunity]) and (availability-structure = "hierarchy" and not any? (solution-on patch-at 0 1) with [solution_id > [opportunity_id] of which-opportunity])) or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at -1 0) with [participant_id > [opportunity_id] of which-opportunity]) and (access-structure = "hierarchy" and not any? (problem-on patch-at -1 0) with [problem_id > [opportunity_id] of which-opportunity]) and (availability-structure = "hierarchy" and not any? (solution-on patch-at -1 0) with [solution_id > [opportunity_id] of which-opportunity])) or
                ((decision-structure = "hierarchy" and not any? (participant-on patch-at 0 -1) with [participant_id > [opportunity_id] of which-opportunity]) and (access-structure = "hierarchy" and not any? (problem-on patch-at 0 -1) with [problem_id > [opportunity_id] of which-opportunity]) and (availability-structure = "hierarchy" and not any? (solution-on patch-at 0 -1) with [solution_id > [opportunity_id] of which-opportunity]))
                ) [
              ;; If yes, a flight by postponement takes place.
              set num-postponement num-postponement + 1
              ;; A flight takes place by postponing the most difficult problem to the least important opportunity.
              ask which-opportunity [
                set blocked? false
                set charged? true
                set with-problem which-problem-for-opportunity
              ]
              ask which-problem-for-opportunity [
                set blocked? false
                set postponed? true
                set to-opportunity which-opportunity
                set since ticks
              ]
              ;; Write information on the control center.
              if (show-details?)
                [write-postponements]
            ]
          ]
          ;; After the possibility of a flight by postponement, the possibility of a flight by buck-passing is considered.
          [
            ;; Eventually, a flight by buck-passing takes place.
            if (buckpass? and count participant-here > 1) [
              ;; A participant and a problem are chosen to be paired to one another.
              let which-participant min-one-of participant-here [ability]     
              let which-problem-for-participant max-one-of problem-here [difficulty]    
              ;; Checks that there is at least one place to which the chosen participant can move.
              if (decision-structure = "anarchy" or (decision-structure = "hierarchy" and
                  (not any? (opportunity-on patch-at 1 0) with [opportunity_id < [participant_id] of which-participant] or
                   not any? (opportunity-on patch-at 0 1) with [opportunity_id < [participant_id] of which-participant] or
                   not any? (opportunity-on patch-at -1 0) with [opportunity_id < [participant_id] of which-participant] or
                   not any? (opportunity-on patch-at 0 -1) with [opportunity_id < [participant_id] of which-participant]))
                 ) [
                set num-buck-passing num-buck-passing + 1
                ;; A flight takes place by buck-passing the most difficult problem to the least able participant.
                ask which-participant [
                  set blocked? false
                  set charged? true
                  set with-problem which-problem-for-participant
                ]
                ask which-problem-for-participant [
                  set blocked? false
                  set passed? true
                  set to-participant which-participant
                  set since ticks
                ]
                ;; Write information on the control center.
                if (show-details?)
                  [write-buck-passings]
              ]
            ]
          ]
        ]
      ]
      ;; On the contrary, if there are no problems to be solved, decisions are made by oversight. Since decision-making by oversight
      ;; has no energy requirements, there is no reason to use more than one choice opportunity. Thus, if there are several participants, 
      ;; several solutions and several opportunities on the same patch, all participants and all solutions make a decision exploiting
      ;; only one opportunity and making use of only one solution. If these agents exit after making a decision, all participants on the
      ;; patch exit, but only one randomly chosen solution exits and only one randomly chosen opportunity exits.
      [
        set num-oversight num-oversight + 1
        ;; A decision by oversight is marked by a sky-blue square. The counter of the life of blocked decisions is reset.
        if (pcolor = white)
          [set num-blocked-oversight num-blocked-oversight + 1]
        set pcolor sky
        set pcolor-white-since 0
        ;; Write information on the control center
        if (show-details?)
          [write-oversights]
        ;; The indicators of the percentages of oversights on low and high hierarchical levels.
        let chosenOppOve one-of opportunity-here
        if (opportunities-exit? and (decision-structure != "anarchy" or availability-structure != "anarchy" or access-structure != "anarchy")) [ 
          ifelse ([opportunity_id] of chosenOppOve < (count opportunity) * 0.5)
            [set countOveHigh countOveHigh + 1]
            [set countOveLow countOveLow + 1]
        ]
        ;; If participants exit after a decision is made, all participants on the patch are killed.
        if (participants-exit?) [
          kill participant-here
        ]
        ;; If opportunities exit after a decision is made, one of the opportunities that are on the patch is picked up and killed.
        if (opportunities-exit?) [
          kill chosenOppOve
        ]
        ;; If solutions exit after a decision is made, one of the solutions that are on the patch is picked up and killed.
        if (solutions-exit?) [
          kill one-of solution-here
        ]
        ;; If there are still agents on the patch, they must be free to move. This is not obvious, because they may stem from a flight.
        ask turtles-here [
          if (blocked?) [set blocked? false]
        ]
      ]
    ]
  ]








  ;;;;;;;;;;;;;;;;;;;;;;;;;; AND FINALLY MOVE
  
  ;; Agents are only allowed to turn by multiples of 90 degrees.
  ;; The movement of participants may be constrained by the decision structure.
  ;; The movement of solutions may be constrained by the availability structure.
  ;; The movement of problems may be constrained by the access structure.
  ;; The movement of opportunities may me constrained by the decision structure, the availability structure and the access structure.
  
  ;; Flying couples move first. Their movements take account of the positions of other agents.
  ask patches [
    ;; Paired problems and opportunities move together.
    ;; Opportunities must consider where they are allowed to move. Problems just follow opportunities.
    ask opportunity-here with [not blocked? and charged?] [
      set heading ((random 4) * 90)
      let initialheading heading
      let stop? false
      while [stop? = false] [
        if (
            (decision-structure = "anarchy" and access-structure = "anarchy" and availability-structure = "anarchy") or
            (decision-structure = "anarchy" and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-ahead 1) with [solution_id > [opportunity_id] of myself])) or   
            (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-ahead 1) with [problem_id > [opportunity_id] of myself]) and availability-structure = "anarchy") or
            (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-ahead 1) with [problem_id > [opportunity_id] of myself]) and (availability-structure = "hierarchy" and not any? (solution-on patch-ahead 1) with [solution_id > [opportunity_id] of myself])) or
            ((decision-structure = "hierarchy" and not any? (participant-on patch-ahead 1) with [participant_id > [opportunity_id] of myself]) and access-structure = "anarchy" and availability-structure = "anarchy") or
            ((decision-structure = "hierarchy" and not any? (participant-on patch-ahead 1) with [participant_id > [opportunity_id] of myself]) and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-ahead 1) with [solution_id > [opportunity_id] of myself])) or   
            ((decision-structure = "hierarchy" and not any? (participant-on patch-ahead 1) with [participant_id > [opportunity_id] of myself]) and (access-structure = "hierarchy" and not any? (problem-on patch-ahead 1) with [problem_id > [opportunity_id] of myself]) and availability-structure = "anarchy") or
            ((decision-structure = "hierarchy" and not any? (participant-on patch-ahead 1) with [participant_id > [opportunity_id] of myself]) and (access-structure = "hierarchy" and not any? (problem-on patch-ahead 1) with [problem_id > [opportunity_id] of myself]) and (availability-structure = "hierarchy" and not any? (solution-on patch-ahead 1) with [solution_id > [opportunity_id] of myself]))
            ) [
          if (pcolor = brown)
            [set pcolor black]
          move-to patch-ahead 1
          set pcolor brown
          set stop? true
        ]
        set heading ((heading + 90) mod 360)
        if (heading = initialheading)
          [set stop? true]
      ]
    ]
    ask problem-here with [not blocked? and postponed? and to-opportunity != nobody] [
      move-to to-opportunity
    ]
    ;; Paired problems and participants move together.
    ;; Participants must consider where they are allowed to move. Problems just follow participants.
    ask participant-here with [not blocked? and charged?] [
      set heading ((random 4) * 90)
      let initialheading heading
      let stop? false
      while [stop? = false] [
        if (
            (decision-structure = "anarchy") or
            ((decision-structure = "hierarchy") and (not any? (opportunity-on patch-ahead 1) with [opportunity_id < [participant_id] of myself]))
            ) [
          if (pcolor = brown)
            [set pcolor black]
          move-to patch-ahead 1
          set pcolor brown
          set stop? true
        ]
        set heading ((heading + 90) mod 360)
        if (heading = initialheading)
          [set stop? true]
      ]
    ]
    ask problem-here with [not blocked? and passed? and to-participant != nobody] [
      move-to to-participant
    ]
  ]

  ;; Uncoordinated agents move in different, randomly chosen directions.
  ;; However, participants must take account of the decision structure, solutions take account of the availability structure and problems
  ;; take account of the access structure.
  ;; Finally, opportunities must take account of both the decision structure, the availability structure and the access structure.
  ;; The highest-ranked agents are those with lowest ID.
  ask participant with [not blocked? and not charged?] [
    set heading ((random 4) * 90)
    if ((decision-structure = "anarchy") or
        ((decision-structure = "hierarchy") and (not any? (opportunity-on patch-ahead 1) with [opportunity_id < [participant_id] of myself]))) [
      move-to patch-ahead 1
    ]
  ]
  ask opportunity with [not blocked? and not charged?] [
    set heading ((random 4) * 90)
    if (
        (decision-structure = "anarchy" and access-structure = "anarchy" and availability-structure = "anarchy") or
        (decision-structure = "anarchy" and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-ahead 1) with [solution_id > [opportunity_id] of myself])) or   
        (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-ahead 1) with [problem_id > [opportunity_id] of myself]) and availability-structure = "anarchy") or
        (decision-structure = "anarchy" and (access-structure = "hierarchy" and not any? (problem-on patch-ahead 1) with [problem_id > [opportunity_id] of myself]) and (availability-structure = "hierarchy" and not any? (solution-on patch-ahead 1) with [solution_id > [opportunity_id] of myself])) or
        ((decision-structure = "hierarchy" and not any? (participant-on patch-ahead 1) with [participant_id > [opportunity_id] of myself]) and access-structure = "anarchy" and availability-structure = "anarchy") or
        ((decision-structure = "hierarchy" and not any? (participant-on patch-ahead 1) with [participant_id > [opportunity_id] of myself]) and access-structure = "anarchy" and (availability-structure = "hierarchy" and not any? (solution-on patch-ahead 1) with [solution_id > [opportunity_id] of myself])) or   
        ((decision-structure = "hierarchy" and not any? (participant-on patch-ahead 1) with [participant_id > [opportunity_id] of myself]) and (access-structure = "hierarchy" and not any? (problem-on patch-ahead 1) with [problem_id > [opportunity_id] of myself]) and availability-structure = "anarchy") or
        ((decision-structure = "hierarchy" and not any? (participant-on patch-ahead 1) with [participant_id > [opportunity_id] of myself]) and (access-structure = "hierarchy" and not any? (problem-on patch-ahead 1) with [problem_id > [opportunity_id] of myself]) and (availability-structure = "hierarchy" and not any? (solution-on patch-ahead 1) with [solution_id > [opportunity_id] of myself]))
        ) [
      move-to patch-ahead 1
    ]
  ]
  ask solution with [not blocked?] [
    set heading ((random 4) * 90)
    if ((availability-structure = "anarchy") or
        ((availability-structure = "hierarchy") and (not any? (opportunity-on patch-ahead 1) with [opportunity_id < [solution_id] of myself]))) [
      move-to patch-ahead 1
    ]
  ]
  ask problem with [not blocked? and not postponed? and not passed?] [ 
    set heading ((random 4) * 90)
    if ((access-structure = "anarchy") or
        ((access-structure = "hierarchy") and (not any? (opportunity-on patch-ahead 1) with [opportunity_id < [problem_id] of myself]))) [
      move-to patch-ahead 1
    ]
  ]
  
  
  
  
  
  
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,,,;;;;;; THE NUMBER OF AGENTS AVAILABLE FOR DECISION-MAKING

  set free-participants free-participants + count participant with [not blocked? and not charged?]
  set ave-free-participants free-participants / ticks
  set free-opportunities free-opportunities + count opportunity with [not blocked?]
  set ave-free-opportunities free-opportunities / ticks
  set free-solutions free-solutions + count solution with [not blocked?]
  set ave-free-solutions free-solutions / ticks
  set free-problems free-problems + count problem with [not blocked?]
  set ave-free-problems free-problems / ticks


  

  
  
  ;;;;;;;;;;;; MEASURES WHETHER OPPORTUNITIES, SOLUTIONS AND PROBLEMS ARE MET, THAT HAD ALREADY BEEN MET
  
  ;; Participants who are in blocked decision processes, as well as participants charged with problems, are excluded.
  ask participant with [not blocked? and not charged?] [
    set meetings-known-opp meetings-known-opp + count opportunity-here with [member? who [encountered] of myself]
    set meetings-opp meetings-opp + count opportunity-here
    set meetings-known-sol meetings-known-sol + count solution-here with [member? who [encountered] of myself]
    set meetings-sol meetings-sol + count solution-here
    set meetings-known-pro meetings-known-pro + count problem-here with [member? who [encountered] of myself]
    set meetings-pro meetings-pro + count problem-here
    ;; Agents that had not been previously met, are added to the list.
    if (any? turtles-here with [breed != participant and not (member? who [encountered] of myself)]) [
      foreach [who] of turtles-here with [breed != participant and not (member? who [encountered] of myself)] [
        set encountered fput ? encountered
      ]
    ]
  ]

      
      
      
    
  ;;;;;;;;;; COUNTS THE NUMBER OF BLOCKED DECISIONS, THE NUMBER OF POSTPONED PROBLEMS AND THE NUMBER OF PASSED PROBLEMS
  
  if (any? patches with [pcolor = white]) [
    ;; Number of blocked decision processes.
    set num-blocked num-blocked + count patches with [pcolor = white]
    set ave-num-blocked num-blocked / ticks
    ;; Size of blocked decision processes.
    set size-blocked size-blocked + count turtles with [blocked?] / count patches with [pcolor = white]
    set ave-size-blocked size-blocked / ticks
    ;; Life of blocked decision processes.
    let life-blocked-now 0
    ask patches with [pcolor = white] [
      set life-blocked-now life-blocked-now + (ticks - pcolor-white-since)
    ]
    set life-blocked-now life-blocked-now / count patches with [pcolor = white]
    set life-blocked life-blocked + life-blocked-now
    set ave-life-blocked life-blocked / ticks
  ]
  if (any? problem with [postponed?]) [
    ;; Number of postponed problems.
    set num-postponed num-postponed + count opportunity with [charged?]
    set ave-num-postponed num-postponed / ticks
    ;; Life of postponed problems
    let life-postponed-now 0
    ask problem with [postponed?] [
      set life-postponed-now life-postponed-now + (ticks - since)
    ]
    set life-postponed-now life-postponed-now / count problem with [postponed?]
    set life-postponed life-postponed + life-postponed-now
    set ave-life-postponed life-postponed / ticks
  ]
  if (any? problem with [passed?]) [
    ;; Number of passed problems.
    set num-passed num-passed + count participant with [charged?]
    set ave-num-passed num-passed / ticks
    ;; Life of passed problems.
    let life-passed-now 0
    ask problem with [passed?] [
      set life-passed-now life-passed-now + (ticks - since)
    ]
    set life-passed-now life-passed-now / count problem with [passed?]
    set life-passed life-passed + life-passed-now
    set ave-life-passed life-passed / ticks
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


















;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;; Procedures to distribute ability to participants, efficiency to solutions, and difficulty to problems ;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to assign-ability
  if (dist-ability = "random") [
    ask participant [set ability random-float (max-ability - min-ability) + min-ability]
  ]
  if (dist-ability = "competence") [
    ifelse (count participant > 1) [
      ask participant [set ability min-ability + ((count participant - 1 - participant_id) / (count participant - 1)) * (max-ability - min-ability)]
    ] [
      ask participant [set ability (min-ability + max-ability) / 2]
    ]
  ]
  if (dist-ability = "incompetence") [
    ifelse (count participant > 1) [
      ask participant [set ability min-ability + (participant_id / (count participant - 1)) * (max-ability - min-ability)]
    ] [
      ask participant [set ability (min-ability + max-ability) / 2]
    ]
  ]
end 

to assign-efficiency
  if (dist-efficiency = "random") [
    ask solution [set efficiency random-float (max-efficiency - min-efficiency) + min-efficiency]
  ]
  if (dist-efficiency = "competence") [
    ifelse (count solution > 1) [
      ask solution [set efficiency min-efficiency + ((count solution - 1 - solution_id) / (count solution - 1)) * (max-efficiency - min-efficiency)]
    ] [
      ask solution [set efficiency (min-efficiency + max-efficiency) / 2]
    ]
  ]
  if (dist-efficiency = "incompetence") [
    ifelse (count solution > 1) [
      ask solution [set efficiency min-efficiency + (solution_id / (count solution - 1)) * (max-efficiency - min-efficiency)]
    ] [
      ask solution [set efficiency (min-efficiency + max-efficiency) / 2]
    ]
  ]
end 

to assign-difficulty
  if (dist-difficulty = "random") [
    ask problem [set difficulty random-float (max-difficulty - min-difficulty) + min-difficulty]
  ]
  if (dist-difficulty = "competence") [
    ifelse (count problem > 1) [
      ask problem [set difficulty min-difficulty + ((count problem - 1 - problem_id) / (count problem - 1)) * (max-difficulty - min-difficulty)]
    ] [
      ask problem [set difficulty (min-difficulty + max-difficulty) / 2]
    ]
  ]
  if (dist-difficulty = "incompetence") [
    ifelse (count problem > 1) [
      ask problem [set difficulty min-difficulty + (problem_id / (count problem - 1)) * (max-difficulty - min-difficulty)]
    ] [
      ask problem [set difficulty (max-difficulty - min-difficulty) / 2]
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

















;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; If participants, choice opportunities, solutions or problems exit after a decision is made, these procedures are acvtivated
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to kill [morituri]
  if (morituri != nobody) [
    ask morituri [
      if (breed = participant) [
        ;; If it is a participant charged with a problem, free the problem.
        if (charged?) [
          let this-problem-to-participant with-problem
          if (any? problem with [who = this-problem-to-participant]) [
            ask this-problem-to-participant [
              set passed? false
              set to-participant nobody
            ]
          ]
        ]
        ;; If the participant to be killed must be replaced, a new one is created.
        if (replace-participants?) [
          ;; Move the participant to be replaced.
          let found? false
          let localcounter 0
          while [not found?] [
            let newxcor random world-width
            let newycor random world-height
            if (not any? turtles-on patch newxcor newycor) [
              set found? true
              set xcor newxcor
              set ycor newycor
            ]
            set localcounter localcounter + 1
            if (localcounter > 10000) [
              type "TOO HIGH AGENT DENSITY"
              stop
            ]
          ]
          ;; Clone it, but with the following differences.
          hatch 1 [ 
            set blocked? false
            set charged? false
            set with-problem nobody
            set encountered []
          ]
        ]
        ;; The participants who met it, forget it.
        ask other participant [
          foreach encountered [
            if (? = [who] of myself)
              [set encountered remove ? encountered]
          ]
        ]
        ;; Finally kills it.
        die
      ]
      if (breed = opportunity) [
        if (charged?) [
          let this-problem with-problem
          if (any? problem with [who = this-problem]) [
            ask this-problem [
              set postponed? false
              set to-opportunity nobody
            ]
          ]
        ]
        ;; If the opportunity to be killed must be replaced, a new one is created.
        if (replace-opportunities?) [
          ;; Move the opportunity to be replaced.
          let found? false
          let localcounter 0
          while [not found?] [
            let newxcor random world-width
            let newycor random world-height
            if (not any? turtles-on patch newxcor newycor) [
              set found? true
              set xcor newxcor
              set ycor newycor
            ]
            set localcounter localcounter + 1
            if (localcounter > 10000) [
              type "TOO HIGH AGENT DENSITY"
              stop
            ]
          ]
          ;; Clone it, but with the following differences.
          hatch 1 [ 
            set blocked? false
            set charged? false
            set with-problem nobody
          ]
        ]
        ;; The participants who met it, forget it.
        ask participant [
          foreach encountered [
            if (? = [who] of myself)
              [set encountered remove ? encountered]
          ]
        ]
        ;; Finally kills it.
        die
      ]
      if (breed = solution) [
        ;; If the solution to be killed must be replaced, a new one is created.
        if (replace-solutions?) [
          ;; Move the solution to be replaced.
          let found? false
          let localcounter 0
          while [not found?] [
            let newxcor random world-width
            let newycor random world-height
            if (not any? turtles-on patch newxcor newycor) [
              set found? true
              set xcor newxcor
              set ycor newycor
            ]
            set localcounter localcounter + 1
            if (localcounter > 10000) [
              type "TOO HIGH AGENT DENSITY"
              stop
            ]
          ]
          ;; Clone it, but with the following differences.
          hatch 1 [ 
            set blocked? false
          ]
        ]
        ;; The participants who met it, forget it.
        ask participant [
          foreach encountered [
            if (? = [who] of myself)
              [set encountered remove ? encountered]
          ]
        ]
        ;; Finally kills it.
        die   
      ]
      if (breed = problem) [
        ;; If it is a postponed problem, free the opportunity to which it is postponed.
        if (postponed?) [
          let this-opportunity to-opportunity
          if (any? opportunity with [who = this-opportunity]) [
            ask this-opportunity [
              set charged? false
              set with-problem nobody
            ]
          ]
        ]
        ;; If is it a problem passed to somebody else, free this participant.
        if (passed?) [
          let this-participant to-participant
          if (any? participant with [who = this-participant]) [
            ask this-participant [
              set charged? false
              set with-problem nobody
            ]
          ]
        ]
        ;; If the problem to be killed must be replaced, a new one is created.
        if (replace-problems?) [
          ;; Move the problem to be replaced.
          let found? false
          let localcounter 0
          while [not found?] [
            let newxcor random world-width
            let newycor random world-height
            if (not any? turtles-on patch newxcor newycor) [
              set found? true
              set xcor newxcor
              set ycor newycor
            ]
            set localcounter localcounter + 1
            if (localcounter > 10000) [
              type "TOO HIGH AGENT DENSITY"
              stop
            ]
          ]
          ;; Clone it, but with the following differences.
          hatch 1 [ 
            set blocked? false
            set postponed? false
            set to-opportunity nobody
            set passed? false
            set to-participant nobody
            set since 0
          ]
        ]
        ;; The participants who met it, forget it.
        ask participant [
          foreach encountered [
            if (? = [who] of myself)
              [set encountered remove ? encountered]
          ]
        ]
        ;; Finally kills it.
        die
      ]
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;












;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; Writes labels on the screen and information on decision-making on the command center ;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to show-labels
  ask participant [
    set label round ability
  ]
  ask problem [
    set label round difficulty
  ]
  ask solution [
    set label precision efficiency 1
  ]
end 

to write-oversights
  type "OVERSIGHT N."
  write num-oversight
  actors-involved
end 

to write-resolutions
  type "RESOLUTION N."
  write num-resolution
  actors-involved
end 

to write-postponements
  type "FLIGHT BY POSTPONEMENT N."
  write num-postponement
  actors-involved
end 

to write-buck-passings
  type "FLIGHT BY BUCK-PASSING N."
  write num-buck-passing
  actors-involved
end 

to actors-involved
  ask participant-here [
    type "      Identity:"
    write who
    type ". One of:"
    write count participant
    type " participants. Ability:"
    write ability
    type ". Charged?"
    write charged?
    type ". With problem:"
    write with-problem
    type "."
  ]
  ask opportunity-here [
    type "      Identity:"
    write who
    type ". One of:"
    write count opportunity
    type " opportunities."
    type " Charged?"
    write charged?
    type ". With problem:"
    write with-problem
    type "."
  ]
  ask solution-here [
    type "      Identity:"
    write who
    type ". One of:"
    write count solution
    type " solutions. Efficiency:"
    write efficiency
    type "."
  ]
  ask problem-here [
    type "      Identity:"
    write who
    type ". One of:"
    write count problem
    type " problems. Difficulty:"
    write difficulty
    type ". Postponed?"
    write postponed?
    type ". To opportunity:"
    write to-opportunity
    type ". Passed?"
    write passed?
    type ". To participant:"
    write to-participant
    type "."
  ]
  print " "
end 

to write-survivors
  print ""
  type "SURVIVING PARTICIPANTS"
  print ""
  ifelse (any? participant) [
    type "Identities:"
    ask participant [ write participant_id ]
    print " "
  ]
  [ type "none" ]
  type "SURVIVING OPPORTUNITIES"
  print ""
  ifelse (any? opportunity) [
    type "Identities:"
    ask opportunity [ write opportunity_id ]
    print " "
  ]
  [ type "none" ]
  type "SURVIVING SOLUTIONS"
  print ""
  ifelse (any? solution) [
    type "Identities:"
    ask solution [ write solution_id ]
    print " "
  ]
  [ type "none" ]
  type "SURVIVING PROBLEMS"
  print ""
  ifelse (any? problem) [
    type "Identities:"
    ask problem [ write problem_id ]
    print " "
  ]
  [ type "none" ]
  print ""
end 

There is only one version of this model, created about 12 years ago by Guido Fioretti.

Attached files

File Type Description Last updated
The Garbage Can Model of Organizational Choice.png preview Preview for 'The Garbage Can Model of Organizational Choice' about 12 years ago, by Guido Fioretti Download

This model does not have any ancestors.

This model does not have any descendants.