How to Convert a Constrained Optimization Problem into an Unconstrained One
At a glance
- 1. Identify constraints
Separate equality constraints from inequalities and note whether the objective and constraints are linear or quadratic.
- 2. Parameterize equalities
For feasible linear equalities, express every feasible point using free variables in the null space of the constraint matrix.
- 3. Substitute into objective
Replace the original variables with the parameterization to obtain an unconstrained problem over the free variables.
- 4. Handle inequalities carefully
Use an appropriate barrier, penalty, or active-set method; these approaches are not automatically equivalent at finite parameter values.
A constrained optimization problem asks you to minimize an objective only over points satisfying specified conditions. Whether you can turn it into an unconstrained problem depends on the type of constraints and on what “convert” means. For linear equality constraints, there is an exact method: describe the feasible set with free variables, then substitute that description into the objective. Penalty and barrier methods are useful too, but they have different guarantees.
Exact conversion for linear equality constraints
Consider the problem
First find one feasible point such that . Next, find a matrix whose columns form a basis for the null space of , so . Every feasible point can then be written as
Here, is a vector of free variables. The equality constraint is satisfied automatically because
Substitute this expression into the objective. The original constrained problem is now the unconstrained problem
This is an equivalent reformulation: its feasible choices of correspond exactly to feasible choices of in the original problem. If the equality constraints have rank and there are variables, the reduced problem has free variables.
For a quadratic objective with symmetric ,
the reduced objective is also quadratic:
The constant term does not affect the minimizer, but it can be retained when you want the original objective value.
Worked example
Minimize subject to . A feasible point is , and a direction along the constraint line is . Thus all feasible points have the form
Substitute into the objective:
This is now an unconstrained one-variable problem. Its minimum occurs at , giving and objective value . The constraint has not been approximated; it is built into the parameterization.
Penalty functions: useful, but usually approximate
A common alternative is to add a penalty for constraint violation. For equality constraints, one choice is
where controls the penalty strength. This is unconstrained, but for a finite its minimizer generally does not satisfy exactly. Increasing discourages violations; under appropriate conditions, solutions approach solutions of the constrained problem as grows. Very large penalties can also make numerical calculations poorly conditioned.
For example, minimize subject to . The penalized objective is . Differentiating and setting the derivative to zero gives
For every finite positive , this minimizer is less than , so it violates the original constraint. It approaches as increases, but the penalty formulation is not exactly equivalent at finite .
Inequalities and the Lagrangian
Inequality constraints, such as , need additional care. A logarithmic barrier, for example, adds terms such as to the objective and keeps iterates inside the feasible region. Barrier methods generally solve a sequence of unconstrained problems as changes; a single finite barrier parameter does not usually give the exact constrained solution. An active-set method instead identifies which inequalities hold with equality at the solution and treats those as equalities, while checking that the remaining inequalities are satisfied.
The Lagrangian for equality constraints is
It is central to deriving optimality conditions, but simply minimizing jointly over and is not a valid general conversion: if , changing the unrestricted multiplier can make the Lagrangian arbitrarily small. Instead, the solution is characterized using a saddle point or the Karush–Kuhn–Tucker (KKT) conditions, when the required assumptions hold.
Common mistakes
- Treating a penalty as exact. A finite quadratic penalty may leave a nonzero constraint residual.
- Optimizing over multipliers as ordinary variables. Lagrange multipliers enforce stationarity and feasibility through saddle-point or KKT conditions; they are not usually extra variables in a plain minimization.
- Assuming inequalities disappear by substitution. Parameterizing equalities does not remove inequalities that remain in the reduced variables.
- Using an infeasible starting point for a parameterization. The expression requires . If no such exists, the equality constraints are infeasible.
For a quadratic program with linear equalities, null-space parameterization is the direct exact route when you want an unconstrained problem. For inequalities, choose a method suited to the goal—such as an active-set, barrier, or penalty method—and account for its assumptions and approximation behavior.
References
- Convex Optimization, Stephen Boyd and Lieven Vandenberghe
- Numerical Optimization, Jorge Nocedal and Stephen J. Wright
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.