Verification

No preview image

1 collaborator

Default-person Estria Putri (Author)

Tags

(This model has yet to be categorized with any tags)
Part of project 'Emergence of Oligarchy'
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.1 • Viewed 293 times • Downloaded 21 times • Run 0 times
Download the 'Verification' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

extensions [csv]

breed [cooperatives cooperative]
breed [suppliers supplier]
breed [neighbours neighbour]


globals [
  domination.level
  domination
  avg.board.size
  reelected.level
  minority.group
  reelected
  minority.level
  total.avg.board.size
  avg.share
  collective.investment
  community.trust.level
  quorum.level
  participate.level
  attendance.level
  real.market.price
  total-investment
  total-e.generation
  total-e.consumption
  min-invest
  max-invest
  avg-invest
  min-bill
  max-bill
  max-i.benefit
  min-i.benefit
  salary
  ;avg.will.invest
  case
  case.0
  case.1
  case.2
  case.3
  case.4
  case.5
  board.list
  what-to-vote-case
  what-to-vote0
  what-to-vote1
  ;the threshold
  quorum
  no.supplier
  pareto
  assembly.decision
  tariff
  member.discount
  voteboard.list
  majority
  rule.vote
  avg.participate
  diff
  real.tariff

  min-balance
  max-balance
  what.to.vote
  lhsExperimentNumber
  lhs
  work.hour
]

cooperatives-own[
  will.participate
  investment.list
  board ; 1 board 0 member
  e.consumption; kWh
  e.generation ; kWh
  time.avail
  education
  balance
  attendance
  influence
  community.trust
  env.concern
  e.independence
  investment ; €
  percieved.cost
  percieved.benefit
  reduced.bill
  market.price
  outcome.discrepancy
  cb
  decisions
  invest.thres
  collect.aspiration
  numb.connection
  candidature
  connection.list
  e.bill
  invest.benefit
  c.income
  this.year
  real.cost
  real.benefit
  real.cb
  add.econsumption
  my.collective.investment
  this.year.collect
]

suppliers-own[
 income
 balance.supp

]

neighbours-own [
  n.balance
  n.education
  n.time.avail
  n.env.concern
  n.e.independence
  n.will.participate
  n.community.trust
]

to load-experiment

  set lhs csv:from-file "lhsExperiment2.csv"
  let currentExperiment item lhsExperimentNumber lhs

  ;creation other global variables
  set attendance.thres item 0 currentExperiment
  set investment.thres item 1 currentExperiment
  set reduced.bill.thres item 2 currentExperiment
  set withdrawal.thres item 3 currentExperiment
  set subsidy item 4 currentExperiment
  set discrepancy.thres item 5 currentExperiment
  set coverage item 6 currentExperiment
  set mean.initial.conn item 7 currentExperiment
  set initial.balance.std item 8 currentExperiment
  set c.income.std item 9 currentExperiment
  set std.econsumption item 10 currentExperiment
end 

to setup
clear-all
  ;creation of cooperatives
  create-cooperatives 200 [
    setxy random-xcor random-ycor
    set shape "dot"
    set color blue
    set balance random-normal 10000 initial.balance.std
    set decisions []
    set collect.aspiration []
    set attendance 1
    set education 1 + random 3
    set time.avail random-normal 30 10
    set env.concern 0.1 + random-float 0.9
    set e.independence 0.1 + random-float 0.9
    set investment.list []
    set e.consumption random-normal 6570 std.econsumption ;6570
    set add.econsumption (random-normal 0.2 0.1) * e.consumption
    set outcome.discrepancy 1
    set work.hour 6
    set c.income random-normal 1500 c.income.std
    set size 0.5
  ]

  ;place cooperatives in social network
  ask cooperatives [
    set numb.connection 1 + min (list 199 (int (random-exponential mean.initial.conn)))
    set connection.list other n-of numb.connection cooperatives
    foreach (list connection.list) [[x] -> ask x [create-link-with myself [set color gray]]]
  ]
  set pareto par
  foreach (list cooperatives with [numb.connection >= pareto]) [[x] -> ask x [
    ask my-links [set color red]]]


  ;creation of the neigbours
  create-neighbours 100 [
    setxy random-xcor random-ycor
    set shape "triangle"
    set color white
    set size 0.5
    set n.balance random-normal 10000 initial.balance.std
    set n.education 1 + random 3
    set n.time.avail random-normal 30 10
    set n.env.concern 0.1 + random-float 0.9
    set n.e.independence 0.1 + random-float 0.9
  ]

  ;creation of energy supplier
  create-suppliers 1 [
    set balance.supp 10000000
    ]

  ;setup of the globals
  set case.0 [[] -> c.case.0]
  set case.1 [[] -> c.case.1]
  set case.2 [[] -> c.case.2]
  set case.3 [[] -> c.case.3]
  set case (list case.0 case.1 case.2 case.3 case.4)

  set what-to-vote0 [[] -> d.case.0]
  set what-to-vote1 [[] -> d.case.1]
  set what.to.vote (list what-to-vote0 what-to-vote1)



  set quorum 1
  set no.supplier 0
  set salary 0
  set tariff 0.1903
  set member.discount 17.5
  set real.market.price 0.035
  set real.tariff 0.0377
  set diff tariff - real.tariff
  reset-ticks
