connected firm no accept probability
This commit is contained in:
9
firm.py
9
firm.py
@@ -261,7 +261,14 @@ class FirmAgent(ap.Agent):
|
||||
|
||||
def accept_request(self, down_firm, product):
|
||||
# para product is the product that self is selling
|
||||
prod_accept = self.flt_diff_new_conn
|
||||
# connected firm has no probability
|
||||
node_self = self.get_firm_network_node()
|
||||
node_d_firm = down_firm.get_firm_network_node()
|
||||
if self.model.firm_network.graph.has_edge(node_self, node_d_firm) or \
|
||||
self.model.firm_network.graph.has_edge(node_d_firm, node_self):
|
||||
prod_accept = 1.0
|
||||
else:
|
||||
prod_accept = self.flt_diff_new_conn
|
||||
if self.model.nprandom.choice([True, False],
|
||||
p=[prod_accept, 1 - prod_accept]):
|
||||
self.firm_network.graph.add_edges_from([
|
||||
|
||||
Reference in New Issue
Block a user