makers schedule

makers schedule preview image

1 collaborator

Default-person Martin Bartsch (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 23 times • Downloaded 0 times • Run 0 times
Download the 'makers schedule' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NetLogo Model: Maker’s vs. Manager’s Schedule (Block Logic)
; Features:
; 1) "Meeting-free Wednesday" -> optional skip meetings on day mod 7 = 2
; 2) Teleport to MeetingZone for participants
; 3) Daily and average daily outputs for Maker & Manager
;
; Author: mabasoft, Martin Bartsch with support from ChatGPT
; date 2025_01_22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

globals [
  tick-in-block              ; hour within the 4-hour block (0..3)
  block-index                ; which block of the day (0=morning,1=afternoon)
  day                        ; day counter (increments after every 8 ticks)
  total-productivity         ; daily total (Maker+Manager)
  daily-maker-output         ; daily sum of all makers
  daily-manager-output       ; daily sum of all managers

  cumulative-maker-output    ; sum of all maker outputs over entire sim
  cumulative-manager-output  ; sum of all manager outputs over entire sim

  average-maker-output       ; cumulative-maker-output / number-of-days
  average-manager-output     ; cumulative-manager-output / number-of-days

  meeting-count              ; total meetings so far
]

patches-own [
  zone  ; "work" or "meeting"
]

turtles-own [
  is-manager?
  has-lost-block?     ; true if the maker was interrupted in current block
  my-daily-output
]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; INTERFACE SWITCH/SLIDERS (example)
;
; Sliders:
;  - number-of-makers
;  - number-of-managers
;  - meeting-frequency
;  - maker-meeting-prob
;  - maker-block-value
;  - manager-tick-value
;  - manager-meeting-cost
; Switch:
;  - meeting-free-wednesday?
;
; Additional monitors/plots for daily/average outputs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup
  clear-all
  set day 0
  set tick-in-block 0
  set block-index 0
  set meeting-count 0

  set daily-maker-output 0
  set daily-manager-output 0
  set total-productivity 0

  set cumulative-maker-output 0
  set cumulative-manager-output 0
  set average-maker-output 0
  set average-manager-output 0

  ; Setup patch zones: left half = "work", right half = "meeting"
  ask patches [
    ifelse pxcor < (max-pxcor / 2) [
      set zone "work"
      set pcolor green    ;; z.B. grün für Arbeitsbereich
    ] [
      set zone "meeting"
      set pcolor gray     ;; z.B. grau für Meetingzone
    ]
  ]

  ; Create Maker Turtles
  create-turtles number-of-makers [
    set is-manager? false
    set shape "person"
    set color blue
    set has-lost-block? false
    set my-daily-output 0
    ; Place them randomly in work zone
    let work-p one-of patches with [ zone = "work" ]
    move-to work-p
  ]

  ; Create Manager Turtles
  create-turtles number-of-managers [
    set is-manager? true
    set shape "person"
    set color red
    set has-lost-block? false  ; not used for managers, but keep consistent
    set my-daily-output 0
    ; place them randomly in work zone
    let work-p one-of patches with [ zone = "work" ]
    move-to work-p
  ]

  reset-ticks
end 

to go
  ; Each tick = 1 hour
  ; We have 8 ticks per day (2 blocks of 4 hours)

  if (ticks mod 8 = 0) and (ticks > 0) [
    finalize-day
  ]

  ; 1) Possibly start a meeting (unless it's "meeting-free Wednesday")
  if (random-float 1.0 < meeting-frequency) [
    ; Check if day mod 7 = 2 => Wednesday
    if not (meeting-free-wednesday? and ((day mod 7) = 2)) [
      start-meeting
    ]
  ]

  ; 2) Manager productivity if no meeting cost is subtracted
  ;    We only do it once per tick. The meeting cost was handled inside start-meeting.
  ask turtles with [ is-manager? ] [
    ; + manager-tick-value each hour
    set my-daily-output my-daily-output + manager-tick-value
  ]

  ; 3) Handle Block progression
  set tick-in-block tick-in-block + 1
  if tick-in-block = 4 [
    finalize-block
    set tick-in-block 0
    set block-index block-index + 1
    if block-index = 2 [
      set block-index 0
    ]
  ]

  tick
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; MEETING LOGIC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to start-meeting
  ; managers always attend
  let mgr-participants turtles with [ is-manager? ]
  ; random subset of makers
  let mk-participants turtles with [
    (not is-manager?) and (random-float 1.0 < maker-meeting-prob)
  ]

  let all-participants (turtle-set mgr-participants mk-participants)

  if any? all-participants [
    set meeting-count meeting-count + 1

    ; Move participants to meeting zone for visual effect
    ask all-participants [
      let meet-p one-of patches with [ zone = "meeting" ]
      if meet-p != nobody [ move-to meet-p ]
    ]

    ; Managers lose manager-meeting-cost
    ask all-participants with [ is-manager? ] [
      set my-daily-output my-daily-output - manager-meeting-cost
      if my-daily-output < 0 [ set my-daily-output 0 ]
    ]

    ; Makers lose entire block
    ask all-participants with [ not is-manager? ] [
      set has-lost-block? true
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; BLOCK COMPLETION
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to finalize-block
  ; award block-value to any maker who wasn't interrupted
  ask turtles with [ not is-manager? ] [
    if not has-lost-block? [
      set my-daily-output my-daily-output + maker-block-value
    ]
    set has-lost-block? false
    ; Teleport back to "work" zone at block end
    let work-p one-of patches with [ zone = "work" ]
    if work-p != nobody [ move-to work-p ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; DAY COMPLETION
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to finalize-day
  set daily-maker-output sum [ my-daily-output ] of turtles with [ not is-manager? ]
  set daily-manager-output sum [ my-daily-output ] of turtles with [ is-manager? ]
  set total-productivity (daily-maker-output + daily-manager-output)

  ; Update cumulative outputs
  set cumulative-maker-output (cumulative-maker-output + daily-maker-output)
  set cumulative-manager-output (cumulative-manager-output + daily-manager-output)

  ; Increase day count
  set day (day + 1)

  ; Recompute average daily outputs
  ; day is now the count of days that have fully finished
  ; so we can do (cumulative / day)
  if day > 0 [
    set average-maker-output (cumulative-maker-output / day)
    set average-manager-output (cumulative-manager-output / day)
  ]

  ; optional: reset everyone's my-daily-output for the new day
  ask turtles [
    set my-daily-output 0
  ]
end 

There is only one version of this model, created 8 days ago by Martin Bartsch.

Attached files

File Type Description Last updated
makers schedule.png preview Preview for 'makers schedule' 8 days ago, by Martin Bartsch Download

This model does not have any ancestors.

This model does not have any descendants.