from BPTK_Py.bptk import bptk
= bptk() bptk
An Agent-based Approach To Modeling The Beer Game
An agent-based model of the beer distribution game. Each of the players in the game is modeled as an agent.
An Agent-based Approach To Modeling The Beer Game
An agent-based model of the beer distribution game. Each of the players in the game is modeled as an agent.
First we explore the game using deterministic agents, then we let the agents learn by themselves using a reinforcement learning approach.
Steady State
bptk.plot_scenarios(=["smBeergame"],
scenario_managers="area",
kind=["steady"],
scenarios=["brewery","distributor","wholesaler","retailer"],
agents=["active"],
agent_states=["outstanding_orders"],
agent_properties=["total"],
agent_property_types=False
return_df )
Typical Player Behavior
Typical player behaviour (which leads to the “whiplash” effect).
bptk.plot_scenarios(=["smBeergame"],
scenario_managers="area",
kind=["typical"],
scenarios=["brewery","distributor","wholesaler","retailer","consumer"],
agents=["active"],
agent_states=["outgoing_order"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smBeergame"],
scenario_managers="area",
kind=["typical"],
scenarios=["brewery","distributor","wholesaler","retailer"],
agents=["active"],
agent_states
=["surplus"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smBeergame"],
scenario_managers="area",
kind=["typical"],
scenarios=["brewery","distributor","wholesaler","retailer"],
agents=["active"],
agent_states=["inventory"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smBeergame"],
scenario_managers="area",
kind=["typical"],
scenarios=["brewery", "distributor","wholesaler","retailer"],
agents=["active"],
agent_states=["cost"],
agent_properties=["total"]
agent_property_types )
bptk.plot_scenarios(=["smBeergame"],
scenario_managers="area",
kind=["typical"],
scenarios=["controlling"],
agents=["active"],
agent_states=["supply_chain_cost","target_supply_chain_cost"],
agent_properties=["total"]
agent_property_types )
Ignore Backorder
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["ignore_backorder"],
scenarios=["retailer"],
agents=["active"],
agent_states=["outgoing_order","inventory","incoming_order"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["ignore_backorder"],
scenarios=["retailer"],
agents=["active"],
agent_states=["total_cost","target_cost"],
agent_properties=["total"],
agent_property_types=False
return_df )
Include Supply Line
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["include_supply_line"],
scenarios=["retailer"],
agents=["active"],
agent_states=["outgoing_order","inventory","incoming_order"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["include_supply_line"],
scenarios=["retailer"],
agents=["active"],
agent_states=["total_cost","target_cost"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["include_supply_line"],
scenarios=["retailer"],
agents=["active"],
agent_states=["surplus"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["include_supply_line"],
scenarios=["brewery","distributor", "wholesaler", "retailer","consumer"],
agents=["active"],
agent_states=["outgoing_order"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["include_supply_line"],
scenarios=["controlling"],
agents=["active"],
agent_states=["supply_chain_cost","target_supply_chain_cost"],
agent_properties=["total"]
agent_property_types )
Slow Inventory Adjustment
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["slow_inventory_adjustment"],
scenarios=["brewery","distributor", "wholesaler", "retailer","consumer"],
agents=["active"],
agent_states=["outgoing_order"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["slow_inventory_adjustment"],
scenarios=["controlling"],
agents=["active"],
agent_states=["supply_chain_cost","target_supply_chain_cost"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["slow_inventory_adjustment"],
scenarios=["brewery","distributor","wholesaler","retailer"],
agents=["active"],
agent_states=["total_cost"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["slow_inventory_adjustment"],
scenarios=["retailer"],
agents=["active"],
agent_states=["total_cost","target_cost"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["slow_inventory_adjustment"],
scenarios=["brewery","distributor", "wholesaler", "retailer"],
agents=["active"],
agent_states=["inventory"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["slow_inventory_adjustment"],
scenarios=["retailer"],
agents=["active"],
agent_states=["surplus","target_surplus"],
agent_properties=["total"]
agent_property_types )
Order Balance Strategy
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["order_balance"],
scenarios=["brewery","distributor", "wholesaler", "retailer","consumer"],
agents=["active"],
agent_states=["outgoing_order"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["order_balance"],
scenarios=["brewery","distributor", "wholesaler", "retailer"],
agents=["active"],
agent_states=["inventory"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["order_balance"],
scenarios=["brewery","distributor","wholesaler","retailer"],
agents=["active"],
agent_states=["total_cost"],
agent_properties=["total"],
agent_property_types=True
return_df )
brewery_active_total_cost_total | distributor_active_total_cost_total | wholesaler_active_total_cost_total | retailer_active_total_cost_total | |
---|---|---|---|---|
t | ||||
1.0 | 200.0 | 200.0 | 200.0 | 200.0 |
2.0 | 400.0 | 400.0 | 400.0 | 400.0 |
3.0 | 600.0 | 600.0 | 600.0 | 800.0 |
4.0 | 800.0 | 868.0 | 1140.0 | 1125.0 |
5.0 | 1185.0 | 1580.0 | 1637.0 | 1725.0 |
6.0 | 2110.0 | 2316.0 | 2484.0 | 2225.0 |
7.0 | 2807.0 | 3459.0 | 3275.0 | 3025.0 |
8.0 | 3320.0 | 4264.0 | 4404.0 | 3725.0 |
9.0 | 3683.0 | 4792.0 | 5135.0 | 4725.0 |
10.0 | 3923.0 | 5092.0 | 5539.0 | 5294.0 |
11.0 | 4123.0 | 5292.0 | 5739.0 | 5507.0 |
12.0 | 4323.0 | 5492.0 | 5939.0 | 5707.0 |
13.0 | 4523.0 | 5692.0 | 6139.0 | 5907.0 |
14.0 | 4723.0 | 5892.0 | 6339.0 | 6107.0 |
15.0 | 4923.0 | 6092.0 | 6539.0 | 6307.0 |
16.0 | 5123.0 | 6292.0 | 6739.0 | 6507.0 |
17.0 | 5323.0 | 6492.0 | 6939.0 | 6707.0 |
18.0 | 5523.0 | 6692.0 | 7139.0 | 6907.0 |
19.0 | 5723.0 | 6892.0 | 7339.0 | 7107.0 |
20.0 | 5923.0 | 7092.0 | 7539.0 | 7307.0 |
21.0 | 6126.0 | 7292.0 | 7739.0 | 7507.0 |
22.0 | 6331.0 | 7492.0 | 7939.0 | 7707.0 |
23.0 | 6539.0 | 7692.0 | 8139.0 | 7907.0 |
24.0 | 6749.0 | 7892.0 | 8339.0 | 8107.0 |
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["order_balance"],
scenarios=["controlling"],
agents=["active"],
agent_states=["supply_chain_cost","target_supply_chain_cost"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["order_balance"],
scenarios=["retailer"],
agents=["active"],
agent_states=["backorder"],
agent_properties=["total"],
agent_property_types=False
return_df )
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["order_balance"],
scenarios=["brewery","distributor","wholesaler","retailer"],
agents=["active"],
agent_states=["order_balance"],
agent_properties=["total"],
agent_property_types=True
return_df )
brewery_active_order_balance_total | distributor_active_order_balance_total | wholesaler_active_order_balance_total | retailer_active_order_balance_total | |
---|---|---|---|---|
t | ||||
1.0 | 600 | 600 | 600 | 600 |
2.0 | 600 | 600 | 600 | 675 |
3.0 | 600 | 600 | 693 | 740 |
4.0 | 600 | 717 | 772 | 797 |
5.0 | 746 | 813 | 839 | 847 |
6.0 | 862 | 892 | 896 | 891 |
7.0 | 955 | 957 | 945 | 929 |
8.0 | 1028 | 1010 | 986 | 962 |
9.0 | 1086 | 1053 | 1021 | 991 |
10.0 | 1130 | 1088 | 1050 | 1017 |
11.0 | 1164 | 1116 | 1075 | 1039 |
12.0 | 1190 | 1139 | 1096 | 1059 |
13.0 | 1209 | 1157 | 1114 | 1076 |
14.0 | 1223 | 1171 | 1129 | 1091 |
15.0 | 1233 | 1182 | 1141 | 1104 |
16.0 | 1239 | 1191 | 1151 | 1116 |
17.0 | 1243 | 1197 | 1160 | 1126 |
18.0 | 1244 | 1202 | 1167 | 1135 |
19.0 | 1245 | 1206 | 1173 | 1143 |
20.0 | 1244 | 1209 | 1178 | 1150 |
21.0 | 1243 | 1211 | 1182 | 1156 |
22.0 | 1241 | 1212 | 1185 | 1161 |
23.0 | 1238 | 1212 | 1188 | 1165 |
24.0 | 1235 | 1212 | 1190 | 1169 |
bptk.plot_scenarios(=["smSmartBeergame"],
scenario_managers="area",
kind=["order_balance"],
scenarios=["retailer"],
agents=["active"],
agent_states=["surplus","target_surplus"],
agent_properties=["total"]
agent_property_types )