Continuity Constraint in a Optimization Problem
10 次查看(过去 30 天)
显示 更早的评论
I'm working on an optimization algorithm and I should insert a continuity constraint on a variable x to be optimized. In other words, I have some appliances and I have to match active/off periods. This is my optimization variable :
x = optimvar('x',8,24,'Type','integer','LowerBound',0,'UpperBound',1);
I have to try to write a constraint to keep appliances running consecutively. How can I do?
1 个评论
回答(1 个)
Alberto Chavez
2020-3-20
编辑:Alberto Chavez
2020-3-31
Sometimes it is better to write the functions and contraints by hand using a small scale problem, and then try to write your code so that you have a clear idea of what you need to do. What I believe you are trying to do is a scheduling constraint, so that if one appliance stops running the next takes over, correct?
In that case, it's not only one constraint, but a set of constraints. If you have 2 appliances for example:
appliance 1 : x11, x12
appliance 2: x21, x22
Variables xij , index "i" represents the appliance name, index "j" represents the order in which it is used.
constraint set 1:
x11+x12+x21+x22 = 2 (this set permits only 2 elements in the schedule)
constraint set 2:
x11+x12 = 1
x21+x22 = 1 (this set permits only one order for each appliance)
constraint set 3:
x11+x21 = 1
x12+x22 = 1 (this set permits only one appliance for each order)
Results:
If x11=1, then x12=0, x22=1, x21=0
this means that appliance 1 runs first and then appliance 2.
If x11=0, then x12=1, x22=0, x21=1
this means that appliance 1 runs second and appliance 2 runs first.
Is that helpful?
Edit:
the 2 indexes in xij can be transformed into one:
instead of x11, x12, x21, x22, it would be x1, x2, x3, x4
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Optimization Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!