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

 
 

bug #56582: [octave forge] (optim) lsqlin produces unexpected error on linearly dependent inputs

Submitted by:  Nicholas Jankowski <nrjank>
Submitted on:  Fri 05 Jul 2019 08:16:05 PM UTC  
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error
Status:  None Assigned to:  None
Originator Name:  Nicholas Jankowski Open/Closed:  Open
Release:  5.1.0 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 06 Jul 2019 01:53:39 AM UTC, comment #1: 

checking full Matlab output for compatibility. #2 is odd:

1. Matlab:

>> C = [1,2,3;2,4,6;2,4,5];
>> D = [4 8 5]';
>> [X, RESNORM, RESIDUAL, EXITFLAG, OUTPUT, LAMBDA]=lsqlin(C,D,[],[])

X =

   NaN
   NaN
     3


RESNORM =

   NaN


RESIDUAL =

   NaN
   NaN
   NaN


EXITFLAG =

     1


OUTPUT =

  struct with fields:

         iterations: 0
          algorithm: 'mldivide'
      firstorderopt: []
    constrviolation: []
       cgiterations: []
       linearsolver: []
            message: ''


LAMBDA =

  struct with fields:

      lower: []
      upper: []
    ineqlin: []
      eqlin: []

Octave error:

error: __qp__: operator *: nonconformant arguments (op1 is 1x1, op2 is 3x1)
error: called from
    quadprog at line 352 column 36
    lsqlin at line 123 column 21

2. Matlab:

>> C=[1 2 3;4 5 6; 2 4 6];
>> D=[4 5 8]';
>> [X, RESNORM, RESIDUAL, EXITFLAG, OUTPUT, LAMBDA]=lsqlin(C,D,[],[])

X =

   NaN
   NaN
   NaN


RESNORM =

   NaN


RESIDUAL =

   NaN
   NaN
   NaN


EXITFLAG =

     1


OUTPUT =

  struct with fields:

         iterations: 0
          algorithm: 'mldivide'
      firstorderopt: []
    constrviolation: []
       cgiterations: []
       linearsolver: []
            message: ''


LAMBDA =

  struct with fields:

      lower: []
      upper: []
    ineqlin: []
      eqlin: []

Octave output:

X =

  -3.2660
   6.5320
  -3.2660

RESNORM =  105.00
RESIDUAL =

  -4.0000
  -8.0000
  -5.0000

EXITFLAG = 0
OUTPUT =

  scalar structure containing the fields:

    iterations =  200

LAMBDA = [](0x0)

3. Matlab:

>> C = [1 2 3; 4 5 6];
>> D = [4 5]';
>> A = [1 1 1;2 2 2];
>> B = [1 2]';
>> [X, RESNORM, RESIDUAL, EXITFLAG, OUTPUT, LAMBDA]=lsqlin(C,D,[],[],A,B,[],[])

Minimum found that satisfies the constraints.

Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.

<stopping criteria details>

X =

   -0.1667
    0.3333
    0.8333


RESNORM =

     2


RESIDUAL =

   -1.0000
    1.0000


EXITFLAG =

     1


OUTPUT =

  struct with fields:

            message: '↵Minimum found that satisfies the constraints.↵↵Optimization completed because the objective function is non-decreasing in ↵feasible directions, to within the value of the optimality tolerance,↵and constraints are satisfied to within the value of the constraint tolerance.↵↵<stopping criteria details>↵↵Optimization completed: The relative dual feasibility, 9.259951e-13,↵is less than options.OptimalityTolerance = 1.000000e-08, the complementarity measure,↵0.000000e+00, is less than options.OptimalityTolerance, and the relative maximum constraint↵violation, 0.000000e+00, is less than options.ConstraintTolerance = 1.000000e-08.↵↵'
          algorithm: 'interior-point'
      firstorderopt: 4.1670e-11
    constrviolation: 0
         iterations: 1
       linearsolver: 'dense'
       cgiterations: []


LAMBDA =

  struct with fields:

    ineqlin: [0×1 double]
      eqlin: [2×1 double]
      lower: [3×1 double]
      upper: [3×1 double]

Octave error:

error: quadprog: equality constraint matrix must be full row rank
error: called from
    quadprog at line 283 column 11
    lsqlin at line 123 column 21

Nicholas Jankowski <nrjank>
Fri 05 Jul 2019 08:16:05 PM UTC, original submission:  

from a mailing list discussion [1]:

Octave:

C=[1 2 3;4 5 6; 2 4 6]
D=[4 5 8]'
lsqlin(C,D,[],[])
error: __qp__: operator *: nonconformant arguments (op1 is 2x2, op2 is 3x1)
error: called from
    quadprog at line 351 column 32
    lsqlin at line 123 column 19

Matlab:

>> C = [1 2 3;4 5 6; 2 4 6];

>> D=[4 5 8]';

>> lsqlin(C,D,[],[])
ans =
   NaN
   NaN
   NaN

the error seems to be related to the 1st and 3rd row of C being linearly dependent.

another possibly related error output:

Octave:

C=[1 2 3;4 5 6]
D=[4   5]'
A=[1 1 1;2 2 2]
B=[1 2]'

lsqlin(C,D,[],[],A,B,[],[])
error: quadprog: equality constraint matrix must be full row rank
error: called from
    quadprog at line 282 column 11
    lsqlin at line 123 column 19

Haven't checked that output in Matlab.   In any case, mailing list suggestion is that Octave produces the NaN output like matlab rather than erroring out.  Also was suggested having an option where lsqlin removes the linearly dependent input for you, although no basis or approach for this to be done consistently and compatibly has been discussed.

[1] http://octave.1599824.n4.nabble.com/lsqlin-error-message-tp4693279.html

Nicholas Jankowski <nrjank>

 

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

Attach Files:
   
   
Comment:
   

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 nrjank (Submitted the item)
  • -email is unavailable- added by nrjank (optim maintainer and participants in mail list discussion)
  • -email is unavailable- added by nrjank (optim maintainer and participants in mail list discussion)
  • -email is unavailable- added by nrjank (optim maintainer and participants in mail list discussion)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-05 nrjank Carbon-Copy- => Added i7tiol@t-online.de
        Carbon-Copy- => Added doug.dastew@gmail.com
        Carbon-Copy- => Added gosim@mail.com

    Back to the top


    Powered by Savane 3.5