help-octave
[Top][All Lists]

## Re: glpk problem,please check code

 From: saiko7 Subject: Re: glpk problem,please check code Date: Mon, 13 Feb 2017 21:57:02 -0800 (PST)

```hey thanks for the reply
The c variable was indeed an oversight for on my part ,and i had changed
that in my original code soon after ,however that wasnt what was causing the
problem for me .

It was a problem with my A_in matrix .I think glpk (atleast my version)has
some problems in taking non semi positive definite matrices (or perhaps
det|A|=0 matrices ) as the value of A_in.

once i changed my A_in matrix and made the necessary changes in my
objective function ,it ran fine .

I am psting my code here ,just for future reference and for any helpful
inputs .

//function [alpha2,obj,inf]=mclp(B,c,d);

a=B(:,1:29);
r=size(a,1);

Q=gallery('lehmer',r);Q2=[Q zeros(r,r);zeros(r,r) eye(r,r)];
alpha=zeros(r,1);

u=zeros(r,1);u2=[u;zeros(r,1)];

y=B(:,30);
p=sum(y==0);q=r-p;
e=ones(r,1);e2=[e;u];
E=[eye(q,q) zeros(q,p);zeros(p,q) -eye(p,p)];E2=[E zeros(r,r);zeros(r,r)
eye(r,r)];
alpha=zeros(r,1);
b=a*a'+e*e';
H=[b zeros(r,r);zeros(r,r) Q];
alpha2=[alpha;u];

[alpha2 obj
inf]=qp([alpha;u],H,zeros(2*r,1),[],[],[],[],(-Q2*[u;zeros(r,1)])-(d*[e;u/d]),E2,-c*[e;u/c]);//

P:S this is a code for a regularized multi criteria linear programming model
for anomaly detection.

--
View this message in context: