#OBJETIVO #2XA+2.5XB+1.5XC+2XD #RESTRICCIONES #XA+XB+XC+XD=1 #6500XA+5800XB+6200XC+5900XD<6050 #6500XA+5800XB+6200XC+5900XD>5950 #0.2XA+0.35XB+0.15XC+0.11XD>0.1 #0.2XA+0.35XB+0.15XC+0.11XD<0.3 #0.05XA+0.015XB+0.065XC+0.1XD>0.045 #0.05XA+0.015XB+0.065XC+0.1XD<0.055 #OBJETIVO obj<-c(2,2.5,1.5,2) #RESTRICCIONES vect<-c(c(1,6500,6500,0.2,0.2,0.05,0.05,1,5800,5800,0.35,0.35,0.015,0.015,1,6200,6200,0.15,0.15 ,0.065,0.065,1,5900,5900,0.11,0.11,0.1,0.1)) mat<-matrix(vect,nrow=7, ncol=4) print(mat) dir<-c("=","<=",">=",">=","<=",">=","<=") print(dir) der<-c(1,6050,5950,0.1,0.3,0.045,0.055) library(lpSolve) EJER2.1<-lp("min",objective.in = obj,const.mat =mat,const.dir = dir,const.rhs = der) print(EJER2.1) XI<-EJER2.1$solution print(XI)