without_exp
This commit is contained in:
20
firm.py
20
firm.py
@@ -63,7 +63,7 @@ class FirmAgent(ap.Agent):
|
||||
|
||||
def seek_alt_supply(self):
|
||||
for product in self.a_lst_up_product_removed:
|
||||
print(f"{self.name} seek alt supply for {product.code}")
|
||||
# print(f"{self.name} seek alt supply for {product.code}")
|
||||
if self.dct_n_trial_up_prod_removed[
|
||||
product] <= self.model.int_n_max_trial:
|
||||
if self.dct_n_trial_up_prod_removed[product] == 0:
|
||||
@@ -87,10 +87,10 @@ class FirmAgent(ap.Agent):
|
||||
select_alt_supply = self.model.nprandom.choice(
|
||||
self.dct_cand_alt_supply_up_prod_removed[product],
|
||||
p=lst_prob)
|
||||
print(
|
||||
f"{self.name} selct alt supply for {product.code} "
|
||||
f"from {select_alt_supply.name}"
|
||||
)
|
||||
# print(
|
||||
# f"{self.name} selct alt supply for {product.code} "
|
||||
# f"from {select_alt_supply.name}"
|
||||
# )
|
||||
assert product in select_alt_supply.a_lst_product, \
|
||||
f"{select_alt_supply} \
|
||||
does not produce requested product {product}"
|
||||
@@ -113,7 +113,7 @@ class FirmAgent(ap.Agent):
|
||||
self.dct_n_trial_up_prod_removed[product] += 1
|
||||
|
||||
def handle_request(self):
|
||||
print(self.name, 'handle_request')
|
||||
# print(self.name, 'handle_request')
|
||||
for product, lst_firm in self.dct_request_prod_from_firm.items():
|
||||
if self.dct_prod_capacity[product] > 0:
|
||||
if len(lst_firm) == 0:
|
||||
@@ -183,10 +183,10 @@ class FirmAgent(ap.Agent):
|
||||
self.dct_prod_capacity[product] -= 1
|
||||
self.dct_request_prod_from_firm[product].remove(down_firm)
|
||||
down_firm.a_lst_up_product_removed.remove(product)
|
||||
print(
|
||||
f"{self.name} accept {product.code} request "
|
||||
f"from {down_firm.name}"
|
||||
)
|
||||
# print(
|
||||
# f"{self.name} accept {product.code} request "
|
||||
# f"from {down_firm.name}"
|
||||
# )
|
||||
else:
|
||||
down_firm.dct_cand_alt_supply_up_prod_removed[product].remove(self)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user