59
Linear and Nonlinear Optimization Programming By Roxana Postolache Assistant Professor of Economics School of Management Capital University [email protected]  September 2007 Funded by the National Science Foundation (DUE 0618252) This module will help students become familiar with specific modeling technique s and their practical application. The student will take an analytic view of decision-making by formalizing trade-offs, specifying constraints, and pe rforming sensitivity analysis. Emphasis is placed on showing how one can develop and use an analytic framework and software to support decisions. Students are assumes to have a basic calculus knowledge, and familiarity with Excel. Abstract:  Linear and nonlinear optimization problems are present in many areas of  Economics and Finance, but they also arise in many other disciplines, with Chemistry, Physics, and Biology being just a few of them. Practical applications of linear and nonlinear programming include finding the optimal product mix, scheduling, transportation and distribution, inventory control, job assignment, capital budgeting and  portfolio management. The graphical modeling of the feasible set using Maple will h elp understand the intuition behind the algorithm which leads to the optimal solution. This module will use Excel, a widely available software package, to find the solutions to linear and nonlinear optimization problems and to analyze the sensitivity of the optimum solution to changes in the parameters of the problem. Key Words: Linear Programming, Nonlinear Programming, Objective Function, Constraints, Maximization, Minimization

Linear 30085

Embed Size (px)

Citation preview

Page 1: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 1/58

Linear and Nonlinear Optimization Programming

By

Roxana Postolache

Assistant Professor of EconomicsSchool of ManagementCapital [email protected] September 2007

Funded by the National Science Foundation (DUE 0618252)

This module will help students become familiar with specific modeling techniques andtheir practical application. The student will take an analytic view of decision-making by

formalizing trade-offs, specifying constraints, and performing sensitivity analysis.Emphasis is placed on showing how one can develop and use an analytic framework andsoftware to support decisions. Students are assumes to have a basic calculus knowledge,and familiarity with Excel. Abstract:  Linear and nonlinear optimization problems are present in many areas of

 Economics and Finance, but they also arise in many other disciplines, with Chemistry,

Physics, and Biology being just a few of them. Practical applications of linear and

nonlinear programming include finding the optimal product mix, scheduling,

transportation and distribution, inventory control, job assignment, capital budgeting and

 portfolio management. The graphical modeling of the feasible set using Maple will help

understand the intuition behind the algorithm which leads to the optimal solution. This

module will use Excel, a widely available software package, to find the solutions to linear

and nonlinear optimization problems and to analyze the sensitivity of the optimum

solution to changes in the parameters of the problem. 

Key Words: Linear Programming, Nonlinear Programming, Objective Function,Constraints, Maximization, Minimization

Page 2: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 2/58

I.  Introduction

One of the guideposts of economic thinking is the idea that agents (individuals, firms,etc.) are self-interested and always economizing. In other words, they will try to reach themaximum level of utility (or satisfaction) at the minimum cost. For starters, why do

(most) firms exist? Usually, it is not because the owners want to produce a good for other people out of the goodness of their hearts, but because they want to make money. Evenmore, they do not just want to want to make money, but they want to make as muchmoney as possible, or, in other words, maximize their profits. One question that veryoften needs to be answered is how much should the company produce in order tomaximize profits? How can the owner or the manger of the company identify this outputthat will lead to the maximum profit given the complexity of the environment the firmoperates in? Not all problems are maximization problems. Sometimes the minimum isthe desirable outcome, like it would be the in the situation of costs. No manger will wantthe total cost to be maximized. It needs to be minimized, as the lower the cost is, thehigher the profit will be (since profits are the difference between total revenue and total

costs). Now, we are back to the idea of profit maximization.

This process of maximizing or minimizing is known as optimization, or mathematical programming. Its job is to find the solution (product mix, allocation of resources,investments, etc.) that leads the best result - the highest profit, or output, or return, or theone that achieves the lowest cost, or waste.

These optimization problems can be linear or nonlinear, depending on the mathematicalform of the various functions included in the model. They can be constrained orunconstrained. They can be solved graphically (although they might be exponentiallymore difficult to solve graphically if the model is nonlinear, or if it contains a large

number of variables), or through the use of statistical software. Additionally, linear programming provides an excellent opportunity to introduce the idea of "what-if"analysis, due to the powerful tools for post-optimality analysis developed for the linear programming model.

Page 3: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 3/58

II.  Problem Statement

Striving to find the optimum solution is a goal in many areas, not just business, orEconomics and Finance. Physics, Chemistry, Biology, Health Care or Engineering are

 just some of the areas these problems arise in. This module will focus on solvingoptimization problems as they relate to business, but the techniques used here can beeasily modified to fit any other scenario where optimization is a goal.

How can one find the outcome, or the solution, that will lead to the best result - thehighest profit, or output, or return, or the one that achieves the lowest cost, or waste,subject to some constraints imposed by the environment? How can one model a complex business environment through the use of mathematical models? How can one answer thequestion “what if” as it relates to changes in environment or constraints?

These questions are partly answered in this module. The optimum solution is found by

solving a mathematical problem that is a representation of reality. A mathematicaloptimization model consists of an objective function and a set of constraints expressed inthe form of a system of equations or inequalities. The model will first be solvedgraphically to preserve the intuition behind finding the solution and to help the readerunderstand the “how”. Then, a solution will be found using Excel, specifically Solver,and the “what if” question will be addressed.

III. Background Information

Let’s begin our journey!

Decision-making models are classified into two categories: deterministic and probabilistic. In deterministic models, you get that what you expect. There is nouncertainty, so the outcome is deterministic, or risk-free.

For example, if you are a farmer, selling apples for $1 a piece, assuming no other factorsthan the selling price affect the amount you sell, the mathematical relationship linkingyour revenue from selling apples and the quantity you sell is:

Revenue = Price of an apple * Quantity of apples you sell, or

TR= P apple * Q

In other words, if you sell 100 apples, your revenue from selling apples can easily becalculated as being $100. Of course, we are making the assumption that no other factor

Page 4: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 4/58

other than the price affects the revenue. We will come back to the assumptions one makeswhen mathematically representing reality soon.

Many applications in business and economics involve a process called optimization, inwhich we are required to find the minimum cost, the maximum profit, or the minimum

use of resources.

Going back to our previous example, most business owners will start a business havingone main goal: to make as much money as possible, or to maximize their profits. Since profits are the difference between total revenues (price of one unit multiplied by thequantity sold, assuming all units are identical) and total costs, one can maximize profits by increasing his revenues or diminishing his costs. There are limits to how muchsomebody can reduce costs. As much as you would like to decrease the amount of moneyyou spend on employee compensation (i.e. salaries), you are constrained by the minimumwage laws, which stipulate that you cannot pay your employees less than a certain hourlywage. The problem becomes one of constrained   optimization. In order to identify the

