its starting to be more stable
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ spec:
|
|||||||
max_world_price: 100
|
max_world_price: 100
|
||||||
|
|
||||||
- name: "Food"
|
- name: "Food"
|
||||||
max_world_price: 10
|
max_world_price: 30
|
||||||
|
|
||||||
- name: "Grain"
|
- name: "Grain"
|
||||||
max_world_price: 5
|
max_world_price: 5
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@ kind: production
|
|||||||
spec:
|
spec:
|
||||||
|
|
||||||
- name: Grain
|
- name: Grain
|
||||||
amount: 200
|
amount: 20
|
||||||
prod:
|
prod:
|
||||||
Raw_Agriculture_Plot: 1
|
Raw_Agriculture_Plot: 1
|
||||||
- name: Fruit
|
- name: Fruit
|
||||||
@@ -24,7 +24,7 @@ spec:
|
|||||||
prod:
|
prod:
|
||||||
# Fuel: 1
|
# Fuel: 1
|
||||||
# Fruit: 1
|
# Fruit: 1
|
||||||
Grain: 1
|
Grain: 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -14,7 +14,7 @@ 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.2,production["amount"], 20)
|
simulation, self, production["name"], exchange, 0.2,production["amount"]*2, 20)
|
||||||
self.craft = AutoProductionAgent(simulation, self)
|
self.craft = AutoProductionAgent(simulation, self)
|
||||||
self.aquire = {}
|
self.aquire = {}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
+11
-1
@@ -66,12 +66,20 @@ class Simulation():
|
|||||||
tasks=[]
|
tasks=[]
|
||||||
for k in keys:
|
for k in keys:
|
||||||
fun=self.tick_funcs[k]
|
fun=self.tick_funcs[k]
|
||||||
|
#row=[fun,self.tick_count,self.episode_count]
|
||||||
|
#tasks.append(row)
|
||||||
|
#self.taskpool.submit(self._execute_tick,row)
|
||||||
|
|
||||||
fun(self.tick_count,self.episode_count)
|
fun(self.tick_count,self.episode_count)
|
||||||
self.taskpool.map(self._execute_tick,tasks)
|
self.taskpool.map(self._execute_tick,tasks)
|
||||||
|
|
||||||
def _execute_tick(args):
|
|
||||||
|
|
||||||
|
def _execute_tick(self,args):
|
||||||
fun=args[0]
|
fun=args[0]
|
||||||
fun(args[1],args[2])
|
fun(args[1],args[2])
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def tick(self,episode_length):
|
def tick(self,episode_length):
|
||||||
"""
|
"""
|
||||||
@@ -188,6 +196,8 @@ class Simulation():
|
|||||||
|
|
||||||
for b in self.businesses:
|
for b in self.businesses:
|
||||||
id=b.production["id"]
|
id=b.production["id"]
|
||||||
|
if len(b.balance_history)<2:
|
||||||
|
continue
|
||||||
diff=b.balance-b.balance_history[-2]
|
diff=b.balance-b.balance_history[-2]
|
||||||
if id not in profit:
|
if id not in profit:
|
||||||
profit[id]=0
|
profit[id]=0
|
||||||
|
|||||||
@@ -28,25 +28,32 @@ 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
|
||||||
|
NUM_EPISODES=100
|
||||||
|
NUM_SEED_BUS=5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sim=Simulation()
|
sim=Simulation()
|
||||||
sim.seed(42)
|
sim.seed(43)
|
||||||
sim.set_cells(cells)
|
sim.set_cells(cells)
|
||||||
sim.reset()
|
sim.reset()
|
||||||
for i in range(100):
|
for i in range(EPISODE_LEN):
|
||||||
sim.tick(100)
|
sim.tick(EPISODE_LEN)
|
||||||
sim.reset()
|
sim.reset()
|
||||||
# create info
|
# create info
|
||||||
while len(sim.get_underutelized_prods(1))>0:
|
while len(sim.get_underutelized_prods(2))>0:
|
||||||
sim.create_bussiness(1)
|
sim.create_bussiness(2)
|
||||||
#sim.reset()
|
#sim.reset()
|
||||||
for a in tqdm(range(100)):
|
for a in tqdm(range(NUM_EPISODES)):
|
||||||
for i in range(100):
|
for i in range(EPISODE_LEN):
|
||||||
sim.tick(100)
|
sim.tick(EPISODE_LEN)
|
||||||
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()
|
||||||
sim.create_bussiness(1)
|
for i in range(NUM_SEED_BUS):
|
||||||
|
sim.create_bussiness(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user