error while generating code for mpcqpsolver
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I tried to generate code for this function solving a quadratic program:
function [x, iter, iA1, lam] = QPmine(G,Linv,F,xk,L,Wxkc)
%#codegen
assert(isa(xk,'double'));
assert(isa(Linv,'double'));
assert(isa(F,'double'));
assert(isa(L,'double'));
assert(isa(Wxkc,'double'));
assert(isa(G,'double'));
[L1,p] = chol(G,'lower');
Linv = inv(L1);
Aeq = [];
beq = zeros(0,1);
Opt= mpcqpsolverOptions();
iA0 = false(size(Wxkc));
[x, iter, iA1, lam] = mpcqpsolver(Linv,F*xk,-L,Wxkc,Aeq,beq,iA0,Opt);
end
But while generating code I got the following error:
??? Non-constant expression or empty matrix. This expression must be constant because its value determines the size or class of some expression. In this context, the value of the string must be known.
Error in ==> mpcqpsolver Line: 237 Column: 46 Code generation failed: View Error Report Error using codegen
The code i wrote to generate the code is:
fun = 'QPmine';
Cfg = coder.config('mex'); % or 'lib', 'dll', etc.
codegen('-config',Cfg,fun,'-o',fun);
Since I do not have equality constraints which have to be met by the quadratic solver the Aeq and beq matrices are empty as specified on the internet. But since these are empty I cannot generate any code for this mpcqpsolver or am I doing something wrong?
1 Kommentar
Jeevan Joishi
am 8 Jun. 2016
Can you include information on how to reproduce the issue. I tried the same at my end and I did not get the same error. This is what I got -
??? Expected a scalar. Non-scalars are not supported in IF or WHILE statements, or with logical operators. Instead, use ALL to convert matrix logicals to their scalar
equivalents.
Error in ==> qpkwik Line: 1 Column: 1
Code generation failed: View Error Report
Error using codegen
Antworten (1)
Rafael Silva
am 5 Apr. 2017
Could someone clarify how to correct define the iA0 parameter? Using qpOASES I get the correct output, but applying mpcqpsolver with the same parameters it doesn't work properly. Including the status is always -2.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Code Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!