solution to an optimization problem (constrained or not), one must construct a model ofthe reality.

 No mathematical model can be a perfectly comprehensive representation of reality,including all of its characteristics, as it is usually impossible to mathematically representsome aspects of a physical system. Even if it were possible to do so, the model will betoo complicated to be tractable. A model is usually a representation of the reality thatcaptures some  characteristics of reality, the ones essential for the issue at hand, whileleaving everything non-essential to the side. 

A smiley face drawn on a piece of paper, as a circle with two lines for the eyes, two dots

for the nose, and a little curve for the mouth is a model for a face. If I were to point to asmiley face and ask anybody what that was, I would probably get the answer “a face” orsomething along these lines. But is it? Have you ever met anybody looking like that?Probably not. For starters, most people have tri-dimensional faces, and such things ascheekbones, which the smiley face does not have. Even so, the smiley captures enough ofthe characteristics of a human face (nose, eyes, mouth) that all of us can recognize it asthe model (or approximation) of a face. Other examples of models may include blood pressure being used as a model of the health of an individual. In this case, the modelcaptures some aspect of the reality it attempts to represent, and it may be useless in a particular application, as it may capture elements of the reality that are not relevant forthe issue at hand. Blood pressure is a model of the health of an individual, but it mightnot be the most relevant one if you have sprained ankle. Thus, the usefulness of themodel is dependent upon the aspect of reality it represents.

Page 5: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 5/58

Page 6: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 6/58

Linear Programming

Linear programming refers to the fact that both the objective function to be optimized andall the constraints, are linear in terms of the decision variables (i.e. no square root, seconddegree polynomials, etc.).

Linear Programming introduced by George B. Dantzig in 1947, and is a method ofoptimizing an objective function by solving a system of linear equations where thesolution is subject to a set of constraints (see, e.g. Danzig 1949). The first polynomial-time algorithm for systems of linear equations was given by Khachiyan (1979). Anylinear programming problem consists of an objective function and a set of constraints. Asolution set for the decision variables, where all of the constraints are satisfied, is called afeasible solution. Most solution algorithms start by finding a feasible solution, then movefrom one feasible solution to another until the objective function has been optimized –maximized or minimized.

Simple models of linear programming can easily be solved graphically, and this is particularly helpful, as it makes the intuition behind the process very clear.

EXAMPLE: Woodchuck’s Carpentry Inc. sells tables and chairs. Woodchuck has tworesources devoted to the production of tables and chairs: wood (capital) and labor.

Of course, most real life business situations are more complex than this, as the production process involves different categories of capital (machinery, assembly lines, warehouses,delivery trucks, to name a few) and various categories of labor (supervisors, managers,accountants, etc.). We will start with a simple, albeit not entirely realistic example, tounderstand the intuition behind linear optimization. The idea stays the same, regardless

how many variables or parameters we take into consideration.

Woodchuck makes $200 worth of profit from every table he sells, and $50 worth of profitfrom every chair he sells. Each table requires 10 units of wood and 3 hours of labor, andeach chair requires 5 units of wood and 4 units of labor. Let’s also assume thatWoodchuck has 100 units of wood and 60 units of labor available. For the sake ofsimplicity, let’s assume that it is not possible to get more of any of these two resources.We will see later on what happens if Woodchuck can get more resources.

 Notice that tables are more wood-intensive (i.e. require more wood per unit produced)and chairs are more labor intensive.

Woodchuck wants to know how many tables and how many chairs to produce eachmonth in order to maximize his profits.

Let’s start by gathering all the information given in the problem.

Page 7: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 7/58

Tables Chairs Available

Wood 10 5 100

Labor  3 4 60

Product

 

The total profit Woodchuck makes will be the sum of the profit from selling tables and

the profit from selling chairs. The profit from selling tables will be the product of the profit from each table times the number of tables sold. Similarly, the profit from sellingchairs will be the profit from each chairs times the number of chairs sold.

Let’s denote the number of tables produced by X1and the number of chairs by X2.

Woodchuck’s total profit will be

Z= 200 X1+50 X2

 This is the objective function.

Given the wood and labor requirements given in the problem, and the amounts availableof the two resources, the wood constraint will be

10 X1+5 X2≤ 100

and the labor constraint will be

3 X1+ 4 X2≤  60.

 Notice the “less than or equal to” sign; 100 units of wood and 60 hours of labor are

maximum limitations that can be rather than must be used. The company can use lessthan the amount of resource available, as long as the profit is maximized (the amount leftover is called slack).

Since it is impossible to produce negative quantities of tables and chairs, we need toconstrain both X1 and X2 to be non-negative.

Therefore, the linear programming model becomes:

Maximize Z= 200 X1+50 X2

 

subject to

10 X1+5 X2≤ 100

3 X1+ 4 X2≤  60X1 ≥ 0X2 ≥ 0

Page 8: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 8/58

This is a mathematical model for the Woodchuck’s problem. The decision variables, i.e.,controllable inputs are X1, and X2, and since we assume the carpenter is not going out of business at the end of the planning horizon, we do not require X1, and X2 to be integers.If the optimum solution includes decimal points, or partial items, they would simply becounted as work in progress and would eventually become finished goods in the next

 period.

V. Solution Methodology/Implementation

We may try to solve for the number of chairs and tables by simply taking different valuesfor each of them and selecting the pair that maximizes the profit, but the feasible solutionset is usually quite large, and it the process would take longer than any manager couldafford.

A graphical solution can be found in this case, since there are only two products in the product mix, and the model can be represented on a bi-dimensional graph. Models

including three variables can be graphed on a tri-dimensional graph, but the process iscomplicated, while models with more than four variables cannot be graphed at all.

The graphical solution is limited to models including two variables, but it is very usefulas it provides a better understanding of the solution.

The first step is finding the feasible area, or all the possible combinations of tables andchairs that satisfy the problem constraints. The feasible area is constructed by graphingthe two constraints. We start with a system of coordinates with X1 on the horizontal axis,and X2 on the vertical axis. Since both X1 and X2 are constrained to be non-negative, weare only interested in the positive quadrant.

The first constraint is the wood constraint, 10 X1+5 X2≤ 100. We start by graphing the

 border of the area given by this constraint, which is the straight line 10 X1+5 X2= 100A simple procedure for plotting the line is finding the points where it intersects the axes,and drawing a straight line through the points.

The point where the line intersects the horizontal axis has X2=0, so X1=10.The point where the line intersects the vertical axis has X1=0, so X2=20.

However, the line we obtain by connecting these two points is not our original constraint,which should also include the values that are less than or equal to this line. The area

