help-octave
[Top][All Lists]
Advanced

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

SQP - Reducing Vector Size?


From: jjmilburn
Subject: SQP - Reducing Vector Size?
Date: Tue, 23 Apr 2013 19:24:50 -0700 (PDT)

I am implementing SQP, using the following functions for my objective and
inequality constraints, respectively:

function obj = cost (w)
        obj = 0.5*norm(w(1,1:columns(w)-1))^2;
        obj;
endfunction

function c2 = inEq (w)
        for i=1:50
                % the below commented line (without w index reference)
works.
                % c2(i,:) = w * 12.5-4;

                % this is a test, the line below does not work
                c2(i,:) = w(i)*12.5-4;
        end
endfunction

When I run sqp via the following : sqpOut=sqp(0, @cost,[],@inEq), I receive
the error:
error: A(I): Index exceeds matrix dimension.
error: called from:
error:   conEq at line 21, column 11
error:   /usr/share/octave/3.2.4/m/optimization/sqp.m at line 361, column 8
error:   /home/josh/octaveExperiment/data/trainSVM.m at line 44, column 7

When I perform a "size(w)" before running sqp, I get the following:
      ans = 1 51
when I perform a "size(w)" after running the above sqp, I get the following:
      ans = 1 1

Questions:
  1) Why is SQP changing the size of my decision variable (w) vector?
  2) how do I remedy this or modify my code to make it not behave in this
way?

As noted in the code comments, I am able to get this to work if I do not
reference w by index.





--
View this message in context: 
http://octave.1599824.n4.nabble.com/SQP-Reducing-Vector-Size-tp4652246.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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