help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glpk problem,please check code


From: saiko7
Subject: glpk problem,please check code
Date: Sun, 12 Feb 2017 07:54:36 -0800 (PST)

function [alpha]=mclp(B,c,d);

a=B(:,1:29);
r=size(a,1);
c=size(a,2);
Q=gallery("lehmer",r);Q2=[Q zeros(r,r);zeros(r,r) zeros(r,r)];
alpha=zeros(r,1);
e=ones(r,1);e2=[e;zeros(r,1)];
u=zeros(r,1);u2=[u;zeros(r,1)];
v=zeros(r,1);v2=[v;zeros(r,1)];
y=B(:,30);
p=sum(y==0);q=sum(y==1);

E=[eye(q,q) zeros(q,p);zeros(p,q) -eye(p,p)];E2=[E zeros(r,r);zeros(r,r)
zeros(r,r)];
alpha=zeros(r,1);
b=a*a'+e*e';
H=[b zeros(r,r);zeros(r,r) Q];
alpha2=[alpha;u];alpha2(1,1)=0.000000001;

[alpha2 obj
inf]=qp(alpha2,H,zeros(2*r,1),[],[],[],[],(-Q2*u2)-(d*e2),E2,-c*e2);



ihave checked the dimensions of the matrices invoved ,but keep getting the
message 
mclp(a,3,1)
error: glpk: A must be a real valued 8 by 12 matrix
error: called from
    glpk at line 506 column 5
    qp at line 370 column 29
    mclp at line 20 column 16

where a is a 4*30 matrix



--
View this message in context: 
http://octave.1599824.n4.nabble.com/glpk-problem-please-check-code-tp4681846.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]