How to perform linear programming in Mathematica based on the following conditions, to draw the feasible region defined by -1 <= a + b <= 1 and 1 <= a - b <= 3, and find the range of t==3 a-b
The range of t can be solved using Reduce.
Reduce[{-1 <= a + b <= 1, 1 <= a - b <= 3, t == 3 a - b}, t, {a,
b}, Reals]
The current requirement is to use linear programming to solve for the feasible region under the given conditions, with the feasible region being shaded for identification. The objective function crosses the feasible region, and the range problem is solved using graphical methods.
My personal attempt is as follows.
inequalities = {-1 <= a + b <= 1, 1 <= a - b <= 3};
RegionPlot[Evaluate@inequalities, {a, -5, 5}, {b, -5, 5},
PlotStyle -> Directive[Opacity[0.5], LightBlue],
FrameLabel -> {"a", "b"}, PlotLegends -> "Expressions"]
targetFunction = b == 3 a - t;
solution = Reduce[Join[inequalities, {targetFunction}], {a, b, t}]
The issue is that the feasible region is not shaded for identification, which feels quite cumbersome. Is there a better way to solve this problem?
inequalities = (-1 <= a + b <= 1 && 1 <= a - b <= 3);
? $\endgroup$