AI Glossary / Graphs and symbolic AI / Beginner

Linear constraints

Definition

Linear constraints are equalities or inequalities in which decision variables appear only in weighted sums with fixed coefficients. Examples include 2x + y <= 10 and x - y = 3. They describe allowed combinations of values and are widely used in optimization, planning, and resource-allocation models.

What it means

A constraint expresses a requirement that a candidate solution must satisfy. Coefficients specify how each variable contributes, and the right-hand side gives a limit or target. In optimization terminology, constraints with constant offsets are commonly called linear even though the corresponding expressions are technically affine.
The word linear refers to dependence on the decision variables. Multiplying a variable by a known constant is allowed. Multiplying two decision variables together, squaring one, or applying a nonlinear function generally produces a nonlinear constraint. Whether a quantity is fixed data or a variable therefore changes the mathematical form.

How it works

Represent each requirement as a weighted sum compared with a bound, then find points satisfying all requirements together. A collection of linear equalities and inequalities over continuous variables defines a convex polyhedral feasible set: line segments between feasible points remain feasible.
An objective function specifies which feasible point is preferred; the constraints alone may leave many possibilities. If some variables must be integers or binary, those restrictions change the feasible set and the optimization problem's difficulty even when all algebraic constraints are linear. Good modeling also requires consistent units and a clear interpretation of each coefficient.

Three practical examples

  • A production model limits total use of two resources across several activities.
  • A staffing model requires enough assigned capacity to meet a stated workload, with additional restrictions expressed where appropriate.
  • A machine-learning or optimization model restricts a weighted combination of parameters to remain within specified bounds.

Think of it this way

Think of several straight-edged boundaries marking an allowed region on a map. A point must lie on the permitted side of every boundary. The analogy is limited because real models can have hundreds or thousands of variables, and integer restrictions can leave isolated allowed points rather than a filled geometric region.

Worked example

Consider an invented workshop producing continuous quantities x and y of two materials. Each unit of x uses 2 units of resource A and 1 unit of resource B. Each unit of y uses 1 unit of A and 3 units of B. Available amounts are 10 units of A and 12 units of B.
The constraints are 2x + y <= 10, x + 3y <= 12, x >= 0, and y >= 0. The point (3, 2) uses 8 units of A and 9 units of B, so it is feasible. The point (4, 3) uses 11 units of A and 13 units of B, violating both capacity limits.
Another feasible point is (4, 1), using 9 units of A and 7 units of B. The midpoint of the two feasible points (3, 2) and (4, 1) is (3.5, 1.5). It uses 8.5 units of A and 8 units of B, so it is feasible as expected for continuous linear constraints.
If x and y instead count indivisible products, the midpoint may be disallowed by integrality requirements despite satisfying every displayed inequality. Also, nothing in the constraints alone tells us whether (3, 2) or (4, 1) is preferable. That requires an objective or another decision criterion.

Illustrative case study

In a fictional project, Linden Workshop builds a capacity model using minutes for one activity and hours for another without converting the units. The formulas look linear and the solver returns a feasible point, but the result is inconsistent with the actual resource limits.
The team standardizes units and checks representative candidate points manually before trusting the model. This invented case illustrates that mathematical form and model validity are different. A solver can correctly solve the stated equations while the equations misrepresent the business problem.

Common misconceptions and mistakes

Linear constraints do not mean the entire optimization problem is linear: the objective may be nonlinear, or variables may have integer restrictions. Nor does a feasible point necessarily optimize anything.
Do not classify xy <= 10 as linear when both x and y are decision variables. If y is a fixed constant, the interpretation changes. Also, a linear model is not automatically accurate merely because it is easy to solve. Fixed coefficients may be a poor approximation when resource use changes with scale, congestion, or operating conditions. Such assumptions need justification.

Business use

The main benefit is a clear, testable description of capacity, balance, and allocation requirements. Start by naming the variables and units, then translate each operational rule into a constraint. Check simple examples with known feasible and infeasible outcomes.
Separate mandatory requirements from preferences represented in an objective. Record whether quantities are divisible and whether coefficients are estimates or fixed facts. When the model is infeasible, inspect conflicting requirements rather than assuming the software failed. When it is feasible, evaluate whether omitted nonlinear effects or discrete choices matter before using the solution operationally.

People also ask

Can a linear constraint contain a constant term?

Yes. Optimization commonly calls affine equalities and inequalities linear constraints.

Is x times y a linear term?

Not when both are decision variables. A fixed coefficient times a variable is linear.

Do linear constraints guarantee one solution?

No. There may be no feasible solution, one, or many, and an objective may be needed to choose among feasible points.

Check your understanding

Why can the midpoint in the worked example satisfy the inequalities but fail an indivisible-product model?

Answer: The inequalities allow continuous quantities, but an additional integer requirement excludes fractional values such as 3.5 and 1.5.

Related terms

  • Linear programming
  • Convex set
  • Objective function
  • feasible region
  • affine expression
  • inequality constraint
  • equality constraint
  • integer programming

Learn next

Write two resource constraints for a simple activity and check several candidate points by substitution. Label every unit. Then add an objective and an integrality requirement separately, noting how each changes the question being solved.

More in Graphs and symbolic AI

  • Lightweight ontology - A lightweight ontology is a relatively simple, explicit model of a domain's concepts and relationships, using limited formal detail compared with a more...
  • Limited rationality - Limited rationality is decision-making that accounts for limits on time, information, memory, or computation.
  • Line search - Line search is an optimization procedure that chooses how far to move from a current point along a selected direction.
  • Linear hashing - Linear hashing is a dynamic hashing method that expands a table or file by splitting buckets in a predetermined sequence.
  • Linear partial information - Linear partial information is a way to represent incomplete knowledge through linear restrictions, especially restrictions on probabilities or normalized...
  • Linear planning - Linear planning, in the historical classical-planning sense used here, solves subgoals through separate subplans and joins those subplans without...

Sources

Sources: Boyd and Vandenberghe, Convex Optimization, original lecture slides on polyhedra and linear optimization: https://web.stanford.edu/~boyd/cvxbook/bv_cvxslides.pdf

Previous: Linear classifier Next: Linear discriminant analysis

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer