This is getting better and better

This commit is contained in:
2023-07-12 15:15:25 +02:00
parent 8d5ad7c62d
commit eec9c82a83
16 changed files with 17 additions and 14 deletions
Binary file not shown.
Binary file not shown.
+3 -1
View File
@@ -17,7 +17,7 @@ class Price_Believe_Distribiute_Agent(Base_Distribution_Agent):
self.lr_moment={i: 0 for i in range(len(self.exchanges))}
self.open_orders = {i: [] for i in range(len(self.exchanges))}
self.open_qty = 0
self.beta=0.6
self.beta=0.8
self.lp_threshold=0.05
self.hp_threshold=0.80
@@ -29,6 +29,8 @@ class Price_Believe_Distribiute_Agent(Base_Distribution_Agent):
cx_id = self.select_best_cx()
price = round(self.price_believe[cx_id],2)
if price==30.0:
print("Ple")
if price < self.min_price:
price = self.min_price
order = self.distribute_resource(
+2 -2
View File
@@ -14,13 +14,13 @@ class Price_Believe_Business(Business):
self.expense_per_prod=-1
self.income_per_unit = -1
self.distribute = Price_Believe_Distribiute_Agent(
simulation, self, production["name"], exchange, 0.5,production["amount"]*2, 20)
simulation, self, production["name"], exchange, 0.08,production["amount"]*2, 6)
self.craft = AutoProductionAgent(simulation, self)
self.aquire = {}
for k, v in production["prod"].items():
a = Price_Believe_Aquire_Agent(
simulation, self, k, exchange, 0.2, 20)
simulation, self, k, exchange, 0.02, 6)
a.set_target(v*2)
a.set_price_max(10)
self.aquire[k] = a
Binary file not shown.
+1 -1
View File
@@ -24,7 +24,7 @@ class Cell:
exchange: None
def __init__(self,name,x,y,area,pop,demand,world) -> None:
pop=pop*100
pop=pop*10
self.name=name
self.loc_x=x
self.loc_y=y
+5 -3
View File
@@ -86,12 +86,14 @@ class Simulation():
Executes a tick of the simulation
"""
start=time.time()
self.tick_agents_random_order()
agentstep=time.time()
for cell_id,c in self.cells.items():
c.setup_demand_for_step(episode_length)
setup=time.time()
self.tick_agents_random_order()
agentstep=time.time()
for b in self.businesses:
b.tick(self.tick_count)