Portfolio hw
Please follow this guidance for full credit, when formulating optimization prob- lems:
• Clearly define variables, and label constraints to explain their meaning.
• It is OK to leave a linear constraint in the form say x2 ≥ 3(x1 + x4). You do
not have to rearrange it to put all variables on one side.
• Please do not make assumptions based on problem data: e.g., “wheat is so cheap, we will not produce any of it, because . . . ”. Such assumptions may be possible in some toy problems, but in general these will not work.
Code Submission Instruction
• Upload your written solution (the LP formulation written down on paper) on Gradescope as usual.
• Upload your code for the homework by Sakai, not on Gradescope.
• Create a folder with the name “HW6.” Then add the following 4 files:
1. portfolio.mod
2. portfolio.dat
3. Q4b.mod
4. Q4d.mod, Q4d.dat
The file portfolio.dat will be provided and you don’t need to modify this data file for submission. The efficient method to continuously change the parameter from the AMPL console side is described in the Q3 (b) hint.
• Make sure your file and folder names are correct. Otherwise, we will not be able to run your code.
• Compress the folder into “HW6.zip” or “HW6.rar” and submit it to Sakai. ———————————————————————————————————
1. (10 points) Given the return matrix
2 0 R= −1 0.1
and the probabilities p1 = 0.8, p2 = 0.2, compute without using any software the maximum expected return that we can get while the ADR is zero.
hapel Hill.Posting any part of this document online is a violation of the Honor Codeand a
Programming Help
2. (10 points) Repeat the previous exercise with 2 0.5
3. (35 points total)
(a) (20 points) Use the data in (b), write an AMPL code to find the minimum ADRportfolioinwhichrP is≥delta, wheredeltaisagivenlowerbound. The values of n,m,R,p and delta should be only specified in the data file.
(b) (10 points) Given the return matrix
5.51 4.80 R = −1.24 0.61 5.46 3.60
0.16 −1.64
R = −1 0.1 .
−1.70 −1.30 0.30
and probabilities pi = 0.25 for i = 1, 2, 3, 4, compute the efficient frontier by increasing delta from 0 in increments of 0.2. Increase delta until the LP problem is infeasible. List in a table the pairs (delta, minimum ADR). (This matrix is scaled for convenience, so the actual values should be 0.551, 0.480, etc.)
Hint: this can be done very efficiently as follows:
• specify “delta” as a parameter: declare it in the model file.
• After solving the LP with AMPL, you can reset delta by typing,
– let delta := 0.2; # don’t forget the colon! – solve;
– let delta := 0.4;
from the AMPL console command line. This way you do not have to “reset data”, etc.
(c) (5 points) Write down the optimal investment x when delta is 0, when delta is 1, and when delta is 2. Which investment is more diversified, i.e., which is more evenly spread among the stocks?
4. (60 points total) (NB: this may look like an artificial problem. In fact, airlines use such models to optimize money spent on fuel purchase).
You are planning to make a roadtrip from Chapel Hill to Austin, Texas. To make the route as scenic and fun as possible, you plan to stop in the following cities: Nashville, Memphis, Tulsa. And finally in Austin. You plan to purchase gas in the first three of these stops (and nowhere else).
So your trip will have 4 legs: leg 1 is from Chapel Hill to Nashville; leg 2 is from Nashville to Memphis; leg 3 is from Memphis to Tulsa; leg 4 is from Tulsa to Austin.
After consulting the map, we see that the gas consumption of your car is as follows:
hapel Hill.Posting any part of this document online is a violation of the Honor Codeand a
浙大学霸代写 加微信 cstutorcs
• leg 1: 11 gallons • leg 2: 6 gallons • leg 3: 9 gallons • leg 4: 10 gallons
Your car’s tank holds 13 gallons of gas, and you leave Chapel Hill with a full tank. The price of a gallon of gas at the stops is given as Nashville: $2.19; Memphis: $1.95; Tulsa: $2.45.
(a) (10 points) Set up an LP to decide how much gas to buy at each stop to minimize the total amount you spend on gas.
(b) (10 points) Write an AMPL code with ONLY a mod file, and solve it.
(c) (15 points) We state a problem of this sort in general, as follows. We have n cities, the 1st city is Chapel Hill, the nth city is Austin. The price of gas in city i is pi per gallon. Fuel consumption on the leg from city i to city i+1 is fi for i = 1,…,n−1. The capacity of your tank is C gallons, and you leave Chapel Hill with a full tank. Here n, pi, fi, C are all given constants.
Set up an LP to decide how much gas to buy at each stop to minimize the total amount you spend on gas. Use these parameters.
(d) (25 points) Write an AMPL code with a mod file and a dat file. The dat file should contain the data given above. The actual values of n,pi, etc should be given only in the dat file.
Solve it. Obviously you should get the same result that you got with only a mod file.
hapel Hill.Posting any part of this document online is a violation of the Honor Codeand a
Programming Help, Add QQ: 749389476