View Full Version : QP with bounds on X

10-06-2005, 09:57 AM
This question has couple up a couple times recently, so I'll post the solution here for reference. This applies to all the IMSL products, but I'll use JMSL as the example.

Consider the case where you need to bound x as in: x_l \leq x \leq x_u

The LinearProgramming class API explicitly allows bounds on x through the setLowerBound() and setUpperBound() methods, but the QuadraticProgramming class does not include this in the API.

The solution is straightforward, though may not be obvious. You just need to add additional inequality constraints of the form A x \leq b, where A is 1 on the diagonal for the lower bounds, and -1 for the upper bounds.

So the A constraint matrix is:

And the B matrix is:

Note the necessary change in sign for the upper bounds. Any other inequality constraints for your problem can be appended to these arrays.