EliminateConstraints
No License
function [C,d]=eliminateConstraints(A,b) eliminates variables from a problem with linear equality constraints to give an unconstrained problem. This is useful e.g. when solving a problem with linear constraints and a nonlinear objective or further nonlinear constraints; eliminating the linear constraints makes the problem easier.
Where the original constrained problem has:
- variable vector x (length n).
- linear constraint A*x=b, where the matrix A and vector b are
eliminateConstraints's arguments.
And the final unconstrained problem has:
- variable vector y (length p).
- an x satisfying the original constraint can be generated by x=C*y+d, where the matrix C and vector d are returned by eliminateConstraints.
Inputs:
- A (an m*n matrix of real numbers)
- b (a m*1 vector of real numbers)
- C (an n*p matrix of real numbers)
- d (a n*1 vector of real numbers)
Hopefully, p<n, so the unconstrained problem is smaller than the constrained problem.
The functionality provided by eliminateConstraints is trivial for small matricies. For larger matrices, it can be done using MATLAB's various matrix decompositions. However, as far as the author is aware, there is no trivial MATLAB solution for the case where A is very large and sparse, so we require a C which is also sparse without using any very large full matrices.
The case for which this was developed automatically creates a well-defined problem, so only minimal validation and error checking has been implemented at this stage.
Cite As
Andrew Jackson (2025). EliminateConstraints (https://se.mathworks.com/matlabcentral/fileexchange/20945-eliminateconstraints), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Mathematics and Optimization > Optimization Toolbox > Nonlinear Optimization > Multiobjective Optimization >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 | Updated with improved documentation following feedback from John D'Errico. |
