[英]GEKKO - Indicator Variable for Columns of Variables as Constraints of Problem
Assume "I" is as follow: (indicator)假设“我”如下:(指标)
Columns represent charger 1 and charger 2.列代表充电器 1 和充电器 2。
Rows represent EV1, EV2, EV3.行代表 EV1、EV2、EV3。
The time stamp is equal to 6.时间戳等于 6。
Each EV can be charged with only one charger.每辆电动汽车只能使用一个充电器充电。 For instance for EV 1: at time 0, I = [0,1] and at time 1, I = [1,0], which is not a valid case.
例如对于 EV 1:在时间 0,I = [0,1],在时间 1,I = [1,0],这不是有效的情况。 I want to implement it while the number of chargers is greater than 2.
我想在充电器数量大于 2 时实现它。
What kind of constraints can satisfy this requirement?什么样的约束可以满足这个要求?
I= [[[0.0], [1.0]],
[[0.0], [1.0]],
[[0.0], [1.0]]],
[[[1.0], [0.0]],
[[1.0], [0.0]],
[[1.0], [0.0]]],
[[[0.0], [0.0]],
[[0.0], [0.0]],
[[0.0], [0.0]]],
[[[0.0], [0.0]],
[[0.0], [0.0]],
[[0.0], [0.0]]],
[[[0.0], [0.0]],
[[0.0], [0.0]],
[[0.0], [0.0]]],
[[[0.0], [0.0]],
[[0.0], [0.0]],
[[0.0], [0.0]]]], dtype=object)
A typical method for this type of problem is to create a variable array for the use of the charger such as I = m.Array(m.Var,(3,6),integer=True,lb=0,ub=1)
for 3 EVs and 6 time periods.此类问题的典型方法是创建一个变量数组供充电器使用,例如
I = m.Array(m.Var,(3,6),integer=True,lb=0,ub=1)
用于 3 个 EV 和 6 个时间段。 If there is only one charger then a constraint can be created with an equation for every time period such as:如果只有一个充电器,则可以使用每个时间段的方程式创建约束,例如:
for i in range(6):
m.Equation(m.sum(I[:,i])==1)
The indicator variable I
can only be one (charging) for one of the vehicles.指示变量
I
对于其中一辆车辆只能是一个(充电)。 There is additional information on how to formscheduling optimization problems with integer programming .还有关于如何使用 integer 编程形成调度优化问题的附加信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.