Skip to content

Instantly share code, notes, and snippets.

@ikatsov
Created February 11, 2020 15:55
Show Gist options
  • Select an option

  • Save ikatsov/8e91c6235b7874741421530b2bd59618 to your computer and use it in GitHub Desktop.

Select an option

Save ikatsov/8e91c6235b7874741421530b2bd59618 to your computer and use it in GitHub Desktop.
class State(object):
def __init__(self, warehouse_num, T, demand_history, t = 0):
self.warehouse_num = warehouse_num
self.factory_stock = 0
self.warehouse_stock = np.repeat(0, warehouse_num)
self.demand_history = demand_history
self.T = T # Length of one episode
self.t = t
def to_array(self):
return np.concatenate( ([self.factory_stock],
self.warehouse_stock,
np.hstack(self.demand_history),
[self.t]) )
def stock_levels(self):
return np.concatenate( ([self.factory_stock], self.warehouse_stock) )
class Action(object):
def __init__(self, warehouse_num):
self.production_level = 0
self.shippings_to_warehouses = np.zeros(warehouse_num)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment