I have a decision variable that consists of a matrix of power usage for an energy facility. Each column in the matrix corresponds to different energy drains (for example light bulbs or heating), with every row being the energy usage at a time step t.
Time Step | LightBulb 1 Power | LightBub 2 Power | Lightbulb 3 Power |
---|---|---|---|
1 | 30 kW | 50 kW | 100 kW |
2 | 40 kW | 40 kW | 80 kW |
The energy usage at each time step is what I want CVXPY to tell me. However the facility has power limits on what the lightbulbs can receive. In particular, some of the lightbulbs are connected to the same outlet, which cannot output more than a certain amount of power to the all the lightbulbs connected to it combined.
Thus, I want to put constraints on different combinations of columns of the array. For example, if column 1 is lightbulb 1 and column 2 is lightbulb 2, I want to iterate through the array and place a constraints like this:
[Column Lightbulb 1 Power at time step T] + [Column Lightbulb 2 Power at time step T] <= [Limit]
However the number of subsets is dynamic, as different facilites have different lightbulb orientations. For example one facility might have 3 lightbulbs plugged into one outlet and another might have 7 lightbulbs plugged into one outlet, and I want to put a limit on the total energy use of these sub-group.
Consequently, I used this:
cvx.sum(cvx.vstack(k for k in [lightbulbs])) <= [Limit]
When I implement this however, in the manner of the snippet above (where [lightbulbs] is an individual subset of lightbulbs who are attached to the same outlet), CVXPY does not obey the constraint, even though it accepts it, i.e. the total power of the lightbulbs at a time step exceeds the limit i want to place on them. What am I doing wrong?