ArticleslgStudy

computer science

Quadratic programming

Quadratic programming is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Quadratic programming rather than just read about it. In short: Quadratic programming (QP) is the process of solving certain mathematical optimization problems involving quadratic functions. Specifically, one seeks to optimize (minimize or maximize) a multivariate quadratic function subject to linear constraints on the variables.

Key takeaways

  • Quadratic programming belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Quadratic programming to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Quadratic programming from memory before moving on to harder problems.

Reference excerpt

Quadratic programming (QP) is the process of solving certain mathematical optimization problems involving quadratic functions. Specifically, one seeks to optimize (minimize or maximize) a multivariate quadratic function subject to linear constraints on the variables. Quadratic programming is a type of nonlinear programming. "Programming" in this context refers to a formal procedure for solving mathematical problems. This usage dates to the 1940s and is not specifically tied to the more recent notion of "computer programming." To avoid confusion, some practitioners prefer the term "optimization" — e.g., "quadratic optimization."

Problem formulation The quadratic programming problem with n variables and m constraints can be formulated as follows. Given:

a real-valued, n-dimensional vector c, an n×n-dimensional real symmetric matrix Q, an m×n-dimensional real matrix A, and an m-dimensional real vector b, the objective of quadratic programming is to find an n-dimensional vector x, that will

where xT denotes the vector transpose of x, and the notation Ax ⪯ b means that every entry of the vector Ax is less than or equal to the corresponding entry of the vector b (component-wise inequality).

Constrained least squares As a special case when Q is symmetric positive-definite, the cost function reduces to least squares:

where Q = RTR follows from the Cholesky decomposition of Q and c = −RT d. Conversely, any such constrained least squares program can be equivalently framed as a quadratic programming problem, even for a generic non-square R matrix.

Generalizations When minimizing a function f in the neighborhood of some reference point x0, Q is set to its Hessian matrix H(f(x0)) and c is set to its gradient ∇f(x0). A related programming problem, quadratically constrained quadratic programming, can be posed by adding quadratic constraints on the variables.

Solution methods For general problems a variety of methods are commonly used, including

interior point, active set, augmented Lagrangian, conjugate gradient, gradient projection, extensions of the simplex algorithm. In the case in which Q is positive definite, the problem is a special case of the more general field of convex optimization.

Equality constraints Quadratic programming is particularly simple when Q is positive definite and there are only equality constraints; specifically, the solution process is linear. By using Lagrange multipliers and seeking the extremum of the Lagrangian, it may be readily shown that the solution to the equality constrained problem

Minimize 1 2 x T Q x + c T x {\displaystyle {\text{Minimize}}\quad {\tfrac {1}{2}}\mathbf {x} ^{\mathrm {T} }Q\mathbf {x} +\mathbf {c} ^{\mathrm {T} }\mathbf {x} }

subject to E x = d {\displaystyle {\text{subject to}}\quad E\mathbf {x} =\mathbf {d} }

is given by the linear system

[ Q E ⊤ E 0 ] [ x λ ] = [ − c d ] {\displaystyle {\begin{bmatrix}Q&E^{\top }\\E&0\end{bmatrix}}{\begin{bmatrix}\mathbf {x} \\\lambda \end{bmatrix}}={\begin{bmatrix}-\mathbf {c} \\\mathbf {d} \end{bmatrix}}}

where λ is a set of Lagrange multipliers which come out of the solution alongside x. The easiest means of approaching this system is direct solution (for example, LU factorization), which for small problems is very practical. For large problems, the system poses some unusual difficulties, most notably that the problem is never positive definite (even if Q is), making it potentially very difficult to find a good numeric approach, and there are many approaches to choose from dependent on the problem. If the constraints don't couple the variables too tightly, a relatively simple attack is to change the variables so that constraints are unconditionally satisfied. For example, suppose d = 0 (generalizing to nonzero is straightforward). Looking at the constraint equations:

E x = 0 {\displaystyle E\mathbf {x} =0}

introduce a new variable y defined by

Z y = x {\displaystyle Z\mathbf {y} =\mathbf {x} }

where y has dimension of x minus the number of constraints. Then

E Z y = 0 {\displaystyle EZ\mathbf {y} =\mathbf {0} }

and if Z is chosen so that EZ = 0 the constraint equation will be always satisfied. Finding such Z entails finding the null space of E, which is more or less simple depending on the structure of E. Substituting into the quadratic form gives an unconstrained minimization problem:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Quadratic programming

Start with the simplest possible case. Write down what Quadratic programming claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Quadratic programming before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Quadratic programming ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Quadratic programming

In research
Quadratic programming appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Quadratic programming in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Quadratic programming is common in secondary-school and first-year university syllabi. It links to neighbouring topics Optimization algorithms and methods, so understanding it makes those chapters shorter.
In everyday life
Look for Quadratic programming outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Quadratic programming in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Quadratic programming means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Quadratic programming out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Quadratic programming in simple terms?

Quadratic programming (QP) is the process of solving certain mathematical optimization problems involving quadratic functions. Specifically, one seeks to optimize (minimize or maximize) a multivariate quadratic function subject to linear constraints on the variables.

Why does Quadratic programming matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Quadratic programming?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Quadratic programming.

Tags

  • Optimization algorithms and methods

Keep exploring