library(lpSolve) beneficio=c(320,320,320,400,400,400,360,360,360,290,290,290) a=c(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,500,0,0,700,0,0,600,0,0,400,0,0,0,500,0,0,700,0,0,600,0,0,400,0,0,0,500,0,0,700,0,0,600,0,0,400,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,0,-1,1,0,-1,1,0,-1,1,0,-1) matriz=matrix(a,nrow=12,ncol=12,byrow=TRUE) print(matriz) b=c(20,16,25,13,12,18,10,7000,9000,5000,0,0) restricciones=c("<=","<=","<=","<=","<=","<=","<=","<=","<=","<=","<=",">=") resultado=lp("max",beneficio,matriz,restricciones,b) resultado$objval resultado$solution