0

Im trying to find the values of x and y at the optimized objective function. This is the code for finding the optimum that i used

objective.in=c(6.55,7.9)
const.mat=matrix(c(0.25,0,0.25,0.5,0.5,0.5),nrow=3,byrow = TRUE)
const.dir<-c("<=","<=","<=")
const.rhs<-c(500,200,200)
lp("max",objective.in,const.mat,const.dir,const.rhs)

enter image description here

Phil
  • 7,287
  • 3
  • 36
  • 66
sonus vareed
  • 31
  • 1
  • 8
  • On the last line, assign it into an object, then use `str()` to see how that object is structured. – Phil Oct 08 '20 at 14:59

1 Answers1

0
> library(lpSolve)
> objective.in=c(6.55,7.9)
> const.mat=matrix(c(0.25,0,0.25,0.5,0.5,0.5),nrow=3,byrow = TRUE)
> const.dir<-c("<=","<=","<=")
> const.rhs<-c(500,200,200)
> res<-lp("max",objective.in,const.mat,const.dir,const.rhs)
> res$objval
[1] 3160

Use ?lp.object to find more information about what is available in the object that lp() returns.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39