representing the entire constraint is shown in Figure 1. The way to test whether orfeasible area is below or above the line is to take a point (i.e. a combination of tables andchairs) and see whether the constraint is satisfied. For example, producing one table(X1=1) and one chair (X2=1) will require 10*1+5*1=15 units of wood. (1,1) is under theline, and it satisfies the constraint. On the other hand, producing ten tables (X1=10) andten chairs (X2=10) will require 10*10+5*10=150 units of wood. (10,10) is above the line,and it does not satisfy the constraint.

Page 9: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 9/58

Figure 1

The Wood Constraint

Similarly, the second constraint gives us the constraint area for labor, as pictured inFigure 2.

Figure 2

The Labor Constraint

We want the labor and the wood constraints to be satisfied simultaneously, so they needto be represented in the same graph. Figure 3 shows the feasible area for the model.

Page 10: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 10/58

Figure 2

The Feasible Area

 Notice the feasible area includes all the combinations of tables and chairs that can be

 produced that satisfy all four constraints of the model,

10 X1+5 X2≤ 100

3 X1+ 4 X2≤  60X1 ≥ 0X2 ≥ 0

and it was found by identifying the common area to all constraints.

Point O in Figure 2 is a combination of tables and chairs that is unattainable, given thewood and labor constraints (i.e. o does not satisfy any of the two constraints). Point I

illustrates a feasible combination of tables and chairs – both constraints are satisfied.Point M satisfies the wood constraint, but not the labor constraint.

One or more of the points (i.e. combinations of tables and chairs) in the feasible area willresult in the maximum profit for Woodchuck. The next step is finding that point, or points.

 Now that we know what the feasible area looks like, let’s try to remember what we weretrying to do in the first place, which is to maximize profit. In order to do this, we need torepresent graphically the profit function as well. The profit function is Z= 200 X1+50 X2,and it obviously includes a third variable, Z. Let’s just take an arbitrarily selected level of

 profit, Z=100.

The profit function becomes 100=200 X1+50 X2, and every combination of tables andchairs on this line will result in a $100 profit. Is this the best that the firm can do (i.e.optimum)? Looking at the graph, we can see that there are profit lines higher than100=200 X1+50 X2, which means there are combinations of tables and chairs that canlead to even higher profits. How much higher?

Page 11: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 11/58

The highest profit level the firm can be reached is represented by the profit line goingthrough point C. A higher profit level cannot be reached, as a line with a bigger interceptwould not pass through the feasible area anymore, and any profit level lower than that isnot the best the firm can do. It follows that the optimum combination of tables and chairsis point C. Woodchuck will need to produce all tables (10 of them), and no chairs in order

to maximize profits. The profit in this case is Z=2000

Figure 4

Optimal solution for Z=200 X1+50 X2

 

What if the profit function becomes 100=50 X1+50 X2?

Figure 5

Optimal solution for Z=50 X1+50 X2

 Chairs become more profitable, and intuitively, one would think that producing all tablesis not the way to go anymore. If we represent graphically the new profit line, then drawlines parallel to it further and further from the origin, the best the firm can do is point B.That is the combination of tables and chairs yielding the highest profit, while still beingfeasible. Point B can be found at the tangency point between the profit line and the vertex

Page 12: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 12/58

of the feasible area. Point B is also the intersection of the two constraint lines, and it can be found by solving a system of simultaneous equations.

10 X1+5 X2 = 100

3 X1+ 4 X2 = 60

To solve this system of equations we multiply the first equation by -3, and the secondequation by 10.

-30 X1-15X2 = -300

30 X1+40 X2 = 600

If we add the two equations we obtain 25 X2 = 300 or X2 = 12. Now we can substitute 12for X2 in either of the original equations, and solve for X1 .

Let’s use the first equation.

10 X1+(5) (12)= 100

10 X1+60= 100

10 X1= 40

X1= 4

The solutions is X1= 4, X2= 12, for a profit Z=800

What if the profit function becomes 100=2X1+20 X2?

Following a similar thinking process, the new optimum is now point A, with 15 chairs

 being produced.

Figure 6

Optimal solution for Z=200X1+20 X2

 

Page 13: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 13/58

It can be proven that the optimum solution will be on the boundary of the feasible area, atthe extreme points (or corners). Any point outside of the feasible area is not attainable,and any point inside the feasible area is not optimum as there is at least one point on the boundary that will lead to a higher profit.

The method used above to solve a graphical linear optimization problem has thefollowing steps:

1.  Plot the model constraints as equations on the graph2.  Find the feasible area3.  Represent the objective function graphically, then move this line out from the

origin to find the optimum.4.  Find the coordinates of the optimum point by solving a system of two equations

with two constraints.

There are a few drawbacks, though. If the optimization problem is subject to multiple

constraints, graphically representing the feasible area could be more challenging; also, ifone of the parameters in the problem changes (i.e. the profitability of each table, or theamount of labor required for each chair), which is often the case in real life, one wouldhave to start from square one in order to solve the problem.

The second method that can be used to solve linear programming problems is the corner point method. Since we know the optimum will be on the boundary of the feasible area,one can find the coordinates of the corners, calculate the value of Z for those coordinates,and compare these values. The point which leads to the highest (in the case ofmaximization problems) Z or the lowest (in the case of minimization) Z is the optimumsolution.

Of course, neither one of these two methods will be very tractable in a situation with alarge number of variables and/or constraints.

Fortunately, Excel (and many others) can be used to solve optimization problems. Exceluses a tool named Solver to find the solution to linear programming related problems.One big plus for Solver is that it is part of the basic Excel program, thus available toeverybody who has access to Excel. Solver is limited to 200 changing cells (variables)each with two constraints and up to 100 additional constraints. All of these capabilitiesmake Solver suitable for the solutions of complex, real world problems.

The first step is entering the variable names and the parameters for the objective functionand constraints (see Figure 7)

Page 14: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 14/58

 

Figure 7 Setting up the Woodchuck’s Carpentry Inc. Example Using Excel

The values of the variables which will be the optimum solution will be located in cellsB10:B11.

A formula must be included for the objective function: in B12 we will have=C4*B10+D4*B11

Formulas must also be included for the two constraints; the wood constraint in F6:=C6*B10+D6*B11 and the labor constraint in F7: =C7*B10+D7*B11.

The right-hand side value for each constraint must be included (cells E6:E7).

Including a column for the slack (any resources left over) is optional, but helpful (cellsG6:G7 will include =E6-F6 and =E7-F7 respectively).

Once all of this data and formulas are included in Excel, you are ready for Solver.

First of all, you might need to add Solver to Excel, if it does not appear under Tools. InExcel, you need to select Tools-Add-ins and check the box next to Solver Add-in. Solvershould now be displayed in the Tools drop-down menu.

Once Solver is selected, the window in Figure 8 will open.

Page 15: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 15/58

Move the cursor to the Set Target Cell box, and fill in the cell that calculates the value ofthe objective function. In our case, cell B12 calculates the value of the profit forWoodchuck.

Figure 8

Solver Parameters

