Skip to content
View Categories

LPSolve Demo – Infeasible Solutions

LPSolve Demo – Infeasible Solutions

Hello, and welcome to this demonstration of LPSolve. In this video, we’ll look at infeasible solutions—what causes them and how to resolve them.

An infeasible solution occurs when there is no combination of ingredients that can satisfy all of the constraints at the same time. In other words, the requirements you’ve set are mathematically impossible to meet.

Let’s start with a very simple example. I’ll create a ration with just two ingredients: dried corn grain and lard. Corn is priced at one hundred seventy-five dollars per metric ton, and fat is priced at four hundred fifty dollars per metric ton. The nutrient values you see come directly from the feed library.

If I set a minimum dry matter of eighty-eight percent and run the formulation, LPSolve finds a feasible solution—about ninety-one percent corn and nine percent fat. That combination allows the ration to meet the dry matter requirement.

Now let’s change the constraint. Instead of a minimum, I’ll set a maximum dry matter of eighty-five percent. Both corn and fat have dry matter values greater than eighty-five percent. That means no matter how I combine them, there is no way to meet this requirement. As a result, the solver returns an infeasible solution. In LPSolve, this is reported as code zero.

Next, I’ll remove the dry matter constraint and set a minimum crude protein of twelve percent. Neither corn nor fat contains enough protein to meet that requirement, so again, there is no feasible solution.

If I lower the protein minimum to eight and a half percent, the solver finds a feasible solution using one hundred percent corn.

Now let’s combine constraints. I’ll set a dry matter minimum of eighty-eight percent and a crude protein minimum of eight and a half percent. To meet the protein requirement, the ration must be one hundred percent corn. But corn has a dry matter of only eighty-six point nine percent, so it fails the dry matter requirement. These two constraints conflict, and the solution becomes infeasible.

If I reduce the dry matter minimum to eighty-six percent, the solution becomes feasible again. This illustrates an important point: infeasible solutions often result from the interaction of constraints, not from any single requirement.

Now I’ll add an ingredient constraint and limit corn to a maximum of fifty percent. To meet protein and dry matter, the solver still needs one hundred percent corn, but that violates the ingredient maximum, so the solution is again infeasible.

If I remove the protein requirement and keep only a dry matter minimum of eighty-six percent along with a fifty percent maximum for corn, the solver finds a feasible solution—fifty percent corn and fifty percent fat. However, that ration contains only about four percent crude protein, which may not be nutritionally acceptable.

Now let’s expand the ration to include a few more typical ingredients. I’ll add soybean meal, forty-eight percent protein, barley grain, and calcium carbonate. Soybean meal is priced at five hundred dollars per metric ton, barley at two hundred dollars, and calcium carbonate at forty-five dollars.

If I set only a dry matter minimum of eighty-six percent, the solver selects one hundred percent calcium carbonate. It’s the least expensive ingredient and easily meets the dry matter requirement, even though it provides no protein or fat.

To make the ration more realistic, I’ll add a crude protein minimum of sixteen percent and a fat minimum of three percent, along with the dry matter minimum. When I run the formulation, I get a feasible solution. Dry matter is well above the minimum, protein is exactly sixteen percent, and fat is just over three percent.

One of the most common causes of infeasible solutions is over-constraining the formulation. For example, if I set both a minimum and a maximum dry matter of eighty-six percent, I eliminate nearly all possible ingredient combinations, and the solver returns an infeasible solution.

Another common mistake is setting a maximum that is lower than the minimum. This always results in an infeasible solution because the allowed range is inverted.

Ingredient limits can also cause problems. If I restrict soybean meal to a maximum of three percent, the remaining ingredients cannot supply enough protein to meet the sixteen percent requirement, and the solution becomes infeasible.

Similarly, forcing an ingredient to an exact inclusion—by setting the minimum and maximum to the same value—can eliminate all feasible solutions.

Let’s look at one final example. I’ll set a dry matter minimum of eighty-six percent and a maximum of eighty-nine percent, along with a protein minimum of sixteen percent and a fat minimum of three percent. This formulation solves successfully.

Now I’ll add a phosphorus minimum of zero point seven percent. When I rerun the formulation, the solution becomes infeasible. The only way to meet this phosphorus requirement is by increasing soybean meal. However, soybean meal has a dry matter of eighty-nine point three percent, which exceeds the dry matter maximum. These two constraints conflict, and the solver can’t resolve them.

Every time we add a minimum or maximum, we reduce the solution space. As more constraints are added, that solution space becomes smaller, until eventually no feasible solution remains.

When you encounter an infeasible solution, the best approach is systematic troubleshooting. Remove constraints one at a time until the formulation becomes feasible again. This process helps identify which requirement, or combination of requirements, is causing the problem.

That’s it for this demonstration. Be sure to visit the LPSolve Knowledge Base for more examples and guidance on using the software. Thanks for watching.

Powered by BetterDocs