The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Lingprog error
Replies: 3   Last Post: Aug 13, 2012 3:50 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 5
Registered: 8/11/12
Lingprog error
Posted: Aug 13, 2012 12:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Deal all
I am using a code with lingprog. When I am running it , it gives me this error
ERROR - (linprog): Incorrect number of columns in B (equalities)
??? Attempted to access variables(2); index out of bounds because numel(variables)=0.)
this is the part relating to matrix B
function [variables, solution] = solve(B, N, padN, fD, fL, tied, objP);
bigNumber = 1000; warning off MATLAB:divideByZero;
[padB padFL padTied] = deal(sparse(size(B, 1), size(N, 2)), sparse(1, size(N, 2)), sparse(size(tied, 1), size(N, 2)));
equalityMatrix = [B padB; padN N; fL padFL; tied padTied];
equalityRHS = sparse(size(equalityMatrix, 1), 1);
equalityRHS(size(B, 1) + size(N, 1) + 1, 1) = 1;
obj = [fD; objP']; % objP' contains plastic multiplier terms
lowerB = [-bigNumber * ones(size(B, 2), 1); sparse(size(N, 2), 1)];
upperB = [bigNumber * ones(size(B, 2), 1); bigNumber * ones(size(N, 2), 1)];
[variables, solution] = linprog(obj, [], [], equalityMatrix, equalityRHS, lowerB, upperB);
Could any one know who to fix this error


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.