Integer Programming Calculator

Optimize a linear objective when decisions must be whole numbers. Set bounds and constraints, then inspect feasible integer points and every tied optimum.

Enter your values

INTEGER OPTIMIZATION

Set up the integer model

Optimize a linear objective over whole-number values of x and y.

Maximize z =x+y

Linear constraints

Each row limits which integer pairs are allowed.

C1
x+y
C2
x+y
C3
x+y
Integer variable boundsx and y are nonnegative integers within these search limits.

The solver checks every lattice point in 0 ≤ x ≤ Xmax and 0 ≤ y ≤ Ymax. Use bounds that cover the planning range you want to analyze.

Enter also calculates
Examples
Overview

What is an integer programming calculator?

Integer programming optimizes an objective subject to constraints while requiring decision variables to take integer values. This calculator searches a bounded model with two nonnegative integer variables.

Important terms

Integer variable
A decision variable restricted to whole-number values; fractional quantities are not allowed.
Feasible integer point
An integer pair (x, y) that satisfies every constraint and both variable bounds.
Objective function
The linear quantity cₓx + cᵧy that the model maximizes or minimizes.
Search bounds
The maximum allowed x and y values that make this exhaustive lattice search finite.

When this method is useful

  • Choose whole units to produce when resources are limited.
  • Compare integer staffing, shipment, or project-selection plans in a small model.
  • See why a continuous linear-programming answer can differ from a practical whole-number decision.
Formula

Formula and variables

Optimize z=cxx+cyy,aix+biy∈{≤,≥,=}di,x,y∈Z≥0\text{Optimize } z=c_xx+c_yy,\quad a_ix+b_iy\in\{\leq,\geq,=\}d_i,\quad x,y\in\mathbb{Z}_{\geq 0}
x, y
Nonnegative integer decision variables, limited by the entered maximum bounds.
cₓ, cᵧ
Objective coefficients used to compute z for each feasible plan.
aᵢ, bᵢ, dᵢ
Coefficients and right-hand side of constraint i.
z
Objective value to maximize or minimize.

The solver enumerates every integer pair in the bounded rectangle, rejects pairs that violate a constraint, and evaluates the objective at each remaining point. The largest or smallest feasible value is the integer optimum; ties are reported together.

Domain note: This tool solves bounded linear models with two nonnegative integer variables and up to eight constraints. Each bound is at most 500 and the total grid is limited to 100,000 points. It is not a general mixed-integer solver and does not handle binary variables, nonlinear expressions, or unbounded domains.

How it works

How to use this calculator

  1. 1

    Choose Maximize or Minimize and enter the coefficients in z = cₓx + cᵧy.

  2. 2

    Enter each linear constraint as an x coefficient, y coefficient, relation, and right-hand side.

  3. 3

    Set maximum integer values for x and y. The variables are nonnegative, so the search begins at zero.

  4. 4

    The calculator checks every integer lattice point inside the selected bounds and keeps only points satisfying all constraints.

  5. 5

    It evaluates the objective for each feasible point, highlights all tied optimal points, and reports the best candidates and a plot.

Worked examples

Step-by-step examples

Example 1

Problem: Maximize z = 3x + 5y subject to x + y ≤ 8, x ≤ 4, y ≤ 6, and x,y are nonnegative integers.

Substitution: The integer point (2, 6) satisfies the constraints: 2 + 6 = 8, 2 ≤ 4, and 6 ≤ 6. Its objective value is 3(2) + 5(6) = 36. The bounded lattice search compares this with every other feasible integer pair.

Result: The maximum is z = 36 at (x, y) = (2, 6).

The best plan uses two units of x and six of y. A continuous model happens to have the same optimum here, but integer restrictions matter whenever the continuous optimum is fractional.

Example 2

Problem: Minimize z = 2x + 3y subject to x + y ≥ 6, x ≤ 5, y ≤ 5, with nonnegative integer x and y.

Substitution: The feasible integer points must total at least six. The point (5, 1) costs 2(5) + 3(1) = 13, while (1, 5) costs 17. Checking the remaining feasible lattice points confirms no lower cost.

Result: The minimum is z = 13 at (x, y) = (5, 1).

Because each x unit costs less than each y unit, the minimum uses as much x as its upper bound allows while meeting the requirement.

Method knowledge

Rules, edge cases, and related ideas

Why enumerate lattice points?

With two variables and a finite grid, direct enumeration checks every allowed integer decision. Unlike a continuous corner-point method, it cannot silently accept fractional values.

Why bounds matter

Integer programming can have infinitely many candidate points. Maximum x and y values define a finite search region and ensure the calculator can prove the best result within that region.

Edge cases and limitations

  • Conflicting constraints can leave no feasible integer pair even when a nearby fractional point exists.
  • A continuous optimum may be fractional and therefore unavailable to an integer model.
  • Several integer points can share the same best objective value; all tied optima are shown.
  • Large bounds are capped by a 100,000-point search limit to keep the browser responsive.

How this differs from a related concept

A continuous linear-programming calculator permits fractional decision variables and commonly checks polygon vertices. An integer-programming calculator must respect whole-number decisions; this bounded two-variable tool checks the discrete lattice directly. Larger production models often require branch-and-bound or other integer-optimization algorithms.

Interpretation

Understand the result

A feasible result is a whole-number plan satisfying every entered constraint. The optimal result is the feasible plan with the best objective value. Multiple points can tie. If no point passes all constraints within the bounds, the model is infeasible in that search domain; increase or correct the bounds before concluding that no solution exists globally.

Common mistakes

  • Using an integer model for a quantity that can genuinely be fractional, such as a measured length.
  • Forgetting that x and y are restricted to nonnegative integers in this calculator.
  • Choosing bounds too small, which can exclude the true optimum from the search.
  • Reading a feasible point as optimal without comparing its objective value with the other feasible points.

Frequently asked questions

What does an integer programming calculator do?

It optimizes a linear objective while requiring its decision variables to be whole numbers. This version handles two bounded, nonnegative integer variables.

How is this different from linear programming?

Continuous linear programming allows fractional values. Integer programming restricts decisions to whole numbers, so its optimum can differ from the continuous model.

Why do I need maximum x and y bounds?

The solver checks a finite grid. Bounds define which integer plans are included and keep the search small enough to run in your browser.

Can the calculator solve a model with no feasible point?

Yes. It reports when no integer point within the selected bounds satisfies all entered constraints. Check the model and bounds if you expected a solution.

Can it solve models with more variables or nonlinear constraints?

No. It is an educational, bounded two-variable linear integer solver, not a general mixed-integer optimization package.

References & technical sources

Keep calculating

Related calculators