[英]Linear programming constraints: multiplication of optimization variables
Given an optimization problem with two optimization variables ( x_in(t)
, x_out(t)
). 给出两个优化变量( x_in(t)
, x_out(t)
)的优化问题。 For any time-step, when x_in
is non-zero, x_out
must be zero (and vice versa). 对于任何时间步长,当x_in
不为零时, x_out
必须为零(反之亦然)。 Written as a constraint: 写成约束:
x_in(t)*x_out(t)=0
How can such a constraint be included in Matlab's linprog
function? 如何在Matlab的linprog
函数中包含这样的约束?
Since the problem is not entirely linear, I do not believe you can solve it as-is using the linprog
function. 由于问题不是完全线性的,我不相信你可以使用linprog
函数解决它。 However, you should be able to reformulate the problem as a mixed integer linear programming problem. 但是,您应该能够将问题重新表述为混合整数线性规划问题。 Then you would be able to use for example this extension from Matlab Central to solve the problem. 然后你就可以使用Matlab Central的 这个扩展来解决问题。
Assuming that x_in(t)
and x_out(t)
are non-negative variables with upper bounds x_in_max
and x_out_max
, respectively, then you can add the variables y_in(t)
and y_out(t)
to your optimization problem and include the following constraints: 假设x_in(t)
和x_out(t)
分别是上限为x_in_max
和x_out_max
非负变量,则可以将变量y_in(t)
和y_out(t)
到优化问题中,并包含以下约束:
(1) y_in(t) and y_out(t) are binary, i.e. 0 or 1
(2) x_in(t) <= x_in_max * y_in(t)
(3) x_out(t) <= x_out_max * y_out(t)
(4) y_in(t) + y_out(t) = 1
Given that y_in
and y_out
are binary variables, constraints (2) and (3) relate the x_
and y_
variables with each other and ensure that the x_
variables remain within bounds (fix bounds on the x_
variables can thus and should be removed from the problem formulation). 假设y_in
和y_out
是二元变量,约束(2)和(3)将x_
和y_
变量相互关联,并确保x_
变量保持在边界内( x_
变量的固定边界因此可以从中删除问题制定)。 Constraint (4) ensures that either the _in
or the _out
event occurs, but not both at the same time. Constraint(4)确保发生_in
或_out
事件,但不能同时发生。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.