使用分段线性逼近的单位承诺问题变为MIQP [英] unit commitment problem using piecewise-linear approximation become MIQP
问题描述
我尝试使用MILP(混合整数线性规划)来计算单位承诺问题. (单位承诺:试图找到最佳发电机调度的优化问题)
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)
有两个优化变量.
发电机功率: P (连续变量). 成本曲线上要使用的线段: BN (二进制变量). ,用于线性化生成器的二次成本函数.
Generator power :P(continuous variables). Which line segment on cost curve to use :BN(binary variable). ,Used to linearize the quadratic cost function of the generator.
一次只能打开一个线段.因此将有一个约束. Bn1 + Bn2 + Bn3 <= 1
Only one line segment can be opened at a time. So there will be a Constraint. Bn1 + Bn2 + Bn3 <=1
每个线段将具有自己的斜率和截距. 我想计算最低成本. 这个数学公式表示从1到H小时的总成本.
Each line segment will have its own slope and intercept. I want to calculate the minimum cost. This mathematical formula represents the sum of the cost of 1 to H hours.
这就是我的编码方式:sum(slope1 * p * Bn1 +拦截1 * Bn1 + slope2 * p * Bn2 +拦截2 * Bn2 +坡度3 * p * Bn3 +拦截3 * Bn3 )
This is how I code : sum(slope1* p * Bn1 +intercept1* Bn1 +slope2* p * Bn2 +intercept2* Bn2 +slope3* p * Bn3 +intercept3* Bn3 )
这样,两个优化变量将相乘.使问题从MILP变成MIQP. 我想问一下是否有任何方法可以保持我在MILP中的问题. 谢谢你. ps:我使用python API的ibm cplex解决优化问题
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
推荐答案
您可以在docplex中使用分段线性.让我分享来自python中 zoo和bus的示例:
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)
给出
nbBus40 = 0
nbBus30 = 10.0
这篇关于使用分段线性逼近的单位承诺问题变为MIQP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!