Example_01: Linear Problem 1

Description Examples

Description

maximize \ \ 2 x_1 + 4 x_2 + 3 x_3

subject \ to:

3 x_1 + 4 x_2 + 2 x_3 ≤q 60

2 x_1 + x_2 + 2 x_3 ≤q 40

x_1 + 3 x_2 + 2 x_3 ≤q 80

x_1, x_2, x_3 ≥q 0

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(ROI)
mat <- matrix(c(3, 4, 2,
                2, 1, 2,
                1, 3, 2), nrow=3, byrow=TRUE)
x <- OP(objective = c(2, 4, 3),
        constraints = L_constraint(L = mat,
                                   dir = c("<=", "<=", "<="),
                                   rhs = c(60, 40, 80)),
        maximum = TRUE)


opt <- ROI_solve(x, solver = "lpsolve")
opt
## Optimal solution found.
## The objective value is: 7.666667e+01
solution(opt)
## [1]  0.000000  6.666667 16.666667

ROI.plugin.lpsolve documentation built on Aug. 30, 2020, 3:01 a.m.