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

View File

@@ -20,7 +20,7 @@ spec:
# Wood: 1
- name: Food
amount: 500
amount: 5
prod:
# Fuel: 1
Fruit: 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(

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

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

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)

View File

@@ -28,8 +28,8 @@ cxs=[cx]
# Create Demand
#cx.submit_order(w,"Wood",0,1000,Side.BUY)
#cx.submit_order(2,"Gem",1,10,Side.SELL)
EPISODE_LEN=100
NUM_EPISODES=50
EPISODE_LEN=20
NUM_EPISODES=20
NUM_SEED_BUS=10
@@ -51,10 +51,8 @@ for a in tqdm(range(NUM_EPISODES)):
print(f"|Stats| Num of Businesses: {len(sim.businesses)} Num Tickfunk: {len(sim.tick_funcs)} Time Agent Tick: {sim.timings['dsa']} Time Logging {sim.timings['dbl']}")
sim.reset()
for i in range(NUM_SEED_BUS):
sim.create_bussiness(1)
sim.create_bussiness(1)
log.writeEXData()

View File

@@ -2,4 +2,5 @@ lightmatchingengine
pyyaml
influxdb-client
pandas
sqlalchemy
sqlalchemy
tensorflow

BIN
tmp.prof

Binary file not shown.