5.1x + 15y +z = 280
6.9x + 17y +z = 320
5.3x + 13y +z = 270
I am particularly interested in solutions where x >= 30 I have done the following but I would like to get the other solutions
A <- rbind(c(5.1, 15, 1),
c(6.9, 17, 1),
c(5.3, 13, 1))
B <- c(280, 320, 270)
solve(A, B)
You have no opportunity to control the solution once you have a unique solution since A
is full rank.
However, if you remove the last equation from your system, say, AA <- A[-3, ]
and BB <- B[-3]
, then AA
becomes rank deficient, and you will have room to add the constraint x>=30
to achieve one solution.
For example, given AA
and BB
like below
AA <- A[-3, ]
BB <- B[-3]
we can make a random x>=30
like aux <- 30 + abs(rnorm(1))
., and solve the problem
> solve(rbind(AA, c(1, rep(0, ncol(AA) - 1))), c(BB, aux))
[1] 30.787640 -7.708876 238.616173