end 

to go
  ask cooperatives [implement-decisions]
  ask cooperatives [evaluate-decision]
  what-to-vote; the board decides what to vote for the next general meeting
  ask cooperatives [define-aspiration];defining aspiration ==> first set the individual aspiration, then influence each other
  vote ;voting procedure : make decision.list, board.list (set board 0)
  eoy ;==> for cooperative and energy supplier
  tick
end 

to implement-decisions
  ;decision list contains either
  ;case 0 invest privately
  ;case 1 invest collectively
  ;case 2 go out from energy supplier
  ;case 3 no one or less than 3 persons to be candidate
  ;set decisions (list case.0 case.1 case.2 case.3 case.4 case.5) ===>>> don't forget this the end of voting procedure and sort


;1. implement the decision that has been decided at last-year general assembly
  set this.year 0
  set this.year.collect 0
  print (word self "decisions" decisions)
  if decisions != [][
  let n length decisions - 1
  let token 0
  while [token <= n] [
  run item (read-from-string (item (token) decisions)) case
  set token token + 1]
  ]

;2. calculate the bill
  ;= calculate the expected electricity bill

  set e.bill bill tariff e.consumption e.generation member.discount subsidy
  set invest.benefit i.benefit e.bill e.consumption
  set min-i.benefit min [invest.benefit] of cooperatives
  set max-i.benefit max [invest.benefit] of cooperatives
  set min-bill min [reduced.bill] of cooperatives
  set max-bill max [reduced.bill] of cooperatives

  ;if they are board they know a bit better the market price
  ifelse board = 1 [
    ifelse no.supplier = 0 [
    set market.price (1 + random-normal 0.3 0.1 - random-normal 0.3 0.1 ) * real.market.price
      set reduced.bill r.bill tariff market.price]
    [set market.price real.market.price set reduced.bill r.bill tariff market.price  ]
  ]
  [set market.price (1 + random-normal 0.6 0.1 - random-normal 0.6 0.1) * real.market.price
   set reduced.bill r.bill tariff market.price
  ]

;3. calculate the investment
  foreach (list cooperatives) [[x] -> ask x[
    set total-investment total-investment + investment
    set total-e.generation total-e.generation + e.generation
    set total-e.consumption total-e.consumption + e.consumption
    ]
  ]
  set min-invest min [investment] of cooperatives
  set max-invest max [investment] of cooperatives
  set avg-invest mean [investment] of cooperatives
  set min-balance min [balance] of cooperatives
  set max-balance max [balance] of cooperatives
end 

to evaluate-decision
;1. cost benefit
  set percieved.cost cost c.income investment board this.year
  set percieved.benefit benefit e.bill e.consumption reduced.bill salary decisions
  set cb percieved.benefit - percieved.cost

  set real.cost co c.income investment board this.year
  set real.benefit be e.bill e.consumption reduced.bill salary decisions
  set real.cb real.benefit - real.cost

;2. update community.trust variable and all the willingness
  set community.trust trust quorum attendance
  set will.participate participate community.trust env.concern e.independence education
  set avg.participate mean [will.participate] of cooperatives

;3. the influence
  set influence power will.participate education numb.connection balance
end 

to what-to-vote
  let board.choice []
  set what-to-vote-case []
  foreach (list cooperatives with [board = 1]) [[x] -> ask x[
    if balance > 0 [
      if will.participate >= investment.thres [
        set board.choice fput "0" board.choice]]
    if reduced.bill > reduced.bill.thres [
      set board.choice fput "1" board.choice
    ]
  ]]
  ;print board.choice
  set what-to-vote-case sort modes board.choice
  ;print (word "whattovote" what-to-vote-case)
