Linear 30085
Linear 30085
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 techniques and
their 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 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 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
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 the
maximum 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. Even
more, they do not just want to want to make money, but they want to make as much
money as possible, or, in other words, maximize their profits. One question that very
often needs to be answered is how much should the company produce in order to
maximize profits? How can the owner or the manger of the company identify this output
that will lead to the maximum profit given the complexity of the environment the firm
operates in? Not all problems are maximization problems. Sometimes the minimum is
the desirable outcome, like it would be the in the situation of costs. No manger will want
the total cost to be maximized. It needs to be minimized, as the lower the cost is, the
higher 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 the
one that achieves the lowest cost, or waste.
These optimization problems can be linear or nonlinear, depending on the mathematical
form of the various functions included in the model. They can be constrained or
unconstrained. They can be solved graphically (although they might be exponentially
more 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.
II. Problem Statement
Striving to find the optimum solution is a goal in many areas, not just business, or
Economics and Finance. Physics, Chemistry, Biology, Health Care or Engineering are
just some of the areas these problems arise in. This module will focus on solving
optimization problems as they relate to business, but the techniques used here can be
easily 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 - the
highest 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 the
question 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 mathematical
optimization model consists of an objective function and a set of constraints expressed in
the form of a system of equations or inequalities. The model will first be solved
graphically to preserve the intuition behind finding the solution and to help the reader
understand the how. Then, a solution will be found using Excel, specifically Solver,
and the what if question will be addressed.
III. Background Information
Lets 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 no
uncertainty, so the outcome is deterministic, or risk-free.
For example, if you are a farmer, selling apples for $1 a piece, assuming no other factors
than the selling price affect the amount you sell, the mathematical relationship linking
your 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 be
calculated as being $100. Of course, we are making the assumption that no other factor
other than the price affects the revenue. We will come back to the assumptions one makes
when mathematically representing reality soon.
Many applications in business and economics involve a process called optimization, in
which 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 having
one 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 the
quantity 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 much
somebody can reduce costs. As much as you would like to decrease the amount of money
you spend on employee compensation (i.e. salaries), you are constrained by the minimum
wage laws, which stipulate that you cannot pay your employees less than a certain hourly
wage. 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 of
the reality.
No mathematical model can be a perfectly comprehensive representation of reality,
including all of its characteristics, as it is usually impossible to mathematically represent
some aspects of a physical system. Even if it were possible to do so, the model will be
too complicated to be tractable. A model is usually a representation of the reality that
captures some characteristics of reality, the ones essential for the issue at hand, while
leaving 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 a
smiley face and ask anybody what that was, I would probably get the answer a face or
something 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 as
cheekbones, which the smiley face does not have. Even so, the smiley captures enough of
the characteristics of a human face (nose, eyes, mouth) that all of us can recognize it as
the 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 model
captures 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 for
the issue at hand. Blood pressure is a model of the health of an individual, but it might
not be the most relevant one if you have sprained ankle. Thus, the usefulness of the
model is dependent upon the aspect of reality it represents.
IV. Model
Without a doubt, the most crucial part of finding the optimal solution is to start with the
right model. If the model used is not a good representation of the characteristics of reality
essential to the issue at hand, even if the problem is ultimately solved correctly from a
mathematical point of view, the final solution is meaningless. Technically, you are
solving some problem correctly, just not the one you had to solve in the first place, and
implementing the solution you found would be a regrettable waste of resources.
Scared yet?
Lets see how mathematical optimization models are built.
A mathematical optimization model consists of an objective function and a set of
constraints expressed in the form of a system of equations or inequalities. The objective
function is a measure of effectiveness, often the cost or the profit. The model also
includes decision variables and parameters.
Optimization models include the following components (Taylor, 1999)
(1) Decision variables - mathematical symbols representing levels of activity of a firm.
(2) Objective function - a linear mathematical relationship describing an objective of the
firm, in terms of decision variables, that is maximized or minimized. Most optimization
problems have a single objective function but it could happen that a manager would
actually like to optimize multiple objectives. For example, a manger might want to
maximize his profit, but at the same time he would like to maximize the level of
satisfaction of his shareholders by offering them increased dividends, and keep the unions
happy by maximizing the workers satisfaction, which could be attained by offering them
higher salaries or increased benefits. It is obvious in this case that at least two of the
managers objectives might not be reached at the same time: maximizing the managers
profit would mean decreasing costs, which in turn would mean minimizing the labor
costs (i.e. employee compensation). The solution that optimizes the managers profit
might be quite different from the one that optimizes the unions satisfaction. Problems
like that are called multicriteria decision making problems, and finding a solution entails
prioritizing the goals, and writing them in the form of desirable constraints, but this is
beyond the scope of this module.
(3) Constraints - restrictions placed on the firm by the operating environment stated in
linear relationships of the decision variables.
(4) Parameters - numerical coefficients and constants used in the objective function and
constraint equations.
Linear Programming
Linear programming refers to the fact that both the objective function to be optimized and
all the constraints, are linear in terms of the decision variables (i.e. no square root, second
degree polynomials, etc.).
Linear Programming introduced by George B. Dantzig in 1947, and is a method of
optimizing an objective function by solving a system of linear equations where the
solution 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). Any
linear programming problem consists of an objective function and a set of constraints. A
solution set for the decision variables, where all of the constraints are satisfied, is called a
feasible solution. Most solution algorithms start by finding a feasible solution, then move
from 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: Woodchucks Carpentry Inc. sells tables and chairs. Woodchuck has two
resources 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, to
understand 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 profit
from every chair he sells. Each table requires 10 units of wood and 3 hours of labor, and
each chair requires 5 units of wood and 4 units of labor. Lets also assume that
Woodchuck has 100 units of wood and 60 units of labor available. For the sake of
simplicity, lets 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 each
month in order to maximize his profits.
Lets start by gathering all the information given in the problem.
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 selling
chairs will be the profit from each chairs times the number of chairs sold.
Lets denote the number of tables produced by X
1
and the number of chairs by X
2
.
Woodchucks total profit will be
Z= 200 X
1
+50 X
2
This is the objective function.
Given the wood and labor requirements given in the problem, and the amounts available
of the two resources, the wood constraint will be
10 X
1
+5 X
2
100
and the labor constraint will be
3 X
1
+ 4 X
2
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 less
than the amount of resource available, as long as the profit is maximized (the amount left
over is called slack).
Since it is impossible to produce negative quantities of tables and chairs, we need to
constrain both X
1
and X
2
to be non-negative.
Therefore, the linear programming model becomes:
Maximize Z= 200 X
1
+50 X
2
subject to
10 X
1
+5 X
2
100
3 X
1
+ 4 X
2
60
X
1
0
X
2
0
This is a mathematical model for the Woodchucks problem. The decision variables, i.e.,
controllable inputs are X
1
, and X
2
, and since we assume the carpenter is not going out of
business at the end of the planning horizon, we do not require X
1
, and X
2
to be integers.
If the optimum solution includes decimal points, or partial items, they would simply be
counted 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 values
for each of them and selecting the pair that maximizes the profit, but the feasible solution
set is usually quite large, and it the process would take longer than any manager could
afford.
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 is
complicated, 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 useful
as it provides a better understanding of the solution.
The first step is finding the feasible area, or all the possible combinations of tables and
chairs that satisfy the problem constraints. The feasible area is constructed by graphing
the two constraints. We start with a system of coordinates with X
1
on the horizontal axis,
and X
2
on the vertical axis. Since both X
1
and X
2
are constrained to be non-negative, we
are only interested in the positive quadrant.
The first constraint is the wood constraint, 10 X
1
+5 X
2
100. We start by graphing the
border of the area given by this constraint, which is the straight line 10 X
1
+5 X
2
= 100
A 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 X
2
=0, so X
1
=10.
The point where the line intersects the vertical axis has X
1
=0, so X
2
=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 or
feasible area is below or above the line is to take a point (i.e. a combination of tables and
chairs) and see whether the constraint is satisfied. For example, producing one table
(X
1
=1) and one chair (X
2
=1) will require 10*1+5*1=15 units of wood. (1,1) is under the
line, and it satisfies the constraint. On the other hand, producing ten tables (X
1
=10) and
ten chairs (X
2
=10) will require 10*10+5*10=150 units of wood. (10,10) is above the line,
and it does not satisfy the constraint.
Figure 1
The Wood Constraint
Similarly, the second constraint gives us the constraint area for labor, as pictured in
Figure 2.
Figure 2
The Labor Constraint
We want the labor and the wood constraints to be satisfied simultaneously, so they need
to be represented in the same graph. Figure 3 shows the feasible area for the model.
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 X
1
+5 X
2
100
3 X
1
+ 4 X
2
60
X
1
0
X
2
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 the
wood 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 will
result 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, lets try to remember what we were
trying to do in the first place, which is to maximize profit. In order to do this, we need to
represent graphically the profit function as well. The profit function is Z= 200 X
1
+50 X
2
,
and it obviously includes a third variable, Z. Lets just take an arbitrarily selected level of
profit, Z=100.
The profit function becomes 100=200 X
1
+50 X
2
, and every combination of tables and
chairs 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 than
100=200 X
1
+50 X
2
, which means there are combinations of tables and chairs that can
lead to even higher profits. How much higher?
The highest profit level the firm can be reached is represented by the profit line going
through point C. A higher profit level cannot be reached, as a line with a bigger intercept
would not pass through the feasible area anymore, and any profit level lower than that is
not the best the firm can do. It follows that the optimum combination of tables and chairs
is 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 X
1
+50 X
2
What if the profit function becomes 100=50 X
1
+50 X
2
?
Figure 5
Optimal solution for Z=50 X
1
+50 X
2
Chairs become more profitable, and intuitively, one would think that producing all tables
is not the way to go anymore. If we represent graphically the new profit line, then draw
lines 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 being
feasible. Point B can be found at the tangency point between the profit line and the vertex
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 X
1
+5 X
2
= 100
3 X
1
+ 4 X
2
= 60
To solve this system of equations we multiply the first equation by -3, and the second
equation by 10.
-30 X
1
-15X
2
= -300
30 X
1
+40 X
2
= 600
If we add the two equations we obtain 25 X
2
= 300 or X
2
= 12. Now we can substitute 12
for X
2
in either of the original equations, and solve for X
1
.
Lets use the first equation.
10 X
1
+(5) (12)= 100
10 X
1
+60= 100
10 X
1
= 40
X
1
= 4
The solutions is X
1
= 4, X
2
= 12, for a profit Z=800
What if the profit function becomes 100=2X
1
+20 X
2
?
Following a similar thinking process, the new optimum is now point A, with 15 chairs
being produced.
Figure 6
Optimal solution for Z=200X
1
+20 X
2
It can be proven that the optimum solution will be on the boundary of the feasible area, at
the 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 the
following steps:
1. Plot the model constraints as equations on the graph
2. Find the feasible area
3. 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, if
one of the parameters in the problem changes (i.e. the profitability of each table, or the
amount of labor required for each chair), which is often the case in real life, one would
have 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 of
maximization problems) Z or the lowest (in the case of minimization) Z is the optimum
solution.
Of course, neither one of these two methods will be very tractable in a situation with a
large number of variables and/or constraints.
Fortunately, Excel (and many others) can be used to solve optimization problems. Excel
uses 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 to
everybody 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 capabilities
make Solver suitable for the solutions of complex, real world problems.
The first step is entering the variable names and the parameters for the objective function
and constraints (see Figure 7)
Figure 7 Setting up the Woodchucks Carpentry Inc. Example Using Excel
The values of the variables which will be the optimum solution will be located in cells
B10: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 (cells
G6: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. In
Excel, you need to select Tools-Add-ins and check the box next to Solver Add-in. Solver
should now be displayed in the Tools drop-down menu.
Once Solver is selected, the window in Figure 8 will open.
Move the cursor to the Set Target Cell box, and fill in the cell that calculates the value of
the objective function. In our case, cell B12 calculates the value of the profit for
Woodchuck.
Figure 8
Solver Parameters
You need to select Max if you are solving a maximization problem, and Min if it is a
minimization problem.
Move the cursor to the By Changing Cells box, and select the cells that contain the values
for the variables, in our case B10:B11.
The constraint will be introduced in the window below Subject to the Constraints. You
need 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 the
list. You can include the non-negativity constraint here (B10:B11greater than or equal to
0) or you can address it later.
By clicking on Options, the window in Figure 9 opens. You need to select Assume Linear
Model. (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.).
Figure 9
Solver Options
Review the information in the Solver window to make sure everything is correct, then
click 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 optimal
solution. If you want additional information (Answer, Sensitivity, Limits) generated, you
may 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 in
cells G6:G7. The maximum value of the objective function is listed in B12.
Figure 11
Answers for Woodchucks Carpentry Inc. Problem
Figure 12 displays the Excel generated Answer Report. It lists the original and the
optimal values of the profit, number of tables and chairs, the slack (if any) and whether
the constraints are binding or not.
Figure 12
Excel Generated Answer Report for Woodchucks Carpentry Inc. Problem
Figure 13 displays the sensitivity report generated by Excel. This report is very useful, as
it helps answer questions like how would the optimal solution change if the company
had 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 that
need to be added to or subtracted from the objective function coefficients or the
constraint parameters to find the upper and lower bounds of the interval for which the
solution stays at the same corner point.
For example, Woodchuck has 100 units of wood available. This amount of wood can
increase by 100 (to 200) or decrease by 100 (to 0) and the optimum solution will stay at
the same corner point.
Also, the optimal solution asks that Woodchuck makes 10 tables and 0 chairs
(information found under Final Value). Making an additional chair will decrease profit by
50 (under Reduced Cost). The profit from each table is 200. It can increase by an infinite
amount (1E+30) or decrease by 100, and the optimum will stay at the same corner point.
Figure 13
Excel Generated Sensitivity Report for Woodchucks Carpentry Inc. Problem
Woodchuck uses 100 units of wood and 20 hours of labor. If he used one more unit of
wood the profit would increase by 20 (under Shadow Price). This is true for 100 more
units of wood. One additional hour of labor will have no impact on the profit (Shadow
Price of 0), because Woodchuck is not using all the labor he has available anyway (he has
60 units available, and uses only 30.)
Lets look at a minimization problem now.
The Dean of the College of Business must plan the schools course offerings for the Fall
semester. Student demands dictate that at least 30 undergraduate and 20 graduate courses
must be offered during the Fall. Faculty contracts also dictate that at least 60 courses total
must be offered. Faculty are being paid $2,500 for each undergraduate course, and $3,000
for each graduate course. The Dean wants to know how many undergraduate and
graduate courses must be offered so that faculty salaries are kept to a minimum?
If we denote the number of undergraduate courses by X
1
and the number of graduate
courses offered by X
2
, the mathematical model for this problem is:
Minimize Z= 2500 X
1
+3000 X
2
subject to
X
1
30
X
2
20
X
1
+ X
2
60
X
1
0
X
2
0
Lets solve the problem graphically.
We begin by representing graphically the undergraduate course constraint (Figure 14).
Figure 14
The Undergraduate Course Constraint
The values of X
1
that satisfy the constraint are to the right of the X
1
=30 straight line
(since X
1
30).
Next, we represent graphically the graduate course constraint (Figure 15).
Figure 15
The Graduate Course Constraint
The student demand constraint is displayed in Figure 16. The feasible combinations of
undergraduate and graduate courses are found to the right of the X
1
+ X
2
= 60 line
(because the constraint is X
1
+ X
2
60).
Figure 16
The Student Demand Constraint
The feasible area for the course offering constraint is in Figure 17.
Figure 17
The Feasible Area for the College of Business Problem
Next, we represent graphically the cost function, Z= 2500 X
1
+3000 X
2
. In this case, we
need to find the combination of courses (graduate and undergraduate) that is feasible, and
minimizes the objective function. In other words, we will represent graphically the cost
function, then draw a series of parallel cost lines. The lowest cost line (the closest to the
origin) 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.
Figure 19
Setting up the College of Business Example Using Excel
Cells D7:E9 include the coefficients of X
1
and X
2
in the problem constraints, just like in
the previous example.
For example, in the first constraint, X
1
30, the coefficient of X
1
is 1, and there is no X
2
.
Column G includes the constraints. For example, under G7, we would have the first
constraint, which is X
1
=30, which translates into D7*C12. Under G9 we would have the
third constraint, which is X
1
+ X
2
=60, which becomes D9*C12+ E9*C13.
C14 includes the total cost, or the objective function, which is Z= 2500 X
1
+3000 X
2
,
which is the same as D5*C12+E5*C13.
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 is
checked. Assume Non-negative is also checked, as the Solver Parameter dialog box in
Figure 20 does not include the non-negative constraint with the other constraints.
Figure 21
Solver Options
Solver found a solution, and it automatically modified the values for the decision
variables, which were originally 0. The optimal solution requires 40 undergraduate and
20 graduate courses (Figure 22).
Figure 22
Excel Answers for the College of Business Problem
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, the
sensitivity range for the cost of an undergraduate course is (0, 3000). Professors
teaching undergraduate courses could be paid any amount in this interval, and the
optimum 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 courses
would increase by 1, the impact on the decision variable (i.e the cost) would be 500.
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 by
nonlinear functions. The solution of a nonlinear programming problem is significantly
more complex than the solution of a linear problem. While in a linear optimization model
the solutions are always found on the border of the feasible area, that is not necessarily
true in a nonlinear problem. In fact, the solution space could look like the peaks and the
valleys of a mountain, and the optimum solution could be at any peak or at any bottom of
a valley. The difficulty is determining whether the peak is the highest point for the
immediate area (local maximum) or the highest point of all (a global optimum).
Lets find the optimal value for a single nonlinear function. This is an example of
unconstrained optimization.
Z=5000 + 200p-10p
2
This function is a second degree polynomial, and its graphical representation is shown in
Figure 25.
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 defines
the curve. Setting this slope equal to 0 and solving for p will give us the value of p at the
highest point.
The first derivative of our function is determined as follows (notice this is a partial
derivative 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 is
6000.
Now lets transform out problem into a constrained optimization problem, by adding the
constraint
p 5
Our nonlinear programming model becomes
Max Z=5000 + 200p-10p
2
s.t.
p 5
Lets represent graphically our constraint (Figure 26). The feasible area is to the left of
the constraint (p 5). In the initial problem, the unconstrained one, the optimum was
found 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 always
lie on the boundary of the feasible area. Lets assume that the constraint becomes p 15.
Our nonlinear programming model becomes
Max Z=5000 + 200p-10p
2
s.t.
p 15
Lets represent graphically our constraint (Figure 27). The feasible area is to the left of
the constraint (p 15). In the initial problem, the unconstrained one, the optimum was
found for p=10, it became unattainable when the constraint was p 5, and now that the
constraint 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. The
optimum 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.
Lets assume the following problem:
Woodchucks Carpentry Inc. produces tables and chairs.
The profit from selling tables and chairs is Z=100 X
1
-2 X
1
2
+
200 X
2
- X
2
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.
Woodchucks maximization problem is:
Maximize Z=100 X
1
-2 X
1
2
+
200 X
2
- X
2
2
subject to
2 X
1
+3 X
2
1000
Figure 28 presents an Excel spreadsheet set up to solve the problem above. The number
of tables and chairs produced are contained in cells C4:C5, the profit per unit in cells
D4:D5, and the total profit in C10. The wood requirements are in D4:D5, and the formula
for the wood constraint in C10.
Figure 28
Setting Up Woodchucks Nonlinear Programming Model
Figure 29 shows the Solver dialog box for this problem. It is important to click on
Options, to get to the menu that will allow you to make sure the Assume Linear Model
option 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
Figure 30
Solver Options for a Nonlinear Programming Model
Figure 31 shows the final solution for this problem. The optimum asks for 22.22 tables
and 88.88 chairs, which simply means that some tables and chairs are not finished during
this period, and are works in progress. Of course, if we wanted to restrict the solution
to 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 be
integers. In order to do this, we would go to the dialog box in Figure 29, click on Add to
add a constraint, we would select our decision variables (in cells C4 and C5), and from
the scroll down menu we would select int (for integer). The sensitivity analysis does not
make any sense for an integer model.
Figure 31
Excel Answers for Woodchucks Nonlinear Programming Model
The Answer and the Sensitivity Report generated for the Nonlinear Programming Model
are shown in Figures 32 and 33. Note that in addition to the problem solution, the value
of the Lagrange multiplier is also provided for the wood constraint. The Lagrange
multiplier value of 2.22 is analogous to the shadow price in a linear programming
problem. The Lagrange multiplier shows the change in the objective function caused by a
one unit change in the wood constraint. In other words, if one more unit of wood became
available, the profit (Z) will increase by 2.22.
Figure 32
Excel Generated Answers Report for Woodchucks Nonlinear Programming Model
Figure 33
Excel Generated Sensitivity Report for Woodchucks Nonlinear Programming
Model
Conceptual Problems
1. Lancy Armstrong owns Armstrongs 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; Lancys profit from road racing bikes is $100, and his profit from
mountain bikes is $120. He has $1200 available this month to purchase bikes. Each bike
must 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 available
to assemble bikes. He has enough space in his store to order 20 bikes a month. Lancy
wants 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? Why
or 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 same
money, space and assembly hour constraints as in Problem 1.) Lancy wants to store at
least 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.
Solutions for the conceptual problems:
1.
X
1
= road racing bikes
X
2
= mountain bikes
Maximize Z= 100 X
1
+120 X
2
subject to
120 X
1
+140 X
2
1200
16 X
1
+ 8 X
2
160
X
1
+ X
2
20
X
1
0
X
2
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.
d. Profit for road racing bikes could increase by 20 without changing the optimal
solution.
Profit for road racing bikes could decrease to zero (by 1E+30) without changing the
optimal 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 not
change.
f. Lancey should not pay for 10 extra hours at $10/hr because the additional assembly
time would not increase Laney's profits (shadow price of 0).
2.
X
1
= road racing bikes
X
2
= mountain bikes
X
3
= cross-country bikes
Maximize Z= 100 X
1
+120 X
2
+110 X
2
subject to
120 X
1
+140 X
2
+60 X
3
1200
16 X
1
+ 8 X
2
+10 X
3
160
X
1
+ X
2
+X
3
20
X
3
2(X
1
+X
2
)
X
1
0
X
2
0
Target Cell (Max)
Cell Name Original Value Final Value
$C$30 Profit = 1942.857143 1942.857143
Adjustable Cells
Cell 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
Problems and Applications
1. Marketing Applications geared toward allocating a fixed or limited budget across
various 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 series
of half-page ads in the Los Angeles Daily newspaper, the second option is to buy
advertising 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 for
advertising 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 maximum
number 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:
X
1
= newspaper ads
X
2
= TV ads
X
3
= radio ads
Maximize Z= 8500 X
1
+5000 X
2
+2500 X
3
subject to
800 X
1
+900 X
2
+500 X
3
8000
X
1
2
X
2
12
X
1
0
X
2
0
Target Cell (Max)
Cell Name Original Value Final Value
$C$14 Exposure 0 57000
Adjustable Cells
Cell Name Original Value Final Value
$C$11 Newspaper 0 2
$C$12 TV 0 8
$C$13 Radio 0 0
Constraints
Cell Name Cell Value Formula Status Slack
$F$6 cost 8000 $F$6<=$G$6 Binding 0
$F$7 Newspaper constraint 2 $F$7<=$G$7 Binding 0
$F$8 TV constraint 8 $F$8<=$G$8 Not Binding 4
X
1
= 2 newspaper ads
X
2
= 8 TV ads
X
3
= 0 radio ads
Total audience exposure: Z= 57,000
2. Portfolio Selection deals with a problem faced by bank managers, mutual funds,
investment services, or insurance companies, and that is the selection of specific
investments from a variety of alternatives. The typical objective is to maximize the
expected return on investments, given a set of legal, policy, or risk constraints.
Good Trust invests in short-term credits, corporate bonds, gold stocks, and construction
loans. In order to encourage a diversified portfolio, the trust wants to limit the amount
that can be committed to a certain type of investment. Good Trust has $5 million
available for immediate investment, and intends to maximize the interest earned on
investment, while abiding by the diversification requirements set by the board of
directors.
Investment Interest Earned (%) Maximum Investment
Trade credit 7 1,000,000
Corporate Bonds 8 2,000,000
Gold Stocks 15 1,500,000
Construction loans 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:
X
1
= dollars invested in trade credits
X
2
= dollars invested in corporate bonds
X
3
= dollars invested in gold stocks
X
3
= dollars invested in construction loans
Maximize Z= .07 X
1
+.08 X
2
+.15 X
3
+.1 X
4
subject to
X
1
1,000,000
X
2
2,000,000
X
3
1,500,000
X
4
1,700,000
X
1
+X
2
+X
3
+X
4
5,000,000
(X
2
+ X
3
).5( X
1
+X
2
+X
3
+X
4
)
X
1
,X
2
,X
3.
X
4
0
Target Cell (Max)
Cell Name Original Value Final Value
$C$12 Investment 0 539000
Adjustable Cells
Cell Name Original Value Final Value
$C$6 Trade credit 0 0
$C$7 Corporate Bonds 0 1800000
$C$8 Gold Stocks 0 1500000
$C$9 Construction loans 0 1700000
Constraints
Cell Name Cell Value Formula Status Slack
$C$10 Total investment 5000000 $C$10<=$E$10 Binding 0
$F$10 Investment Type 800000 $F$10>=$G$10 Not Binding 800000
$C$6 Trade credit 0 $C$6<=$E$6 Not Binding 1000000
$C$7 Corporate Bonds 1800000 $C$7<=$E$7 Not Binding 200000
$C$8 Gold Stocks 1500000 $C$8<=$E$8 Binding 0
$C$9 Construction loans 1700000 $C$9<=$E$9 Binding 0
X
1
= 0 dollars invested in trade credits
X
2
= 1,800,000 dollars invested in corporate bonds
X
3
= 1,500,000 dollars invested in gold stocks
X
3
= 1,700,000 dollars invested in construction loans
3. Transportation Problems the transportation or shipping problem involves
determining the amount of goods or items to be transported from a number or origins to a
number 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 5
Surry 12 9 4
Old Fort 7 3 11
McCoy 9 5 7
The coal mining company wants to minimize shipping costs, while respecting the
capacity constraints, and the demand in the destination cities.
Solution:
Let
A=Cabin Creek
B=Surry
C=Old Fort
D=McCoy
1=Richmond
2=Salem
3=Durham
Then X
A1
=shipping cost between A (Cabin Creek) and 1 (Richmond), etc.
The problem becomes:
Minimize Z= 100 X
A1
+ 10 X
A2
+ 5 X
A3
+
+12 X
B1
+ 9 X
B2
+ 4 X
B3
+
+7 X
C1
+ 3 X
C2
+ 11 X
C3
+
+9X
D1
+ 5 X
D2
+ 7 X
D3
subject to
X
A1
+ X
A2
+X
A3
90
X
B1
+ X
B2
+ X
B3
50
X
C1
+ X
C2
+ X
C3
80
X
D1
+ X
D2
+ X
D
60
X
A1
+ X
B1
+X
C1
+X
D1
120
X
A2
+ X
B2
+X
C2
+X
D2
100
X
A3
+ X
B3
+X
C3
+X
D3
110
All X
ij
0
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
Ginas Winery produces three kinds of wine each year: Magnificent Red (X
1
), Amazing Blush
(X
2
), and Delicious Blanc (X
3
). The vineyard has 240 hours of production capacity and it requires
5 hours to produce a cask of Red, 2 hours to produce a cask of Blush, and 4 hours to produce a
cask of Blanc. The Winery has 500 tons of grapes available to produce wine this season. A cask
of Red requires 3 tons of grapes, a cask of Blush requires 5 tons of grapes, and a cask of Blanc
requires 2 tons of grapes. Gina estimates her profit function to have the following form:
Z=10000 X
1
-300 X
1
2
+
20000 X
2
- 150X
2
2
+15000 X
2
- 100X
2
2
Gina wants to know how much of each wine she should produce in order to maximize her
profit.
Solution:
Maximize
Z=10000 X
1
-300 X
1
2
+
20000 X
2
- 150X
2
2
+15000 X
2
- 100X
2
2
Subject to
5X
1
+2X
2
+4X
3
240
3X
1
+5X
2
+2X
3
500
X
1
,X
2
,X
3
0
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
X
1
= 0 casks of Red
X
2
= 52.85 casks of Blush
X
3
= 33.57 casks of Blanc
The Lagrange multiplier for the Grape constraint is 0 having additional grapes would
not increase profits (since the grape constraint is not binding), but having additional hours
of labor will increase profits by $2071.43 per hour.
References
Dantzig, G. B. (1949). Programming of interdependent activities, II, Mathematical
model. Econometrica. 17. 200 211.
Dantzig, G. B. and Thapa, M. N. (1997). Linear Programming 1: Introduction. New
York. 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, 6
th
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, Elsevier
Science, 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.
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),optionsexclude
d=(color=white),axesfont=[fnt,sz-
4],labelfont=[fnt,sz],view=[-5..25,-5..25]):
t11:=textplot([13,15,`wood
constraint`],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,l
abels=[x1,x2],optionsfeasible=(color=gray),optionsexcluded=
(color=white),axesfont=[fnt,sz-
4],labelfont=[fnt,sz],view=[-5..25,-5..25]):
t21:=textplot([13,15,`labor
constraint`],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);
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,`feasible
area`],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);
> 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,`profit
function`],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):
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,`profit
function`],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,`profit
function`],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);
> 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),a
xesfont=[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),a
xesfont=[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),optionsexclude
d=(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]);
>
g[5]:=textplot([30,31,`A`],align={MIDDLE,RIGHT},font=[fnt,s
z]):
g[6]:=plottools[pieslice]([30,30], .2, 0..2*Pi,
color=black):
g[7]:=textplot([39,19,`B`],align={MIDDLE,RIGHT},font=[fnt,s
z]):
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),optionsexclude
d=(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);
> 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=b
lack):
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]):
s:=seq(g[i],i=1..6):
display(s);
>
g[4]:=textplot([16,f(15)*1.05,`A`],align={MIDDLE,RIGHT},fon
t=[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);