Starting from:

$35

price vector

Problem 1: Suppose we have an ordered list of n items of food.
Let a ∈ R
n denote the price vector of all these food items, let
p ∈ R
n denote the protein vector, c ∈ R
n denote the carbohydrate vector, f ∈ R
n denote the fats vector.
Denote by xi to be amount of food item i, and
x = (x1, x2, ..., xn)
to be the vector all these food combinations.
Find the vector x which will minimize the total cost, i.e. a
tx,
subject to the constraints that the total protein of the food combination needs to be at least p, total carbohydrate needs to be at
least c, and the total fats need to be at least f (here p, c, f are
given real numbers). Let us further require that the total calories
of the food combination needs to be in the interval [callow, calhigh]
i.e. at least callow calories but at most calhigh calories, again the
numbers callow and calhigh must be specified.
Create a code in R called,
optimize.food(a,p.vec,c.vec,f.vec,p,c,f,cal.low,cal.high)
Which will return the vector x of food combinations that need to
be selected that will minimize the total cost of production. Check
that your code solves our special example that we did in class.
1
Problem 2: Suppose a firm produces a certain product. The demand for this product varies through out the year. Let d ∈ R
n
denote the demand vector, where n is the number of divisions of
a full year (when n = 12 the year is broken up into months, when
n = 26 the year is broke up biweekly, ect.).
The full year is broken up into n equal time blocks. The employees of the firm can produce at most r tons of this product, the
cost for production is k dollars/ton. It is possible to overwork the
employees so that they will produce beyond what they normally
do. However, the cost for additional production is K dollars/ton
(in applications this is always a bigger number than k) and the
employees can only product up to a extra tons.
There is a storage cost of s dollars/ton where any unsold product
can be carried into the next time block.
The goal of the firm is to sell off its entire product by the end
of the year with no remaining surplus, meet the demand for each
time block, and minimize the total cost of production.
Write the following code in R.
optimal.production(d,r,k,a,K,s) = computes the ideal production model to minimize the cost.
2

More products