Linear Programs and Line Search Algorithms in Matlab Equipment: PC with MATLAB® installed. Team size: Work individually
Using Matlabs linprog function
Matlab provides a function to solve Linear Programs. Linear programs must first be formulated correctly, then programmed using the linprog functionality. Use the matlab help function or any other resources to understand the linprog synax and use. Submission The submission for this assignment is: Document (.pdf) including: 1) Student number table below 2) Problem 1 Image of the workings for the formulation for Problem 1 Solution to problem 1 4) Problem 2 Image of the workings for the formulation for Problem 2 Solution to problem 2 6) Problem 3 Details as specified by Problem 3 Matlab Code: All code must be commented and have student name and number in comments at beginning of the file. 1) Matlab script to solve Problem 1. Matlab .m file 2) Matlab script to solve Problem 2. Matlab .m file 3) Matlab script to solve Problem 3. Matlab .m file
Student number: Corresponding symbols, to be used throughout this lab assignment in the places indicated α β γ δ ε η θ λ
3 1 Food optimisation Consider the following table indicating the nutritional value of different food types:
- Write an LP which will help you to decide how many servings of each food to buy each day so that you minimize the total cost of buying your food while satisfying t he following daily nutritional requirements: • calories must be at least 2000 + αδλ • fat must be at least 50 + θ g, • protein must be at least 100 - δε g, • carbohydrates must be at least 250 + βλ g. You may buy fractional numbers of servings.
- Solve the formulated LP by using linprog function from Matlab.
- Determine whether the LP is infeasible, unbounded or has an optimal solution. 2 Milk optimisation MUCOW owns a herd of Holstein cows and a herd of Jersey cows. For each herd, the total num ber of litres produced each day, and milk -fat content (as a percentage) are as follows:
The fat is split off and blended again to create various products. For each product, the and profit are as follows. In particular, equal what is specified.
- Formulate as an LP the problem of deciding how many items of each type to
produce, so that the total prof it is maximi sed (fractional numbers are allowed).
- δε
- λδ - 0.λ 4 2. Solve the formulated LP by using linprog function from Matlab.
- Determine whether the LP is infeasible, unbounded or has an optimal solution.
3 Line Search Algorithm Development
• Generate six random numbers by any means. • Designate these a1 to a6.
You will determine the minimum of the function 𝐹(𝑥)=𝑎1 𝑥!+ 𝑎2 𝑥+𝑎3. (i) Calculate the minimum mathematically. (ii) Using MATLAB, perform a line search to estimate the minimum. You will use the following method: a. If the last digit of your student number is 0, 1 or 2, use grid search. b. If the last digit of your student number is 3, 4, 5 or 6, use Fibonacci search, c. If the last digit of your student number is 7, 8 or 9, use golden section search. In your code, record how many calls of the function F(x) occur. (iii) Plot the first three steps of your search for, for x and F(x). Plot the error of the estimated location of the mini mum versus iteration of your algorithm.
Your document should contain:
- random numbers used a1 – a6
- Calculation of minimum value, F(x)and solution x for analytical solution.
- Identify the search method used
- Recorded function evaluations
- Record the value, F(x) and solution (x) achieved by the search
- Plots of first three steps and error