Reputation: 382
I was trying to optimize the following problem using python pulp
import pulp
# Instantiate our problem class
model = pulp.LpProblem("Cost minimising problem", pulp.LpMinimize)
W = pulp.LpVariable('W', cat='Integer')
X = pulp.LpVariable('X', cat='Integer')
Y = pulp.LpVariable('Y', cat='Integer')
Z = pulp.LpVariable('Z', cat='Integer')
# Objective function
model += 1.33 * W + 1.76 * X + 1.46 * Y + 0.79 * Z,"Cost"
# Constraints
model += W + X + Y + Z == 1
model += W >= 0.1
model += W <= 0.75
model += X >= 0.1
model += X <= 0.85
model += Y >= 0.1
model += Y <= 0.65
model += Z >= 0.1
model += Z <= 0.40
# Solve our problem
model.solve()
pulp.LpStatus[model.status]
'Undefined'
The solution turns out to be undefined. Am I making a mistake in problem formulation or missing out something ?
Upvotes: 1
Views: 604
Reputation: 5429
When I implement the same code I get the result 'Infeasible'.
This makes sense as your variables W, X, Y, Z
all have to be integers, but you then bound them to be more than 0.1, and less than another number which is less than 1.
There are no integers inbetween 0.1 and 0.XX, so there is no feasible solution.
Upvotes: 1