error while generating code for mpcqpsolver

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

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

댓글을 달려면 로그인하십시오.

답변 (1개)

Rafael Silva
Rafael Silva 2017년 4월 5일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Code Generation에 대해 자세히 알아보기

질문:

2016년 6월 1일

답변:

2017년 4월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by