# NOT RUN {
if (has_latte()) {
latte_max(
"-2 x + 3 y",
c("x + y <= 10", "x >= 0", "y >= 0")
)
latte_max(
"-2 x + 3 y",
c("x + y <= 10", "x >= 0", "y >= 0"),
quiet = FALSE
)
df <- expand.grid("x" = 0:10, "y" = 0:10)
df <- subset(df, x + y <= 10L)
df$objective <- with(df, -2*x + 3*y)
library("ggplot2")
ggplot(df, aes(x, y, size = objective)) +
geom_point()
latte_min(
"-2 x + 3 y",
c("x + y <= 10", "x >= 0", "y >= 0"),
method = "cones"
)
latte_min("-2 x - 3 y - 4 z", c(
"3 x + 2 y + z <= 10",
"2 x + 5 y + 3 z <= 15",
"x >= 0", "y >= 0", "z >= 0"
), "cones", quiet = FALSE)
}
# }
Run the code above in your browser using DataLab