Variables for power flow with condition in constraint

It is not allowed.

The error message is not good because you have X < 0. Did you mean instead X[i, t] < 0? I think if you had done that you’d get a nicer error message.

For your other questions, yes, you need to model X = X_plus - X_neg where X_plus and X_neg are both >= 0. You’ll end up with a formulation that allows simultaneous flows in both directions, which is a known problem with this sort of LP formulation.

If you’re solving power flow problems, you should look up (if you haven’t already)

2 Likes