Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

> with(Optimization): > > with(plots): In order to solve linear programming problems, both the Optimization and plots

package must be loaded. The Optimization package provides commands to find the minimum or maximum of various types of functions subject to various types of constraints. The plots package lets us display the feasible region graphically for any linear programming problem. MAPLE ASSIGNMENT FOUR (LINEAR INEQUALITIES)

Solve the following system of inequalities graphically, and clearly indicate the feasible region: Q.1 x-y>4, x<2,y>-5 > syst:=[x-y>4,x<2,y>-5]; > q1:=inequal(syst,x=-30..30,y=30..30,optionsexcluded=(color=white),optionsfeasible=(color=blac k)); > display(q1);

> > restart; > with(Optimization): > with(plots): Solve the following system of inequalities graphically, and clearly indicate the feasible region: Q.2 x+y y> with(Optimization): > with(plots): > syst:=[3*x+y<=6,x+y<=4,x>=0,y>=0];

> q2:=inequal(syst,x=-30..30,y=30..30,optionsexcluded=(color=white),optionsfeasible=(color=blac k)); > display(q2);

> > Solve the following system of inequalities graphically, and clearly indicate the feasible region: Q.3 x+y>1, 3x-y5, y<2x

> > > >

restart; with(Optimization): with(plots): syst:=[x+y>1,3*x-y<=5,y<2*x];

> q3:=inequal(syst,x=-30..30,y=30..30,optionsexcluded=(color=white),optionsfeasible=(color=blac k)); > display(q3);

> Q.4 Solve the following system of inequalities graphically, and clearly indicate the feasible region: 4x+2y<=28, 3x+4y <=48 > restart; > with(Optimization): > with(plots): > syst:=[4*x+2*y<=28,3*x+4*y=48];

> q4:=inequal(syst,x=-30..30,y=30..30,optionsexcluded=(color=white),optionsfeasible=(color=yell ow)); > display(q4);

> >

Q.5 A store sells two types of cameras. In order to cover overhead, it must sell at least 50 cameras per week and in order to satisfy distribution requirements, it must sell at least twice as many of type I cameras as type II. Write a system of inequalities to describe the situation and solve the system graphically. > > > restart; > with(Optimization): > with(plots): Let x be number of Type I Cameras and y be number of Type II Cameras > syst:=[x+y>=50,x>2*y,x>=0,y>=0];

> q5:=inequal(syst,x=-10..60,y=10..60,optionsexcluded=(color=white),optionsfeasible=(color=yell ow)); > display(q5);

> > Q.6 Minimize

subject to the constraints:

> > > >

restart; with(Optimization): with(plots): syst:=[y<=4*x+1/2,y<=-5*x+2,x>=0,y>=0];

> q6:=inequal(syst,x=-5..5,y=5..5,optionsexcluded=(color=white),optionsfeasible=(color=yellow )); > display(q6);

> obj:=-2*x-y; > LPSolve(obj,syst);

> The command given above returns the optimal function values, as well as the point at which the optimal value occurs. LPSolve command just returns minimum values, it will not work if the objective has to be maximized. In a case where the objective function needs to be maximized, the parameter maximize has to be added to the command. Q.7 Maximize

subject to the constraints:

> > > >

restart; with(Optimization): with(plots): constraints:=[y<=7,3*x-y<=3,x+y>=5,x>=0,y>=0];

> q7:=inequal(constraints,x=-30..30,y=30..30,optionsexcluded=(color=white),optionsfeasible=(color=yell ow)); > display(q7);

> obj:=4*x-6*y; > LPSolve(obj,constraints,maximize); Hence, the function is maximized when and and reaches a maximum value of

> If we just write, the below commmand: > LPSolve(obj,constraints); This gives us the minimum value of the objective function which is -42 and it occurs at =0 and =7. >

You might also like