Skip to main content

OPTIMIZATION PROBLEM SOLVER

Linear programming solver for two-variable optimization problems.

Build a model with an objective function, linear constraints, and optional non-negative restrictions. The lab evaluates feasible corner points so you can maximise or minimise the objective in the browser.

LINEAR PROGRAM

Objective and constraints

2 VARIABLES

OBJECTIVE FUNCTION

The model uses Z = 3x + 5y. Choose maximise for profit, output, or score problems, and minimise for cost, waste, distance, or time problems.
Include non-negative constraints: x ≥ 0 and y ≥ 0

QUICK EXAMPLE

Try maximise Z = 3x + 5y with 2x + y ≤ 18, 2x + 3y ≤ 42, 3x + y ≤ 24, and x,y ≥ 0. The solver evaluates the feasible corner points and compares objective values.
Load the sample model or clear the form before entering your own.

HOW IT WORKS

What this optimization calculator solves

LP

OBJECTIVE FUNCTION

The objective function is the quantity you want to maximise or minimise, such as profit, cost, output, time, or resource use. In a two-variable linear program it has the form Z = c₁x + c₂y.

CONSTRAINTS

Constraints describe limits such as material, labour, budget, or capacity. A constraint like 2x + 3y ≤ 42 means every feasible choice of x and y must stay on the allowed side of that boundary line.

FEASIBLE REGION

The feasible region is the overlap of all constraints. For a bounded continuous two-variable linear program, the best value occurs at one of the feasible corner points, so the lab calculates and compares those corners.

WORKED EXAMPLE

Maximise a production objective

ObjectiveMaximise Z = 3x + 5y
Constraints2x + y ≤ 18, 2x + 3y ≤ 42, 3x + y ≤ 24
MethodEvaluate feasible corner points

INTERPRETATION

If x and y represent two products, each constraint can represent a limited resource. The optimum is the feasible corner where the objective value is highest for a maximisation problem or lowest for a minimisation problem.

LIMITATIONS

This page solves continuous two-variable linear programming models. It does not solve integer, binary, nonlinear, or many-variable optimization problems.

METHOD

Linear programming solver: worked examples, formulation and limits

What does this linear programming solver do?

It solves a linear program with two decision variables, x and y: maximise or minimise Z = ax + by subject to ≤, ≥ and = constraints. It lists every feasible corner point of the region and picks the best one, because the optimum of a bounded linear program always lies at a corner.

Worked example: maximise profit

A workshop earns $40 per table (x) and $30 per chair (y). A table needs 2 carpentry hours and a chair 1; there are 100 carpentry hours. Each item needs 1 finishing hour; there are 80 finishing hours.

  1. Objective: maximise Z = 40x + 30y.
  2. Constraints: 2x + y ≤ 100, x + y ≤ 80, x ≥ 0, y ≥ 0.
  3. Corner points: (0, 0) → 0; (50, 0) → 2,000; (20, 60) → 2,600; (0, 80) → 2,400.
  4. Optimum: make 20 tables and 60 chairs for a maximum profit of $2,600. Both hour limits are fully used (binding).

Worked example: minimise cost

A feed mix uses ingredient x at $2 per kg and y at $3 per kg. It needs at least 8 units of energy (x + y ≥ 8) and at least 12 units of protein (x + 3y ≥ 12).

  1. Objective: minimise Z = 2x + 3y.
  2. Corner points of the feasible region: (0, 8) → 24; (6, 2) → 18; (12, 0) → 24.
  3. Optimum: 6 kg of x and 2 kg of y at a minimum cost of $18.

How to turn a word problem into a linear program

  • Decision variables: what you choose (how many tables, how many kg).
  • Objective: the profit or cost per unit of each variable, to maximise or minimise.
  • Constraints: one inequality per limited resource or requirement, in the same units on both sides.
  • Non-negativity: x ≥ 0 and y ≥ 0 when negative quantities make no sense.
  • Check: plug the answer back into every constraint and read which ones are binding.

Infeasible, unbounded and multiple optimal solutions

  • Infeasible: no point satisfies all constraints at once, so the solver finds no corner. Look for contradictory limits such as x + y ≤ 5 and x + y ≥ 8.
  • Unbounded: the region is open in the direction you are optimising, so the objective can grow forever. A maximisation with only ≥ constraints is the usual cause; add the missing upper limit.
  • Multiple optima: two neighbouring corners give the same best value, so every point on the edge between them is optimal. This happens when the objective is parallel to a binding constraint.

Limits of this solver and what to use for bigger models

The corner-point method works for two variables only, and it assumes continuous values. For three or more variables, use the simplex method, for example Excel's Solver add-in (Data → Solver, Simplex LP engine) or SciPy's linprog. For whole-number answers, use integer programming, because rounding an LP answer can break a constraint or miss the true optimum.