程序代写代做代考 compiler c++ Hive finance This question paper

This question paper
consists of 3 printed pages,
each of which is identified
by the Code Number MATH5360M01
MATH5360M01
UNIVERSITY OF LEEDS
Semester 1 2016/17
Assessed Coursework for the degree of MSc
–Subject to external examiner’s approval–
OPTIMISATION METHODS FOR FINANCE 15% of total module mark
Question 1 (30% marks)
Consider the following optimisation problem:
max 3×1 − 10×2 + x3 x
subject to x1 − x2 + x3 ≥ −12 3×1 +2×2 +2×3 ≤30
5×1 −6×2 +4×3 ≤100 x2,x3 ≥0.
(a) Use AMPL to solve this optimisation problem.
(b) Use AMPL to compute the reduced cost of x2.
(c) Use AMPL to compute the optimal value if the objective function is changed to 3×1 −9×2 +x3.
(d) Explain how parts (b) and (c) are related.
(e) Use AMPL to compute the optimal value if the objective function is changed to 3×1 −3×2 +x3. Explain the result.
MATH5360M01
Page 1

Question 2 (30% marks)
Write a C++ program which keeps asking the user to input a number until the user inputs zero.
The program then prints the smallest positive number.
A sample run of the program should go as follows:
Give a number (zero to stop)? 10
Give a number (zero to stop)? -4
Give a number (zero to stop)? 2
Give a number (zero to stop)? 0
Smallest positive number is 2.
Question 3 (40% marks) Consider the function f (x) = x sin x.
(a) Write a C++ program that computes f(x) where x ranges over a sequence of n equidistant points in a given interval [a,b] with a,b ∈ R and displays a table of x against f(x). Your program should allow the user to input values for a, b and n.
The function f should be treated as a C++ function with the following definition: double function f(double x);
Include the output of your program with the interval [0, 5] and 10 data points in the report.
(b) Write a C++ program that estimates the maximum of f(x) over a given interval [a,b] by computing the value of f(x) at a sequence of n equidistant points in [a,b]. Your program should allow the user to input values for a, b and n.
Include the output of your program with the interval [0, 5] and 1000 data points in the report.
(c) Write a C++ program that estimates the maximum of f(x) over a given interval [a,b] by computing the value of f(x) at a sequence of n randomly chosen points in [a,b]. Your program should allow the user to input values for a, b and n.
Include the output of your program with the interval [0, 5] and 1000 data points in the report.
Marking criteria
The programming questions (Questions 2 and 3) are marked against the following criteria:
• Functionality (60%): The program does what is asked, is easy to use, handles errors gracefully.
• Code quality (20%): The code is easy to read, understand and maintain, and is efficient.
• Report (20%): If the question did not completely specify the task, explain what choice you took. If you considered alternative implementations, explain why you picked a particular one. Explanations in C++ comments will also be considered.
MATH5360M01
Page 2

The deadline date for this assignment is 12.00 noon on Tuesday 8 November 2016.
An electronic copy of the assignment must be submitted to the Assignment Submission area within the module resource on the Blackboard VLE website no later than 12 noon on the deadline date.
Failure to meet this initial deadline will result in a reduction of marks.
Submission
You need to submit two files:
Report: The report should contain the answers to the questions and any explanations you deem necessary. If you did not use Visual C++, mention the compiler used. All C++ and AMPL code should be included as appendices. Use the link “Coursework 1 Report” to upload the report.
Code: All C++ and AMPL code should also be submitted separately. Gather all your C++ files as they are stored by Visual C++ (.cpp or .cc; NO pdf, doc, ps, etc.) and your AMPL code files (.dat, .mod or .run), and store them in a zip file or some other common archive format (like rar or tar). Use the link “Coursework 1 Code” to upload the archive file.
Please ensure that you leave sufficient time to complete the online submission process, as upload times can vary. Accessing the submission link before the deadline does NOT constitute completion of submission. You MUST click the “CONFIRM” button for both files before 12 noon for your assignment to be classed as submitted on time, if not you will need to submit to the Late Area and your assignment will be marked as late. It is your responsibility to ensure you upload the correct file to the VLE, and that it has uploaded successfully.
It is important that any file submitted follows the conventions stated below: FILE NAME
The name of the file that you upload must be your student ID only.
ASSIGNMENT TITLE
During the submission process the system will ask you to enter the title of your submission. This should also be your student ID only.
FRONT COVER
The first page of your report should always be the Assessed Coursework Coversheet (individ- ual), which is available to download from the following location: https://lubswww.leeds.ac.uk/ code-of-practice/downloadable-forms/
STUDENT NAME
You should NOT include your name anywhere on your assignment (not in the report and not in the code).
END
Page 3
MATH5360M01