eliminatevariables.m bug?

21 views
Skip to first unread message

Chen Chen

unread,
Jun 17, 2014, 1:26:21 AM6/17/14
to yal...@googlegroups.com
Hello, I was using the optimizer function, and came across an indexing error.

-----------
Attempted to access model.K.s(8); index out of bounds because numel(model.K.s)=7.

Error in eliminatevariables (line 124)
        n = model.K.s(i);

Error in optimizer/subsref (line 104)
            [self.model,keptvariables,infeasible] = eliminatevariables(self.model,self.parameters,thisData(:));
----------

The for loop on line 120 of eliminatevariables.m is over the length of model.K.q.  Is it simply supposed to be over model.K.s or do you suspect something else is going on?

Thank you,

-Chen

Johan Löfberg

unread,
Jun 17, 2014, 2:31:50 AM6/17/14
to yal...@googlegroups.com
Thank you for reporting this. Yes, the loop should be over K.s

Johan Löfberg

unread,
Jun 17, 2014, 2:45:25 AM6/17/14
to yal...@googlegroups.com
Note that it say

if model.K.s(1) > 0
   
% This code cannot occur yet, so untested

Obviously, the case could occur (I seem to have removed the limitation), but I can assure you that the code has not been tested. Most likely does not work as intended, but I will try to fix it and add some test-cases for it
Reply all
Reply to author
Forward
0 new messages