Optimal and Robust Control
B3M35ORR + BE3M35ORR + BE3M35ORCHomework problem assignment #1 - Retest
An optimal breakfast
You are given a set of n=3 types of food, each of which has the nutritional characteristic described in the table below. Find the optimal composition (amount of servings per each food) of a breakfast having minimum cost, number of calories between 2,000 and 2,250, amount of vitamin between 5,000 and 10,000, and sugar level no larger than 1,000, assuming that the maximum number of servings per food is 10.
Food | Cost | Vitamin | Sugar | Calories |
Corn | 0.15 | 107 | 45 | 70 |
Milk | 0.25 | 500 | 40 | 121 |
Bread | 0.05 | 0 | 60 | 65 |
Formulate this task as an optimization problem, identify the class of this optimization problem (LP, QP or NLP) and solve it in Matlab by either CVX or functions from Optimization Toolbox. Submit a Matlab function solving this optimization problem. Your solution will be evaluated automatically thus the function you will submit has to have a certain name and return certain values. Specifically, the function has to be stored in a file named hw1_cvutID.m and the header of the function has to be in the following form:
function [ optval, opt_X, opt_type ] = hw1_cvutID()
where cvutID is you KOS username, optval is the found optimal value, opt_X is the 10-by-3 matrix composed of the optimal plans for individual chargers and opt_type is the class of this optimization problem. In opt_type, the function is supposed to return string 'LP', 'QP' or 'NLP'. You can submit only one m-file. If you need more functions, you can use nested functions (for details, see this).