You need to select Max if you are solving a maximization problem, and Min if it is aminimization problem.

Move the cursor to the By Changing Cells box, and select the cells that contain the valuesfor the variables, in our case B10:B11.

The constraint will be introduced in the window below Subject to the Constraints. Youneed to click on Add; when you do that, a new window will open. The Cell Reference box is for the left-hand side of the constraint (F6:F7), while Constraint refers to the parameters given in the problem. When you click Add, the constraint gets added to thelist. You can include the non-negativity constraint here (B10:B11greater than or equal to0) or you can address it later.

By clicking on Options, the window in Figure 9 opens. You need to select Assume LinearModel. (You can also check Assume Non-negative, if you did not include the non-negative constraint with the other constraints). When you are done with this dialogue box, click the OK button to close it and return to the main Solver dialogue box.).

Page 16: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 16/58

Figure 9

Solver Options

Review the information in the Solver window to make sure everything is correct, thenclick Solve. The window in Figure 10 is displayed. It indicates that a solution was found.Select Keep Solver Solution and the values in the spreadsheet will be kept at the optimalsolution. If you want additional information (Answer, Sensitivity, Limits) generated, youmay select these options then click OK.

Figure 10

Solver Results

The optimal solution is now displayed in cells B10:B11, and the slack is displayed incells G6:G7. The maximum value of the objective function is listed in B12.

Page 17: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 17/58

Figure 11

Answers for Woodchuck’s Carpentry Inc. Problem

Figure 12 displays the Excel generated Answer Report. It lists the original and theoptimal values of the profit, number of tables and chairs, the slack (if any) and whetherthe constraints are binding or not.

Page 18: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 18/58

Figure 12

Excel Generated Answer Report for Woodchuck’s Carpentry Inc. Problem

Figure 13 displays the sensitivity report generated by Excel. This report is very useful, asit helps answer questions like “how would the optimal solution change if the companyhad more (or less) wood (or labor) available, if it used more (or less) wood (or labor) to produce each table (or chair), or if the profitability of each table (or chair) changed”.The values under Allowable Increase and Allowable Decrease represent the values thatneed to be added to or subtracted from the objective function coefficients or theconstraint parameters to find the upper and lower bounds of the interval for which thesolution stays at the same corner point.

For example, Woodchuck has 100 units of wood available. This amount of wood canincrease by 100 (to 200) or decrease by 100 (to 0) and the optimum solution will stay atthe same corner point.

Page 19: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 19/58

Page 20: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 20/58

If we denote the number of undergraduate courses by X1and the number of graduatecourses offered by X2, the mathematical model for this problem is:

Minimize Z= 2500 X1+3000 X2

 

subject to

X1≥ 30

X2 ≥ 20

X1+ X2 ≥ 60X1 ≥ 0X2 ≥ 0

Let’s solve the problem graphically.

We begin by representing graphically the undergraduate course constraint (Figure 14).

Figure 14

The Undergraduate Course Constraint

The values of X1 that satisfy the constraint are to the right of the X1=30 straight line(since X1≥ 30). Next, we represent graphically the graduate course constraint (Figure 15).

Page 21: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 21/58

Figure 15

The Graduate Course Constraint

The student demand constraint is displayed in Figure 16. The feasible combinations ofundergraduate and graduate courses are found to the right of the X1+ X2 = 60 line

(because the constraint is X1+ X2 ≥ 60).

Figure 16

The Student Demand Constraint

The feasible area for the course offering constraint is in Figure 17.

Page 22: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 22/58

Figure 17

The Feasible Area for the College of Business Problem

 Next, we represent graphically the cost function, Z= 2500 X1+3000 X2. In this case, weneed to find the combination of courses (graduate and undergraduate) that is feasible, andminimizes the objective function. In other words, we will represent graphically the costfunction, then draw a series of parallel cost lines. The lowest cost line (the closest to theorigin) to touch the feasible area provides with the optimal solution corner. In this case,the optimum is point B (see Figure 18), with 40 undergraduate and 20 graduate courses.

Figure 18

Optimal Solution for the College of Business Minimization Problem

The Excel set up is presented in Figure 19. The format is similar, the only difference being in the sign in the constraints.

Page 23: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 23/58

Figure 19

Setting up the College of Business Example Using Excel

Cells D7:E9 include the coefficients of X1 and X2 in the problem constraints, just like inthe previous example.

For example, in the first constraint, X1≥ 30, the coefficient of X1 is 1, and there is no X2 .

Column G includes the constraints. For example, under G7, we would have the firstconstraint, which is X1=30, which translates into D7*C12. Under G9 we would have thethird constraint, which is X1+ X2   =60, which becomes D9*C12+ E9*C13.

C14 includes the total cost, or the objective function, which is Z= 2500 X1+3000 X2,which is the same as D5*C12+E5*C13.

Page 24: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 24/58

Figure 20 presents the Solver dialog box; notice the Min box is checked in this problem.

Figure 20 Solver Parameters

Figure 21 displays the Solver options dialog box. Notice that Assume Linear Model ischecked. Assume Non-negative is also checked, as the Solver Parameter dialog box inFigure 20 does not include the non-negative constraint with the other constraints.

Figure 21

Solver Options

Page 25: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 25/58

 Solver found a solution, and it automatically modified the values for the decisionvariables, which were originally 0. The optimal solution requires 40 undergraduate and20 graduate courses (Figure 22).

Figure 22

Excel Answers for the College of Business Problem

Page 26: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 26/58

Figure 23 presents the Excel generated Answer Report for the minimization problem.

Figure 23 

Excel Generated Answer Report for the College of Business Problem

The sensitivity report generated by Excel is presented in Figure 24. For example, thesensitivity range for the “cost” of an undergraduate course is (0, 3000). Professorsteaching undergraduate courses could be paid any amount in this interval, and theoptimum combination of graduate/undergraduate courses would not change. The shadow price for a graduate course is 500; that means that if the requirement for graduate courseswould increase by 1, the impact on the decision variable (i.e the cost) would be 500.

Page 27: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 27/58

Figure 24

Excel Generated Sensitivity Report for College of Business Problem

Nonlinear Programming

Linear Programming is widely used and can be applied to a variety of practical situations, but many realistic business problems have relationships that can only be modeled bynonlinear functions. The solution of a nonlinear programming problem is significantlymore complex than the solution of a linear problem. While in a linear optimization modelthe solutions are always found on the border of the feasible area, that is not necessarilytrue in a nonlinear problem. In fact, the solution space could look like the peaks and thevalleys of a mountain, and the optimum solution could be at any peak or at any bottom ofa valley. The difficulty is determining whether the peak is the highest point for theimmediate area (local maximum) or the highest point of all (a global optimum).

Let’s find the optimal value for a single nonlinear function. This is an example ofunconstrained optimization.