end 

to define-aspiration

  set decisions []
  set collect.aspiration []

  if what-to-vote-case != [][
  let n length what-to-vote-case - 1
  let token 0
  while [token <= n] [
  run item (read-from-string (item (token) what-to-vote-case)) what.to.vote
  set token token + 1]
  ]

  set decisions sort decisions
  set collect.aspiration sort collect.aspiration
  print (word "i am" self "collect.aspiration" collect.aspiration "influence" influence)
end 

to vote
 ;1.
  ;withdrawal from the membership
  ; sharing aspiration
  set domination 0
  foreach (list cooperatives) [[x] -> ask x [
    if will.participate <= withdrawal.thres and cb < 0 [die]
    if any? connection.list with [influence > [influence] of myself][
    print (word "iAM" self "collect.aspi" [collect.aspiration] of self "influencer" [collect.aspiration] of last sort-on [influence] connection.list with [influence > [influence] of myself] )
    if [collect.aspiration] of last sort-on [influence] connection.list with [influence > [influence] of myself] != [collect.aspiration] of self and
    [board] of last sort-on [influence] connection.list with [influence > [influence] of myself] = 1 [set domination domination + 1]
    set collect.aspiration [collect.aspiration] of last sort-on [influence] connection.list with [influence > [influence] of myself]
]
  ]]

  set assembly.decision []
  let candidate.list []
  set voteboard.list []
  let my.choice []

   ;2. do u want to attend the general assembly?
  foreach (list cooperatives) [[x] -> ask x [
    set candidature 0
    set attendance 0
    ifelse board = 1 [set attendance 1]
    [ifelse time.avail > attendance.thres and will.participate > (withdrawal.thres + 0.1) ;maybe average will participate??
      [set attendance 1]
      [set attendance 0]  ] ]]

  ; 3. do u want to be a leader?
  ;=set the potential leader
  foreach (list cooperatives with [ time.avail >= work.hour and investment >= avg-invest and education >= 2
    and will.participate >= avg.participate and numb.connection >= pareto ]) [[x] -> ask x [
      set candidature 1]]

  if length (list [who] of cooperatives with [candidature = 1]) < 3 [
    foreach (list cooperatives with [ time.avail >= work.hour and  will.participate >= avg.participate and numb.connection >= pareto ]) [[x] -> ask x [
      set candidature 1]]
  ]

  set candidate.list [who] of cooperatives with [candidature = 1]
  print (word "candidate.list" candidate.list)
  print length candidate.list

  ;4. the voting for board
  if length candidate.list < 3[
    foreach (list cooperatives) [[x] -> ask x[
      if balance > ((salary * count cooperatives with [board = 1]) / count cooperatives) [
        set collect.aspiration lput "3" collect.aspiration]]]
    foreach (list cooperatives with [board = 1]) [[x] -> ask x[ set candidature 1]]]

    ;== ask the member to determine their choice
    foreach (list cooperatives with [attendance = 1]) [[x] -> ask x[
    ifelse candidature = 1
    [set my.choice [who] of self]
    [set my.choice [who] of cooperatives with [candidature = 1 and (collect.aspiration = [collect.aspiration] of myself
          or link-with myself = true) and education >= 2]
     if empty? my.choice [
      set my.choice [who] of cooperatives with [candidature = 1]]]
    set voteboard.list sentence my.choice voteboard.list
    set board 0
]]
   print voteboard.list; need to be deleted!!
   set majority n-of (min (list 3 length modes voteboard.list)) modes voteboard.list
   print (word "majority" majority) ; need to be deleted!!

    ;=set the board
    ;for the candidate
    ifelse length majority >= 3 [
    foreach (list cooperatives with [candidature = 1]) [[x] -> ask x[
       ifelse item 0 majority = [who] of self or item 1 majority = [who] of self or item 2 majority = [who] of self
      [set board 1 set size size + 0.5]
      [set board 0]
    ]]]
  [ifelse length majority = 2 [
    foreach (list cooperatives with [candidature = 1]) [[x] -> ask x[
      ifelse item 0 majority = [who] of self or item 1 majority = [who] of self
      [set board 1 set size size + 0.5]
      [set board 0]
    ]]]

    [foreach (list cooperatives with [candidature = 1]) [[x] -> ask x[
      ifelse item 0 majority = [who] of self
      [set board 1 set size size + 0.5]
      [set board 0]]]]
  ]

  ;for non candidate
  foreach (list cooperatives with [candidature = 0]) [[x] -> ask x [
    set board 0]]

  if count cooperatives with [board = 1] = 0 [
    ifelse any? cooperatives with [size >= avg.board.size] [
    ask cooperatives with [size >= avg.board.size]
      [set board 1 set size size + 0.5]]
    [ask cooperatives with [size > 0.5] [set board 1 set size size + 0.5]]
  ]


  ;3. is quorum?
  ifelse count cooperatives with [attendance = 1] >= 2 / 3 * (count cooperatives)[
    set quorum 1
    run [[] -> vote.case0]; 50+1
  ]
  [ set quorum 0
    run [[] -> vote.case1]; 2/3
  ]
  print quorum
