2023-02-24 15:16:28 +08:00
|
|
|
import agentpy as ap
|
|
|
|
|
|
|
|
|
2023-02-24 17:53:55 +08:00
|
|
|
class FirmAgent(ap.Agent):
|
2023-02-25 20:14:53 +08:00
|
|
|
def setup(self, code, name, type_region, revenue_log, list_product,
|
|
|
|
capacity):
|
2023-02-24 15:16:28 +08:00
|
|
|
self.firm_network = self.model.firm_network
|
2023-02-24 17:53:55 +08:00
|
|
|
|
|
|
|
self.code = code
|
|
|
|
self.name = name
|
|
|
|
self.type_region = type_region
|
|
|
|
self.revenue_log = revenue_log
|
2023-02-25 20:14:53 +08:00
|
|
|
self.list_product = list_product
|
|
|
|
self.capacity = capacity
|
2023-02-24 17:53:55 +08:00
|
|
|
|
2023-02-25 20:14:53 +08:00
|
|
|
self.dct_product_is_disrupted = dict.fromkeys(list_product, False)
|
|
|
|
self.dct_product_is_removed = dict.fromkeys(list_product, False)
|
2023-02-26 21:58:05 +08:00
|
|
|
|
|
|
|
def remove_edge_to_customer_if_removed(self, remove_product):
|
|
|
|
t = self.firm_network.graph.out_edges(
|
|
|
|
self.firm_network.positions[self], keys=True, data=True)
|
|
|
|
print(t)
|