Z=5000 + 200p-10p2

 This function is a second degree polynomial, and its graphical representation is shown inFigure 25.

Page 28: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 28/58

Figure 25

Graphical Representation of a Nonlinear Function

The maximum point will be found at the peak, or wherever the curve is at its highest. Notice the curve only has one peak, so identifying the maximum is not very challenging.

In calculus, the maximum point will be found where the curve “turns”, and the slope is 0.The slope can be found as the first derivative of the mathematical function that definesthe curve. Setting this slope equal to 0 and solving for p will give us the value of p at thehighest point.

The first derivative of our function is determined as follows (notice this is a partialderivative if the function includes multiple decision variables):

δZ/ δ p = 200-20p

By setting the first derivative equal to 0

200-20p=0

and solving for p, we obtain

 p=10

This is the optimal value of p, or the value of p for which Z is maximized.

By substituting p=10 into our original Z function, we find the maximum Z, which is6000.

 Now let’s transform out problem into a constrained optimization problem, by adding theconstraint

 p ≤ 5

Page 29: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 29/58

 Our nonlinear programming model becomes

Max Z=5000 + 200p-10p2

s.t.

 p ≤ 5

Let’s represent graphically our constraint (Figure 26). The feasible area is to the left ofthe constraint (p ≤ 5). In the initial problem, the unconstrained one, the optimum wasfound for p=10, but now that point is unattainable given the constraint, so the highest point that can be reached will be a p =5.

Figure 26

Constrained Optimization Model with a Solution on the Constraint Boundary

However, the difficulty with nonlinear programming is that the solution does not alwayslie on the boundary of the feasible area. Let’s assume that the constraint becomes p ≤ 15.

Our nonlinear programming model becomes

Max Z=5000 + 200p-10p2

s.t.

 p ≤ 15

Let’s represent graphically our constraint (Figure 27). The feasible area is to the left ofthe constraint (p ≤ 15). In the initial problem, the unconstrained one, the optimum was

Page 30: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 30/58

found for p=10, it became unattainable when the constraint was p ≤ 5, and now that theconstraint changed to p ≤ 15, the optimum p=10 is attainable again.

 Notice that solution is no longer on the boundary of the feasible solution space. Theoptimum is found for p=10, which leads to a higher value for Z than point A, which is on

the boundary. This greatly complicates the process of finding a solution to a nonlinear problem.

Figure 27

Constrained Optimization Model with a Solution not on the Constraint Boundary

Luckily, Excel can solve nonlinear programming problems using Solver.

Let’s assume the following problem:

Woodchuck’s Carpentry Inc. produces tables and chairs.The profit from selling tables and chairs is Z=100 X1-2 X1

2 + 200 X2- X2

2

Woodchuck faces one constraint, as he only has 1000 units of mahogany wood available,and he needs 2 units for each table, and 3 units for each chair.

Woodchuck’s maximization problem is:

Maximize Z=100 X1-2 X12 + 200 X2- X2

2

 subject to

2 X1+3 X2≤ 1000

Page 31: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 31/58

Figure 28 presents an Excel spreadsheet set up to solve the problem above. The numberof tables and chairs produced are contained in cells C4:C5, the profit per unit in cellsD4:D5, and the total profit in C10. The wood requirements are in D4:D5, and the formulafor the wood constraint in C10.

Figure 28Setting Up Woodchuck’s Nonlinear Programming Model

Figure 29 shows the Solver dialog box for this problem. It is important to click onOptions, to get to the menu that will allow you to make sure the Assume Linear Modeloption has not   been selected (Figure 30).The formula in cell C9 is

Total Wood=E4*C4+E5*C5, and in cell C10 we have the Total Profit= D4*C4+D5*C5.

Figure 29

Solver Parameters

Page 32: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 32/58

 

Figure 30

Solver Options for a Nonlinear Programming Model

Figure 31 shows the final solution for this problem. The optimum asks for 22.22 tablesand 88.88 chairs, which simply means that some tables and chairs are not finished duringthis period, and are “works in progress”. Of course, if we wanted to restrict the solutionto be formed of integers, Solver can accommodate that as well. We would simply include

an additional constraint, stating that the decision variables (cells C4:C5) have to beintegers. In order to do this, we would go to the dialog box in Figure 29, click on Add toadd a constraint, we would select our decision variables (in cells C4 and C5), and fromthe scroll down menu we would select int (for integer). The sensitivity analysis does notmake any sense for an integer model.

Page 33: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 33/58

Page 34: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 34/58

Figure 32

Excel Generated Answers Report for Woodchuck’s Nonlinear Programming Model 

Page 35: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 35/58

Figure 33

Excel Generated Sensitivity Report for Woodchuck’s Nonlinear Programming

Model

Page 36: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 36/58

Conceptual Problems

1. Lancy Armstrong owns Armstrong’s Bikeroo, a bike shop. He sells two types of bicycles - road racing and mountain bikes. A road racing bike costs $120 and a mountain

 bike costs $40; Lancy’s profit from road racing bikes is $100, and his profit frommountain bikes is $120. He has $1200 available this month to purchase bikes. Each bikemust be assembled; a road-racing bike requires 16 hours to assemble, while a mountain bike requires 8 hours. Lancy estimates that he and his crew will have 160 hours availableto assemble bikes. He has enough space in his store to order 20 bikes a month. Lancywants to know how many bikes of each type he needs to get in order to maximize profits.

a. Formulate a linear programming model for this problem. b. Solve the model using the computer.c. Does Lancy have any money left over? If so, how much?d. Interpret the sensitivity range for the profit from selling road racing bikes.

e. Assume Lancy could get his employees to work 10 additional hours assembling bikes.Would the optimum solution change?f. If he could get the 10 additional hours in part e) for $10/hour, should he get them? Whyor why not?

2. Assume the same info as in problem 1, but assume that Lancy also wants to sell cross-country bicycles as well. Each cross-country bike costs $60, the profit from each cross-country bike is $110, and it takes 10 hours to assemble. (Assume Lancy faces the samemoney, space and assembly hour constraints as in Problem 1.) Lancy wants to store atleast twice as many cross-country bikes as the other two combined, because cross-country bikes sell better.

a. Formulate a programming model to solve the profit maximization problem. b. Solve the problem using the computer.

Page 37: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 37/58

Solutions for the conceptual problems:

1.

X1= road racing bikes

X2= mountain bikes

Maximize Z= 100 X1+120 X2

 subject to

120 X1+140 X2≤ 1200

16 X1+ 8 X2≤ 160

X1+ X2≤  20X1 ≥ 0X2 ≥ 0

 b. 

Target Cell (Max)

Cell Name Original Value Final Value

$C$23 Profit = 0 2400

 Adjustable Cells

Cell Name Original Value Final Value

$C$21 Road = 0 0

$C$22 Mountain = 0 20

