0

I have quite a simple linear programming problem. Where I want to maximise z with various constraints. However, I'm not sure how to write constraint number 4. I need both x and y to be above 2. Any solutions?

max z = 5x + 4y

constraints:
1) 4x + 2y <18 , 2) x+y<9 , 3)2x+3y<19 , 4) x,y>2

 library(lpSolve)
     f.obj <- c(5,4)
    f.con <- matrix(c(4,2,
                  1,1,
                  2,3),nrow=3,byrow=TRUE)

    f.dir <- c("<=",
           "<=",
           "<=")

    f.rhs <- c(18,
           9,
           19)

    lp("max",f.obj,f.con,f.dir,f.rhs)$solution
Zara Liew
  • 1
  • 3
  • What's so special? `x, y > 2 <-> x > 2, y > 2` (actually `>=` as there is no `>`). These are two constraints. In most cases, you will enforce this by variable bounds though (which might be more specialized depending on the framework/solver). – sascha Nov 26 '19 at 13:08
  • Have you tried to identify it individually like a matrix: 1,0> 2 and 0,1> 2? – RIckHenr Sep 02 '20 at 22:33

0 Answers0