Math Calculator

Linear Programming Calculator

Solve continuous linear programming problems with maximize/minimize objectives, ≤/≥/= constraints, simplex results, slacks and a 2D feasible-region graph.

Maximize or minimize a linear objective with up to six non-negative variables and twelve linear constraints using a two-phase simplex solver, with a feasible-region graph for two-variable problems.

Continuous LP only: variables are assumed non-negative and may be fractional. If decisions must be whole numbers or binary, you need an integer/mixed-integer programming solver rather than rounding this result.

Objective coefficients

Constraints

All variables automatically have xᵢ ≥ 0. Coefficients and right-hand sides may be negative or decimal. Equality and ≥ constraints are supported.

Use this linear programming calculator to maximize or minimize a linear objective subject to linear constraints. Enter two to six non-negative decision variables, choose up to twelve ≤, ≥ or = constraints, and the calculator returns the optimal objective value, each variable value, constraint activity, slack and binding status. Two-variable problems also get a feasible-region graph and corner-point view.

What a linear programming problem contains

A continuous linear program has three main pieces: decision variables, a linear objective function and linear constraints. For example:

Maximize Z = 40x + 30y

subject to:

x + y ≤ 12
2x + y ≤ 16
x ≥ 0, y ≥ 0

The optimum is x = 4 and y = 8, giving Z = 400. This calculator uses that problem as its default example.

Linear programming calculator online: supported inputs

This linear programming calculator online supports continuous maximization and minimization problems with up to six variables. Constraints can use ≤, ≥ or equality signs, and coefficients may be positive, negative or decimal. Every decision variable is assumed to be non-negative.

That covers many production-mix, resource-allocation, blending, transportation approximations, staffing-allocation and cost-minimization classroom problems. It does not solve nonlinear expressions such as x², xy, absolute-value constraints or products of decision variables.

How the simplex solver works

The calculator converts the entered constraints to a standard inequality representation and solves the continuous problem with a two-phase simplex tableau. Phase I is used when needed to find a feasible starting basis; Phase II improves the objective until no entering variable can improve it.

If the constraints cannot all be satisfied, the result is reported as infeasible. If the objective can improve indefinitely while remaining feasible, it is reported as unbounded. Otherwise the solver returns an optimal basic feasible solution.

Graphical method for two variables

With two variables, each linear constraint is a boundary line in the x-y plane. Their shared feasible side forms the feasible region. For a bounded continuous LP, a linear objective reaches an optimum at a corner point of that region.

The graph on this page plots the constraint boundaries, feasible corner points and the optimal point. It is meant to make the simplex answer easier to interpret, not to replace the numerical solver.

Slack and binding constraints

A ≤ constraint has slack when the optimal solution uses less than its available right-hand-side resource. A ≥ constraint has surplus when the left side exceeds the required minimum. A constraint is binding when the optimal solution sits on its boundary, so the left-hand side and right-hand side are equal within numerical tolerance.

For the default problem, both constraints bind at x = 4 and y = 8:

4 + 8 = 12
2(4) + 8 = 16

Maximization versus minimization

Maximization problems seek the largest feasible objective value, such as profit or output. Minimization problems seek the smallest feasible value, such as cost, distance or waste. The calculator handles minimization internally by reversing the objective direction while preserving the entered constraints.

Why integer decisions are different

Linear programming assumes continuous variables. If the answer says x = 3.6, that is mathematically valid for a divisible resource such as tons or hours. It may not be valid for workers, trucks or projects that must be whole numbers.

Do not simply round an LP solution and assume it remains optimal or even feasible. Integer and binary restrictions require integer linear programming or mixed-integer linear programming techniques such as branch and bound.

Worked example

Suppose Product X contributes $40 and Product Y contributes $30. Resource A limits x + y to 12 units, while Resource B limits 2x + y to 16. The feasible corner points include (0,0), (0,12), (4,8) and (8,0). Evaluating the objective gives:

Corner Z = 40x + 30y
(0,0) 0
(0,12) 360
(4,8) 400
(8,0) 320

The maximum is therefore Z = 400 at x = 4, y = 8.

Frequently asked questions

What does a linear programming calculator solve?

It finds the best value of a linear objective function while satisfying a set of linear constraints and variable bounds. “Best” means maximum or minimum depending on the selected goal.

Can this calculator solve more than two variables?

Yes. The simplex solver supports up to six variables and twelve entered constraints. The graphical view is available only when there are two decision variables.

Can I enter ≥ and = constraints?

Yes. The solver accepts ≤, ≥ and equality constraints. Equality constraints are enforced in both directions internally.

What does infeasible mean?

Infeasible means there is no non-negative variable combination that satisfies every entered constraint at the same time.

What does unbounded mean?

Unbounded means the objective can continue improving without a finite optimum while all constraints remain satisfied.

Does this calculator solve integer programming?

No. It solves continuous linear programs. If variables must be integers or binary, use a dedicated MILP/ILP solver.

Methodology and sources

The numerical engine uses a two-phase simplex tableau for continuous non-negative linear programs. Google’s OR-Tools linear-programming example and MathWorks linprog documentation were reviewed for standard LP formulation and result terminology. Current first-page online solvers were reviewed for useful presentation features including objective/constraint tables, feasibility status, slacks and two-variable graphical interpretation.