On the file
MATH3017 COURSEWORK ASSIGNMENT 2019–20 Your coursework must be submitted electronically via blackboard by 4pm on Friday, De- cember 6th. Any work handed in after this time will be subject to the following penalties: 10% of your marks lost per working day up to 5 working days. Do not write your name anywhere on your work, as marking is anonymous. You may work in a group of size no more than three members, but must write up your final work individually. Please list the ID numbers of members of your group on the front sheet of your submitted work. An extension, for bona fide reasons, may be allowed by prior agreement, but only well before the deadline. Computer crashes or file losses a day or two before the deadline will not be an acceptable reason. It is therefore advisable to keep back-up copies of your work. As you are probably ware, this coursework will count for 20% of the overall mark of MATH3017. You are asked to model and/or solve the following problems using CVXOPT. The software is the main topic of the computer labs of 4th and 11th November. You should submit a single pdf or word file describing the model (Q1-1) and explaining how they are solved using CVXOPT (Q1-2 and Q2). Then include your CVXOPT scripts/codes as appendices to the document. Q1. Cost minimization. Sales forecasts for the next four months are (in thousand of units): October 10 November 16 December 10 January 12 September’s production was set at 12,000 units. Varying production rate incurs some cost: produc- tion can be increased from one month to the next at a cost of £2 per unit and it can be decreased at a cost of £0.50 per unit. In addition, inventory left at the end of a month can be stored at a cost of £1 per unit per month. Given current demand, there will be no inventory at the end of September. No inventory is desired at the end of January. Q1-1: Formulate a linear program that minimizes the total cost (varying production rate + inven- tory costs) of meeting the above demand. (15 marks) Q1-2: Solve the resulting problem using CVXOPT. (15 marks) 1 2 MATH3017 COURSEWORK ASSIGNMENT 2019–20 Q2. Support vector machines. Given labels y ∈ {−1, 1}n and a feature matrix X ∈ Rn×p with rows x1, . . . xn, recall the support vector machine (SVM) problem min β,β0,ξ 1 2 ‖β‖22 + C n∑ i=1 ξi s.t. ξi ≥ 0, i = 1, . . . n yi(x T i β+ β0) ≥ 1− ξi, i = 1, . . . n. Q2-1: Load the training data in xy train.csv. This is a matrix of n = 200 row and 3 columns. The first two columns give the first p = 2 features, and the third column gives the labels. Using CVXOPT, solve the SVM problem with C = 1 and eport the optimal crtierion value, and the opti- mal coefficients β ∈ R2 and intercept β0 ∈ R. (15 marks) Q2-2: Recall that the SVM solution defines a hyperplane β0 + β Tx = 0, which serves as the decision boundary for the SVM classifier. Based on the optimal solution from Q2-1, plot the training data and color the points from the two classes differently. Draw the decision boundary on top. (15 marks) Q2-3: Let e> = (1, . . . , 1) ∈ Rn. Define X̃ ∈ Rn×p to have rows x̃i = yixi, i = 1, . . . , n and also solve the following problem using CVXOPT for C = 1: (15 marks) max w − 1 2 w>X̃X̃Tw+ e>w s.t. 0 ≤ w ≤ Ce, wTy = 0. • How does the optimal objective function value of this problem compare to the one obtained in question Q2-1? (5 marks) • Report X̃Tw at the optimal solutionw of this problem. How does this value compare to the optimal β from question Q2-1? (5 marks) Q2-4: Define the cost parameter C = 2a and solve the SVM problem in Q2-1 for different values of a taken from the interval −5 to 5 and plot the resulting optimal objective function values. What do you observe on how these values change under different values of a? (15 marks)