condense external variables
This commit is contained in:
20
firm.py
20
firm.py
@@ -23,12 +23,10 @@ class FirmAgent(ap.Agent):
|
||||
self.dct_request_prod_from_firm = {}
|
||||
|
||||
# para
|
||||
self.flt_crit_supplier = float(self.p.crit_supplier)
|
||||
self.is_firm_req_prf_size = bool(self.p.firm_req_prf_size)
|
||||
self.is_firm_req_prf_conn = bool(self.p.firm_req_prf_conn)
|
||||
self.is_firm_acc_prf_size = bool(self.p.firm_acc_prf_size)
|
||||
self.is_firm_acc_prf_conn = bool(self.p.firm_acc_prf_conn)
|
||||
self.is_prf_size = self.model.is_prf_size
|
||||
self.is_prf_conn = bool(self.p.prf_conn)
|
||||
self.flt_diff_new_conn = float(self.p.diff_new_conn)
|
||||
self.flt_crit_supplier = float(self.p.crit_supplier)
|
||||
|
||||
def remove_edge_to_cus_remove_cus_up_prod(self, remove_product):
|
||||
lst_out_edge = list(
|
||||
@@ -80,7 +78,7 @@ class FirmAgent(ap.Agent):
|
||||
continue
|
||||
# select based on connection
|
||||
lst_firm_connect = []
|
||||
if self.is_firm_req_prf_conn:
|
||||
if self.is_prf_conn:
|
||||
for firm in \
|
||||
self.dct_cand_alt_supply_up_prod_removed[product]:
|
||||
out_edges = self.model.firm_network.graph.out_edges(
|
||||
@@ -98,7 +96,7 @@ class FirmAgent(ap.Agent):
|
||||
lst_firm_connect.append(firm)
|
||||
if len(lst_firm_connect) == 0:
|
||||
# select based on size or not
|
||||
if self.is_firm_req_prf_size:
|
||||
if self.is_prf_size:
|
||||
lst_size = \
|
||||
[size for size in
|
||||
self.dct_cand_alt_supply_up_prod_removed[
|
||||
@@ -113,7 +111,7 @@ class FirmAgent(ap.Agent):
|
||||
self.dct_cand_alt_supply_up_prod_removed[product])
|
||||
elif len(lst_firm_connect) > 0:
|
||||
# select based on size of connected firm or not
|
||||
if self.is_firm_req_prf_size:
|
||||
if self.is_prf_size:
|
||||
lst_firm_size = \
|
||||
[firm.revenue_log for firm in lst_firm_connect]
|
||||
lst_prob = \
|
||||
@@ -161,7 +159,7 @@ class FirmAgent(ap.Agent):
|
||||
elif len(lst_firm) > 1:
|
||||
# handling based on connection
|
||||
lst_firm_connect = []
|
||||
if self.is_firm_acc_prf_conn:
|
||||
if self.is_prf_conn:
|
||||
for firm in lst_firm:
|
||||
out_edges = \
|
||||
self.model.firm_network.graph.out_edges(
|
||||
@@ -182,7 +180,7 @@ class FirmAgent(ap.Agent):
|
||||
lst_firm_connect.append(firm)
|
||||
if len(lst_firm_connect) == 0:
|
||||
# handling based on size or not
|
||||
if self.is_firm_acc_prf_size:
|
||||
if self.is_prf_size:
|
||||
lst_firm_size = \
|
||||
[firm.revenue_log for firm in lst_firm]
|
||||
lst_prob = \
|
||||
@@ -197,7 +195,7 @@ class FirmAgent(ap.Agent):
|
||||
self.accept_request(select_customer, product)
|
||||
elif len(lst_firm_connect) > 0:
|
||||
# handling based on size of connected firm or not
|
||||
if self.is_firm_acc_prf_size:
|
||||
if self.is_prf_size:
|
||||
lst_firm_size = \
|
||||
[firm.revenue_log for firm in lst_firm_connect]
|
||||
lst_prob = \
|
||||
|
||||
Reference in New Issue
Block a user