# Optimizing vectors with equal elements

I am trying to distribute power across different devices, so that the sum is as equal as possible to the power setpoint. At the same time, the sum of power per phase must not exceed the power of the fuse and must also be between min and max power (depending on the device). So far I have reduce the problem to the following: $$\sum_i^n \sum^z P_i= P_{setpoint}$$ $$\sum_i^n P_{x i}\leq P_{xfuse}$$ $$\sum_i^n P_{y i} \leq P_{yfuse}$$ $$\sum_i^n P_{z i} \leq P_{zfuse}$$ $$P_{min} \leq P_i \leq P_{max}$$ Where I get stuck is at defining devices, since some use one phase, others three, so their power vector would look like: $$P_i = (0, 0, P_z)$$ or $$P_i = (P_x, 0, 0)$$ (for one phase devices) or $$P_j = (P_x, P_y, P_z)$$ but $$P_x = P_y = P_z$$ (for three phase devices). Also, power per device is defined as $$P_{device} = Px + Py + Pz$$.

I think this could be easily solved with linear optimization, but I don't know how to enforce the eqality of the elements for three phase devices. Also, how would I ensure that the sum of power of all devices is as equal as possible to the setpoint?

I searched for existing answers, but I haven't found anything helpful(I might be using the wrong terms).

Edit

As said in the comments, my optimization goal was not defined well. What I really want is to maximize the power of each device with above constraints. In other words, I want all devices to still use as much power as possible, but their power still sums to $$P_{setpoint}$$.

• Should the first constraint have another summation over the components of $P_i$? – nicoguaro Apr 21 at 12:43
• Also, when you say "is as equal as possible" then you really don't mean that they're equal, but that you're trying to minimize a deviation. Right now, there is no optimization problem in your statement, just a bunch of equalities. – Wolfgang Bangerth Apr 22 at 0:07
• Edited to better explain optimization goal and fix summation. @nicoguaro Yes, I wrote it in the text but forgot to include it above. – Vid Apr 22 at 13:40
• Although I am not certain how to notate the summation correctly, I hope that it is clear from the text. – Vid Apr 22 at 13:47