I'm trying to solve a linearized DEA optimization problem.
Here is how I defined the problem in python:
Philadelphia = plp.LpProblem("Philadelphia", plp.LpMaximize)
U1 = plp.LpVariable("U1", 0)
U2 = plp.LpVariable("U2", 0)
V1 = plp.LpVariable("V1", 0)
V2 = plp.LpVariable("V2", 0)
Philadelphia += 700*U1 + 300*U2, "obj"
Philadelphia += 700*U1 + 300*U2 - 40*V1 - 500*V2 <= 0, "c1"
Philadelphia += 300*U1 + 600*U2 - 50*V1 - 500*V2 <= 0, "c2"
Philadelphia += 200*U1 + 700*U2 - 50*V1 - 400*V2 <= 0, "c3"
Philadelphia += 400*U1 + 600*U2 - 50*V1 - 500*V2 <= 0, "c4"
Philadelphia += 500*U1 + 400*U2 - 40*V1 - 400*V2 <= 0, "c5"
Philadelphia += 500*U1 + 500*U2 - 50*V1 - 500*V2 <= 0, "c6"
Philadelphia += 800*U1 + 500*U2 - 40*V1 - 600*V2 <= 0, "c7"
Philadelphia += 300*U1 + 200*U2 - 30*V1 - 400*V2 <= 0, "c8"
Philadelphia += 40*V1 + 500*V2 = 1, "c9"
However, the constraint:
Philadelphia += 40*V1 + 500*V2 = 1, "c9"
Gives the error "invalid syntax" with an arrow pointing to the equals sign.
How can I modify my constraint so that I do not get this error?
PuLP syntax needs ==
for forcing equality.
Philadelphia += 40*V1 + 500*V2 == 1, "c9"
That should work!