[R] Issue on LGP solving
Dr. Debasis Ghosh
deb at debasis.in
Tue Sep 20 08:12:16 CEST 2016
I was solving a LGP problem which is very basic.
Find x0 = [x1; x2], n0 = [n1; n2; n3] and p0 = [p1; p2; p3] that minimize a
= [(2p1); (n2); (n3)]
The objectives are as follows
10x1 + 15x2 + n1 - p1 = 40
100x1 + 100x2 + n2 - p2 = 1000
x2 + n3 - p3 = 7
x; n; p >= 0
The solution is x' = [4; 0] and a = [0; 600; 7]
> local({pkg <- select.list(sort(.packages(all.available =
TRUE)),graphics=TRUE)
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
> local({pkg <- select.list(sort(.packages(all.available =
TRUE)),graphics=TRUE)
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
> coeff<-matrix (c(10,15,100,100,0,1), nrow=3, ncol=2, byrow=TRUE)
> target<-c(40,1000,7)
> p1<-c(2,0,0,0,0,0)
> p2 <- c(0,0,0,0,1,0)
> p3<- c(0,0,0,0,0,1)
> achievement <- data.frame(p1,p2,p3)
> achievement
p1 p2 p3
1 2 0 0
2 0 0 0
3 0 0 0
4 0 0 0
5 0 1 0
6 0 0 1
> llgp(coeff,target,achievement)
Do you have any idea why I am seeing below error ?
Error in matrix(0, nrow = levels, ncol = nonbasics) :
invalid 'nrow' value (too large or NA)
In addition: Warning messages:
1: In max(achievements$priority) :
no non-missing arguments to max; returning -Inf
2: In matrix(0, nrow = levels, ncol = nonbasics) :
NAs introduced by coercion to integer range
Regards,
Debasis Ghosh, Ph.D
[[alternative HTML version deleted]]
More information about the R-help
mailing list