diff --git a/db/production.yml b/db/production.yml index 90ddca2..86da6e7 100644 --- a/db/production.yml +++ b/db/production.yml @@ -20,7 +20,7 @@ spec: # Wood: 1 - name: Food - amount: 500 + amount: 5 prod: # Fuel: 1 Fruit: 1 diff --git a/econ/__pycache__/exchange.cpython-310.pyc b/econ/__pycache__/exchange.cpython-310.pyc index c042305..e8b6f84 100644 Binary files a/econ/__pycache__/exchange.cpython-310.pyc and b/econ/__pycache__/exchange.cpython-310.pyc differ diff --git a/econ/__pycache__/simulation.cpython-310.pyc b/econ/__pycache__/simulation.cpython-310.pyc index 8414d07..3b71a9b 100644 Binary files a/econ/__pycache__/simulation.cpython-310.pyc and b/econ/__pycache__/simulation.cpython-310.pyc differ diff --git a/econ/agents/__pycache__/base_aquire_agent.cpython-310.pyc b/econ/agents/__pycache__/base_aquire_agent.cpython-310.pyc index 698aba8..902481e 100644 Binary files a/econ/agents/__pycache__/base_aquire_agent.cpython-310.pyc and b/econ/agents/__pycache__/base_aquire_agent.cpython-310.pyc differ diff --git a/econ/agents/__pycache__/base_distribution_agent.cpython-310.pyc b/econ/agents/__pycache__/base_distribution_agent.cpython-310.pyc index faf9622..e0e29b4 100644 Binary files a/econ/agents/__pycache__/base_distribution_agent.cpython-310.pyc and b/econ/agents/__pycache__/base_distribution_agent.cpython-310.pyc differ diff --git a/econ/agents/__pycache__/price_believe_distribute.cpython-310.pyc b/econ/agents/__pycache__/price_believe_distribute.cpython-310.pyc index cd88ea6..43f5a7c 100644 Binary files a/econ/agents/__pycache__/price_believe_distribute.cpython-310.pyc and b/econ/agents/__pycache__/price_believe_distribute.cpython-310.pyc differ diff --git a/econ/agents/price_believe_distribute.py b/econ/agents/price_believe_distribute.py index 4bd8772..2d56c87 100644 --- a/econ/agents/price_believe_distribute.py +++ b/econ/agents/price_believe_distribute.py @@ -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( diff --git a/econ/business/Price_Believe_Business.py b/econ/business/Price_Believe_Business.py index 5269756..28ca0b1 100644 --- a/econ/business/Price_Believe_Business.py +++ b/econ/business/Price_Believe_Business.py @@ -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 diff --git a/econ/business/__pycache__/Price_Believe_Business.cpython-310.pyc b/econ/business/__pycache__/Price_Believe_Business.cpython-310.pyc index 954c7ec..d85fbc9 100644 Binary files a/econ/business/__pycache__/Price_Believe_Business.cpython-310.pyc and b/econ/business/__pycache__/Price_Believe_Business.cpython-310.pyc differ diff --git a/econ/cells/__pycache__/cell.cpython-310.pyc b/econ/cells/__pycache__/cell.cpython-310.pyc index 8dda1d8..07c3b0f 100644 Binary files a/econ/cells/__pycache__/cell.cpython-310.pyc and b/econ/cells/__pycache__/cell.cpython-310.pyc differ diff --git a/econ/cells/cell.py b/econ/cells/cell.py index e5ec4ad..5ea6d65 100644 --- a/econ/cells/cell.py +++ b/econ/cells/cell.py @@ -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 diff --git a/econ/simulation.py b/econ/simulation.py index f1d4523..0c7b249 100644 --- a/econ/simulation.py +++ b/econ/simulation.py @@ -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) diff --git a/log/__pycache__/__init__.cpython-310.pyc b/log/__pycache__/__init__.cpython-310.pyc index 3daa835..7eae110 100644 Binary files a/log/__pycache__/__init__.cpython-310.pyc and b/log/__pycache__/__init__.cpython-310.pyc differ diff --git a/main.py b/main.py index 13ae49e..fbf5aac 100644 --- a/main.py +++ b/main.py @@ -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() diff --git a/requirements.txt b/requirements.txt index cb7ea52..b96ab1f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,5 @@ lightmatchingengine pyyaml influxdb-client pandas -sqlalchemy \ No newline at end of file +sqlalchemy +tensorflow \ No newline at end of file diff --git a/tmp.prof b/tmp.prof index 1cb4441..81616b7 100644 Binary files a/tmp.prof and b/tmp.prof differ