Search All of the Math Forum:

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

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

 Messages: [ Previous | Next ]
 Bestun Posts: 5 Registered: 8/11/12
Lingprog error
Posted: Aug 13, 2012 12:10 PM

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;
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)];
B
[variables, solution] = linprog(obj, [], [], equalityMatrix, equalityRHS, lowerB, upperB);
********************************************************************
Could any one know who to fix this error

Regards

Date Subject Author
8/13/12 Bestun
8/13/12 Matt J
8/13/12 Bestun
8/13/12 Matt J