end 

to eoy
;1. update decision list each cooperatives
  foreach (list cooperatives) [[x] -> ask x[
    set decisions sentence assembly.decision decisions
    set decisions sort decisions
    set balance balance + c.income - e.bill
    set e.consumption e.consumption + add.econsumption
  ]]
;print (word "ass.dec" assembly.decision)
;2. update balance of supliers
  ask suppliers [
    set income max (list 0 (real.tariff * (total-e.consumption - total-e.generation))) -
    max (list 0 (real.market.price * (total-e.consumption - total-e.generation))) +
    max (list 0 (real.market.price * (total-e.generation - total-e.consumption))) -
    count cooperatives * member.discount
    set balance.supp balance.supp + income
    ;if they loss they have to increase the tariff
    if income <= 0 [
      ;if balance still positive, they eliminate the member discount
      ;if not they increase the market price
      ifelse balance.supp > 0 [
        set member.discount max (list 0 ((1 - random-float 1) * member.discount))]
      [ let increase real.market.price * random-float 0.5
        set real.tariff real.market.price * (1 + increase)
        set tariff tariff * (1 + increase)
      ]
    ]
  ]

;3. creation of new connection
  foreach (list cooperatives with [attendance = 1]) [[x] -> ask x[
    make-node find-partner
  ]]

;4. set the pareto
  ; = make the list, sort in decending order, calculate the total
  set pareto par
  foreach (list cooperatives with [numb.connection >= pareto]) [[x] -> ask x [
    ask my-links [set color red]]]

;5. add new member
  ask n-of 10 neighbours [
    set n.will.participate participate n.community.trust n.env.concern n.e.independence n.education
    let surround.benefit 0
    let surround.cost 0
    foreach (list cooperatives-on neighbors) [[x] -> ask x[
      set surround.benefit surround.benefit + percieved.benefit
      set surround.cost surround.cost + percieved.cost]]
    if surround.benefit > surround.cost and n.will.participate > withdrawal.thres [
      hatch-cooperatives 1
      [ setxy [xcor] of myself [ycor] of myself
        new-member
      ]
    die ]
  ]
;6. oligarchy track
  ifelse count cooperatives with [board = 1] > 0 [
  set avg.board.size mean [size] of cooperatives with [board = 1]
  set reelected avg.board.size / 0.5]
  [set avg.board.size 0.5 set reelected 0]
  set minority.group count cooperatives with [size >= avg.board.size] / count cooperatives
  set minority.level minority.level + minority.group
  set total.avg.board.size total.avg.board.size + avg.board.size
  set reelected.level reelected.level + reelected
  set domination.level domination.level + (domination / count cooperatives)
  set collective.investment sum [my.collective.investment] of cooperatives
  set avg.share collective.investment / count cooperatives
  set community.trust.level community.trust.level + (mean [community.trust] of cooperatives)
  set quorum.level quorum.level + quorum
  set participate.level participate.level + avg.participate
  set attendance.level attendance.level + (count cooperatives with [attendance = 1] / count cooperatives)
end 


;;;;;;;;;;;;;;;;;;;;;;;;;;additional procedure;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to make-node [new-partner]
  if new-partner != nobody [
    create-link-with new-partner
    set numb.connection numb.connection + 1
    set connection.list (turtle-set connection.list new-partner )
    ask new-partner [set numb.connection numb.connection + 1
    set connection.list (turtle-set connection.list myself)]
  ]
end 

