C++ Reference: matrix_scaler

This documentation is automatically generated.

The SparseMatrixScaler class provides tools to scale a SparseMatrix, i.e. reduce the range of its coefficients and make for each column and each row the maximum magnitude of its coefficients equal to 1.

In the case there are bounds or costs on the columns or a right-hand side related to each row, SparseMatrixScaler provides the tools to scale those appropriately.

More precisely, suppose we have the Linear Program: min c.x s.t A.x = b with l <= x <= u

The rows of A are scaled by left-multiplying it by a diagonal matrix R whose elements R_ii correspond to the scaling factor of row i. The columns of A are scaled by right-multiplying it by a diagonal matrix C whose elements C_jj correspond to the scaling factor of column j.

We obtain a matrix A' = R.A.C.

We wish to scale x, c, b, l, u so as to work on the scaled problem: min c'.x' s.t A'.x' = b' with l' <= x' <= u'

The right-hand side b needs to be left-multiplied by R, the cost function c needs to be right-multiplied by C. Finally, x, and its lower- and upper-bound vectors l and u need to be left-multiplied by C^-1.

Note also that the dual vector y is scaled as follows: y'.R = y, thus y' = y.R^-1.

The complete transformation is thus: A' = R.A.C, b' = R.b, c' = c.C, x' = C^-1.x, l' = C^-1.l, u' = C^-1.u, y' = y.R^-1.

The validity of the above transformation can be checked by computing: c'.x' = c.C.C^-1.x = c.x. and: A'.x' = R.A.C.C^-1.x = R.A.x = R.b = b'.



Send feedback about...