38 lines
1.5 KiB
Python
38 lines
1.5 KiB
Python
import numpy as np
|
|
import json
|
|
|
|
from InventorySystem import InventorySystem
|
|
from OrderSystem import OrderSystem
|
|
from ProduceSystem import ProduceSystem
|
|
|
|
# Create Company Instance
|
|
class Firm:
|
|
the_os: OrderSystem
|
|
the_is: InventorySystem
|
|
the_ps: ProduceSystem
|
|
|
|
def __init__(self, env, dct_all_para):
|
|
self.env = env
|
|
|
|
# get the parameters here
|
|
self.xv_ary_initial_product_num = np.asarray(dct_all_para['xv_ary_initial_product_num'])
|
|
self.xv_ary_initial_material_num = np.asarray(dct_all_para['xv_ary_initial_material_num'])
|
|
self.dct_status_info = json.loads(dct_all_para['dct_status_info'])
|
|
self.xv_ary_lead_time = np.array([dct_all_para['xv_int_lead_time_a'], dct_all_para['xv_int_lead_time_b']])
|
|
|
|
# create agents here
|
|
self.the_os = OrderSystem(env)
|
|
self.the_is = InventorySystem(env, xv_ary_initial_material_num=self.xv_ary_initial_material_num,
|
|
xv_ary_initial_product_num=self.xv_ary_initial_product_num,
|
|
xv_ary_lead_time=self.xv_ary_lead_time)
|
|
self.the_ps = ProduceSystem(env, dct_status_info=self.dct_status_info)
|
|
# self.the_fs = FinancialSystem(env, xv_flt_initial_cash=self.xv_flt_initial_cash)
|
|
|
|
def operating(self):
|
|
self.the_os.rank_order()
|
|
self.the_ps.change_status()
|
|
self.the_ps.run_produce()
|
|
self.the_os.do_shipment()
|
|
# self.the_is.inventory_cost()
|
|
# self.the_fs.financial_calculating()
|