zero capacity firm should also be removed from candidate list to prevent repeated request
This commit is contained in:
parent
c348f3eb9c
commit
206dd2fbc0
9
firm.py
9
firm.py
|
@ -246,6 +246,15 @@ class FirmAgent(ap.Agent):
|
||||||
select_customer = \
|
select_customer = \
|
||||||
self.model.nprandom.choice(lst_firm_connect)
|
self.model.nprandom.choice(lst_firm_connect)
|
||||||
self.accept_request(select_customer, product)
|
self.accept_request(select_customer, product)
|
||||||
|
else:
|
||||||
|
for down_firm in lst_firm:
|
||||||
|
down_firm.dct_cand_alt_supp_up_prod_disrupted[
|
||||||
|
product].remove(self)
|
||||||
|
|
||||||
|
print(
|
||||||
|
f"{self.name} denied {product.code} request "
|
||||||
|
f"from {down_firm.name} for lack of capacity"
|
||||||
|
)
|
||||||
|
|
||||||
def accept_request(self, down_firm, product):
|
def accept_request(self, down_firm, product):
|
||||||
# para product is the product that self is selling
|
# para product is the product that self is selling
|
||||||
|
|
Loading…
Reference in New Issue