bugGNU Octave - Bugs: bug #64970, [octave forge] (optim 1.6.2)...


bug #64970: [octave forge] (optim 1.6.2) quadprog does not work for semidefinite H

Submitter:  Torsten Lilge <ttl>
Submitted:  Sun 03 Dec 2023 06:50:17 PM UTC
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 04 Dec 2023 07:50:05 PM UTC, comment #4: 

quadprog should definitely be able to run with semidefinite weighting matrices. I stumbled on this issue while solving a model predicitve control problem with YALMIP and quadprog as solver. The problem is formulated by YALMIP such that the resulting (stacked) H matrix is semidefinite although the weighting matrices in the cost function are all definite.

However, if qp is not reliable for semidefinite matrices (as I read in one of the other bug reports) this should be fixed first.

Torsten Lilge <ttl>
Group Member
Mon 04 Dec 2023 07:16:48 PM UTC, comment #3: 

It would really help if we heard from Olaf Till since he's a maintainer on the optim package and made the change from positive semidefinite to positive definite. I had copied him on the other reports but hadn't heard back.

From other bug reports, it seems Matlab does accept semidefinite inputs, so it would be preferable if Octave can do that too like it did before, preferably without requiring the optim package. Thoughts?

Arun Giridhar <arungiridhar>
Group Member
Mon 04 Dec 2023 06:35:43 PM UTC, comment #2: 

Thanks for the info and sorry for not having searched thoroughly enough. However, in my case (Octave 9.0.0 from default branch) it was sufficient to comment out the test for definiteness in quadprog.m without changing qp.m. That's why I was sure it is the optim package and not the core function.

Torsten Lilge <ttl>
Group Member
Sun 03 Dec 2023 09:51:05 PM UTC, comment #1: 

@ttl: This is a problem with core Octave. See bug #64346, bug #61762, and bug #64901.

The fix should be in core Octave. A workaround is given in bug #64901.

Arun Giridhar <arungiridhar>
Group Member
Sun 03 Dec 2023 06:50:17 PM UTC, original submission:  

quadprog does not allow a semidefinite weighting matrix H in quadprog.


H = [2 0; 0 0];
f = [1; -1];
A = [1 1; -1 -1];
b = [1; 1];
[x,fval,exitflag] = quadprog(H,f,A,b)


x = [0;0]
fval = 0
exitflag = -3

Expected result:

x = [-1;2]
fval = -2
exitflag = 1

The correct result is obtained if line 278 in quadprog.m is commented out.

Torsten Lilge <ttl>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by arungiridhar
  • -email is unavailable- added by arungiridhar (Posted a comment)
  • -email is unavailable- added by ttl (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-12-04 arungiridhar Carbon-Copy- Added i7tiol

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code