Continuity Constraint in a Optimization Problem

8 views (last 30 days)
VB
VB on 8 Nov 2019
Edited: Alberto Chavez on 31 Mar 2020
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 Comment
Matt J
Matt J on 21 Mar 2020
What does "consecutively" mean in relation to the 8x24 structure of x?

Sign in to comment.

Answers (1)

Alberto Chavez
Alberto Chavez on 20 Mar 2020
Edited: Alberto Chavez on 31 Mar 2020
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

Categories

Find more on Optimization Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!