This is getting better and better
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ spec:
|
|||||||
# Wood: 1
|
# Wood: 1
|
||||||
|
|
||||||
- name: Food
|
- name: Food
|
||||||
amount: 500
|
amount: 5
|
||||||
prod:
|
prod:
|
||||||
# Fuel: 1
|
# Fuel: 1
|
||||||
Fruit: 1
|
Fruit: 1
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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.lr_moment={i: 0 for i in range(len(self.exchanges))}
|
||||||
self.open_orders = {i: [] for i in range(len(self.exchanges))}
|
self.open_orders = {i: [] for i in range(len(self.exchanges))}
|
||||||
self.open_qty = 0
|
self.open_qty = 0
|
||||||
self.beta=0.6
|
self.beta=0.8
|
||||||
self.lp_threshold=0.05
|
self.lp_threshold=0.05
|
||||||
self.hp_threshold=0.80
|
self.hp_threshold=0.80
|
||||||
|
|
||||||
@@ -29,6 +29,8 @@ class Price_Believe_Distribiute_Agent(Base_Distribution_Agent):
|
|||||||
cx_id = self.select_best_cx()
|
cx_id = self.select_best_cx()
|
||||||
|
|
||||||
price = round(self.price_believe[cx_id],2)
|
price = round(self.price_believe[cx_id],2)
|
||||||
|
if price==30.0:
|
||||||
|
print("Ple")
|
||||||
if price < self.min_price:
|
if price < self.min_price:
|
||||||
price = self.min_price
|
price = self.min_price
|
||||||
order = self.distribute_resource(
|
order = self.distribute_resource(
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ class Price_Believe_Business(Business):
|
|||||||
self.expense_per_prod=-1
|
self.expense_per_prod=-1
|
||||||
self.income_per_unit = -1
|
self.income_per_unit = -1
|
||||||
self.distribute = Price_Believe_Distribiute_Agent(
|
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.craft = AutoProductionAgent(simulation, self)
|
||||||
self.aquire = {}
|
self.aquire = {}
|
||||||
|
|
||||||
for k, v in production["prod"].items():
|
for k, v in production["prod"].items():
|
||||||
a = Price_Believe_Aquire_Agent(
|
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_target(v*2)
|
||||||
a.set_price_max(10)
|
a.set_price_max(10)
|
||||||
self.aquire[k] = a
|
self.aquire[k] = a
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -24,7 +24,7 @@ class Cell:
|
|||||||
exchange: None
|
exchange: None
|
||||||
|
|
||||||
def __init__(self,name,x,y,area,pop,demand,world) -> None:
|
def __init__(self,name,x,y,area,pop,demand,world) -> None:
|
||||||
pop=pop*100
|
pop=pop*10
|
||||||
self.name=name
|
self.name=name
|
||||||
self.loc_x=x
|
self.loc_x=x
|
||||||
self.loc_y=y
|
self.loc_y=y
|
||||||
|
|||||||
+5
-3
@@ -86,12 +86,14 @@ class Simulation():
|
|||||||
Executes a tick of the simulation
|
Executes a tick of the simulation
|
||||||
"""
|
"""
|
||||||
start=time.time()
|
start=time.time()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
self.tick_agents_random_order()
|
||||||
|
agentstep=time.time()
|
||||||
for cell_id,c in self.cells.items():
|
for cell_id,c in self.cells.items():
|
||||||
c.setup_demand_for_step(episode_length)
|
c.setup_demand_for_step(episode_length)
|
||||||
setup=time.time()
|
setup=time.time()
|
||||||
self.tick_agents_random_order()
|
|
||||||
agentstep=time.time()
|
|
||||||
for b in self.businesses:
|
for b in self.businesses:
|
||||||
b.tick(self.tick_count)
|
b.tick(self.tick_count)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -28,8 +28,8 @@ cxs=[cx]
|
|||||||
# Create Demand
|
# Create Demand
|
||||||
#cx.submit_order(w,"Wood",0,1000,Side.BUY)
|
#cx.submit_order(w,"Wood",0,1000,Side.BUY)
|
||||||
#cx.submit_order(2,"Gem",1,10,Side.SELL)
|
#cx.submit_order(2,"Gem",1,10,Side.SELL)
|
||||||
EPISODE_LEN=100
|
EPISODE_LEN=20
|
||||||
NUM_EPISODES=50
|
NUM_EPISODES=20
|
||||||
NUM_SEED_BUS=10
|
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']}")
|
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()
|
sim.reset()
|
||||||
for i in range(NUM_SEED_BUS):
|
for i in range(NUM_SEED_BUS):
|
||||||
sim.create_bussiness(1)
|
sim.create_bussiness(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
log.writeEXData()
|
log.writeEXData()
|
||||||
|
|||||||
+2
-1
@@ -2,4 +2,5 @@ lightmatchingengine
|
|||||||
pyyaml
|
pyyaml
|
||||||
influxdb-client
|
influxdb-client
|
||||||
pandas
|
pandas
|
||||||
sqlalchemy
|
sqlalchemy
|
||||||
|
tensorflow
|
||||||
Reference in New Issue
Block a user