#do not forget to instal pulp
#python -m pip install pulp

# import the solver pulp
from pulp import *

# Define the Model
model_RM = LpProblem("Reddy Mikks", LpMaximize)

#Define the variables
x1 = LpVariable("x1", 0, None)
x2 = LpVariable("x2", 0, None)

#Objective function
model_RM += 5*x1 + 4*x2

#Constraints
model_RM += 6*x1 + 4*x2 <= 24, "C1"
model_RM += x1 + 2*x2 <= 6, "C2"
model_RM += -x1 + x2 <= 1, "C3"
model_RM +=      x2 <= 2, "C4"

#solve model
model_RM.solve()
status=LpStatus[model_RM.status]
print("Status:", LpStatus[model_RM.status])

# write the model in a txt file
model_RM.writeLP("modelRM.lp")

# write the solution
print("solution value = ",
      value(model_RM.objective))

# Each of the variables is printed with it's resolved optimum value
for v in model_RM.variables():
       print(v.name, "=", v.varValue)


