Objective function: opt_model = pulp.LpProblem("Optimizer", pulp.LpMinimize)
# use status of A tranches on day (used or not used)Ī_status_15 = pulp.LpVariable('a_stat_15', cat='Binary')Ī_status_30 = pulp.LpVariable('a_stat_30', cat='Binary')Ī_status_45 = pulp.LpVariable('a_stat_45', cat='Binary')Ī_status_60 = pulp.LpVariable('a_stat_60', cat='Binary') # status of supply options per hour (in use or not in use)
((hour, option) for hour in hours for option in options.index), Variables: # production per supply option per hour Options = pd.DataFrame(options_list, columns=cols)
#Milp solver for excel code#
My code has 200+ lines so I am a bit hesitant to share all of it here, but I'll share the most important bits below.ĭefining supply options: def set_supplyoptions():Ĭols = The problem contains around 1250 constraints. Each option can vary every hour and has an integer value (amount of production) and a binary value (on/off), resulting in around 14 x 2 x 24 = 672 variables. I defined each asset-mode combination as an 'option', resulting in 14 options in total. I am dealing with 3 production asset ('a', 'l' and 'o'), each of which have several production modes. At the end of each loop, I take the optimized production schedule for the day and append it to a dataframe, so in the end I have a dataframe that contains the production schedule for all days of the year.