Created
April 26, 2020 18:17
-
-
Save pabloazurduy/10f599cf56c0287430981fb9798cc231 to your computer and use it in GitHub Desktop.
a snippet that shows the implementation of the qp appx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from helpers.mip import get_quadratic_appx | |
# get a new variable that represents u^2 = qa_u | |
qa_u = {} | |
for i in stores: | |
for t in days: | |
qa_u[(i,t)] = get_quadratic_appx(model = mdl, | |
var = u[(i,t)], | |
id_name = 'qpu_{}_{}'.format(i,t), | |
min_interval = 0, # lower value where we estimate that u will be moving | |
max_interval = 100, # higher value where we estimate that u will be moving | |
num_linspace = 5 # number of points of discretization or interest | |
) | |
mdl.objective = mip.xsum(qa_u[(i,t)] for i in stores for t in days) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment