pip install pulp

# import the library pulp as p
import pulp as p
#create a LP minimization problem
prob= p.LpProblem ('Problem',p.LpMinimize)


x=p.LpVariables("x",lowbound=0)
y=p.LpVariables("y",lowbound=0)
z=p.LpVariables("z",lowbound=0)
q=p.LpVariables("q",lowbound=0)


prob+= 2*x+4*y+5*z+3*q


#constraints
prob+= -x-2*y+2*z>=40
prob+= 3*x+2*z+q<=100
prob+= x-2*y-z+4*q>=50


print(prob)
status=prob.solve()
print(p.value(x),p.value(y),p.value(z),p.value(q),p.value(prob.objective))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: