Consider the half-planes $\{x \leqslant 2\}$ and $\{x+y \leqslant 3\}$. These two half-planes are coded with the R package 'rcdd' as follows:
library(rcdd)
A <- rbind(
c(1, 0), # x
c(1, 1) # x + y
)
b <- c(2, 3)
H <- makeH(A, b)
And we can get a representation of their intersection as follows:
V <- scdd(H)
which gives:
> V$output
[,1] [,2] [,3] [,4]
[1,] 0 1 2 1
[2,] 0 0 -1 1
[3,] 0 0 0 -1
The first column is always made of 0s, it is useless. The second one indicates whether we have a vertex of the intersection region (if 1
in the second column) or a ray (if 0
). So here we have the vertex $(2,1)$ and two rays directed by $(-1,1)$ and $(0,-1)$.
We can add a new half-plane, e.g. $\{y \leqslant 4\}$:
H <- addHin(c(0, 1), 4, H)
scdd(H)$output
# [,1] [,2] [,3] [,4]
# [1,] 0 0 0 -1
# [2,] 0 1 2 1
# [3,] 0 1 -1 4
# [4,] 0 0 -1 0
Denote by $R$ the obtained region. My problem is the following one. Given a pair $(a,b)$, I want to get the minimum value and the maximal value (possibly infinites) of $ax + by$ with $(x,y) \in R$.