Presentation is loading. Please wait.

Presentation is loading. Please wait.

Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.

Similar presentations


Presentation on theme: "Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University."— Presentation transcript:

1 Agent-Based Modeling and Simulation (ABMS) Bertan Badur badur@boun.edu.tr Department of Management Information Systems Boğaziçi University

2 Thetelemarketer Model Chapter 13, 14, of Agent-Based and Individual- Based Modeling: A Practical Introduction, by S. F. Railsback and V. Grimm NetLogo User Menual

3 Outline 13.

4 4. The Telemarketer Model ODD Description Purpose Entitie, States Variables, and Scales –patches – poterntial customers called in one time step – boolean – color black or red –turtles – telemarketers location – xcor, ycor size – staff, telephone,... bank-balance – money –Time – weeks 200 steps –no wraping in x and y, max-x 200, max-y 200

5 NetLogo Code globals [n-telemar] turtles-own [bank-bal] to setup ca set n-telemar 200 crt n-telemar [ set bank-bal 0.0 ] reset-ticks end to go tick if ticks > 200 [stop] end

6 Process Overview and Scheduling (1) For actions in each time step First: set calling “no” – with a color Second: sales – make sales –order is important – each time random –call customers in radius proportional with size –if a customer not called previously in the same week – then buy – else not buy

7 Process Overview and Scheduling (1) Third: accounting –revenue form sales –fixed cost proportionla with size –update bank balance –updete size if bank balance is high enough –die if bank balance is lessw then 0 Forth: output –marketers in business at each time –size distribution and total sales

8 NetLogo Code - go to go tick if ticks > 200 [stop] ask patches [set pcolor black] ask turtles [ sales account ] output end

9 NetLogo Code - submodels to sales end to account end to output end

10 Design Concepts Basic principles Emergence Adaptive behavior Prediction Sensing Interraction Stochasticity Observation

11 Initialization Telemarketers: –bank balance 0.0 –size 1.0 –color random –lacation random –chape circle Potential customers: –called no – color black

12 NetLogo code to setup ca set n-telemar 200 crt n-telemar [ set bank-bal 0.0 set sıze 1.0 setxy random-xcor random-ycor set shape "circle" ] ask patches [ set pcolor black ] reset-ticks end

13 Submodels - sales radius: 10 times square root of size max number of calls: 100 times size if potential cust > nax number of calls select nax number of calls of them else select all of them if poterntial customer is not called sell to the poterntial customers change its call to yes – color to red

14 NetLogo code - sales to sales let radius 10 * sqrt sıze let max-call floor ( 100 * sıze ) let pot-custs patches in-radius radius if count pot-custs > max-call [ set pot-custs n-of max-call pot-custs ] ask pot-custs [ if pcolor = black [ set pcolor red ] ] end.

15 Submodels - account cost: 50 times size income: 2 times succesful sales update bank balance if bank balance is greater then growth param bank balance – growth param is used to increase size size is added: excess money times 0.001 if size less then zero the telemarketer goes out of business

16 NetLogo code - updates globals [n-telemar growth-param size-param ] turtles-own [bank-bal n-sales] to setup ca set growth-param 1000 set size-param 0.001 add tot the sales set n-sales count pot-custs with [pcolor = black]...

17 NetLogo code - account to account let cost 50 * sıze let income 2 * n-sales set bank-bal bank-bal + income - cost if bank-bal > growth-param [ set sıze sıze + size-param * ( bank- bal - growth-param ) set bank-bal 1000 ] if bank-bal < 0 [ die ] end

18 Submodels - output number of telemarketers size and bank balance distribution

19 add a ploter plot count turtles

20 5. Direct Interraction: Mergers in the Telemarketing Model update balance depends on have a parent or not if bank balance less then zero and not have a parent select a parent with size greater then ist own size and bank balance greater then its deficit or go out of business if balance < 0 and have a parent get subsidize or die

21 netLogo code – account modififed to account let cost 50 * sıze let income 2 * n-sales let profit income - cost ifelse parent != nobody [ set bank-bal bank-bal + 0.5 * profit ask parent [set bank-bal 0.5 * profit ] ] [ set bank-bal bank-bal + profit ] if bank-bal > growth-param [ set sıze sıze + size-param * ( bank-bal - growth-param ) set bank-bal 1000 ]

22 netLogo code – account modififed if bank-bal < 0 and parent != nobody [ output-show parent let bank-bal-par [bank-bal] of parent ifelse bank-bal-par > ( -1 * bank-bal ) [ ask parent [set bank-bal bank-bal + [bank- bal] of myself ] set bank-bal 0.0 ] [die stop] ]

23 netLogo code – account modififed if bank-bal < 0 and parent = nobody [ let pot-parents other turtles with [ sıze > [sıze] of myself and bank- bal > -1 * [bank-bal] of myself ] ifelse any? pot-parents [ set parent one-of pot-parents ask parent [set bank-bal bank-bal + [bank-bal] of myself ] set bank-bal 0 ] [die stop] ] end

24 updates turtles-own [bank-bal n-sales parent] crt to setup... crt n-telemar [... set parent nobody

25 Using links to reach parents if aparent set a directed link

26 NetLogo code -account to account let cost 50 * sıze let income 2 * n-sales let profit income - cost ifelse any? my-out-links [ set bank-bal bank-bal + 0.5 * profit ask one-of out-link-neighbors [set bank-bal 0.5 * profit ] ] [ set bank-bal bank-bal + profit ] if bank-bal > growth-param [ set sıze sıze + size-param * ( bank-bal - growth-param ) set bank-bal 1000 ]

27 NetLogo code -account if bank-bal < 0 and any? my-out-links [ let bank-bal-par [bank-bal] of one-of out-link-neighbors ifelse bank-bal-par > ( -1 * bank-bal ) [ ask one-of out-link-neighbors [set bank-bal bank-bal + [bank-bal] of myself ] set bank-bal 0.0 ] [die stop] ]

28 NetLogo code -account if bank-bal < 0 and not any? my-out-links [ let pot-parents other turtles with [ sıze > [sıze] of myself and bank-bal > -1 * [bank-bal] of myself ] ifelse any? pot-parents [ create-link-to one-of pot-parents ask one-of out-link-neighbors [set bank-bal bank-bal + [bank-bal] of myself ] set bank-bal 0 ] [die stop] ] end

29 6. The Customers Fight Back: Remembering Who Cslled custmers talernce limit if cals from a marketer exceeds taht limit reject call

30 NetLogo code - sales to sales let radius 10 * sqrt sıze let max-call floor ( 100 * sıze ) let pot-custs patches in-radius radius if count pot-custs > max-call [ set pot-custs n-of max-call pot-custs ] set pot-custs pot-custs with [pcolor = black] set pot-custs pot-custs with [ accept-call myself] set n-sales count pot-custs ask pot-custs [ set pcolor red ] end

31 NetLogo code – accept-call to-report accept-call [marketer] let num-calls length filter [? = marketer] caller- list set caller-list fput marketer caller-list report num-calls <= tol-lim end

32 NetLogo code – initilalizations patches-own [caller-list tol-lim] to setpu... ask patches [ set pcolor black set tol-lim 5 + random 16 set caller-list [] ] end


Download ppt "Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University."

Similar presentations


Ads by Google