help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error: quadprog: equality constraint matrix has incorrect column dim


From: Kai Torben Ohlhus
Subject: Re: error: quadprog: equality constraint matrix has incorrect column dimension
Date: Fri, 18 Jan 2019 14:33:50 +0100

On Fri, Jan 18, 2019 at 1:38 PM ola <address@hidden> wrote:
Okey, so I have tried in a command line octave sth like this:
/>pkg load optim
>    C = [1, 1, 1, 1, 1;
              1, 1, 1, 1, 0;
              1, 1, 0, 0, 1;
              1, 0, 1, 0, 0];
>d = [1; .7; .7; .01];
>lb = zeros (5, 1);
>ub = ones (5, 1);
>x = lsqlin (C, d, [], [], [], [], lb, ub)/
Return the same quadprog error.
But example from https://octave.sourceforge.io/optim/function/lsqlin.html
works well.
So, I have tried few combinations and I found that only x = lsqlin (C, d, A,
b, [], [], lb, ub) works. Aeq, beq - Linear equality constraint
matrix/vector could be empty, but empty A, b - Linear inequality constraint
matrix/vector returns quadprog error.
So, what should I put to these matrices (A,b) if I don't have any values.
Should it be empty, but with known dimension matrix or zeros matrix or ones
matrix?

-----
ola
--

You probably found a bug in lsqlin.  The problem is (but should not be) that you provide all empty constraints: A = b = Aeq = beq = [].


In short: `horzcat ({1},[],{2})` will evaluate to `{1, 2}` not `{1, [], 2}`.

A fix is to surround the arguments "{A}" and "{b}" in the aforementioned line.


Best,
Kai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]