-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.yaml
562 lines (551 loc) · 15.1 KB
/
config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
simulation_metadata:
device: 'cpu'
num_episodes: 7
num_steps_per_episode: 200
num_substeps_per_step: 5
calibration: false
visualize: true
max_x: 1000
max_y: 1000
num_bap: 100
num_bpp: 20
num_bg: 1
max_orders: 1000
state:
environment:
last_order_id:
name: 'Last Created Order'
learnable: false
shape:
- 1
dtype: 'int'
value: -1
initialization_function: null
network: null
agents:
bap:
number: ${simulation_metadata.num_bap}
properties:
id:
name: 'ID'
learnable: false
shape:
- ${state.agents.bap.number}
- 1
dtype: 'int'
initialization_function:
generator: 'generate_ids'
arguments:
shape:
learnable: false
shape:
- 2
value:
- ${state.agents.bap.number}
- 1
initialization_function: null
coordinates:
name: 'Position'
learnable: false
shape:
- ${state.agents.bap.number}
- 2
dtype: 'float'
initialization_function:
generator: 'random_float'
arguments:
lower_limit:
learnable: false
shape:
- 1
value: 0
initialization_function: null
upper_limit:
learnable: false
shape:
- 1
value: ${simulation_metadata.max_x}
initialization_function: null
resource_level:
name: 'Resource Level'
learnable: false
shape:
- ${state.agents.bap.number}
- 1
dtype: 'float'
initialization_function:
generator: 'random_float'
arguments:
lower_limit:
learnable: false
shape:
- 1
value: 0
initialization_function: null
upper_limit:
learnable: false
shape:
- 1
value: 100
initialization_function: null
current_order:
name: 'Current Order'
learnable: false
shape:
- ${state.agents.bap.number}
- 1
dtype: 'int'
value: -1 # -1 indicates no active order
initialization_function: null
wallet:
name: 'Available Money'
learnable: false
shape:
- ${state.agents.bap.number}
- 1
dtype: 'float'
initialization_function:
generator: 'random_float'
arguments:
lower_limit:
learnable: false
shape:
- 1
value: 100
initialization_function: null
upper_limit:
learnable: false
shape:
- 1
value: 1000
initialization_function: null
bpp:
number: ${simulation_metadata.num_bpp}
properties:
id:
name: 'ID'
learnable: false
shape:
- ${state.agents.bpp.number}
- 1
dtype: 'int'
initialization_function:
generator: 'generate_ids'
arguments:
shape:
learnable: false
shape:
- 2
value:
- ${state.agents.bpp.number}
- 1
initialization_function: null
coordinates:
name: 'Position'
learnable: false
shape:
- ${state.agents.bpp.number}
- 2
dtype: 'float'
initialization_function:
generator: 'random_float'
arguments:
lower_limit:
learnable: false
shape:
- 1
value: 0
initialization_function: null
upper_limit:
learnable: false
shape:
- 1
value: ${simulation_metadata.max_x}
initialization_function: null
revenue:
name: 'Revenue Earned'
learnable: false
shape:
- ${state.agents.bap.number}
- 1
dtype: 'float'
value: 0
initialization_function: null
price:
name: 'Service Price'
learnable: true
shape:
- ${state.agents.bpp.number}
- 1
dtype: 'float'
initialization_function:
generator: 'random_float'
arguments:
lower_limit:
learnable: false
shape:
- 1
value: 0.1
initialization_function: null
upper_limit:
learnable: false
shape:
- 1
value: 0.5
initialization_function: null
max_capacity:
name: 'Max Service Capacity'
learnable: false
shape:
- ${state.agents.bpp.number}
- 1
dtype: 'int'
initialization_function:
generator: 'random_int'
arguments:
lower_limit:
learnable: false
shape:
- 1
value: 1
initialization_function: null
upper_limit:
learnable: false
shape:
- 1
value: 10
initialization_function: null
available_capacity:
name: 'Current Available Capacity'
learnable: false
shape:
- ${state.agents.bpp.number}
- 1
dtype: 'int'
initialization_function:
generator: 'random_int'
arguments:
lower_limit:
learnable: false
shape:
- 1
value: 1
initialization_function: null
upper_limit:
learnable: false
shape:
- 1
value: 10
initialization_function: null
rating:
name: 'Service Rating'
learnable: false
shape:
- ${state.agents.bpp.number}
- 1
dtype: 'float'
value: 0
initialization_function: null
num_ratings:
name: 'Number of Ratings'
learnable: false
shape:
- ${state.agents.bpp.number}
- 1
dtype: 'int'
value: 0
initialization_function: null
bg:
number: ${simulation_metadata.num_bg}
properties:
id:
name: 'ID'
learnable: false
shape:
- ${state.agents.bg.number}
- 1
dtype: 'int'
initialization_function:
generator: 'generate_ids'
arguments:
shape:
learnable: false
shape:
- 2
value:
- ${state.agents.bg.number}
- 1
initialization_function: null
network_traffic:
name: 'Network Traffic'
learnable: false
shape:
- ${state.agents.bg.number}
- 1
dtype: 'int'
value: 0
initialization_function: null
objects:
order:
number: ${simulation_metadata.max_orders}
properties:
id:
name: 'ID'
learnable: false
shape:
- ${state.objects.order.number}
- 1
dtype: 'int'
initialization_function:
generator: 'generate_ids'
arguments:
shape:
learnable: false
shape:
- 2
value:
- ${state.objects.order.number}
- 1
initialization_function: null
bap_id:
name: 'BAP ID'
learnable: false
shape:
- ${state.objects.order.number}
- 1
dtype: 'int'
value: -1
initialization_function: null
bpp_id:
name: 'BPP ID'
learnable: false
shape:
- ${state.objects.order.number}
- 1
dtype: 'int'
value: -1
initialization_function: null
quantity:
name: 'Service Quantity'
learnable: false
shape:
- ${state.objects.order.number}
- 1
dtype: 'float'
value: -1
initialization_function: null
status:
name: 'Order Status'
learnable: false
shape:
- ${state.objects.order.number}
- 1
dtype: 'int' # 0: Created, 1: Confirmed, 2: In Progress, 3: Completed, 4: Cancelled
value: -1
initialization_function: null
substeps:
'0':
name: 'Search'
description: 'BAP searches for available BPPs'
active_agents:
- 'bap'
observation:
bap:
find_nearby_bpps:
generator: 'FindNearbyBPPs'
arguments: null
input_variables:
bap_positions: 'agents/bap/coordinates'
bpp_positions: 'agents/bpp/coordinates'
output_variables:
- distances
- mask
policy:
bap:
select_bpp:
generator: 'SelectBPP'
arguments: null
input_variables:
bpp_prices: 'agents/bpp/price'
bpp_capacity: 'agents/bpp/available_capacity'
resource_level: 'agents/bap/resource_level'
output_variables:
- selected_bpps
transition:
create_order:
generator: 'CreateOrder'
arguments: null
input_variables:
bap_id: 'agents/bap/id'
resource_level: 'agents/bap/resource_level'
last_order_id: 'environment/last_order_id'
order_bap_id: 'objects/order/bap_id'
order_bpp_id: 'objects/order/bpp_id'
order_quantity: 'objects/order/quantity'
order_status: 'objects/order/status'
output_variables:
- order_bap_id
- order_bpp_id
- order_quantity
- order_status
'1':
name: 'Confirm'
description: 'BPP confirms the order'
active_agents:
- 'bpp'
observation:
bpp:
check_availability:
generator: 'CheckAvailability'
arguments: null
input_variables:
bpp_capacity: 'agents/bpp/available_capacity'
output_variables:
- is_available
policy:
bpp:
confirm_order:
generator: 'ConfirmOrder'
arguments: null
input_variables: null
output_variables:
- order_confirmation
transition:
update_order_status:
generator: 'UpdateOrderStatus'
arguments: null
input_variables:
bpp_capacity: 'agents/bpp/available_capacity'
order_bpp_id: 'objects/order/bpp_id'
order_status: 'objects/order/status'
output_variables:
- order_status
- bpp_capacity
'2':
name: 'Fulfill'
description: 'BAP receives service from BPP'
active_agents:
- 'bap'
observation:
bap:
get_route:
generator: 'GetRoute'
arguments: null
input_variables:
bap_pos: 'agents/bap/coordinates'
bpp_pos: 'agents/bpp/coordinates'
order_bap_id: 'objects/order/bap_id'
order_bpp_id: 'objects/order/bpp_id'
order_status: 'objects/order/status'
output_variables:
- distances
- involved_baps
- involved_bpps
- orders_to_update
policy:
bap:
consume_service:
generator: 'ConsumeService'
arguments: null
input_variables:
bap_pos: 'agents/bap/coordinates'
bap_res: 'agents/bap/resource_level'
output_variables:
- movement
- service_progress
- involved_baps
- orders_to_update
transition:
update_positions_and_resources:
generator: 'UpdatePositionsAndResources'
arguments: null
input_variables:
bap_pos: 'agents/bap/coordinates'
bap_res: 'agents/bap/resource_level'
bpp_cap: 'agents/bpp/available_capacity'
order_status: 'objects/order/status'
output_variables:
- bap_pos
- bap_res
- bpp_cap
- order_status
'3':
name: 'Pay'
description: 'BAP pays for the service'
active_agents:
- 'bap'
observation:
bap:
get_order_details:
generator: 'GetOrderDetails'
arguments: null
input_variables:
order_bap_id: 'objects/order/bap_id'
order_bpp_id: 'objects/order/bpp_id'
order_status: 'objects/order/status'
output_variables:
- involved_baps
- involved_bpps
- orders_to_update
policy:
bap:
calculate_payment:
generator: 'CalculatePayment'
arguments: null
input_variables:
bpp_price: 'agents/bpp/price'
order_quantity: 'objects/order/quantity'
output_variables:
- payments_to_make
- involved_baps
- involved_bpps
transition:
update_wallets:
generator: 'UpdateWallets'
arguments: null
input_variables:
bap_wallet: 'agents/bap/wallet'
bpp_revenue: 'agents/bpp/revenue'
output_variables:
- bap_wallet
- bpp_revenue
'4':
name: 'Rate'
description: 'BAP rates the service'
active_agents:
- 'bap'
observation:
bap:
get_service_experience:
generator: 'GetServiceExperience'
arguments: null
input_variables:
order_bap_id: 'objects/order/bap_id'
order_bpp_id: 'objects/order/bpp_id'
order_status: 'objects/order/status'
output_variables:
- involved_baps
- involved_bpps
policy:
bap:
calculate_rating:
generator: 'CalculateRating'
arguments: null
input_variables:
bpp_rating: 'agents/bpp/rating'
bpp_num_ratings: 'agents/bpp/num_ratings'
output_variables:
- ratings_given
- num_ratings_given
- involved_baps
- involved_bpps
transition:
update_bpp_rating:
generator: 'UpdateBPPRating'
arguments: null
input_variables:
bpp_rating: 'agents/bpp/rating'
bpp_num_ratings: 'agents/bpp/num_ratings'
output_variables:
- bpp_rating
- bpp_num_ratings