Ren, Shubin
2009-Jun-10 08:03 UTC
[R] Asking for help while using "Simplex" to solve LP Problem.
Hello. I am a new user and want to use R to solve Linear Programming problem. I met a problem while using function "Simplex" and I would kindly ask whether someone could help to figure it out. In my problem, there are 47 parameters and all limited to (0,1). M file has 147 lines and P file has 100 line. Each line in M indicated following inequality: V1>=V2*X1+V3*X2+V4*X3+...+V48*X47, where the top 47 lines 1>=Xi (i=1 to 47) . Each line in P indicated inequality: V1<=V2*X1+V3*X2+V4*X3+...+V48*X47 The object function is (1,0,0...0) as I want to know the range of first parameter. So I wrote statements as following: enj<-c(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) P<-as.matrix(read.table("P",header=FALSE,sep="\t")); M<-as.matrix(read.table("M",header=FALSE,sep="\t")); simplex(a=enj,A1=M[,2:48],b1=t(M[,1]),A2=P[,2:48],b2=t(P[,1]),maxi=TRUE) Then I got the error message: Error in while (!all(obfun > -eps) && (it <= n.iter)) { : missing value where TRUE/FALSE needed Is anybody knows how to fix the error? Thank you. Cheers. Shubin Ren