Balancing of Utility in Palmoil Supply chain model
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This section could give a general understanding of what the model is trying to show or explain.
tes
HOW IT WORKS
This section could explain what rules the agents use to create the overall behavior of the model.
HOW TO USE IT
This section could explain how to use the model, including a description of each of the items in the interface tab.
THINGS TO NOTICE
This section could give some ideas of things for the user to notice while running the model.
THINGS TO TRY
This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.
EXTENDING THE MODEL
This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.
NETLOGO FEATURES
This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.
RELATED MODELS
This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
CREDITS AND REFERENCES
This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.
Comments and Questions
globals [
gcounter
gcounter2
gupetani
gupedagang
gupabrcpo
gupabrminygor
gudistributor
gw1_1petani
gw2_1petani
gw1_2petani
gw2_2petani
gw1_1pedagang
gw2_1pedagang
gw1_2pedagang
gw2_2pedagang
gw1_1pabrcpo
gw2_1pabrcpo
gw1_2pabrcpo
gw2_2pabrcpo
gw1_1pabrminygor
gw2_1pabrminygor
gw1_2pabrminygor
gw2_2pabrminygor
gw1_1distributor
gw2_1distributor
gw1_2distributor
gw2_2distributor
gformulayl1petani
gformulayl1pedagang
gformulayl1pabrcpo
gformulayl1pabrminygor
gformulayl1distributor
gformulayl2petani
gformulayl2pedagang
gformulayl2pabrcpo
gformulayl2pabrminygor
gformulayl2distributor
gntpetani
gntpedagang
gntpabrcpo
gntpabrminygor
gntdistributor
gntriilpetani
gntriilpedagang
gntriilpabrcpo
gntriilpabrminygor
gntriildistributor
gu_total
gnt_total
gntriil_total
gselisih
]
turtles-own [
risiko
investasi
u1
u2
formulayl1
formulayl2
nt
ntriil
alpha
w1_1
w1_2
w2_1
w2_2
alphawx1
alphawx2
]
breed [petani]
breed [pedagang]
breed [pabrik_cpo]
breed [pabrik_minygor]
breed [distributor]
breed [konsumen]
to do_setup
clear-all
if file-exists? "hasilutil.csv"
[file-delete "hasilutil.csv"]
file-open "hasilutil.csv"
file-print
"W1_1PET,W2_1PET,FORMULAYL1PET,W2_2PET,W1_2PET,FORMULAYL2PET,SELISIHPET, W1_1PED,W2_1PED,FORMULAYL1PED,W2_2PED,W1_2PED,FORMULAYL2PED,SELISIHPED, W1_1CPO,W2_1CPO,FORMULAYL1CPO,W2_2CPO,W1_2CPO,FORMULAYL2CPO,SELISIHCPO, W1_1GOR,W2_1GOR,FORMULAYL1GOR,W2_2GOR,W1_2GOR,FORMULAYL2GOR,SELISIHGOR, W1_1IDIS,W2_1DIS,FORMULAYL1DIS,W2_2DIS,W1_2DIS,FORMULAYL2DIS,SELISIHDIS"
file-close
set gselisih 0
do_setup_patches
do_setup_turtles
end
to do_setup_patches
ask patches
[ set pcolor green ]
end
to do_setup_turtles
set-default-shape petani "circle"
create-petani 1
[
set color red
;setxy -10 0
]
set-default-shape pedagang "circle"
create-pedagang 1
[
set color black
;setxy -5 0
]
set-default-shape pabrik_cpo "circle"
create-pabrik_cpo 1
[set color violet]
set-default-shape pabrik_minygor "circle"
create-pabrik_minygor 1
[set color sky]
set-default-shape distributor "circle"
create-distributor 1
[set color yellow]
;ask turtles [
; setxy random-pxcor random-pycor]
end
to do_go
do_optimal
tick
end
to-report VARY [#low #high]
;; reports a random integer in given range, inclusive
report #low + random(#high - #low + 1)
end
to do_optimal
set gcounter gcounter + 1
ask turtle 0
[
;biaya produksi petani
ifelse gcounter > 1
[
if w1_1 < (1 - 0.001)
[
set w1_1 w1_1 + 0.001
]
if w2_2 < (1 - 0.001)
[
set w2_2 w2_2 + 0.001
]
]
[
set risiko 0.355
;set investasi 0.49
set investasi 0.00298
set alpha 2
;w1 adalah bobot risiko w2 investasi
set w1_1 0.001
set w2_2 0.001
]
set w2_1 1 - w1_1
;gw1 global
set gw1_1petani w1_1
set gw2_1petani w2_1
set alphawx1 alpha * ( (w1_1 * risiko) + (w2_1 * investasi))
; u1 fungsi utility berdasar risiko sebelum dikalikan alpha
; formulayl adalah fungsi utility setelah dikalikan alpha
; formulayl = u * alpha
set u1 exp(alphawx1)
set formulayl1 u1 * alpha
set gformulayl1petani formulayl1
set w1_2 1 - w2_2
set gw1_2petani w1_2
set gw2_2petani w2_2
set alphawx2 alpha * ( (w1_2 * risiko) + (w2_2 * investasi))
set u2 exp(alphawx2)
set formulayl2 u2 * alpha
set gformulayl2petani formulayl2
set-current-plot "petani"
set-current-plot-pen "Util-risk"
plot formulayl1
set-current-plot-pen "Util-inv"
plot formulayl2
]
ask turtle 1
[
;biaya produksi pedagang
ifelse gcounter > 1
[
if w1_1 < (1 - 0.001)
[
set w1_1 w1_1 + 0.001
]
if w2_2 < (1 - 0.001)
[
set w2_2 w2_2 + 0.001
]
]
[
set risiko 0.124
set investasi 0.00854
set alpha 2
set w1_1 0.001
set w2_2 0.001
set ntriil 0.67
set gntriilpedagang ntriil
]
set w2_1 1 - w1_1
set gw1_1pedagang w1_1
set gw2_1pedagang w2_1
set alphawx1 alpha * ( (w1_1 * risiko) + (w2_1 * investasi))
set u1 exp(alphawx1)
set formulayl1 u1 * alpha
set gformulayl1pedagang formulayl1
set w1_2 1 - w2_2
set gw1_2pedagang w1_2
set gw2_2pedagang w2_2
set alphawx2 alpha * ( (w1_2 * risiko) + (w2_2 * investasi))
set u2 exp(alphawx2)
set formulayl2 u2 * alpha
set gformulayl2pedagang formulayl2
set-current-plot "Pengepul"
set-current-plot-pen "Util-risk"
plot formulayl1
set-current-plot-pen "Util-inv"
plot formulayl2
]
;pabrcpo
ask turtle 2
[
ifelse gcounter > 1
[
if w1_1 < (1 - 0.001)
[
set w1_1 w1_1 + 0.001
]
if w2_2 < (1 - 0.001)
[
set w2_2 w2_2 + 0.001
]
]
[
set risiko 0.224
set investasi 0.39381
set alpha 2
set w1_1 0.1
set w2_2 0.1
;set ntriil 1.35
;set gntriilpabrcpo ntriil
; instruksi ini sebetulnya tidak berperan karena tidak dipakai pada program
]
set w2_1 1 - w1_1
set gw1_1pabrcpo w1_1
set gw2_1pabrcpo w2_1
set alphawx1 alpha * ( (w1_1 * risiko) + (w2_1 * investasi))
set u1 exp(alphawx1)
set gupabrcpo u1
set formulayl1 u1 * alpha
set gformulayl1pabrcpo formulayl1
set w1_2 1 - w2_2
set gw1_2pabrcpo w1_2
set gw2_2pabrcpo w2_2
set alphawx2 alpha * ( (w1_2 * risiko) + (w2_2 * investasi))
set u2 exp(alphawx2)
set gupabrcpo u2
set formulayl2 u2 * alpha
set gformulayl2pabrcpo formulayl2
set-current-plot "PKS"
set-current-plot-pen "Util-risk"
plot formulayl1
set-current-plot-pen "Util-inv"
plot formulayl2
]
;pabrcpo
ask turtle 3
[
ifelse gcounter > 1
[
if w1_1 < (1 - 0.001)
[
set w1_1 w1_1 + 0.001
]
if w2_2 < (1 - 0.001)
[
set w2_2 w2_2 + 0.001
]
]
[
set risiko 0.193
set investasi 0.58575
set alpha 2
set w1_1 0.001
set w2_2 0.001
set ntriil 9.35
set gntriilpabrminygor ntriil
]
set w2_1 1 - w1_1
set gw1_1pabrminygor w1_1
set gw2_1pabrminygor w2_1
set alphawx1 alpha * ( (w1_1 * risiko) + (w2_1 * investasi))
set u1 exp(alphawx1)
set formulayl1 u1 * alpha
set gformulayl1pabrminygor formulayl1
set w1_2 1 - w2_2
set gw1_2pabrminygor w1_2
set gw2_2pabrminygor w2_2
set alphawx2 alpha * ( (w1_2 * risiko) + (w2_2 * investasi))
set u2 exp(alphawx2)
set formulayl2 u2 * alpha
set gformulayl2pabrminygor formulayl2
set-current-plot "Refinery"
set-current-plot-pen "Util-risk"
plot formulayl1
set-current-plot-pen "Util-inv"
plot formulayl2
]
ask turtle 4
[
ifelse gcounter > 1
[
if w1_1 < (1 - 0.001)
[
set w1_1 w1_1 + 0.001
]
if w2_2 < (1 - 0.001)
[
set w2_2 w2_2 + 0.001
]
]
[
set risiko 0.103
set investasi 0.00893
set alpha 2
set w1_1 0.001
set w2_2 0.001
; sebetulnya ntriil nilai tambah riil tidak diapa-apakan dalam proses beirkutnya
set ntriil 0.42
set gntriildistributor ntriil
]
set w2_1 1 - w1_1
set gw1_1distributor w1_1
set gw2_1distributor w2_1
set alphawx1 alpha * ( (w1_1 * risiko) + (w2_1 * investasi))
set u1 exp(alphawx1)
set formulayl1 u1 * alpha
set gformulayl1distributor formulayl1
set w1_2 1 - w2_2
set gw1_2distributor w1_2
set gw2_2distributor w2_2
set alphawx2 alpha * ( (w1_2 * risiko) + (w2_2 * investasi))
set u2 exp(alphawx2)
set formulayl2 u2 * alpha
set gformulayl2distributor formulayl2
set-current-plot "distributor"
set-current-plot-pen "Util-risk"
plot formulayl1
set-current-plot-pen "Util-inv"
plot formulayl2
]
file-open "hasilutil.csv"
; disini dihitung selisih-selisih utk mencari titik temu curva risiko dan curva investasi langsung di print di csv
file-print (word gw1_1petani "," gw2_1petani "," gformulayl1petani "," gw2_2petani "," gw1_2petani "," gformulayl2petani "," (gformulayl1petani - gformulayl2petani) "," gw1_1pedagang "," gw2_1pedagang "," gformulayl1pedagang "," gw2_2pedagang "," gw1_2pedagang "," gformulayl2pedagang "," (gformulayl1pedagang - gformulayl2pedagang) "," gw1_1pabrcpo "," gw2_1pabrcpo "," gformulayl1pabrcpo "," gw2_2pabrcpo "," gw1_2pabrcpo "," gformulayl2pabrcpo "," (gformulayl1pabrcpo - gformulayl2pabrcpo) "," gw1_1pabrminygor "," gw2_1pabrminygor "," gformulayl1pabrminygor "," gw2_2pabrminygor "," gw1_2pabrminygor "," gformulayl2pabrminygor "," (gformulayl1pabrminygor - gformulayl2pabrminygor) "," gw1_1distributor "," gw2_1distributor "," gformulayl1distributor "," gw2_2distributor "," gw1_2distributor "," gformulayl2distributor "," (gformulayl1distributor - gformulayl2distributor))
file-close
end
There is only one version of this model, created over 6 years ago by Syarif Hidayat.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.
Download this model