internal.optim.postsolve line 183 error?

3 visualizzazioni (ultimi 30 giorni)
Rawan El Khateeb
Rawan El Khateeb il 14 Mag 2016
Commentato: Rawan El Khateeb il 20 Mag 2016
Hello. I have a code that uses the quadprog function to solve a quadratic problem. I am using the 2014 version. It used to run okay but I started getting the following error:
Index exceeds matrix dimensions.
Error in internal.optim.postsolve (line 183)
Error in ipqpcommon (line 64)
Error in quadprog (line 353)
[X,fval,exitflag,output,lambda] = ipqpcommon(H,f,A,B,Aeq,Beq,lb,ub,X0, ...
Error in miqp (line 737)
[x,fval,exitflag,outpu,lambda] = quadprog(subprob.H, subprob.f, ...
I am unable to access the file ipqpcommon or internal.optim.postsolve where the problem occurs. Furthermore, when I run the same code on the 2010 version this error does not occur, but it runs much faster on the 2014 version (until the error occurs and the code stops).
How can I fix this error?
  3 Commenti
Rawan El Khateeb
Rawan El Khateeb il 14 Mag 2016
It's a big code with lots of functions, here is the main part:
iterations = 50;
NoRuns = 1;
ExactCost = zeros(iterations,1);
SubOptimalCost = zeros(iterations,1);
NormalizedCost = zeros(iterations,1);
CostDifference = zeros(iterations,1);
time = 1:iterations;
while(NoRuns <= iterations)
%initialize
N = randi([3, 8]);
M = randi([5, 10]);
[ H,f,A,b,Aeq,beq ] = MatrixandVectorMaker( N,M);
LB = zeros(1, N*M);
UB = CheckPathValidity(N,M);
vartype = zeros(size(H,1),1);
for vartypecount = 1:(size(H,1))
vartype(vartypecount) = vartypecount;
end
[XExactSol, XExactVal, ExactFlag] = miqp(H, f, A, b, Aeq, beq, vartype, LB, UB, X0);
if (ExactFlag == 1)
[ XSolHeur, XHeurVal, HeurFlag ] = SequentialFixing(N,M, H,f,A,b,Aeq,beq,LB,UB, X0 );
if (HeurFlag == 1);
if not(isnan(XHeurVal/XExactVal))
NormalizedCost(NoRuns) = XHeurVal/XExactVal;
CostDifference(NoRuns) = abs(XExactVal - XHeurVal);
ExactCost(NoRuns) = XExactVal;
SubOptimalCost(NoRuns) = XHeurVal;
NoRuns = NoRuns +1
end
end
end
end
the error occurs when I try to call miqp.m BUT it does not happen all the time and I have not been able to find the trigger.
You can download miqp.m from here: http://cse.lab.imtlucca.it/~bemporad/hybrid/toolbox/
I forgot to mention I am using Windows 10 if that helps.
Walter Roberson
Walter Roberson il 16 Mag 2016
Is the above, together with that toolbox, enough to reproduce the problem?

Accedi per commentare.

Risposte (1)

Steven Lord
Steven Lord il 16 Mag 2016
Set a breakpoint on line 737 in miqp then run your code. Ensure that all the variables that miqp is using to call quadprog satisfy the requirements for sizes and shapes given in the quadprog documentation for the release you're using. For instance, are H and f correctly sized so that x'*H*x and f'*x are both defined?
If everything seems to be defined correctly, save those variables with which miqp is calling quadprog and submit those variables along with the corresponding quadprog call to Technical Support for investigation.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by