Path: blob/main/Homework/Lesson 02 HW - LP2/Homework_02.ipynb
871 views
Lesson 02 Homework
When asking questions about homework in Piazza please use a tag in the subject line like HW2.4 to refer to Homework 2, Question 4. So the subject line might be HW2.4 question Notice there are no spaces in the tag HW2.4.
For full credit, all code in this notebook must be both executed in this notebook and copied to the Canvas quiz where indicated.
Hints for 1-2
These follow directly from the reading / lesson.Question 1 (2 points, auto)
A “sensitive parameter” is a parameter
that can be set outside its allowable range.
that satisfies the certainty assumption.
whose value must be estimated.
is a constraint boundary that can be changed without affecting the optimal solution.
whose values cannot be changed without changing the optimal solution.
Question 2 (2 points, auto)
The shadow price for a resource is
the amount the objective function Z changes for each one unit increase in the amount of the resource available when it goes beyond its allowable range.
the amount the objective function Z changes for each one unit increase in the amount of the resource available, provided that is stays within its allowable range.
the range of values for the right-hand side over which the current optimal solution remains feasible.
a constraint that must be satisfied.
a constraint boundary that can be characterized by a random variable.
Hints for 3-10
If you're not sure what to do here, review the section in the lesson titled "Common Types of Sensitivity Analysis for Linear Programs.In particular, Videos 1-4 show how to use Desmos to the kinds of sensitivity analysis in this problem.
If you want to verify your answers you could set up the model in Pyomo and generate a sensitivity report but this is not required.
Questions 3-10 (use this setup for 3-10)
Giapetto's Woodcarving, Inc., manufactures two types of wooden toys: soldiers and trains.
A soldier sells for $27 and uses $10 worth of raw materials. Each soldier that is manufactured increases Giapetto’s variable labor and overhead costs by $14 (so think about what the unit profit would be). A train sells for $21 and uses $9 worth of raw materials. Each train built increases Giapetto’s variable labor and overhead costs by $10. The manufacture of wooden soldiers and trains requires two types of skilled labor: carpentry and finishing. A soldier requires 2 hours of finishing labor and 1 hour of carpentry labor. A train requires 1 hour of finishing labor and 1 hour of carpentry labor. Each week, Giapetto can obtain all the needed raw material but only 80 carpentry hours and 100 finishing hours. Demand for trains () is unlimited, but at most 40 soldiers () are bought each week. Giapetto wants to maximize weekly profit (revenues-costs). (This example is from the textbook "Operations Research" by Wayne L. Winston.)
The model formulation that can be used to maximize Giapetto’s weekly profit is:
Maximize
subject to
and
Use this Desmos page or create your own Desmos graph to answer the questions below. Note, if it's tricky to adjust a slider in Desmos you can click on number and edit it directly.
Question 3 (1 point, auto)
What is the shadow price for the weekly carpentry hours?
Question 4 (1 point, manual)
Write a sentence describing the shadow price for the weekly carpentry hours in the context of the problem. (e.g. for Wyndor: For each additional hour of production time at plant 3 the maximum total profit increases by 1 thousand dollars if the weekly carpenter hours is in its allowable range.)
Question 5 (1 point, auto)
What is the lower bound for the allowable range of weekly carpenter hours?
Question 6 (1 point, auto)
What is the upper bound for the allowable range of weekly carpenter hours?
Question 7 (2 points, auto)
If the demand for soldiers is reduced enough, then the demand becomes a sensitive parameter. If everything else stays the same as in the original problem, at what demand level does demand become a sensitive parameter?
Question 8 (2 points, auto)
If everything else stayed the same but the price of selling a soldier increased to $28.50, then what is the new maximum profit (in dollars)?
Question 9 (1 point, auto)
If everything else stayed the same but the price of selling a soldier increased to $28.50, then how many soldiers should be produced to achieve the maximum profit?
Question 10 (1 point, auto)
If everything else stayed the same but the price of selling a soldier increased to $28.50, then what is the new shadow price for weekly carpenter hours?
Hints for 11-18
If you're having trouble getting started compare this to the abstraction of the Wyndor model.Start with the resource table below and use it to develop the equations in the mathematical model.
The Pyomo code should be quite similar to the abstract Pyomo code we used for Wyndor in the lesson.
Questions 11-18
Fred Jonasson manages a family-owned farm. To supplement several food products grown on the farm, Fred also raises pigs for market. He now wishes to determine the quantities of the available types of feed (corn, tankage, and alfalfa) that should be given to each pig. Since pigs will eat any mix of these feed types, the objective is to determine which mix will meet certain nutritional requirements at a minimum cost. The number of units of each type of basic nutritional ingredient contained within a kilogram of each feed type is given in the following table, along with the daily nutritional requirements and feed costs:
Nutrional Ingredient |
Kilogram of Corn |
Kilogram of Tankage |
Kilogram of Alfalfa |
Minimum Daily Requirement |
---|---|---|---|---|
Carbohydrates | 90 | 20 | 40 | 200 |
Protein | 30 | 80 | 60 | 180 |
Vitamins | 10 | 20 | 60 | 150 |
Cost | $2.10 | $1.80 | $1.50 |
The main code for solving the linear program should be included in Question 13.
Question 11 (1 point, auto)
What is the minimum cost, in dollars and cents, of feed for each pig? Enter your answer to the nearest penny. Do not include a dollar sign.
Question 12 (1 point, auto)
To achieve the minimum cost, how many kg of alfalfa should be given to each pig? Round your answer to 2 decimal places.
Question 13 (10 points, manual)
Use Pyomo to solve this problem. Your solution should include all necessary code and inputs, and it should produce formatted output. For credit, you must use the abstract approach as we did in the lesson. Your code should be included in this answer as well as in your CoCalc notebook.
Question 14 (2 points, manual)
Produce and sensitivity report using Pyomo and GLPK. Paste the text of the report into the next cell. The output should also be included in your CoCalc notebook.
Question 15 (1 point, auto)
How many of the nutrient requirement constraints are binding?
0
1
2
3
Question 16 (1 point, auto)
For each additional unit of protein required the minimum cost increases by how many dollars? Round your answer to 4 decimal places (e.g. .1234 )
Question 17 (1 point, auto)
What is the lower bound of the allowable range for the units of carbohydrates required? (This is the range over which the shadow price is valid if no other parameters are changed).
Question 18 (1 point, auto)
If only the price per kg of Corn is allowed to change, then what is the largest that the price can be, in dollars per kg, without changing the values of optimal decision variables? Enter your answer to 3 decimal places (e.g. 9.123).
Hints for 19-22
The table shown below is essentially the same as a resource table like those introduced in Lesson 1 and on page 28 of the textbook.Just consider the check marks to be ones and the blanks to be zeros.
The mathematical model for this problem is on page 59 of the textbook.
The main challenge in this problem is getting the model into abstract form.
If you're having trouble, revisit the abstraction of the Wyndor problem because the structure here is very similar.
Questions 19 - 22
UNION AIRWAYS is adding more flights to and from its hub airport, and so it needs to hire additional customer service agents. However, it is not clear just how many more should be hired. Management recognizes the need for cost control while also consistently providing a satisfactory level of service to customers. Therefore, an OR team is studying how to schedule the agents to provide satisfactory service with the smallest personnel cost.
Based on the new schedule of flights, an analysis has been made of the minimum number of customer service agents that need to be on duty at different times of the day to provide a satisfactory level of service. The rightmost column of the table below shows the number of agents needed for the time periods given in the first column. The other entries in this table reflect one of the provisions in the company’s current contract with the union that represents the customer service agents. The provision is that each agent work one of the five different available 8-hour shifts 5 days per week. Each agent keeps the same shift for the week (no switching shifts between days).
Checkmarks in the main body of the table show the hours covered by the respective shifts. Because some shifts are less desirable than others, the wages specified in the contract differ by shift. For each shift, the daily compensation (including benefits) for each agent is shown in the bottom row. The problem is to determine how many agents should be assigned to the respective shifts each day to minimize the total personnel cost for agents, based on this bottom row, while meeting (or surpassing) the service requirements given in the rightmost column.
Question 19 (12 points, manual)
Solve this problem using an abstract approach in Pyomo. You can find a concrete formulation of the model for this problem on page 59 of our textbook. The optimal solution is also included in the textbook so you should be able to determine if your code is working correctly. Paste your code, including imports and formatted output in the box below. The same code should be in your CoCalc notebook and should be executed so that the output is showing.
Here is the problem data, stored in lists, if you want to copy it into your code to avoid typos:
Essay Answer:
Put solution in next cell and include all imports:
Question 20 (2 point, manual)
Use GLPK and Pyomo to generate a sensitivity report and paste the report in the box below. You will use the sensitivity report to answer further questions below.
Note: There should be only 5 decision variables for this problem - one for the number of each agents who will work on each of the 5 shifts. Each of the rows in the table above corresponds to a constraint and the coefficients at the bottom of the table are used to construct the objective function.
Question 21 (2 points, auto)
For the shift from 10 am to noon we require a minimum of 65 agents. How many additional agents can be required from 10 am to noon without changing the total cost?
Question 22 (2 points, auto)
For the shift from 8 pm to 10 pm how much does the total cost change for each additional agent required (starting from 43)?