damp prob removal first than sample
This commit is contained in:
parent
0e40f90559
commit
a8259fdc7d
Binary file not shown.
Binary file not shown.
6
model.py
6
model.py
|
@ -1,7 +1,6 @@
|
|||
import agentpy as ap
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
# import random
|
||||
import networkx as nx
|
||||
from firm import FirmAgent
|
||||
from product import ProductAgent
|
||||
|
@ -14,7 +13,6 @@ class Model(ap.Model):
|
|||
def setup(self):
|
||||
self.sample = self.p.sample
|
||||
self.int_stop_times, self.int_stop_t = 0, None
|
||||
# self.random = random.Random(self.p.seed)
|
||||
self.nprandom = np.random.default_rng(self.p.seed)
|
||||
self.int_n_iter = int(self.p.n_iter)
|
||||
|
||||
|
@ -373,13 +371,13 @@ class Model(ap.Model):
|
|||
std_size = (firm.revenue_log - min(lst_size) +
|
||||
1) / (max(lst_size) - min(lst_size) + 1)
|
||||
prob_remove = 1 - std_size * (1 - lost_percent)
|
||||
# damp prod
|
||||
prob_remove = prob_remove ** self.flt_diff_remove
|
||||
# sample prob
|
||||
prob_remove = self.nprandom.uniform(
|
||||
prob_remove - 0.1, prob_remove + 0.1)
|
||||
prob_remove = 1 if prob_remove > 1 else prob_remove
|
||||
prob_remove = 0 if prob_remove < 0 else prob_remove
|
||||
# damp prod
|
||||
prob_remove = prob_remove ** self.flt_diff_remove
|
||||
if self.nprandom.choice([True, False],
|
||||
p=[prob_remove,
|
||||
1 - prob_remove]):
|
||||
|
|
Loading…
Reference in New Issue