Constraints

Cell Name Cell Value Formula Status Slack

$G$16 Bike Cost Usage 800 $G$16<=$F$16 Not Binding 400$G$17 Assembly Time Usage 160 $G$17<=$F$17 Binding 0$G$18 Storage Space Usage 20 $G$18<=$F$18 Binding 0

 c. Yes, Lancey has $400 left after buying 0 road racing bikes and 20 mountain bikes.

Page 38: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 38/58

d. Profit for road racing bikes could increase by 20 without changing the optimalsolution.

Profit for road racing bikes could decrease to zero (by 1E+30) without changing theoptimal solution.

 Adjustable Cells

Final Reduced Objective Allowable Allowable

Cell Name Value Cost Coefficient Increase Decrease

$C$21 Road = 0 -20 100 20 1E+30$C$22 Mountain = 20 0 120 1E+30 20

Constraints

Final Shadow Constraint   Allowable Allowable

Cell Name Value Price R.H. Side Increase Decrease

$G$16 Bike Cost Usage 800 0 1200 1E+30 400$G$17 Assembly Time Usage 160 0 160 1E+30 0$G$18 Storage Space Usage 20 120 20 0 20

 

e. If the assembly time available increases to 170 hours, the optimum solution does notchange.

f. Lancey should not pay for 10 extra hours at $10/hr because the additional assemblytime would not increase Laney's profits (shadow price of 0).

2.X1= road racing bikesX

2= mountain bikes

X3= cross-country bikes

Maximize Z= 100 X1+120 X2+110 X2

 subject to

120 X1+140 X2+60 X3≤ 1200

16 X1+ 8 X2+10 X3≤ 160

X1+ X2+X3≤  20

X3 ≥ 2(X1+X2)X1 ≥ 0X2 ≥ 0

Page 39: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 39/58

Target Cell (Max)

Cell Name Original Value Final Value

$C$30 Profit = 1942.857143 1942.857143

 Adjustable CellsCell Name Original Value Final Value

$C$27 Road Racing = 0 0$C$28 Mountain = 5.714285714 5.714285714$C$29 Cross-Country = 11.42857143 11.42857143

Constraints

Cell Name Cell Value Formula Status Slack

$H$24 Storage constraint Usage 0 $H$24>=$G$24 Binding 0$H$21 Cost Usage 914.2857143 $H$21<=$G$21 Not Binding 285.7142857$H$22 Assembly Usage 160 $H$22<=$G$22 Binding 0

$H$23 Storage Usage 17.14285714 $H$23<=$G$23 Not Binding 2.857142857

 

Page 40: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 40/58

Problems and Applications

1. Marketing Applications – geared toward allocating a fixed or limited budget acrossvarious media (which might include radio, television, newspaper, magazine ads, etc.),

maximization of audience exposure, etc.

Los Angeles Big Tires Corporation is considering producing a new type of ATV. They plan to advertise their product using three media venues. The first plan is to buy a seriesof half-page ads in the Los Angeles Daily newspaper, the second option is to buyadvertising time on LA TV (1 minute spots), and the third is advertising on local radio(30 second spots during prime time). Each newspaper ad costs $800, each TV ad costs$900, and each radio spot costs $500. The company has $8000 budgeted weekly foradvertising purposes. Each newspaper ad reaches and average audience of 8,500 people,the TV spot 5,000, while the radio ad reaches an average of 2,500 people. The maximumnumber of newspaper ads per week is 2, and the maximum number of TV ads per week is

12. How many ads of each type should the company buy in order to maximize exposure?

Formulate a linear programming model and solve it using Excel.

Solution:

X1= newspaper adsX2= TV adsX3= radio ads

Maximize Z= 8500 X1+5000 X2+2500 X3

 subject to

800 X1+900 X2+500 X3≤ 8000

X1≤  2

X2≤ 12X1 ≥ 0X2 ≥ 0

Page 41: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 41/58

Page 42: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 42/58

2. Portfolio Selection  – deals with a problem faced by bank managers, mutual funds,investment services, or insurance companies, and that is the selection of specificinvestments from a variety of alternatives. The typical objective is to maximize theexpected return on investments, given a set of legal, policy, or risk constraints.

Good Trust invests in short-term credits, corporate bonds, gold stocks, and constructionloans. In order to encourage a diversified portfolio, the trust wants to limit the amountthat can be committed to a certain type of investment. Good Trust has $5 millionavailable for immediate investment, and intends to maximize the interest earned oninvestment, while abiding by the diversification requirements set by the board ofdirectors.

Investment Interest Earned (%) Maximum Investment

Trade credit 7 1,000,000

Corporate Bonds 8 2,000,000

Gold Stocks 15 1,500,000

Construction loan 10 1,700,000  

The board also specifies that at least 50% of the funds invested must be in corporate bonds and gold stocks.

Solution:

X1= dollars invested in trade creditsX2= dollars invested in corporate bondsX3= dollars invested in gold stocksX3= dollars invested in construction loans

Maximize Z= .07 X1+.08 X2+.15 X3+.1 X4

 subject to

X1≤  1,000,000

X2≤  2,000,000

X3≤  1,500,000

X4≤  1,700,000

X1+X2+X3+X4≤ 5,000,000(X2+ X3)≥.5( X1+X2+X3+X4)

X1,X2,X3.X4 ≥ 0

Page 43: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 43/58

Page 44: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 44/58

3. Transportation Problems  – the transportation or shipping problem involvesdetermining the amount of goods or items to be transported from a number or origins to anumber of destinations. The objective is usually to minimize shipping costs or distances,subject to capacity constraints, or requirements at the destination.

(Taylor, 1999) Coal is mined and processed at the following mines in Kentucky.

Mines Supply

Cabin Creek 90

Surry 50

Old Fort 80

McCoy 60  

The coal is delivered to utility plants in the following cities:

Utility Plants Demand

Richmond 120

Salem 100

Durham 110  

The transportation costs in between the cities are as follows:

Shipment Costs ($):

Plants

Mills Richmond Salem Durham

Cabin Creek 100 10 5Surry 12 9 4

Old Fort 7 3 11

McCoy 9 5 7  

The coal mining company wants to minimize shipping costs, while respecting thecapacity constraints, and the demand in the destination cities.

Page 45: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 45/58

Solution:

Let

A=Cabin Creek

B=SurryC=Old FortD=McCoy

1=Richmond2=Salem3=Durham

Then XA1=shipping cost between A (Cabin Creek) and 1 (Richmond), etc.

The problem becomes:

Minimize Z= 100 XA1+ 10 XA2+ 5 XA3++12 XB1+ 9 XB2+ 4 XB3++7 XC1+ 3 XC2+ 11 XC3++9XD1+ 5 XD2+ 7 XD3

 subject to

