HA looks good
This commit is contained in:
@@ -29,6 +29,8 @@ class Base_Distribution_Agent(BaseAgent,ABC):
|
||||
"""
|
||||
Sets the amount of resources the agent should keep in business inventory
|
||||
"""
|
||||
if target<0:
|
||||
target=0
|
||||
self.target=target
|
||||
|
||||
|
||||
@@ -46,7 +48,7 @@ class Base_Distribution_Agent(BaseAgent,ABC):
|
||||
If err < 0 then agent needs to distribute resources
|
||||
"""
|
||||
err=self.business.inventory[self.resource]-self.target
|
||||
return err
|
||||
return int(err)
|
||||
|
||||
|
||||
def distribute_resource(self,price_per,amount,cx_id):
|
||||
@@ -119,6 +121,7 @@ class Base_Distribution_Agent(BaseAgent,ABC):
|
||||
def confirm_distribution(self,dis_qty,step):
|
||||
income_per=self.income/self.qty
|
||||
income_to_confirm=income_per*dis_qty
|
||||
income_to_confirm=round(income_to_confirm,2)
|
||||
self.income_offset-=income_to_confirm
|
||||
self.qty_offset-=dis_qty
|
||||
self.income_offset=round(self.income_offset,2)
|
||||
|
||||
Reference in New Issue
Block a user