;; THE GARBAGE CAN MODEL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Variables declaration ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; globals [ ;; population dynamics step ;; steps counter morituri_par ;; the participants waiting to be killed morituri_opp ;; the opportunities waiting to be killed morituri_sol ;; the solutions waiting to be killed morituri_pro ;; the problems waiting to be killed 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 ;; kinds of decision-making t_decision ;; total number of decisions n_resolution ;; number of decisions by resolution in a tick t_resolution ;; total number of decisions by resolution n_oversight ;; number of decisions by oversight in a tick t_oversight ;; total number of decisions by oversight n_flight ;; number of flights in a tick t_flight ;; total number of flights n_flight_res ;; number of flights in a tick, that are followed by decisions by resolution t_flight_res ;; total number of flights that are followed by decisions by resolution n_flight_ove ;; number of flights in a tick, that are followed by decisions by oversight t_flight_ove ;; total number of flights that are followed by decisions by oversight t_energy_par ;; total energy of participants t_energy_pro ;; total energy required by problems ;; some auxiliary variables decimal_par ;; the decimal fraction of participants who enter or exit decimal_opp ;; the decimal fraction of opportunities who enter or exit decimal_sol ;; the decimal fraction of solutions who enter or exit decimal_pro ;; the decimal fraction of problems who enter or exit i ;; a counter used to re-number agents after some of them died coordination ;; the orientation by which coordinated agents move id ;; auxiliary variable employed with some access structures and decision structures cumulative_problems ;; the sum of problems over time, used to compute "problem latency" chosenOppOve ;; the opportunity selected to make a decision by oversight, necessary to compute "countOve*" chosenOppRes ;; the opportunity selected to make a decision by resolution, necessary to compute "countRes*" ;; the indicators suggested by Cohen, March and Olsen problem_jumps problem_bindings problem_latency unsolved_problems participant_jumps participant_bindings used_energy excess_energy unexploited_opportunities waiting_time ;; other indicators needed in order to test all of CMO's hypotheses with hierarchical structures countOveI ;; the number of oversights making use of opportunities in the the first class of importance percentOveI ;; the above as percentage of the number of decisions countOveII ;; the number of oversights making use of opportunities in the second class of importance percentOveII ;; the above as percentage of the number of decisions countOveIII ;; the number of oversights making use of opportunities in the third class of importance percentOveIII ;; the above as percentage of the number of decisions countOveIV ;; the number of oversights making use of opportunities in the fourth class of importance percentOveIV ;; the above as percentage of the number of decisions countResI ;; the number of resolutions making use of opportunities in the first class of importance percentResI ;; the above as percentage of the number of decisions countResII ;; the number of resolutions making use of opportunities in the second class of importance percentResII ;; the above as percentage of the number of decisions countResIII ;; the number of resolutions making use of opportunities in the third class of importance percentResIII ;; the above as percentage of the number of decisions countResIV ;; the number of resolutions making use of opportunities in the fourth class of importance percentResIV ;; the above as percentage of the number of decisions ] turtles-own [ blocked? ;; whether an agent is allowed to move coordinated? ;; coordinated agents move in the same direction date_of_birth ;; the step when an agent was born id_at_birth ;; its identity when it was born ] breeds [ solution problem participant opportunity ] ;; our four classes of agents participant-own [ participant_id ;; the identification number of participants energy_par ;; the energy of participants ] opportunity-own [ opportunity_id ;; the identification number of opportunities ] solution-own [ solution_id ;; the identification number of solutions efficiency ;; the coefficient by which solutions multiply the energy of participants ] problem-own [ problem_id ;; the identification number of problems energy_pro ;; the energy of problems ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;; What is done when the "Setup" button is pressed ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to setup ;; initializes general variables ca set step 0 ;; 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 set decimal_par 0 set decimal_opp 0 set decimal_sol 0 set decimal_pro 0 ;; creates the agents that are initially present in the organization set-default-shape participant "participant" create-custom-participant initial-number-of-participants ;; creates the participants and initializes their variables [ setxy random screen-size-x random screen-size-y set blocked? false set coordinated? false set date_of_birth step set id_at_birth who set participant_id id_at_birth ] set-default-shape opportunity "opportunity" create-custom-opportunity initial-number-of-opportunities ;; creates the choice opportunities and initializes their variables [ setxy random screen-size-x random screen-size-y set blocked? false set coordinated? false set date_of_birth step set id_at_birth (who - initial-number-of-participants) set opportunity_id id_at_birth ] set-default-shape solution "solution" create-custom-solution initial-number-of-solutions ;; creates the solutions and initializes their variables [ setxy random screen-size-x random screen-size-y set blocked? false set coordinated? false set date_of_birth step set id_at_birth (who - initial-number-of-participants - initial-number-of-opportunities) set solution_id id_at_birth ] set-default-shape problem "problem" create-custom-problem initial-number-of-problems ;; creates the problems and initializes their variables [ setxy random screen-size-x random screen-size-y set blocked? false set coordinated? false set date_of_birth step set id_at_birth (who - initial-number-of-participants - initial-number-of-opportunities - initial-number-of-solutions) set problem_id id_at_birth ] ;; participants and problems are endowed with energy, solutions are endowed with efficiency assign-energy-par assign-energy-pro assign-efficiency ;; initializes the number of decision-makings set t_decision 0 set n_resolution 0 set t_resolution 0 set n_oversight 0 set t_oversight 0 set n_flight 0 set t_flight 0 set n_flight_res 0 set t_flight_res 0 set n_flight_ove 0 set t_flight_ove 0 ;; initializes the lists of agents to be killed set morituri_par [] set morituri_opp [] set morituri_sol [] set morituri_pro [] ;; initializes the indicators and their auxiliary variables ifelse (problems-exit?) [set unsolved_problems count problem] [set unsolved_problems "not available"] set problem_jumps t_flight set problem_bindings 0 set cumulative_problems 0 set problem_latency 0 set participant_bindings 0 ifelse (not participants-exit?) [set participant_jumps 0] [set participant_jumps "not available"] set used_energy 0 set excess_energy 0 ifelse (opportunities-exit?) [set unexploited_opportunities count opportunity] [set unexploited_opportunities "not available"] ifelse (opportunities-exit?) [set waiting_time 0] [set waiting_time "not available"] if ((opportunities-exit?) and ((decision-structure != 0) or (access-structure != 0))) [ set countOveI 0 set countOveII 0 set countOveIII 0 set countOveIV 0 set countResI 0 set countResII 0 set countResIII 0 set countResIV 0 ] set percentOveI "not available" set percentOveII "not available" set percentOveIII "not available" set percentOveIV "not available" set percentResI "not available" set percentResII "not available" set percentResIII "not available" set percentResIV "not available" 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 ;;; THE SIMULATION IS NOT ALLOWED TO BEGIN IF MINIMUM VALUES OF ENERGY AND EFFICIENCY ARE GREATER THAN THE CORRESPONDING MAXIMUM VALUES if ((min-energy-par > max-energy-par) or (min-energy-pro > max-energy-pro)) [ type "MINIMUM ENERGY SHOULD NOT BE GREATER THAN MAXIMUM ENERGY" stop ] if (min-efficiency-sol > max-efficiency-sol) [ type "MINIMUM EFFICIENCY SHOULD NOT BE GREATER THAN MAXIMUM EFFICIENCY" stop ] ;;;;;;;;;;;;;;;;;;;;;;; AGENTS FLOW IN AND OUT OF THE MODEL ;; net flows of participants ifelse (step != 0 and (remainder step 10) = 0) [set decimal_par (10 * abs net-flow-of-participants - 10 * abs int net-flow-of-participants)] [set decimal_par 0] if (((stop-flow-par-at = 0) or (step < stop-flow-par-at)) and (net-flow-of-participants > 0)) [ repeat (int net-flow-of-participants + decimal_par) [ without-interruption [ create-custom-participant 1 [ setxy random screen-size-x random screen-size-y set blocked? false set coordinated? false set date_of_birth step set id_at_birth (initial-number-of-participants + arrivals-departures_par) set participant_id id_at_birth set energy_par random-float (max-energy-par - min-energy-par) + min-energy-par ] set arrivals-departures_par arrivals-departures_par + 1 ] ] ] if (((stop-flow-par-at = 0) or (step < stop-flow-par-at)) and (net-flow-of-participants < 0) and (count participant > 0)) [ repeat (- int net-flow-of-participants + decimal_par) [ without-interruption [ ask participant with [participant_id = (count participant - 1)] [ die ] set arrivals-departures_par arrivals-departures_par - 1 ] ] ] ;; net flows of opportunities ifelse (step != 0 and (remainder step 10) = 0) [set decimal_opp (10 * abs net-flow-of-opportunities - 10 * abs int net-flow-of-opportunities)] [set decimal_opp 0] if (((stop-flow-opp-at = 0) or (step < stop-flow-opp-at)) and (net-flow-of-opportunities > 0)) [ repeat (int net-flow-of-opportunities + decimal_opp) [ without-interruption [ create-custom-opportunity 1 [ setxy random screen-size-x random screen-size-y set blocked? false set coordinated? false set date_of_birth step set id_at_birth (initial-number-of-opportunities + arrivals-departures_opp) set opportunity_id id_at_birth ] set arrivals-departures_opp arrivals-departures_opp + 1 ] ] ] if (((stop-flow-opp-at = 0) or (step < stop-flow-opp-at)) and (net-flow-of-opportunities < 0) and (count opportunity > 0)) [ repeat (- int net-flow-of-opportunities + decimal_opp) [ without-interruption [ ask opportunity with [opportunity_id = (count opportunity - 1)] [ die ] set arrivals-departures_opp arrivals-departures_opp - 1 ] ] ] ;; net flows of solutions ifelse (step != 0 and (remainder step 10) = 0) [set decimal_sol (10 * abs net-flow-of-solutions - 10 * abs int net-flow-of-solutions)] [set decimal_sol 0] if (((stop-flow-sol-at = 0) or (step < stop-flow-sol-at)) and (net-flow-of-solutions > 0)) [ repeat (int net-flow-of-solutions + decimal_sol) [ without-interruption [ create-custom-solution 1 [ setxy random screen-size-x random screen-size-y set blocked? false set coordinated? false set date_of_birth step set id_at_birth (initial-number-of-solutions + arrivals-departures_sol) set solution_id id_at_birth set efficiency random-float (max-efficiency-sol - min-efficiency-sol) + min-efficiency-sol ] set arrivals-departures_sol arrivals-departures_sol + 1 ] ] ] if (((stop-flow-sol-at = 0) or (step < stop-flow-sol-at)) and (net-flow-of-solutions < 0) and (count solution > 0)) [ repeat (- int net-flow-of-solutions + decimal_sol) [ without-interruption [ ask solution with [solution_id = (count solution - 1)] [ die ] set arrivals-departures_sol arrivals-departures_sol - 1 ] ] ] ;; net flows of problems ifelse (step != 0 and (remainder step 10) = 0) [set decimal_pro (10 * abs net-flow-of-problems - 10 * abs int net-flow-of-problems)] [set decimal_pro 0] if (((stop-flow-pro-at = 0) or (step < stop-flow-pro-at)) and (net-flow-of-problems > 0)) [ repeat (int net-flow-of-problems + decimal_pro) [ without-interruption [ create-custom-problem 1 [ setxy random screen-size-x random screen-size-y set blocked? false set coordinated? false set date_of_birth step set id_at_birth (initial-number-of-problems + arrivals-departures_pro) set problem_id id_at_birth set energy_pro random-float (max-energy-pro - min-energy-pro) + min-energy-pro ] set arrivals-departures_pro arrivals-departures_pro + 1 ] ] ] if (((stop-flow-pro-at = 0) or (step < stop-flow-pro-at)) and (net-flow-of-problems < 0) and (count problem > 0)) [ repeat (- int net-flow-of-problems + decimal_pro) [ without-interruption [ ask problem with [problem_id = (count problem - 1)] [ die ] set arrivals-departures_pro arrivals-departures_pro - 1 ] ] ] ;;;;;;;;;;;;;;; ENERGY AND EFFICIENCY MAY NEED TO BE ASSIGNED AGAIN ;; If energy and efficiency are distributed according to the numbering of agents (dist-energy-par = {0,2}, ;; dist-energy-pro = {0,2}, dist-efficiency-sol = {0,2}) and if some participants, problems or solutions are born or ;; die during the simulation, then energy and efficiency 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 energy or efficiency. ;; Participants, problems and solutions that are born during the simulation are endowed with random values of energy, ;; so if dist-energy-par = 1, dist-energy-pro = 1 or dist-efficiency-sol = 1 nothing has to be changed. if (((dist-energy-par = 0) or (dist-energy-par = 2)) and (((net-flow-of-participants != 0) and ((step <= stop-flow-par-at) or (stop-flow-par-at = 0))) or (participants-exit?))) [ assign-energy-par ] if (((dist-energy-pro = 0) or (dist-energy-pro = 2)) and (((net-flow-of-problems != 0) and ((step <= stop-flow-pro-at) or (stop-flow-pro-at = 0))) or (problems-exit?))) [ assign-energy-pro ] if (((dist-efficiency = 0) or (dist-efficiency = 2)) and (((net-flow-of-solutions != 0) and ((step <= stop-flow-sol-at) or (stop-flow-sol-at = 0))) or (solutions-exit?))) [ assign-efficiency ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DECISION - MAKING ;; Though decisions are made by participants, it is more convenient to let patches operate. In fact, a participant may not be ;; able to kill itself. ask patches [ without-interruption [ ;; 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)) [ ;; If there are problems as well, either they are resolved if energy is sufficient or all agents stay put until another ;; opportunity passes by and takes a problem away. ifelse (any? problem-here) [ ;; If the sum of the energy 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 energy of all problems on the same patch, then decisions are made by ;; resolution. If the agents are required to exit after decision-making, all participants exit, but only the most efficient ;; solution exits and only one randomly chosen opportunity exits. ifelse ((sum values-from participant-here [energy_par])*(efficiency-of max-one-of solution-here [efficiency]) >= (sum values-from problem-here [energy_pro])) [ set n_resolution n_resolution + 1 ;; Write information on the control center if (show-details?) [write-resolutions] ;; The indicators based on energy values must be computed here evaluate-used-energy evaluate-excess-energy ;; The indicators of the percentages of resolutions per importance must be computed here set chosenOppRes one-of opportunity-here evaluate-resolutions ;; If participants exit after a decision is made, all participants on the patch are killed. if (participants-exit?) [ set morituri_par fput participant-here morituri_par kill-participants ] ;; 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?) [ set morituri_opp fput chosenOppRes morituri_opp kill-opportunities ] ;; If solutions exit after a decision is made, the most efficient solution on the patch is killed. if (solutions-exit?) [ set morituri_sol fput max-one-of solution-here [efficiency] morituri_sol kill-solutions ] ;; If problems exit after a decision is made, all problems on the patch are killed. if (problems-exit?) [ set morituri_pro fput problem-here morituri_pro kill-problems ] ;; 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 (coordinated?) [set coordinated? false] ] ] ;; If the energy of the participants is not sufficient to make a decision, all agents on the patch are blocked until a choice ;; opportunity arrives, that takes away the problem with the highest energy. This flight may enable the remaining agents to ;; make a decision either by resolution or by oversight. [ ask turtles-here [set blocked? true] ;; If there is more than one opportunity, this is left free to move and take away the problem with the highest energy. The ;; pairs of problems and opportunities that fly are bound to one another until the problem is solved. if (count opportunity-here > 1) [ set n_flight n_flight + 1 ;; The remaining agents may make a decision, either by resolution or by oversight. Note that, since the pair of problem ;; and opportunity are still in their places, the ensuing conditions take account of the fact that one more problem and ;; one more opportunity are there. ;; Eventually, the remaining problems may be solved by resolution. A counter of flights that are followed by decision-making ;; by resolution is updated, though the decision is made the next step. if ((count problem-here > 1) and ((sum values-from participant-here [energy_par])*(efficiency-of max-one-of solution-here [efficiency]) >= (sum values-from problem-here [energy_pro] - energy_pro-of max-one-of problem-here [energy_pro]))) [ set n_flight_res n_flight_res + 1 evaluate-jumps_par ] ;; Or, if no problem is left, a decision may be made by oversight. A counter of flights that are followed by decision-making ;; by oversight is updated, though the decision is made the next step. if (count problem-here <= 1) [ set n_flight_ove n_flight_ove + 1 evaluate-jumps_par ] ;; In any case, an opportunity flies away with the hardest problem. ask one-of opportunity-here [ without-interruption [ set blocked? false set coordinated? true ] ] ask max-one-of problem-here [energy_pro] [ without-interruption [ set blocked? false set coordinated? true ] ] ] ] ] ;; 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 n_oversight n_oversight + 1 ;; Write information on the control center if (show-details?) [write-oversights] ;; Used energy must be computed here evaluate-used-energy ;; The indicators of the percentages of oversights per importance must be computed here set chosenOppOve one-of opportunity-here evaluate-oversights ;; If participants exit after a decision is made, all participants on the patch are killed. if (participants-exit?) [ set morituri_par fput participant-here morituri_par kill-participants ] ;; 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?) [ set morituri_opp fput chosenOppOve morituri_opp kill-opportunities ] ;; 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?) [ set morituri_sol fput one-of solution-here morituri_sol kill-solutions ] ;; 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 (coordinated?) [set coordinated? false] ] ] ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;; THE REMAINING AGENTS ARE RE-NUMBERED if (participants-exit?) [ set i 0 repeat count participant [ without-interruption [ if (not any? participant with [participant_id = i]) [ set participant_id-of one-of participant with [participant_id >= count participant] i ] set i i + 1 ] ] ] if (opportunities-exit?) [ set i 0 repeat count opportunity [ without-interruption [ if (not any? opportunity with [opportunity_id = i]) [ set opportunity_id-of one-of opportunity with [opportunity_id >= count opportunity] i ] set i i + 1 ] ] ] if (solutions-exit?) [ set i 0 repeat count solution [ without-interruption [ if (not any? solution with [solution_id = i]) [ set solution_id-of one-of solution with [solution_id >= count solution] i ] set i i + 1 ] ] ] if (problems-exit?) [ set i 0 repeat count problem [ without-interruption [ if (not any? problem with [problem_id = i]) [ set problem_id-of one-of problem with [problem_id >= count problem] i ] set i i + 1 ] ] ] ;;;;;;;;;;;;;;;;;;;;;;;;;; AND FINALLY MOVE ;; In order to be sure that agents exit their patch every time they move, they are only allowed to turn by multiples of 90°. ;; Participants may be constrained by the decision structure, problems may be constrained by the access structure, opportunities ;; may me constrained by both the decision and the access structure, whereas the movements of solutions are unconstrained. ;; Uncoordinated agents move in different, randomly chosen directions. ;; However, only solutions are always allowed to move anywhere. In fact, participants must take account of the decision structure. ;; Problems must take account of the access structure. Finally, opportunities must take account of both the decision structure ;; and the access structure. ask participant with [(not blocked?) and (not coordinated?)] [ rt (random 4) * 90 set id participant_id if ((decision-structure = 0) or ((decision-structure = 1) and (not any? (opportunity-on patch-ahead 1) with [opportunity_id < id])) or ((decision-structure = 2) and (not any? (opportunity-on patch-ahead 1) with [opportunity_id != id]))) [ fd 1 ] ] ask opportunity with [(not blocked?) and (not coordinated?)] [ rt (random 4) * 90 set id opportunity_id if (((decision-structure = 0) and (access-structure = 0)) or ((decision-structure = 1) and (not any? (participant-on patch-ahead 1) with [participant_id > id]) and (access-structure = 0)) or ((decision-structure = 2) and (not any? (participant-on patch-ahead 1) with [participant_id != id]) and (access-structure = 0)) or ((decision-structure = 0) and (access-structure = 1) and (not any? (problem-on patch-ahead 1) with [problem_id > id])) or ((decision-structure = 0) and (access-structure = 2) and (not any? (problem-on patch-ahead 1) with [problem_id != id])) or ((decision-structure = 1) and (not any? (participant-on patch-ahead 1) with [participant_id > id]) and (access-structure = 1) and (not any? (problem-on patch-ahead 1) with [problem_id > id])) or ((decision-structure = 1) and (not any? (participant-on patch-ahead 1) with [participant_id > id]) and (access-structure = 2) and (not any? (problem-on patch-ahead 1) with [problem_id != id])) or ((decision-structure = 2) and (not any? (participant-on patch-ahead 1) with [participant_id != id]) and (access-structure = 1) and (not any? (problem-on patch-ahead 1) with [problem_id > id])) or ((decision-structure = 2) and (not any? (participant-on patch-ahead 1) with [participant_id != id]) and (access-structure = 2) and (not any? (problem-on patch-ahead 1) with [problem_id != id]))) [ fd 1 ] ] ask solution with [(not blocked?) and (not coordinated?)] [ rt (random 4) * 90 fd 1 ] ask problem with [(not blocked?) and (not coordinated?)] [ rt (random 4) * 90 set id problem_id if ((access-structure = 0) or ((access-structure = 1) and (not any? (opportunity-on patch-ahead 1) with [opportunity_id < id])) or ((access-structure = 2) and (not any? (opportunity-on patch-ahead 1) with [opportunity_id != id]))) [ fd 1 ] ] ;; Coordinated problems and opportunities move in the same direction, chosen randomly at each step for all of them. ;; Problems may move anywhere, because they are already coupled to an opportunity. On the contrary, opportunities should consider ;; whether they are moving onto patches where there are participants or additional problems with which they are not allowed to ;; interact. ask patches [ without-interruption [ set coordination (random 4) * 90 ask opportunity-here with [(not blocked?) and (coordinated?)] [ set id opportunity_id rt coordination if (((decision-structure = 0) and (access-structure = 0)) or ((decision-structure = 1) and (not any? (participant-on patch-ahead 1) with [participant_id > id]) and (access-structure = 0)) or ((decision-structure = 2) and (not any? (participant-on patch-ahead 1) with [participant_id != id]) and (access-structure = 0)) or ((decision-structure = 0) and (access-structure = 1) and (not any? (problem-on patch-ahead 1) with [problem_id > id])) or ((decision-structure = 0) and (access-structure = 2) and (not any? (problem-on patch-ahead 1) with [problem_id != id])) or ((decision-structure = 1) and (not any? (participant-on patch-ahead 1) with [participant_id > id]) and (access-structure = 1) and (not any? (problem-on patch-ahead 1) with [problem_id > id])) or ((decision-structure = 1) and (not any? (participant-on patch-ahead 1) with [participant_id > id]) and (access-structure = 2) and (not any? (problem-on patch-ahead 1) with [problem_id != id])) or ((decision-structure = 2) and (not any? (participant-on patch-ahead 1) with [participant_id != id]) and (access-structure = 1) and (not any? (problem-on patch-ahead 1) with [problem_id > id])) or ((decision-structure = 2) and (not any? (participant-on patch-ahead 1) with [participant_id != id]) and (access-structure = 2) and (not any? (problem-on patch-ahead 1) with [problem_id != id]))) [ fd 1 ] ] ask problem-here with [(not blocked?) and (coordinated?)] [ rt coordination fd 1 ] ] ] ;;;;;;;;;;;; GRAPHICAL PROCEDURES display-labels-par ;; display the energy labels of participants display-labels-pro ;; display the energy labels of problems display-labels-sol ;; display the energy labels of solutions do-plots ;; plots diagrams general-indicators ;; computes a block of general indicators that appear at the bottom of the interface ;;;;;;;;;;;;;;;;;;;;;; VARIOUS UPDATINGS ;; The number of steps is updated. Eventually, the simulation is stopped. set step step + 1 if ((stop-at > 0) and (step = stop-at)) [ if (show-details?) [write-survivors] stop ] ;; the cumulative number of decisions is updated set t_resolution (t_resolution + n_resolution) set t_oversight (t_oversight + n_oversight) set t_decision (t_resolution + t_oversight) set t_flight (t_flight + n_flight) set t_flight_res (t_flight_res + n_flight_res) set t_flight_ove (t_flight_ove + n_flight_ove) ;; the percentages of decisions per importance are updated if ((opportunities-exit?) and ((decision-structure != 0) or (access-structure != 0)) and (t_decision > 0)) [ set percentOveI (countOveI * 100 / t_decision) set percentOveII (countOveII * 100 / t_decision) set percentOveIII (countOveIII * 100 / t_decision) set percentOveIV (countOveIV * 100 / t_decision) set percentResI (countResI * 100 / t_decision) set percentResII (countResII * 100 / t_decision) set percentResIII (countResIII * 100 / t_decision) set percentResIV (countResIV * 100 / t_decision) ] ;; the number of decisions in a tick is set down to zero set n_resolution 0 set n_oversight 0 set n_flight 0 set n_flight_res 0 set n_flight_ove 0 end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;; Procedures to distribute energy to participants and problems, efficiency to solutions ;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to assign-energy-par if (dist-energy-par = 0) [ ask participant [ set energy_par min-energy-par + ((participant_id + 1) / (count participant)) * (max-energy-par - min-energy-par) ] ] if (dist-energy-par = 1) [ ask participant [ set energy_par random-float (max-energy-par - min-energy-par) + min-energy-par ] ] if (dist-energy-par = 2) [ ask participant [ set energy_par min-energy-par + ((count participant - participant_id) / (count participant)) * (max-energy-par - min-energy-par) ] ] end to assign-energy-pro if (dist-energy-pro = 0) [ ask problem [ set energy_pro min-energy-pro + ((problem_id + 1) / (count problem)) * (max-energy-pro - min-energy-pro) ] ] if (dist-energy-pro = 1) [ ask problem [ set energy_pro random-float (max-energy-pro - min-energy-pro) + min-energy-pro ] ] if (dist-energy-pro = 2) [ ask problem [ set energy_pro min-energy-pro + ((count problem - problem_id) / (count problem)) * (max-energy-pro - min-energy-pro) ] ] end to assign-efficiency if (dist-efficiency = 0) [ ask solution [ set efficiency min-efficiency-sol + ((solution_id + 1) / (count solution)) * (max-efficiency-sol - min-efficiency-sol) ] ] if (dist-efficiency = 1) [ ask solution [ set efficiency random-float (max-efficiency-sol - min-efficiency-sol) + min-efficiency-sol ] ] if (dist-efficiency = 2) [ ask solution [ set efficiency min-efficiency-sol + ((count solution - solution_id) / (count solution)) * (max-efficiency-sol - min-efficiency-sol) ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; If participants, choice opportunities, solutions or problems exit after a decision is made, these procedures are acvtivated ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to kill-participants foreach morituri_par [ ask ? [die] ] set morituri_par [] end to kill-opportunities foreach morituri_opp [ ask ? [die] ] set morituri_opp [] end to kill-solutions foreach morituri_sol [ ask ? [die] ] set morituri_sol [] end to kill-problems foreach morituri_pro [ ask ? [die] ] set morituri_pro [] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;; If "show energy" is ON, it writes a label close to each turtle displaying its energy ;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to display-labels-par if show-energy-par? [ ask participant [ set label round energy_par ] ] end to display-labels-pro if show-energy-pro? [ ask problem [ set label round energy_pro ] ] end to display-labels-sol if show-efficiency? [ ask solution [ set label precision efficiency 1 ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Plots diagrams ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to do-plots ;; plotting current decisions set-current-plot "Current Decisions / Current Flights" set-current-plot-pen "Resolutions" plot n_resolution set-current-plot-pen "Oversights" plot n_oversight set-current-plot-pen "Flights" plot n_flight ;; plotting the energy balance set-current-plot "Energy Balance" set-current-plot-pen "Potential Energy of Participants" plot sum values-from participant [energy_par] set-current-plot-pen "Effective Energy of Participants" ifelse (count solution > 0) [ plot (sum values-from participant [energy_par]) * (sum values-from solution [efficiency]) / (count solution) ] [ plot 0 ] set-current-plot-pen "Energy Required by Problems" plot sum values-from problem [energy_pro] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; Calculates indicators ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to general-indicators ;; Number of unresolved problems. Same as the number of problems if they do not exit the model, minus the ;; initial number of problems. ifelse (problems-exit?) [ set unsolved_problems count problem ] [ set unsolved_problems "not available" ] ;; The number of times a problem changes opportunity. This is equivalent to the number of flights. set problem_jumps t_flight ;; The number of times a problem cannot be solved because blocked or taken away by an opportunity, summed over problems. ;; Equivalent to the cumulative number of blocked or coordinated problems. ask problem [ if ((blocked?) or (coordinated?)) [ set problem_bindings problem_bindings + 1 ] ] ;; The number of times a problem is neither blocked or taken away by an opportunity, summed over problems. ;; Equivalent to the difference between the number of problems and the previous indicator, summed over time. set cumulative_problems cumulative_problems + count problem set problem_latency cumulative_problems - problem_bindings ;; The number of times a participant cannot make a decision because blocked, summed over participants. Equivalent to the ;; cumulative number of blocked participants. ask participant [ if (blocked?) [ set participant_bindings participant_bindings + 1 ] ] ;; The number of non-exploited opportunities. Same as the number of opportunities if they do not exit the model, ;; minus the initial number of opportunities. ifelse (opportunities-exit?) [ set unexploited_opportunities count opportunity ] [ set unexploited_opportunities "not available" ] ;; The lifespan of opportunities, if they may exit the simulation, measures the waiting time before decisions are made. ifelse (opportunities-exit?) [ set waiting_time waiting_time + count opportunity ] [ set waiting_time "not available" ] end to evaluate-used-energy ;; The energy of the participants involved in decision-making. Also this indicator is calculated at another place, i.e. ;; where decision is made, either by oversight or by resolution. The variable is "used_energy". set used_energy used_energy + (sum values-from participant-here [energy_par]) end to evaluate-excess-energy ;; The excess energy, measured as the energy of the participants involved in decision-making, weighted by the efficiency ;; of the solution that they employ, minus the energy of the problems that are eventually solved. Also calculated where ;; decision by resolution is made. The variable is "excess_energy". set excess_energy excess_energy + ((sum values-from participant-here [energy_par])*(efficiency-of max-one-of solution-here [efficiency]) - sum values-from problem-here [energy_pro]) end to evaluate-jumps_par ;; The number of times that a participant leaves an opportunity. This happens when a flight causes decision-making, ;; either by resolution or by oversight. It is not equivalent to the number of flights that cause decision-making ;; because it is multiplied by the number of participants involved. This indicator is computed at the same place where the ;; number of flights that cause decision-making are computed. The variable is "participant_jumps". ifelse (not participants-exit?) [ set participant_jumps participant_jumps + count participant-here ] [ set participant_jumps "not available" ] end to evaluate-resolutions ;; The number of resolutions made by choice opportunities of different importance. Importance is subdivided into four classes ;; in which the opportunities available at any point in time are classified. if ((opportunities-exit?) and ((decision-structure != 0) or (access-structure != 0))) [ if (opportunity_id-of chosenOppRes < (count opportunity) * 0.25) [ set countResI countResI + 1 ] if ((opportunity_id-of chosenOppRes >= (count opportunity) * 0.25) and (opportunity_id-of chosenOppRes < (count opportunity) * 0.5)) [ set countResII countResII + 1 ] if ((opportunity_id-of chosenOppRes >= (count opportunity) * 0.5) and (opportunity_id-of chosenOppRes < (count opportunity) * 0.75)) [ set countResIII countResIII + 1 ] if ((opportunity_id-of chosenOppRes >= (count opportunity) * 0.75) and (opportunity_id-of chosenOppRes < count opportunity)) [ set countResIV countResIV + 1 ] ] end to evaluate-oversights ;; The number of oversights made by choice opportunities of different importance. Importance is subdivided into four classes ;; in which the opportunities available at any point in time are classified. if ((opportunities-exit?) and ((decision-structure != 0) or (access-structure != 0))) [ if (opportunity_id-of chosenOppOve < (count opportunity) * 0.25) [ set countOveI countOveI + 1 ] if ((opportunity_id-of chosenOppOve >= (count opportunity) * 0.25) and (opportunity_id-of chosenOppOve < (count opportunity) * 0.5)) [ set countOveII countOveII + 1 ] if ((opportunity_id-of chosenOppOve >= (count opportunity) * 0.5) and (opportunity_id-of chosenOppOve < (count opportunity) * 0.75)) [ set countOveIII countOveIII + 1 ] if ((opportunity_id-of chosenOppOve >= (count opportunity) * 0.75) and (opportunity_id-of chosenOppOve < count opportunity)) [ set countOveIV countOveIV + 1 ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;; Writes information on decision-making on the command center ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to write-oversights without-interruption [ type "OVERSIGHT" ask participant-here [ without-interruption [ type " Participant:" write participant_id type " Out of:" write count participant type " Born as:" write id_at_birth type " At step:" write date_of_birth ] ] ask opportunity-here [ without-interruption [ type " Opportunity:" write opportunity_id type " Out of:" write count opportunity type " Born as:" write id_at_birth type " At step:" write date_of_birth ] ] ask solution-here [ without-interruption [ type " Solution:" write solution_id type " Out of:" write count solution type " Born as:" write id_at_birth type " At step:" write date_of_birth ] ] print " " ] end to write-resolutions without-interruption [ type "RESOLUTION" ask participant-here [ without-interruption [ type " Participant:" write participant_id type " Out of:" write count participant type " Born as:" write id_at_birth type " At step:" write date_of_birth ] ] ask opportunity-here [ without-interruption [ type " Opportunity:" write opportunity_id type " Out of:" write count opportunity type " Born as:" write id_at_birth type " At step:" write date_of_birth ] ] ask solution-here [ without-interruption [ type " Solution:" write solution_id type " Out of:" write count solution type " Born as:" write id_at_birth type " At step:" write date_of_birth ] ] ask problem-here [ without-interruption [ type " Problem:" write problem_id type " Out of:" write count problem type " Born as:" write id_at_birth type " At step:" write date_of_birth ] ] print " " ] end to write-survivors print "" type "SURVIVING PARTICIPANTS" print "" ifelse (any? participant) [ type "Identities:" ask participant [ write participant_id ] print " " type "Identities at birth:" ask participant [ write id_at_birth ] print " " ] [ type "none" ] type "SURVIVING OPPORTUNITIES" print "" ifelse (any? opportunity) [ type "Identities:" ask opportunity [ write opportunity_id ] print " " type "Identities at birth:" ask opportunity [ write id_at_birth ] print " " ] [ type "none" ] type "SURVIVING SOLUTIONS" print "" ifelse (any? solution) [ type "Identities:" ask solution [ write solution_id ] print " " type "Identities at birth:" ask solution [ write id_at_birth ] print " " ] [ type "none" ] type "SURVIVING PROBLEMS" print "" ifelse (any? problem) [ type "Identities:" ask problem [ write problem_id ] print " " type "Identities at birth:" ask problem [ write id_at_birth ] print " " ] [ type "none" ] print "" end @#$#@#$#@ GRAPHICS-WINDOW 551 10 1555 978 17 16 28.4 1 10 1 1 1 0 CC-WINDOW 5 992 1564 1087 Command Center SLIDER 9 281 247 314 net-flow-of-problems net-flow-of-problems -5 5 4.0 0.1 1 NIL SLIDER 9 116 247 149 initial-number-of-opportunities initial-number-of-opportunities 0 500 0 1 1 NIL SLIDER 9 50 247 83 initial-number-of-participants initial-number-of-participants 0 500 100 1 1 NIL BUTTON 268 10 342 43 Set Up setup NIL 1 T OBSERVER T NIL MONITOR 462 10 534 59 Step step 0 1 MONITOR 411 265 501 314 problems count problem 0 1 MONITOR 411 199 501 248 solutions count solution 0 1 BUTTON 397 10 462 43 Go Until go T 1 T OBSERVER T NIL BUTTON 342 10 397 43 Go Step go NIL 1 T OBSERVER T NIL SLIDER 341 418 507 451 min-energy-pro min-energy-pro 0 10 1.5 0.1 1 NIL SLIDER 175 418 341 451 min-efficiency-sol min-efficiency-sol 0 1 1.0 0.1 1 NIL SLIDER 9 418 175 451 min-energy-par min-energy-par 0 10 1.0 0.1 1 NIL PLOT 9 734 409 854 Current Decisions / Current Flights step NIL 0.0 100.0 0.0 1.0 true true PENS "Resolutions" 1.0 0 -16777216 true "Oversights" 1.0 0 -8716033 true "Flights" 1.0 0 -11352576 true MONITOR 191 524 373 573 Decisions by Resolution t_resolution 0 1 MONITOR 9 524 191 573 Decisions by Oversight t_oversight 0 1 MONITOR 191 573 373 622 Flights that cause Resolutions t_flight_res 0 1 SWITCH 9 484 175 517 show-energy-par? show-energy-par? 1 1 -1000 SLIDER 9 215 247 248 net-flow-of-solutions net-flow-of-solutions -5 5 0.0 0.1 1 NIL SLIDER 9 83 247 116 net-flow-of-participants net-flow-of-participants -5 5 0.0 0.1 1 NIL MONITOR 411 67 501 116 participants count participant 0 1 SLIDER 9 149 247 182 net-flow-of-opportunities net-flow-of-opportunities -5 5 2.0 0.1 1 NIL MONITOR 411 133 501 182 opportunities count opportunity 0 1 SLIDER 9 182 247 215 initial-number-of-solutions initial-number-of-solutions 0 500 100 1 1 NIL SLIDER 9 248 247 281 initial-number-of-problems initial-number-of-problems 0 500 0 1 1 NIL SWITCH 247 50 411 83 participants-exit? participants-exit? 1 1 -1000 SWITCH 247 116 411 149 opportunities-exit? opportunities-exit? 0 1 -1000 SWITCH 247 182 411 215 solutions-exit? solutions-exit? 1 1 -1000 SWITCH 247 248 411 281 problems-exit? problems-exit? 0 1 -1000 SLIDER 9 451 175 484 max-energy-par max-energy-par 0 10 1.0 0.1 1 NIL SLIDER 341 451 507 484 max-energy-pro max-energy-pro 0 10 1.5 0.1 1 NIL SLIDER 175 451 341 484 max-efficiency-sol max-efficiency-sol 0 1 1.0 0.1 1 NIL MONITOR 9 573 191 622 Flights that cause Oversights t_flight_ove 0 1 MONITOR 373 573 542 622 Total Flights t_flight 0 1 SWITCH 341 484 507 517 show-energy-pro? show-energy-pro? 1 1 -1000 SWITCH 175 484 341 517 show-efficiency? show-efficiency? 1 1 -1000 CHOOSER 9 373 175 418 dist-energy-par dist-energy-par 0 1 2 1 CHOOSER 341 373 507 418 dist-energy-pro dist-energy-pro 0 1 2 1 CHOOSER 175 373 341 418 dist-efficiency dist-efficiency 0 1 2 1 CHOOSER 123 321 237 366 access-structure access-structure 0 1 2 0 CHOOSER 9 321 123 366 decision-structure decision-structure 0 1 2 0 MONITOR 111 678 213 727 Unsolved Problems unsolved_problems 0 1 MONITOR 9 629 111 678 Problem Jumps problem_jumps 0 1 MONITOR 9 678 111 727 Problem Bindings problem_bindings 0 1 MONITOR 111 629 213 678 Problem Latency problem_latency 0 1 SLIDER 9 10 268 43 stop-at stop-at 0 1000 200 1 1 NIL MONITOR 220 678 322 727 Participant Bindings participant_bindings 0 1 MONITOR 220 629 322 678 Participant Jumps participant_jumps 0 1 MONITOR 322 629 424 678 Used Energy used_energy 2 1 MONITOR 322 678 424 727 Excess Energy excess_energy 2 1 MONITOR 431 629 542 678 Unexploited Opportunities unexploited_opportunities 0 1 MONITOR 431 678 542 727 Waiting Time waiting_time 0 1 PLOT 9 857 409 977 Energy Balance step NIL 0.0 100.0 0.0 10.0 true true PENS "Potential Energy of Participants" 1.0 0 -65536 true "Effective Energy of Participants" 1.0 0 -44544 true "Energy Required by Problems" 1.0 0 -16777216 true SLIDER 247 83 411 116 stop-flow-par-at stop-flow-par-at 0 200 0 1 1 NIL SLIDER 247 149 411 182 stop-flow-opp-at stop-flow-opp-at 0 200 100 1 1 NIL SLIDER 247 215 411 248 stop-flow-sol-at stop-flow-sol-at 0 200 0 1 1 NIL SLIDER 247 281 411 314 stop-flow-pro-at stop-flow-pro-at 0 200 100 1 1 NIL MONITOR 373 524 542 573 Total Decisions t_decision 0 1 SWITCH 413 734 543 767 show-details? show-details? 1 1 -1000 MONITOR 413 781 478 830 %O-I percentOveI 3 1 MONITOR 413 830 478 879 %O-II percentOveII 3 1 MONITOR 413 879 478 928 %O-III percentOveIII 3 1 MONITOR 413 928 478 977 %O-IV percentOveIV 3 1 MONITOR 478 781 543 830 %R-I percentResI 3 1 MONITOR 478 830 543 879 %R-II percentResII 3 1 MONITOR 478 879 543 928 %R-III percentResIII 3 1 MONITOR 478 928 543 977 %R-IV percentResIV 3 1 @#$#@#$#@ WHAT IS IT? ------------ The "Garbage Can" is a model of organizational decision-making. In the Garbage Can model, 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 model, choice opportunities take the role of "garbage cans" where solutions and problems are dumped. Organizations whose processes of decision-making follow the Garbage Can model are called "organized anarchies". There are four classes of agents in this model: participants, choice opportunities, solutions and problems. The number of participants measures the size of an organization by means of its members. The number of choice opportunities, henceforth "opportunities", measures the frequency by which decisions are made in the organization, e.g. whether contracts are signed every year or every five years. The number of solutions measures the variety of theories, schemata, mental models and frames available in the organization, each of which suggests a particular solution to a decision problem. Finally, the number of problems measures the difficulties actually encountered by the organization. An organization starts its life with a given number of participants, choice opportunities, solutions and problems. These initial values are set by means of the parameters "initial-number-of-participants", "initial-number-of-opportunities", initial-number-of-solutions" and "initial-number-of-problems", respectively. These parameters may take any integer value greater or equal than zero. Eventually, an organization may want to attract or expel participants, opportunities, solutions and problems in the course of its life. The corresponding net input-output flows are set by means of the parameters "net-flow-of-participants", "net-flow-of-opportunities", "net-flow-of-solutions" and "net-flow-of-problems", respectively. If these parameters are greater than zero, the organization attracts participants, choice opportunities, solutions or problems. If these parameters are less than zero, the organization expels participants, choice opportunities, solutions or problems into the environment. If these parameters are zero, the flows between the organization and its environment compensate one another. Since, as we shall see, an organization may destroy participants, opportunities, solutions or problems in order to make a decision, the net flows of these three classes of agents may be required to be positive in order for an organization to be viable in the long run. The parameters "net-flow-of-participants", "net-flow-of-opportunities", "net-flow-of-solutions" and "net-flow-of-problems" take values in the [-5, 5] interval in decimal steps. If they take integer values, they denote the number of participants, opportunities, solutions or problems that enter or exit the organization at each step. If they have a decimal component, this denotes an additional number of agents that enter or exit the organization every 10 steps. For instance, "net-flow-of-participants = 3.4" means that in general 3 participants enter the organization at every time step, but 7 participants enter the organization every ten time steps. The switches "stop-flow-par-at", "stop-flow-opp-at", "stop-flow-sol-at" and "stop-flow-pro-at" enable the user to stop these flows after a selected number of simulation steps. These parameters are ineffective when they are set to zero. Participants, opportunities, solutions and problems may be required to exit the organization after decision-making. This option is chosen by means of the parameters "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. This reflects the idea that all of them are involved in decision-making, be it resolution or overflight. If the switch "opportunities-exit?" is ON, on each patch where a decision is made only one opportunity exits. This is chosen at random among the opportunities on the patch. The underlying idea is that decision-making requires only one choice opportunity. If the switch "solutions-exit?" is ON, on each patch where a decision is made only one solution exits. The underlying idea is that even when decision-making involves many participants and solves several problems, only one solution is applied. If the decision is made by resolution, the chosen solution is the one with highest efficiency. If the decision is made by oversight, a solution is selected at random among those on the patch. Finally, the switch "problems-exit?" is only effective when decisions are made by resolution. If it is ON, all problems on patches where a decision is made, exit. The four monitors "participants", "opportunities", "solutions" and "problems" report the cumulative number of the corresponding agents. They reflect both net flows and deaths. Participants, choice opportunities, solutions and problems walk freely on the model space if both "decision-structure = 0" and "access-structure = 0". If "decision-structure = 1" 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 "decision-structure = 2" participants are only allowed to move on to opportunities of equal importance. If "access-structure = 1" problems and opportunities are ranked in order of importance and problems are only allowed to move on to opportunities of less or equal importance. If "access-structure = 2" problems are only allowed to move on to opportunities of equal importance. Participants are endowed with "energy", which denotes their personal ability in solving problems. Problems are endowed with "energy" as well, which denotes their difficulty to be solved. Solutions are endowed with "efficiency", a parameter which is applied to the energy of participants to yield their strength in solving problems. The sliders "show-energy-par?", "show-energy-pro?" and "show-efficiency?" allow to visualize energy and efficiency values of participants, problems and solutions, respectively. Energy and efficiency take values within a range specified by the sliders "min-energy-par" and "max-energy-par", "min-energy-pro" and "max-energy-pro", "min-efficiency-sol" and "max-efficiency-sol". They may be assigned to participants, problems and solutions following three criteria that can be chosen by means of the slider "dist-energy-par", "dist-energy-pro" and "dist-efficiency", respectively: 0) The participants, problems or solutions with lowest identification number (conventionally, the most important participants, problems and solutions in the organization) receive the lowest values of energy or efficiency; 1) The values of energy and efficiency are assigned at random according to a uniform distribution that spans the range between minimum and maximum values; 2) The participants, problems or solutions with lowest identification number (conventionally, the most important participants, problems and solutions in the organization) receive the highest values of energy or efficiency. A problem is solved when a participant has enough personal energy and a sufficiently efficient solution such that their product is greater or equal to the energy of the problem. Intuitively, this process is analogous to that of a machine that transforms potential energy into kinetic energy. For instance, a car extracts potential energy from gasoline (the "energy" of the decision-maker) wasting a certain fraction of it (the "efficiency" of the solution) in order to cover a distance (the "energy" of the problem). When problems are solved, 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". In the model, decision-making takes place when participants, choice opportunities, solutions and eventually problems happen to be on the same patch. Participants, choice opportunities, solutions and problems walk freely on the model space if both "decision-structure = 0" and "access-structure = 0". If "decision-structure = 1" 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 "decision-structure = 2" participants are only allowed to move on to opportunities of equal importance. If "access-structure = 1" problems and opportunities are ranked in order of importance and problems are only allowed to move on to opportunities of less or equal importance. If "access-structure = 2" problems are only allowed to move on to opportunities of equal importance. Decision-making by resolution takes place when at least one participant, at least one choice opportunity, at least one solution, at least one problem are on the same patch and the sum of the energies 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 energies 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 energy of the participant, multiplied by the efficiency of the solution that she is using, is greater or equal to the energy of the problem. 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, and no energy balance is required. 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 monitor "Decisions by Resolution" reports the cumulative number of decisions that are made by resolution. The monitor "Decisions by Oversight" reports the cumulative number of decisions that are made by oversight. The graph reports the number of decisions by resolution and by oversight that are made at each tick. If problems are on a patch with participants, solutions and choice opportunities, but the energy of the participants and the efficiency of the solutions is not sufficient to solve the problems, all agents on the patch are blocked and no decision is made. However, if there is more than one choice opportunity on the patch, or if an additional opportunity just walks on a patch where decision is blocked, then an opportunity takes away the problem with the highest energy and walks together with it until they find a participant and a solution that are able to solve the problem. This is called a "flight". Since the most difficult problem left, the blocked participants may now be able to make a decision, either by resolution or by oversight. Flight is very important in organizational decision-making. It represents all situations where a difficult problem is either postponed, or passed on to other decision-makers. The monitor "Total Flights" reports the cumulative number of times that a problem flied away with another opportunity. Sometimes, a flight enables decision-making for the remaining agents. The monitor "Flights that cause Resolutions" reports the number of flights that enabled decision-making by resolution. The monitor "Flights that cause Oversights" reports the number of flights that enabled decision-making by oversight. Thus, the sum of "Flights that cause Resolutions" and "Flights that cause Oversights" is less or equal to "Total Flights". Note that, since decision is made one tick after a flight, the decisions caused by a flight may not reflect in the monitors "Decisions by Resolution" and "Decisions by Oversight" if the simulation is stopped just after a flight. Also note that, if "decision-structure" and "access-structure" are not set to 0, it may happen that an opportunity hinders the way of an opportunity that wants to fly. In this (very unlikely) case, the monitors "Flights that cause Resolutions" and "Flights that cause oversights" do not actually cause flights or oversights, respectively. The Garbage Can model comes with the following indicators: Problem Jumps The number of times a problem jumps from one opportunity onto another one. This indicator is equivalent to the number of flights; it has been added for compatibility with Cohen, March and Olsen's model. Problem Bindings The length of time a problem cannot be solved, either because it is bound to participants with too low energy or because it is flying away with an opportunity, summed over all problems. Problem Latency The length of time a problem is not bound to an opportunity, summed over all problems. Unsolved Problems If problems exit when a decision is made, then the number of problems in the simulation denotes the number of unresolved problems. This indicator is not available if the parameter "problems-exit?" is OFF. Participant Jumps The number of times a participant leaves an opportunity after staying some time with it. This happens because of a flight. However, this indicator is not equivalent to the number of flights that cause decision-making because several participents may be involved. Participant Bindings The length of time a participant cannot make a decision because involved in problems for which she does not have sufficient energy, summed over all participants. Used Energy The cumulative energy used by all participants involved in decision-making, both by resolution and by oversight. Excess Energy The difference between the cumulative energy used by all participants who resolved problems, multiplied by the efficiency of the solution that they employed, and the cumulative energy of all the problems that they solved. Unexploited Opportunities If opportunities exit when a decision is made, then the number of opportunities in the simulation denotes the number of unexploited occasions for making a choice. This indicator is not available if the parameter "opportunities-exit?" is OFF. Waiting Time If opportunities exit when a decision is made, then the time they spend in the organization measures the time before a decision was made. This indicator is the cumulative lifespan summed over all opportunities. It is not available if the parameter "opportunities-exit?" is OFF. Furthermore, the fraction of decisions made by oversight and resolution is disaggregated with respect to the importance of choice opportunities. If the decision structure is either hierarchical or specialized participants have a degree of importance, meaning that only certain participants are allowed to make use of certain opportunities. Likewise, if the access structure is either hierarchical or specialized problems have a degree of importance, meaning that only certain problems gain access to certain choice opportunities. In both cases, choice opportunities need to be ordered by their importance as well. Thus, the importance of choice opportunities can be used to rank decision-making both when the decision structure is hierarchical or specialized and when the access structure is hierarchical or specialized. The degree of importance of opportunities, just like the degree of importance of participants and problems, is indicated by their identification number. The lowest numbered opportunities are the most important ones. Since the number of opportunities may vary during a simulation, classes of importance are defined in percent terms with respect to the current population of opportunities. Four classes are defined, entailing one fourth of all opportunities each. The indicators that appear at the bottom right of the interface have the following meaning: - %O-I reports the percent of decisions by oversight over total decisions, that are made on opportunities in first class of importance. Class I entails one fourth of all opportunities, the most important ones. - %O-II reports the percent of decisions by oversight over total decisions, that are made on opportunities in the second class of importance. Class II entails one fourth of all opportunities, just less important than those of class I. - %O-III reports the percent of decisions by oversight over total decisions, that are made on opportunities in the third class of importance. Class III entails one fourth of all opportunities, less important than those of class II and yet not the least important ones. - %O-IV reports the percent of decisions by oversight over total decisions, that are made on opportunities in the fourth class of importance. Class IV entails one fourth of all opportunities, the least important ones. - %R-I reports the percent of decisions by resolution over total decisions, that are made on opportunities in first class of importance. Class I entails one fourth of all opportunities, the most important ones. - %R-II reports the percent of decisions by resolution over total decisions, that are made on opportunities in the second class of importance. Class II entails one fourth of all opportunities, just less important than those of class I. - %R-III reports the percent of decisions by resolution over total decisions, that are made on opportunities in the third class of importance. Class III entails one fourth of all opportunities, less important than those of class II and yet not the least important ones. - %R-IV reports the percent of decisions by resolution over total decisions, that are made on opportunities in the fourth class of importance. Class IV entails one fourth of all opportunities, the least important ones. These indicators are not available if opportunities do not exit after decision-making or both the decision structure and the access structure are non segmented. Even if these conditions are satisfied, they remain unavailable until at least one decision is made. Additional information on decision-making can be obtained by switching on "show-details?". If "show-details?" is ON, each time a decision is made a line is printed on the Command Center. Each line says whether the decision was made by oversight or resolution, which agents it involved according to current numbering, which was their identification number at the time they were created as well as the time step when they were created. If the simulation stops because the step specified by "stops-at" is reached, information on the current and original identification numbers of surviving agents is written on the Command Center. If this option is chosen it is advisable to enlarge the Command Center. Finally, the following graphs are available: - Current number of decisions by resolution, current number of decisions by oversight and current number of flights at each simulation step; - Total potential energy available to participants, total effective energy available to participants and total energy required by problems at each simulation step. Total effective energy is defined as the total potential energy multiplied by the average of the efficiency of solutions. 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 energy of problems should not be too different to the energy of participants multiplied by the efficiency of solutions. Depending on energy configuration, maximum differences of one or two units are recommended. With hierarchical or specialized decision 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 energy, sufficiently high values of solution efficiency and sufficiently low values of problem energy. 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 cause decisions by oversight are many more than the flights causing decisions by resolution. The energy of problems affects all the above indicators, all of which measure some aspect of the difficulty of decision-making. Energy distribution influences the outcome of decision-making as well. 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 and access structures. 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 ------------------- In this version of the Garbage Can, the number of agents is exogenous. It might be interesting to devise an evolutionary dynamics of participants, opportunities, solutions and problems. NETLOGO FEATURES ---------------- Note the extensive use of the instruction "without-interruption". This is needed in order to execute a series of instructions sequentially. For instance, a NetLogo code like this: repeat N [ instruction A instruction B ] is equivalent to the following Java or C/C++ code: for (i=0; i