XA1+ XA2+XA3≥ 90XB1+ XB2+ XB3≥ 50

XC1+ XC2+ XC3≥ 80

XD1+ XD2+ XD≥ 60

XA1+ XB1+XC1+XD1≤  120

XA2+ XB2+XC2+XD2≤  100

XA3+ XB3+XC3+XD3≤  110

All X ij ≥ 0

Page 46: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 46/58

Utility Plants

Mines Richmond Salem Durham Supply Shipped

Cabin Creek 0 0 90 90 90

Surry 30 0 20 50 50

Old Fort 40 40 0 80 80

McCoy 0 60 0 60 60

  Demand 120 100 110

Shipped 70 100 110

  Cost =   1590  

4. Nonlinear Programming

Gina’s Winery produces three kinds of wine each year: Magnificent Red (X1), Amazing Blush(X2), and Delicious Blanc (X3). The vineyard has 240 hours of production capacity and it requires5 hours to produce a cask of Red, 2 hours to produce a cask of Blush, and 4 hours to produce acask of Blanc. The Winery has 500 tons of grapes available to produce wine this season. A caskof Red requires 3 tons of grapes, a cask of Blush requires 5 tons of grapes, and a cask of Blancrequires 2 tons of grapes. Gina estimates her profit function to have the following form:

Z=10000 X1-300 X12 + 20000 X2- 150X2

2+15000 X2- 100X2

2

 Gina wants to know how much of each wine she should produce in order to maximize her profit.

Solution: 

Maximize

Z=10000 X1-300 X12 + 20000 X2- 150X2

2+15000 X2- 100X2

2

Subject to

5X1+2X2+4X3≤ 240

3X1+5X2+2X3≤ 500

X1,X

2,X

3≥ 0

Page 47: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 47/58

Target Cell (Max)

Cell Name Original Value Final Value

$C$11 Profit Grapes 0 1028928.571

 Adjustable Cells

Cell Name Original Value Final Value

$G$6 Red Produced 0 0$G$7 Blush Produced 0 52.85714284$G$8 Blanc Produced 0 33.57142858

Constraints

Cell Name Cell Value Formula Status Slack

$C$10 Grapes 331.4285714 $C$10<=$C$9 Not Binding 168.5714286$D$10 Hours 240 $D$10<=$D$9 Binding 0  

 Adjustable Cells

Final Reduced

Cell Name Value Gradient

$G$6 Red Produced 0 -357.1396484$G$7 Blush Produced 52.85714284 0$G$8 Blanc Produced 33.57142858 0

Constraints

Final Lagrange

Cell Name Value Multiplier  

$C$10 Grapes 331.4285714 0$D$10 Hours 240 2071.427734

 

X1= 0 casks of RedX2= 52.85 casks of BlushX3= 33.57 casks of Blanc

The Lagrange multiplier for the Grape constraint is 0 – having additional grapes wouldnot increase profits (since the grape constraint is not binding), but having additional hoursof labor will increase profits by $2071.43 per hour.

Page 48: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 48/58

References

Dantzig, G. B. (1949). Programming of interdependent activities, II, Mathematicalmodel. Econometrica. 17 . 200 – 211.

Dantzig, G. B. and Thapa, M. N. (1997). Linear Programming 1: Introduction. NewYork. Springer.

Karmarkar, N. (1984). A new polynomial algorithm for linear programming.Combinatorica. 4. 373-395.

Khachiyan, L. G. (1979). A polynomial algorithm for linear programming. Soviet

 Mathematics Doklady. 20. 191-194.

Taylor, Bernard W., Introduction to Management Science, 6th

 edition, Prentice Hall 1999

Further Readings 

Ackoff R., Ackoff's Best: His Classic Writings on Management , Wiley, 1999.

Bender E., An Introduction to Mathematical Modeling, Dover Pubns, 2000.

Fdida S., and G. Pujolle,  Modeling Techniques and Performance Evaluation, ElsevierScience, 1987.

Gershenfeld N., The Nature of Mathematical Modeling, Cambridge Univ. Pr., 1998.

Diwekar U., Introduction to Applied Optimization, Kluwer Academic Publishers, 2003.

Luenberger D., Linear and Nonlinear Programming, Kluwer Academic Publishers, 2003.

Miller R., Optimization: Foundations and Applications, Wiley, 1999.

 Nesterov, Y. and Nemirovskii, A. (1994). Interior-Point Polynomial Algorithms in

Convex Programming. Philadelphia. Society for Industrial and Applied Mathematics.

Rodin R., Optimization in Operations Research, Prentice Hall, New Jersey, 2000.

Page 49: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 49/58

Appendix 1

Maple Code

g1:=inequal({10*x1+5*x2<=100,x1>=0,x2>=0},x1=0..25,x2=0..25

,labels=[x1,x2],optionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..25,-5..25]):t11:=textplot([13,15,`woodconstraint`],align={ABOVE,RIGHT},font=[fnt,sz]):t12:=textplot([13,10,`slope = -2`],align={ABOVE,RIGHT},font=[fnt,sz]):a11:=plottools[arrow]([13,15],[5,10],0,.7,.1,color=black):display(a11,g1,t11,t12);

