Thread Subject: Constraint System of Linear Eq.

Subject: Constraint System of Linear Eq.

From: cgs Spindler

Date: 9 Feb, 2010 21:09:19

Message: 1 of 7

Hi folkes,

I've got to solve the linear system AX=B with all three A, X and B being matrices. As constraints, there are equations x_ij + x_kl = 1 for some of the elements of X. Altogether, the system is overdetermined (i.e., columns of A are time series with ~180 time steps, rows of A are 24 parameters, to be mapped down at 4 parameters in B).

Might I get any hint how to enter this in MatLab? I searched through the Optimization Toolbox tutorial but could not find really what I want.

Thanks a lot for helping!

Subject: Constraint System of Linear Eq.

From: Matt J

Date: 9 Feb, 2010 22:02:02

Message: 2 of 7

"cgs Spindler" <christian-spindler@gmx.de> wrote in message <hksitv$ac8$1@fred.mathworks.com>...
> Hi folkes,
>
> I've got to solve the linear system AX=B with all three A, X and B being matrices. As constraints, there are equations x_ij + x_kl = 1 for some of the elements of X. Altogether, the system is overdetermined (i.e., columns of A are time series with ~180 time steps, rows of A are 24 parameters, to be mapped down at 4 parameters in B).
================


Why not use quadprog() to do find a constrained least squares solution?

Subject: Constraint System of Linear Eq.

From: John D'Errico

Date: 9 Feb, 2010 22:53:04

Message: 3 of 7

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <hksm0q$rca$1@fred.mathworks.com>...
> "cgs Spindler" <christian-spindler@gmx.de> wrote in message <hksitv$ac8$1@fred.mathworks.com>...
> > Hi folkes,
> >
> > I've got to solve the linear system AX=B with all three A, X and B being matrices. As constraints, there are equations x_ij + x_kl = 1 for some of the elements of X. Altogether, the system is overdetermined (i.e., columns of A are time series with ~180 time steps, rows of A are 24 parameters, to be mapped down at 4 parameters in B).
> ================
>
>
> Why not use quadprog() to do find a constrained least squares solution?

lsqlin is far easier to use in this sense, since it takes
the problem in the form of A*x = b, without needing
to reformulate it into the quadprog form.

As far as entering it into matlab, you need to formulate
the problem in the form of

   A*X = b

where X and B are (column) vectors. This is the standard
form that lsqlin will require.

John

Subject: Constraint System of Linear Eq.

From: John D'Errico

Date: 9 Feb, 2010 23:18:05

Message: 4 of 7

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <hksp0g$7j7$1@fred.mathworks.com>...
> "Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <hksm0q$rca$1@fred.mathworks.com>...
> > "cgs Spindler" <christian-spindler@gmx.de> wrote in message <hksitv$ac8$1@fred.mathworks.com>...
> > > Hi folkes,
> > >
> > > I've got to solve the linear system AX=B with all three A, X and B being matrices. As constraints, there are equations x_ij + x_kl = 1 for some of the elements of X. Altogether, the system is overdetermined (i.e., columns of A are time series with ~180 time steps, rows of A are 24 parameters, to be mapped down at 4 parameters in B).
> > ================
> >
> >
> > Why not use quadprog() to do find a constrained least squares solution?
>
> lsqlin is far easier to use in this sense, since it takes
> the problem in the form of A*x = b, without needing
> to reformulate it into the quadprog form.
>
> As far as entering it into matlab, you need to formulate
> the problem in the form of
>
> A*X = b
>
> where X and B are (column) vectors. This is the standard
> form that lsqlin will require.
>
> John

Let me expand on this a bit. The OP will need to
convert A into a new matrix (sparse!!!!) as well as
form a constraint system that is sparse.

Kron will aid in this task as I recall.

John

Subject: Constraint System of Linear Eq.

From: Bruno Luong

Date: 10 Feb, 2010 08:11:04

Message: 5 of 7

"cgs Spindler" <christian-spindler@gmx.de> wrote in message <hksitv$ac8$1@fred.mathworks.com>...
> Hi folkes,
>
> I've got to solve the linear system AX=B with all three A, X and B being matrices. As constraints, there are equations x_ij + x_kl = 1 for some of the elements of X. Altogether, the system is overdetermined (i.e., columns of A are time series with ~180 time steps, rows of A are 24 parameters, to be mapped down at 4 parameters in B).
>
> Might I get any hint how to enter this in MatLab? I searched through the Optimization Toolbox tutorial but could not find really what I want.
>
> Thanks a lot for helping!

Extend your system as block diagonal (put X & B as long vectosr, repeating A on diagonal using KRON or BLKDIAGS for example). The constraints can be formulated as linear. If you have QUADPROG use it, otherwise written the new system in the basis of the orthogonal of the constraints to make the new system unconstrained, then solve using "\".

Bruno

Subject: Constraint System of Linear Eq.

From: cgs Spindler

Date: 10 Feb, 2010 10:30:05

Message: 6 of 7

Great,

this should be valuable hints for me to get me along. Thanks all for the fast reply, have a nice time!

Christian

Subject: Constraint System of Linear Eq.

From: John D'Errico

Date: 10 Feb, 2010 11:12:03

Message: 7 of 7

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <hktpmo$7o9$1@fred.mathworks.com>...
> "cgs Spindler" <christian-spindler@gmx.de> wrote in message <hksitv$ac8$1@fred.mathworks.com>...
> > Hi folkes,
> >
> > I've got to solve the linear system AX=B with all three A, X and B being matrices. As constraints, there are equations x_ij + x_kl = 1 for some of the elements of X. Altogether, the system is overdetermined (i.e., columns of A are time series with ~180 time steps, rows of A are 24 parameters, to be mapped down at 4 parameters in B).
> >
> > Might I get any hint how to enter this in MatLab? I searched through the Optimization Toolbox tutorial but could not find really what I want.
> >
> > Thanks a lot for helping!
>
> Extend your system as block diagonal (put X & B as long vectosr, repeating A on diagonal using KRON or BLKDIAGS for example). The constraints can be formulated as linear. If you have QUADPROG use it, otherwise written the new system in the basis of the orthogonal of the constraints to make the new system unconstrained, then solve using "\".
>
> Bruno

I'll still argue that the use of quadprog here is,
while not technically incorrect, it is numerically
improper.

Effectively, in order to use quadprog, one must
form A'*A. You will minimize a quadratic form,
after all. So you are squaring the condition
number of the problem, just as if you had formed
the normal equations.

Use lsqlin instead to avoid that operation. Only
use quadprog when your problem is already in
the nominal form that it is designed for.

John

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com