unit commitment problem using piecewise-linear approximation become MIQP

橙三吉。 提交于 2020-06-17 12:56:18

问题


I try to use MILP (Mixed Integer Linear Programming) to calculate the unit commitment problem. (unit commitment: An optimization problem trying to find the best scheduling of generator)

There are two optimization variables.

Generator power :P(continuous variables). Which line segment on cost curve to use :BN(binary variable). enter image description here,Used to linearize the quadratic cost function of the generator.

Only one line segment can be opened at a time. So there will be a Constraint. Bn1 + Bn2 + Bn3 <=1

Each line segment will have its own slope and intercept. I want to calculate the minimum cost. enter image description here This mathematical formula represents the sum of the cost of 1 to H hours.

This is how I code : sum(slope1* p * Bn1 +intercept1* Bn1 +slope2* p * Bn2 +intercept2* Bn2 +slope3* p * Bn3 +intercept3* Bn3 )

This way, the two optimization variables will be multiplied. Make the problem from MILP become to MIQP. I want to ask if there is any way can maintain my problem in MILP. thank you. ps : i use ibm cplex of python API to solve Optimization problem


回答1:


You could use piecewise linear in docplex. Let me share the example from the zoo and bus example in python:

from docplex.mp.model import Model

mdl = Model(name='buses')
nbbus40 = mdl.integer_var(name='nbBus40')
nbbus30 = mdl.integer_var(name='nbBus30')
mdl.add_constraint(nbbus40*40 + nbbus30*30 >= 300, 'kids')

#after 4 buses, additional buses of a given size are cheaper
f=mdl.piecewise(0, [(0, 0),(4,4)], 0.8)

mdl.minimize(f(nbbus40)*500 + f(nbbus30)*400)

mdl.solve()

mdl.export("c:\\buses.lp")

for v in mdl.iter_integer_vars():
    print(v," = ",v.solution_value)

which gives

nbBus40  =  0
nbBus30  =  10.0


来源:https://stackoverflow.com/questions/61904604/unit-commitment-problem-using-piecewise-linear-approximation-become-miqp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!