We see graphically how linear programming optimizes a linear objective function in which the variables must satisfy a set of simultaneous linear equations. From the graphical view of points, we take following examples of linear programming problems of two variables and their analysis can be seen on a two-dimensional graph.

Example
Solve the following linear programming problem graphically.

maximize \quad \ \ \ \ \ \ 5x_1 +7x_2

subject to \ \ \ \ \ \ \ 3x_1 +8x_2\leq 12 \\ \ \ \ \ \ \ x_1 +x_2\leq 2 \\ \ \ \ \ \ \ 2x_1 \leq 3 \\ \ \ \ \ \ \ x_1 ,x_2 \geq 0

We consider the constraints as equalities and plot them. 

subject to \ \ \ \ \ \ \ 3x_1 +8x_2= 12 \\ \ \ \ \ \ \ x_1 +x_2= 2 \\ \ \ \ \ \ \ 2x_1 = 3

Then we have :

blank

The maximum value of  5x_1 +7x_2 will be attainable at any one of the five vertices (extreme points) of the feasible region.

blank

Thus, the objective function  5x_1 +7x_2 is maximum at  (4/5 , 6/5)

 

In the Command Window of MATLAB,

>> mupad

k :=[{3*x1+8*x2<=12,x1+x2<=2,2*x1<=3},5*x1+7*x2 ,NonNegative ] :
g:= linopt::plot_data (k , [ x1 , x2 ] ) :
plot ( g ) :</p>

 

mupad command open MAPLE environment for entering MAPLE commands.

blank

The commands after mupad command, are MAPLE commands. These commands do not answer in command window of MATLAB.

Perhaps , You have a question, Why we do not use MATLAB command?

MAPLE is very professional software in mathematics, MATLAB does not support all of MAPLE capabilities, so MATLAB supports MAPLE to increase its capability and the user can solve complex problems easily in mupad.

 

Example

Solve graphically

maximize \quad \ \ \ \ \ \ 4x_1 +2x_2

subject \ \ \ \ to \ \ \ \ \ \ \ x_1 +2x_2 \geq 2 \\ \ \ \ \ \ \ 3x_1 +x_2\geq 3 \\ \ \ \ \ \ \ 4x_1+3x_2 \geq 6 \\ \ \ \ \ \ \ x_1 ,x_2 \geq 0

>> mupad

k :=[f x1+2*x2&gt;=2,3*x1+x2&gt;=3,4*x1+3*x2&gt;=6g,
4*x1+2*x2 , NonNegative ] :
g:= linopt::plotdata (k,[ x1,x2] ) :
plot (g)

 

An optimum value of the objective function is  24/5 at  (3/5,6/5).