to new-member ; more or less same with setup procedure
  set shape "dot"
  set color blue
  set size 0.5
  set balance [n.balance] of myself
  set decisions []
  set decisions sentence assembly.decision decisions
  set collect.aspiration []
  set attendance 1
  set education [n.education] of myself
  set time.avail [n.time.avail] of myself
  set env.concern [n.env.concern] of myself
  set e.independence [n.e.independence] of myself
  set investment.list []
  set e.consumption random-normal 6570 std.econsumption
  set add.econsumption (random-normal 0.2 0.1) * e.consumption
  set outcome.discrepancy 1
  set numb.connection 1 + min (list 199 (int (random-exponential mean.initial.conn)))
  set connection.list other n-of numb.connection cooperatives
  set c.income random-normal 1500 c.income.std
  foreach (list connection.list) [[x] -> ask x [create-link-with myself [set color gray]]]
end 



;;;;;;;;;;;;;;;;;;;;;;;;;;here where I store some functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to-report find-partner
  report one-of cooperatives with [attendance = 1 and numb.connection > [numb.connection] of myself]
end 

to-report initial-connection [a]
  report n-of a cooperatives
end 

to-report participate [ a b c d] ; formula to calculate willingness to participate
  ;community.trust env.concern e.independence education
  let willingness.p 0.307 + 0.271 * a +  0.147 * b + 0.158 * c + 0.117 * (d / 4)
  report willingness.p
end 

to-report bill [a b c d f]; tariff, e.consumption, e.generation, member.discount, subsidy
  let payment 0
  if b > c
  [ifelse no.supplier = 0 [
    set payment (a * (b - c)) - d - (f * c)]
    [set payment ((market.price + diff) * (b - c)) - (f * c)]]

  if c > b
  [ifelse no.supplier = 1 [
    set payment  (- (((c - b) * (market.price - diff)) + (f * c)))]
    [set payment (- (((a - diff) * (c - b)) + (f * c)))
  ]]
  report payment
end 

to-report cost [a b c d] ;c.income investment board this.year
  ; my cost from inside factor
  ; what i invest compare with my balance
  let ori d / a

  ;my cost from outside factor
  let invest 0
  let time.cost 0
  let skill.cost 0
  let perception-min-invest 0
  let perception-max-invest 0
  set perception-min-invest min-invest * (1 + random-float 0.05 - random-float 0.05)
  set perception-max-invest max-invest * (1 + random-float 0.05 - random-float 0.05)

  ;somehow i know better about my cost if im the board
  ifelse c = 1 [
    print (word self "im here")
    set invest max (list 0 (b - min-invest)) / max (list 1 (max-invest - min-invest)) ; how my cost of investment compared with others
    set time.cost work.hour / time.avail
    set skill.cost 1
  ][
    ;because the do not know others investment so the min and max is merely approximation
    set invest max (list 0 (b - perception-min-invest))/ max (list 1 (perception-max-invest - perception-min-invest))
    ;ifelse ticks != 0 [set time.cost 0.2] [set time.cost 0]
    set time.cost 0
    set skill.cost 0
  ]
  let total.cost max (list 0 ((ori + invest + time.cost + skill.cost) / 4))
  print (word "ori" ori "invest" invest "time.cost" time.cost "skill.cost" skill.cost)
  report total.cost
end 

to-report benefit [a b c d f]; e.bill e.consumption reduced.bill salary decisions
  ; my benefit from inside factor
  ; what i pay with investment and what i pay without investment
  let ori invest.benefit

  ;my benefit from outside factor
  ;percieved benefit to stay with supplier
  let motivation.benefit 0
  let salary.benefit 0
  let perception-min-bill 0
  let perception-max-bill 0
  set perception-min-bill min-bill * (1 + random-float 0.05 - random-float 0.05)
  set perception-max-bill max-bill * (1 + random-float 0.05 - random-float 0.05)
  let r.bill.benefit (max (list 0 (c - perception-min-bill))) / (max (list 1 (perception-max-bill - perception-min-bill)))
  if d > 0[
    ifelse board = 1 [
      set salary.benefit 1]
      [ set salary.benefit 0]
    ]
  if f != [] [
  if item 0 f = "0" or item 0 f = "1" ; invest privately or invest collectively
        [set motivation.benefit 1]]
  let total.benefit max (list 0 ((ori + c + r.bill.benefit + motivation.benefit + salary.benefit) / 5))
  report total.benefit
