Skip to content

Instantly share code, notes, and snippets.

# Import lpSolve package
library(lpSolve)
# Set coefficients of the objective function
f.obj <- c(5, 7)
# Set matrix corresponding to coefficients of constraints by rows
# Do not consider the non-negative constraint; it is automatically assumed
f.con <- matrix(c(1, 0,
2, 3,