Continuity Constraint in a Optimization Problem
조회 수: 1 (최근 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에서 Direct Search에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!