1

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?

  • Please be more precise. This incomplete peusocode (whose syntax is broken) doesn't help much. If you are trying to put one constraint on each element of a cartesian product of two sets, both approaches are very far away from it. But without data, reproducible code and context it's really hard to guess. Remark: You can print cvxpy's expressions and this should show you which constraint really is posted and why your approach is not working as expected. (But i recommend doing it with scaled down data) – sascha Jun 09 '21 at 20:48
  • do these changes help? – ROHAN DATTA Jun 09 '21 at 21:03

0 Answers0