end 

to-report i.benefit [a b]; e.bill e.consumption
  let ori ((tariff * b) - a) / (max (list 1 (tariff * b)))
  report ori
end 

to-report r.bill [a b]; tariff market.price
  let profit ((a - (b + diff)))
  report profit
end 

to-report trust [a b] ; quorum attendance
  let outcome 0
  let number.neigh max (list 1 (round (coverage * count connection.list)))
  if any? connection.list [
  foreach (list n-of number.neigh connection.list) [[x] -> ask x [
    set outcome outcome + abs (percieved.benefit - percieved.cost)
    ]
  ]]

  let avg outcome / number.neigh
  let discrepancy (avg - [cb] of self)

  ifelse any? connection.list [
  if abs (discrepancy) > discrepancy.thres [
    set outcome.discrepancy outcome.discrepancy - abs (discrepancy)
  ]]
  [set outcome.discrepancy outcome.discrepancy]
  ;show outcome.discrepancy
  ;if outcome.discrepancy < 0 [set outcome.discrepancy 0]
  let believe (a + outcome.discrepancy + b) / 3
  report believe
end 

to-report power [a b c d]; will.participate education numb.connection investment
  let max.connection max [numb.connection] of cooperatives
  let min.connection min [numb.connection] of cooperatives
  let conn (c - min.connection) / max (list 1 (max.connection - min.connection))
  let money (d - min-balance) / max (list 1 (max-balance - min-balance))
  report (a + (b / 4) + conn + money) / 4
end 

to-report par
  let connect.list sort-by > [numb.connection] of cooperatives
  ; = make cummulative list
  let n length connect.list - 2
  let token 0
  let cumm.list (list item 0 connect.list)
  while [n != token] [
  set cumm.list lput (item token cumm.list + item (token + 1) connect.list) cumm.list
  print (word "cumm.list" cumm.list)
  set token token + 1]
  ; = check in every item whether the satisfy 0.8 of total, store the value
  let pareto.list []
  foreach cumm.list [[x] -> set pareto.list lput precision (x / sum [numb.connection] of cooperatives) 1 pareto.list]
  print (word "pareto.list" pareto.list)
  report item (position 0.2 pareto.list) connect.list
end 

to-report co [a b c d] ;c.income investment board this.year
   ; my cost from inside factor
  ; what i invest compare with my balance
  let ori d / a

  ;my cost from outside factor
  let invest 0
  let time.cost 0
  let skill.cost 0
  let perception-min-invest 0
  let perception-max-invest 0
  set perception-min-invest min-invest
  set perception-max-invest max-invest

  ;somehow i know better about my cost if im the board
  ifelse c = 1 [
    set invest max (list 0 (b - min-invest)) / max (list 1 (max-invest - min-invest)) ; how my cost of investment compared with others
    set time.cost work.hour / time.avail
    set skill.cost 1
  ][
    ;because the do not know others investment so the min and max is merely approximation
    set invest max (list 0 (b - perception-min-invest))/ max (list 1 (perception-max-invest - perception-min-invest))
    ;ifelse ticks != 0 [set time.cost 0.2] [set time.cost 0]
    set time.cost 0
    set skill.cost 0
  ]
  let total.cost max (list 0 ((ori + invest + time.cost + skill.cost) / 4))
  report total.cost
end 

to-report be [a b c d f]; e.bill e.consumption reduced.bill salary decisions
  ; my benefit from inside factor
  ; what i pay with investment and what i pay without investment
  let ori invest.benefit

  ;my benefit from outside factor
  ;percieved benefit to stay with supplier
  let motivation.benefit 0
  let salary.benefit 0
  let perception-min-bill 0
  let perception-max-bill 0
  set perception-min-bill min-bill
  set perception-max-bill max-bill
  let r.bill.benefit (max (list 0 (c - perception-min-bill))) / (max (list 1 (perception-max-bill - perception-min-bill)))
  if d > 0[
    ifelse board = 1 [
      set salary.benefit 1]
      [ set salary.benefit 0]
    ]
  if f != [] [
  if item 0 f = "0" or item 0 f = "1" ; invest privately or invest collectively
        [set motivation.benefit 1]]
  let total.benefit max (list 0 ((ori + c + r.bill.benefit + motivation.benefit + salary.benefit) / 5))
  report total.benefit
end 

