# pongo directamente los costos de fabricacion+transporte para quitar variables del medio # (osea en vez de poner X1,X2,X3,X4 pongo directamente sus correspondientes Xij) # vector = (x1a,x1b,x1c,x1d,x2a,x2b,x2c,x2d,x3a,x3b,x3c,x3d,x4a,x4b,x4c,x4d) obj <- c(88,100,96,98,90,100,96,102,90,102,100,102,96,108,100,106) res <- matrix(c(1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1, 1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0, 0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0, 0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0, 0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1), nrow=8, byrow=TRUE) sig <- c("<=","<=","<=","<=",">=",">=",">=",">=") rhs <- c(140,260,360,220,180,280,150,200) lpSolve::lp("min", obj, res, sig, rhs) lpSolve::lp("min", obj, res, sig, rhs)$Solution # asi como esta no me devuelve los X. Re edito Z <- lp("min", obj, res, sig, rhs) X <- Z$solution print(Z) print(X) # Z=78880 # X: 0 0 0 140 0 160 100 0 180 120 0 60 0 0 50 0