Projects Efficiency

No preview image

1 collaborator

Fab Fabio Baj (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.3 • Viewed 321 times • Downloaded 37 times • Run 0 times
Download the 'Projects Efficiency' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

patches-own [work-to-do priority]

globals [skills effort planned-effort etc billable-work-done efficiency context-switch scenario-descr]

to setup
  clear-all
 reset-ticks
 setup-project
 setup-resources 
;; if ams-tickets [gen-ams-tickets]  
 set planned-effort sum [work-to-do] of patches with [member? pcolor skills]
 describe
end 

to describe
   if scenario = 1
   [ set scenario-descr "Scenario 1:  simple word: one skill type repetitive activity"]
   if scenario = 2   
   [ set scenario-descr (word "Scenario 2:  in this scenario we have three \n" 
                         "parallel projects  \n" 
                         "TRY: change the number of resources that optimizes efficiency  \n" 
                         "" 
                         "")]
    
    
    clear-output
     output-print scenario-descr  
end 

to setup-project
  if scenario = 2
  [set skills  [red  blue  orange ]
      if not override-scenario [set estimate-deviation 0]
 draw-proj  [[blue 0.2][ red 0.3 ][orange 0.5]] 100 -25 10  10 10   
   draw-proj  [[blue 0.3][ red 0.5 ][orange 0.2]] 200 -25 0  10 7   
  draw-proj  [[blue 0.5][ red 0.4 ][orange 0.1]] 100 -25 -10  10 7
  if not override-scenario [set blue-resources   20   set red-resources 10   set orange-resources 15  set AMS-Tickets false]
  ]
  
  
  if scenario = 1[
    set skills  [ blue  ]
     if not override-scenario [set blue-resources   2    set red-resources 0    set orange-resources 0 set yellow-resources 0  
                 set overhead 0 set estimate-deviation 0] ]
   draw-proj  [[blue 0.2]] 100 -25 10  10 10
   

  if scenario = 3
  [set skills  [red  blue  orange]
    if not override-scenario [set estimate-deviation 10]
  draw-proj  [[blue 0.2][ red 0.3 ][orange 0.5]] 100 -25 10  10 10   
   draw-proj  [[blue 0.3][ red 0.5 ][orange 0.2]] 200 -25 0  10 7   
  draw-proj  [[blue 0.5][ red 0.4 ][orange 0.1]] 100 -25 -10  10 7
  if not override-scenario [set blue-resources   13   set red-resources 17   set orange-resources 10  set AMS-Tickets false]
  ]
      

  if scenario = 4
  [set skills  [red  blue  orange yellow]
    if not override-scenario [set estimate-deviation 10]

  draw-proj  [[blue 0.2][ red 0.3 ][orange 0.5]] 100 -25 10  30 10   
   draw-proj  [[blue 0.3][ red 0.5 ][orange 0.2]] 200 -25 0  30 7   
  draw-proj  [[blue 0.5][ red 0.4 ][orange 0.1]] 100 -25 -10  30 7
  if not override-scenario [set blue-resources   12   set red-resources 16  set yellow-resources 10 set ticket-density 11
                            set orange-resources 9  set overhead 0.20 set AMS-Tickets true set dedicated-AMS false]
  ]
  
  if scenario = 5 ;; ams only
  [set skills  [red  blue  orange yellow]
    gen-ams-tickets
  if not override-scenario [set blue-resources   13 set yellow-resources   15   
                             set red-resources 17   set orange-resources 10
                             set estimate-deviation 10 set AMS-Tickets true set overhead 0.25]
  ]
    
    
  ;;ask patches [if (pycor < 18) and (pycor > -2) and (pxcor < -12) and (pxcor > -18)[set pcolor one-of skills   set work-to-do 1 + random 9 set priority random 10]]

  ;; ask patches [if (pycor < 17) and (pycor > 4) and (pxcor < 18) and (pxcor > 4)[set pcolor one-of skills  set work-to-do 1 + random 9  set priority random 10] ]
  ask patches [if (pycor < -17) [ set pcolor green ] ]
end 

to setup-resources

  
  create-turtles orange-resources[ setxy random-xcor random-ycor
    set color  orange
     set shape "persona" ]
  
   create-turtles red-resources [ setxy random-xcor random-ycor
    set color  red
     set shape "persona" ]
   
   create-turtles blue-resources [ setxy random-xcor random-ycor
    set color  blue
     set shape "persona" ]
     
     create-turtles yellow-resources [ setxy random-xcor random-ycor
    set color  yellow
     set shape "persona" ]
  
  
  
  ask turtles [ let pool one-of patches with  [ pcolor = green  and not any? turtles-here]
  if pool != nobody [
     set xcor [pxcor] of pool 
     set ycor [pycor] of pool]]
end 

to find-activity ;; turtle preocedure
  let skill  color
  let new-activity one-of (patch-set
                           patches with [pcolor = skill and not any? turtles-here ] (patch-set patch-here) with [pcolor = skill]) 
                   with-min [prio-dist myself] 
                          
  if new-activity != nobody [
     ;; [pcolor] of patch-here != black mease thatt only when you interrupt an activity due to higer prio is considered context switc context switch
     if new-activity != patch-here  and [pcolor] of patch-here != green   [      ;;project startup is not considere context switch
       ask new-activity [set work-to-do work-to-do + (distance myself * overhead)];; overhead due to context switc
       set context-switch context-switch + 1
      
       ] ;; count context switc. If 
     set xcor [pxcor] of new-activity  ;; move turtle to new activity
     set ycor [pycor] of new-activity]
end 

to go
 if count  patches with [member? pcolor skills] = 0 [stop]
 if ticks >= 365 [stop]
  
 if ams-tickets [gen-ams-tickets]  
 
       
 ;; ask all resources to find and activity to do based on priority and distance
 ask  turtles [find-activity] 
 ;; in this case a resource finishes the asssigned activity before lookin for new activity
 
  
  ;; work on prject activity i tick
  ask patches with [member? pcolor  skills and any? turtles-here] [
      set work-to-do work-to-do - 1
      if work-to-do <= 0 [set pcolor black]
      ]      
   set effort effort + count turtles
   set etc sum [work-to-do] of patches with [member? pcolor skills]

   set billable-work-done (planned-effort - etc)
   set efficiency billable-work-done / effort
   
   
 ;; resources that have finished work go back to pool
  ;;ask  turtles-on patches with [ (pcolor = black)] [back-to-pool]
  
  tick
end 

to-report prio-distance [ x y x1 y1]  ;; nmeric reporterre
 report sqrt((x - x1)^ 2 + (y - y1)^ 2)
end  

to-report prio-dist   [tur]
    ;; patch procedure
    let result sqrt ( (priority   * priority-weigth ) ^ 2 + (distance tur) ^ 2)
 
 report result
end  

to back-to-pool ;; turtle preocedure
  let pool one-of patches with  [ pcolor = green  and not any? turtles-here]
  if pool != nobody [
     set xcor [pxcor] of pool 
     set ycor [pycor] of pool]
end 

to gen-ams-tickets-old
  let sk skills
  if dedicated-ams [set sk [yellow]]
  ask patches with [pcolor = black and random (100 / ticket-density) = 0]
     [set pcolor  one-of sk set work-to-do 1 + random 9
       set priority 1 ]
end 

to gen-ams-tickets
let sk skills
  if dedicated-ams [set sk [yellow]]
ask patches with [pcolor = black and random (10000 / ticket-density) = 0]
     [set pcolor  one-of sk set work-to-do 1 + random 9
       set planned-effort  planned-effort + work-to-do
       set priority 1 ]
end   

to  gen-task-force
  ask patches [if (pycor < -10) and (pycor > -15) and (pxcor < 25) and (pxcor > 10)[
      set pcolor one-of skills   
      set work-to-do 1 + random 9 
      set priority  1
      set planned-effort  planned-effort + work-to-do]
  ]
end 

to draw-proj [skill-list  proj-size x y  wrk prio]
     
     let h 3  ; means the bar is thick k2 patches
     let yy y
     foreach skill-list [
       let pair ?
       set yy yy + 2
       let c item 0 pair
       let p item 1 pair
       let b (proj-size * p) / 2 + 1 
       ask patches [if (pycor > yy) and (pxcor > x) and (pycor < yy + h)and (pxcor < x + b) 
        [ set pcolor c set work-to-do  realistic-work wrk set priority  prio] 
           
        ] 
      ] 
end 

to-report realistic-work [ work] ;; returns work plus or minus 10%
   let w     work + ( random  estimate-deviation - random estimate-deviation) * work / 100
  ;; print w 
   report w 
end 

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

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.