to-report add [a b]
  report random-normal a b
end 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;here where I store some cases;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;each cases

to c.case.0; invest private
  print (word self "im here" "case.1")
  ;update e.generation 20.000 for 10 - 15 years, capacity 3kW = 5600 kWh ;!!! add to assumption
  set e.generation e.generation + 5600
  ;update investment
  set investment investment + 20000
  ;update balance
  set balance balance - 20000
  ;update list of investment
  set investment.list fput 1 investment.list
  set this.year this.year + 20000
end 

to c.case.1 ; invest collective
  print (word self "im here" "case.1")
  if balance > 325 [
  ;update e.generation 225  kWh/year
  set e.generation e.generation + 225
  set investment investment + 325
  ;update balance
  set balance balance - 325
  ;update list of investment
  set investment.list fput 2 investment.list
  set my.collective.investment my.collective.investment + 1
  set this.year this.year + 325
  set this.year.collect this.year.collect + 1]
end 

to c.case.2 ; go out energy supplier
  print (word self "im here" "case.1")
  set market.price real.market.price
;  ;update work.hour
;  set work.hour work.hour + 6
;  set candidature.thres candidature.thres + 0.1
;  ;update no.supplier
;  set no.supplier 1
;  ;update market.price = real.market.price for the board
;  foreach (list cooperatives) [[x] -> ask x [set market.price real.market.price]]
;  set tariff diff
;  set member.discount 0
;  ask suppliers [die]
end 

to c.case.3 ; give salary
  print (word self "im here" "case.1")
  ;update salary
;  set salary salary + 200
;  set candidature.thres candidature.thres - 0.1
  let numb.board count cooperatives with [board = 1]
  set balance balance - ((salary * numb.board) / (count cooperatives))
  if board = 1 [
    set balance balance + salary ]
end 

to vote.case0; in case quorum is satisfied [1]
  set rule.vote []
  foreach (list cooperatives with [attendance = 1]) [[x] -> ask x [set rule.vote sentence collect.aspiration rule.vote]]
  print rule.vote
  let attendance.list count cooperatives with [attendance = 1]
  if length filter [[i] -> i = "1"] rule.vote > 0.5 * attendance.list
  [set assembly.decision fput "1" assembly.decision ]
  if length filter [[i] -> i = "2"] rule.vote > 0.5 * attendance.list
  [set assembly.decision fput "2" assembly.decision
  set work.hour work.hour + 6
  set no.supplier 1
  set tariff diff
  set member.discount 0
  ask suppliers [die]]
  if length filter [[i] -> i = "3"] rule.vote > 0.5 * attendance.list
  [set assembly.decision fput "3" assembly.decision
    set salary salary + 200]
  set assembly.decision sort assembly.decision
  print (word "assembly.decision" assembly.decision)
end 

to vote.case1 ; in case quorum is not satisfied [0]
  set rule.vote []
  foreach (list cooperatives with [attendance = 1]) [[x] -> ask x [set rule.vote sentence collect.aspiration rule.vote]]
  ;print rule.vote
  let attendance.list count cooperatives with [attendance = 1]
  if length filter [[i] -> i = "1"] rule.vote > 2 / 3 * attendance.list
  [set assembly.decision fput "1" assembly.decision ]
  if length filter [[i] -> i = "2"] rule.vote > 2 / 3 * attendance.list
  [set assembly.decision fput "2" assembly.decision
  set work.hour work.hour + 6
  ;set candidature.thres candidature.thres + 0.1
  set no.supplier 1
  set tariff diff
  set member.discount 0
  ask suppliers [die]]
  if length filter [[i] -> i = "3"] rule.vote > 2 / 3 * attendance.list
  [set assembly.decision fput "3" assembly.decision
    set salary salary + 200]
  set assembly.decision sort assembly.decision
print (word "assembly.decision" assembly.decision)
end 

to d.case.0
  print (word "i am" self "d.case.0")
  if balance > 0 [
  if will.participate >= investment.thres
  [
    ifelse balance > 20000 [set decisions fput "0" decisions ]
    [if balance > 325 [set collect.aspiration fput "1" collect.aspiration]]
  ]]
end 

to d.case.1
  print (word "i am" self "d.case.1")
  if reduced.bill > reduced.bill.thres
    [ set collect.aspiration fput "2" collect.aspiration]
end 

There is only one version of this model, created over 7 years ago by Estria Putri.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.