install.packages("lpSolve")
Error in install.packages : Updating loaded packages
library(lpSolve)
obj.fun = c(12, 15)
constr = matrix(c(4, 3, 2, 5), ncol=2, byrow=TRUE)
constr.dir = c("<=","<=")
rhs = c(12, 10)
belt.sol = lp("max",obj.fun,constr,constr.dir,rhs)
belt.sol
Success: the objective function is 42.85714
belt.sol$solution
[1] 2.142857 1.142857
# draw feasible solution space
#tried to draw region using gMOIP but tried installing package, couldn't get it to work
x = seq(0, 12, by = 1)
eq1 = 4-(4/3)*x
eq2 = (10-2*x)/5
plot(x, eq1, type = "l", col="blue",ylim = c(0,12),xlab="x1",ylab="x2", main = "Feasible Region")
lines(x,eq2,col="purple")
install.packages("gMOIP")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/alice/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.3/gMOIP_1.5.0.zip'
Content type 'application/zip' length 2595437 bytes (2.5 MB)
downloaded 2.5 MB
package ‘gMOIP’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\alice\AppData\Local\Temp\RtmpYBJEPo\downloaded_packages
install.packages("lpSolve")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Warning in install.packages :
package ‘lpSolve’ is in use and will not be installed
library(gMOIP)
Warning: package ‘gMOIP’ was built under R version 4.3.2Error: package or namespace load failed for ‘gMOIP’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘htmlwidgets’
Feasible Solution Space