I need to come up with a solution for a rather, odd situation. Let's say I have an $M \times N$ matrix called ${\bf A}$, and I would like to solve it for ${\bf x}$ where $b_1 \le {\bf A} {\bf x} \le b_2$. However I also need to be able to put an upper and lower bound on each value in ${\bf x}$. Any suggestions? Linear programming is giving me some help, and doing well with $b_1$, but I'm having difficulty placing upper bounds on $b_2$.
Asked
Active
Viewed 972 times
1 Answers
2
Maybe
LinearProgramming[
ConstantArray[0, Last@Dimensions@A],
ArrayFlatten[{{A}, {-A}}],
Join[b1, -b2]
]
?
unlikely
- 7,103
- 20
- 52
-
-
Doh! I just realized, I need to be able to get discrete values for certain x's. – Daniel Mar 06 '16 at 06:33
-
@Daniel Integer values? This is possible by the 5th argument of
LinearProgramming... – unlikely Mar 06 '16 at 07:33 -
Never mind, I remembered how to do the last bit. Afraid it's been a while since I've used Mathematica. – Daniel Mar 06 '16 at 07:34
b1<=A*x<=b2.... if you get pinged .) – Dr. belisarius Mar 05 '16 at 08:48LinearProgramminghere (http://mathematica.stackexchange.com/a/108655/16267). If you just want a feasible solution, without minimizing anything, you can use a zero cost vector (first argument). If you want to enforce a set constraints like $\mathbf{b}_1 \le \mathbf{Ax} \le \mathbf{b}_2$ you should double the constaints as $\mathbf{Ax} \le \mathbf{b}_2$ and $- \mathbf{Ax} \le -\mathbf{b}_1$ (second and thrid arguments). If you also want to put a lower/upper bound on each $\mathbf{x}$ component you should use the 4th argument. – unlikely Mar 05 '16 at 14:10