Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
I_0: initial_inventory
c_t: unit production cost in month t
d_t: demand of month t
Variables:
X_t: Amount produced in month t
I_t: Inventory at the end of period t
Constraints:
Inventory Constraints: I_{t-1} + X_t - d_t = I_t
Capacity Constraints: X_t <= p
Objective: Min Sum(h*I_t + c_t*X_t)
"""
model = cpx.Model('prod_planning')
start = time()
# ================== Decision variables ==================
production_variables = model.continuous_var_dict(input_df_dict['input_data'].index, name="X")
inventory_variables = model.continuous_var_dict(input_df_dict['input_data'].index, name="I")
# Alternative way of creating the variables
# production_variables = {index: model.continuous_var(name='X_' + str(row['period']))
# for index, row in input_df_dict['input_data'].iterrows()}
#
# inventory_variables = {index: model.continuous_var(name='I_' + str(row['period']))
# for index, row in input_df_dict['input_data'].iterrows()}
logger.debug("var declaration time: {:.6f}".format(time() - start))
def __init__(self, input_data, input_params):
self.input_data = input_data
self.input_params = input_params
self.model = cpx.Model('prod_planning')
self._create_decision_variables()
self._create_main_constraints()
self._set_objective_function()