# Setting a constraint as a percent in a linear programming problem

I am trying to solve the following linear programming problem with a constraint that requires at least 10% of each ingredient. The problem is asking that the solution consists of at least 10% seeds, 10% raisins, 10% flakes, 10% pecans, and 10% walnuts. At the moment I have the constraints set up under "#ingredients" but am not able to figure out how to make the value 10%, .10 does not seem to be working.

``````# declare the model
model = ConcreteModel()

# declare decision variables
model.seeds = Var(domain=NonNegativeReals)
model.raisins = Var(domain=NonNegativeReals)
model.flakes = Var(domain=NonNegativeReals)
model.peacans = Var(domain=NonNegativeReals)
model.walnuts = Var(domain=NonNegativeReals)

# declare objective
model.cost = Objective(
expr = 4*model.seeds + 5*model.raisins + 3*model.flakes + 7*model.peacans + 6*model.walnuts,
sense = minimize)

# declare constraints
# Vitamin Content
model.Vitamins = Constraint(expr = 10*model.seeds + 20*model.raisins + 10*model.flakes +
30*model.peacans + 20*model.walnuts >= 20)

# Mineral Content
model.Minerals = Constraint(expr = 5*model.seeds + 7*model.raisins + 4*model.flakes + 9*model.peacans
+ 2*model.walnuts >= 10)

# Protein Content
model.Protein = Constraint(expr = 1*model.seeds + 4*model.raisins + 10*model.flakes + 2*model.peacans
+ 1*model.walnuts >= 15)

# Calorie Content
model.Calories = Constraint(expr = 500*model.seeds + 450*model.raisins + 160*model.flakes +
300*model.peacans + 500*model.walnuts >= 600)

#Ingredients
# Seed Constraint
model.Seeds = Constraint(expr = model.seeds >= .10)

# Raisin Constraint
model.Raisin = Constraint(expr = model.raisins >= .10)

# Flakes Constraint
model.Flakes = Constraint(expr = model.flakes >= .10)

# Peacans Constraint
model.Peacans = Constraint(expr = model.peacans >= .10)

# Walnuts Constraint
model.Walnuts = Constraint(expr = model.walnuts >= .10)

# show the model you've created
model.pprint()
``````

### Content Attribution

This content was originally published by Joshua Cortigiano at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.