g2:=inequal({3*x1+4*x2<=60,x1>=0,x2>=0},x1=0..25,x2=0..25,labels=[x1,x2],optionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-

4],labelfont=[fnt,sz],view=[-5..25,-5..25]):t21:=textplot([13,15,`laborconstraint`],align={ABOVE,RIGHT},font=[fnt,sz]):t22:=textplot([13,10,`slope = -3/4`],align={ABOVE,RIGHT},font=[fnt,sz]):a21:=plottools[arrow]([13,15],[5.5,11],0,.7,.1,color=black:display(a21,g2,t21,t22);

Page 50: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 50/58

 

g3:=inequal({10*x1+5*x2<=100,3*x1+4*x2<=60,x1>=0,x2>=0},x1=0..25,x2=0..25,labels=[x1,x2],optionsfeasible=(color=gray),

optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..25,-5..25]):t31:=textplot([5,20,`O`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p31:=plottools[pieslice]([4,20], .2, 0..2*Pi, color=black):t32:=textplot([13,2,`M`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p32:=plottools[pieslice]([12,2], .2, 0..2*Pi, color=black):t33:=textplot([2,10,`I`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p33:=plottools[pieslice]([1,10], .2, 0..2*Pi, color=black):

t34:=textplot([13,10,`feasiblearea`],align={ABOVE,RIGHT},font=[fnt,sz]):a34:=plottools[arrow]([13,11],[4,5],0,.7,.1,color=black):display(t31,p31,t32,p32,t33,p33,t34,a34,g3);

Page 51: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 51/58

> solve({10*x1+5*x2=100,3*x1+4*x2=60}); 

>g41:=inequal({10*x1+5*x2<=100,3*x1+4*x2<=60,x1>=0,x2>=0},x1=0..25,x2=0..25,labels=[x1,x2],optionsfeasible=(color=gray)

,optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..25,-5..25]):t41:=textplot([1,15,`A`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p41:=plottools[pieslice]([0,15], .2, 0..2*Pi, color=black):t42:=textplot([5,12,`B`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p42:=plottools[pieslice]([4,12], .2, 0..2*Pi, color=black):t43:=textplot([10,1,`C`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p43:=plottools[pieslice]([10,0], .2, 0..2*Pi, color=black):

t44:=textplot([13,15,`profitfunction`],align={ABOVE,RIGHT},font=[fnt,sz]):a44:=plottools[arrow]([13,16],[6,15],0,1,.2,color=black):z:=500:g42:=plot((z-200*x1)/50,x1=-5..25):z:=1000:g43:=plot((z-200*x1)/50,x1=-5..25):z:=2000:g44:=plot((z-200*x1)/50,x1=-5..25):display(p41,p42,p43,a44,t41,t42,t43,t44,g41,g42,g43,g44); >

>g51:=inequal({10*x1+5*x2<=100,3*x1+4*x2<=60,x1>=0,x2>=0},x1=0..25,x2=0..25,labels=[x1,x2],optionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..25,-5..25]):t51:=textplot([1,15,`A`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p51:=plottools[pieslice]([0,15], .2, 0..2*Pi, color=black):

Page 52: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 52/58

t52:=textplot([5,12,`B`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p52:=plottools[pieslice]([4,12], .2, 0..2*Pi, color=black):t53:=textplot([10,1,`C`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p53:=plottools[pieslice]([10,0], .2, 0..2*Pi, color=black):t54:=textplot([13,15,`profitfunction`],align={ABOVE,RIGHT},font=[fnt,sz]):a54:=plottools[arrow]([13,16],[6,15],0,1,.2,color=black):z:=500:g52:=plot((z-50*x1)/50,x1=-5..25):z:=800:g53:=plot((z-50*x1)/50,x1=-5..25):z:=1000:g54:=plot((z-50*x1)/50,x1=-5..25):display(p51,p52,p53,a54,t51,t52,t53,t54,g51,g52,g53,g54);

>g61:=inequal({10*x1+5*x2<=100,3*x1+4*x2<=60,x1>=0,x2>=0},x1=0..25,x2=0..25,labels=[x1,x2],optionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..25,-5..25]): t61:=textplot([1,15,`A`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p61:=plottools[pieslice]([0,15], .2, 0..2*Pi, color=black):t62:=textplot([5,12,`B`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p62:=plottools[pieslice]([4,12], .2, 0..2*Pi, color=black):t63:=textplot([10,1,`C`],align={MIDDLE,RIGHT},font=[fnt,sz]):

 p63:=plottools[pieslice]([10,0], .2, 0..2*Pi, color=black):t64:=textplot([13,15,`profitfunction`],align={ABOVE,RIGHT},font=[fnt,sz]):a64:=plottools[arrow]([13,16],[10,15],0,1,.2,color=black):z:=20:g62:=plot((z-2*x1)/20,x1=-5..25):z:=248:g63:=plot((z-2*x1)/20,x1=-5..25):z:=300:g64:=plot((z-2*x1)/20,x1=-5..25):display(p61,p62,p63,a64,t61,t62,t63,t64,g61,g62,g63,g64);

Page 53: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 53/58

 

Page 54: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 54/58

> restart;with(plots):fnt:='TIMES':sz:=20: War ni ng, t he name changecoor ds has been r edef i ned

>g[1]:=inequal({x1>=30},x1=0..100,x2=0..100,labels=[x1,x2],o

 ptionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..70,-5..70]):g[2]:=inequal({x2>=20},x1=0..100,x2=0..100,labels=[x1,x2],o

 ptionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..70,-5..70]):g[3]:=inequal({x1+x2>=60},x1=0..100,x2=0..100,labels=[x1,x2],optionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..70,-

5..70]):g[4]:=inequal({x1>=30,x2>=20,x1+x2>=60},x1=0..100,x2=0..100,labels=[x1,x2],optionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..70,-5..70]):display(g[1]);display(g[2]);display(g[3]);display(g[4]);

Page 55: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 55/58

 

Page 56: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 56/58

>g[5]:=textplot([30,31,`A`],align={MIDDLE,RIGHT},font=[fnt,sz]):g[6]:=plottools[pieslice]([30,30], .2, 0..2*Pi,color=black):g[7]:=textplot([39,19,`B`],align={MIDDLE,RIGHT},font=[fnt,sz]):g[8]:=plottools[pieslice]([40,20], .2, 0..2*Pi,color=black):g[9]:=inequal({x1>=30,x2>=20,x1+x2>=60},x1=0..100,x2=0..100,labels=[x1,x2],optionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[25..50,15..35]):z:=165000:g[10]:=plot((z-2500*x1)/3000,x1=25..50):z:=160000:g[11]:=plot((z-2500*x1)/3000,x1=25..50):s:=seq(g[i],i=5..11):display(s); 

Page 57: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 57/58

> restart;with(plots):fnt:='TIMES':sz:=20: War ni ng, t he name changecoor ds has been r edef i ned

> f:=p->5000+200*p-10*p^2;g[1]:=plot({f(p)},p=0..40,labels=[p,z],axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[-5..40,-1000..7000]):d:=diff(f(p),p);

 _max:=solve(d=0,p);g[2]:=implicitplot(p=_max,p=0..40,z=0..f(_max),linestyle=3, color=black, thickness=1):

 _fmax=f(_max);g[3]:=implicitplot(z=f(_max),p=0..10,z=0..f(_max),linestyle=3, color=black, thickness=1):s:=seq(g[i],i=1..3):display(s);

>

g[4]:=textplot([5,f(5)*.98,`A`],align={MIDDLE,RIGHT},font=[fnt,sz]):g[5]:=plottools[ellipse]([5,f(5)],.3,50,filled=true,color=black):g[6]:=inequal({p<=5},p=-10..40,z=0..7000,labels=[p,z],optionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[0..40,0..7000]):

Page 58: Linear 30085

8/12/2019 Linear 30085

http://slidepdf.com/reader/full/linear-30085 58/58

s:=seq(g[i],i=1..6):display(s);

>g[4]:=textplot([16,f(15)*1.05,`A`],align={MIDDLE,RIGHT},font=[fnt,sz]):g[5]:=plottools[ellipse]([15,f(15)],.3,50,filled=true,color=black):g[6]:=inequal({p<=15},p=-10..40,z=0..7000,labels=[p,z],optionsfeasible=(color=gray),optionsexcluded=(color=white),axesfont=[fnt,sz-4],labelfont=[fnt,sz],view=[0..40,0..7000]):s:=seq(g[i],i=1..6):display(s);