some things work
This commit is contained in:
@@ -6,20 +6,26 @@ class Price_Believe_Business(Business):
|
||||
def __init__(self, id, production, balance,exchange,simulation) -> None:
|
||||
super().__init__(id, production, balance)
|
||||
|
||||
self.distribute=Price_Believe_Distribiute_Agent(simulation,self,production["name"],exchange,0.1,50)
|
||||
self.distribute=Price_Believe_Distribiute_Agent(simulation,self,production["name"],exchange,0.5,10)
|
||||
self.craft=AutoProductionAgent(simulation,self)
|
||||
self.aquire={}
|
||||
for k,v in production["craft"].items():
|
||||
a=Price_Believe_Aquire_Agent(simulation,self,k,exchange,1,50)
|
||||
a.set_target(v*2)
|
||||
a.set_price_max(10)
|
||||
self.aquire[k]=a
|
||||
for l in production["prod"]:
|
||||
for k,v in l.items():
|
||||
a=Price_Believe_Aquire_Agent(simulation,self,k,exchange,1,10)
|
||||
a.set_target(v*2)
|
||||
a.set_price_max(10)
|
||||
self.aquire[k]=a
|
||||
self.distribute.set_price_min(10)
|
||||
self.distribute.set_target(0)
|
||||
|
||||
def step_business_decisions(self):
|
||||
for k,v in self.production["craft"].items():
|
||||
def tick_business_decisions(self,step):
|
||||
for comp in self.production["prod"]:
|
||||
for k,v in comp.items():
|
||||
modifier=self.craft.worker+1
|
||||
self.aquire[k].set_target(v*modifier)
|
||||
max_amount=self.production["amount"]*5
|
||||
self.craft.set_target(max_amount)
|
||||
|
||||
def resource_in_possesion(self):
|
||||
return self.distribute.open_qty+self.inventory[self.production["name"]]
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -13,14 +13,33 @@ class Business(ABC):
|
||||
"""
|
||||
self.id=id
|
||||
self.production=production
|
||||
self.balance_history=[balance]
|
||||
self.balance=balance
|
||||
#Setup Inventory
|
||||
self.inventory={production["name"]: 0}
|
||||
for k,v in production["craft"].items():
|
||||
self.inventory[k]=0
|
||||
for l in production["prod"]:
|
||||
for k,v in l.items():
|
||||
self.inventory[k]=0
|
||||
pass
|
||||
|
||||
def step_business_decisions(self):
|
||||
|
||||
def tick(self,step):
|
||||
self.tick_business_decisions(step)
|
||||
|
||||
def tick_business_decisions(self,step):
|
||||
assert "no business decision method has been created"
|
||||
pass
|
||||
|
||||
|
||||
def tick_episode(self,episode_count):
|
||||
"""
|
||||
Call for resetting for the next episode
|
||||
"""
|
||||
self.balance_history.append(self.balance)
|
||||
self.tick_business_episode(episode_count)
|
||||
|
||||
|
||||
def tick_business_episode(self,episode_count):
|
||||
"""
|
||||
Call for resetting for the next episode
|
||||
"""
|
||||
assert "no business episode tick method has been created"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user