Discrete Computational Structures Project Full Report
Discrete Computational Structures Project Full Report
Let:
import pulp
# Calorie requirement
# Protein requirement
# Carbohydrate requirement
problem += 20 * x_apple + 28 * x_rice >= 300, "Carbohydrate_Requirement"
problem.solve()
print("Status:", pulp.LpStatus[problem.status])
print(f"Apple: {x_apple.varValue:.2f}g")
print(f"Rice: {x_rice.varValue:.2f}g")
print(f"Chicken: {x_chicken.varValue:.2f}g")
This code defines the problem, defines the constraints, solves the LP problem
and prints out the result!
Result:
Status: Optimal
Apple: 21.74g
Rice: 0.00g
Chicken: 1.30g