« Previous « Start » Next »
28 Economics
28.1 Choice of loans
% function Result = choiceofloansEx(PriLev)
%
% Creates a TOMLAB MIP problem for choice of loans
%
% CHOICE OF LOANS
%
% Mr Chic, director of a chain of shops selling clothes, wishes to
% open three new shops: one in London, one in Munich, and one in
% Rome. To open a new shop costs respectively $ 2.5 million, $ 1
% million and $ 1.7 million. To finance his project, he calls at
% three different banks.
%
% Rates offered by the banks for the different projects
%
% +------+------+------+----+
% | |London|Munich|Rome|
% +------+------+------+----+
% |Bank 1| 5.0% | 6.5% |6.1%|
% |Bank 2| 5.2% | 6.2% |6.2%|
% |Bank 3| 5.5% | 5.8% |6.5%|
% +------+------+------+----+
%
% Depending on the location of the shops and the evaluation of the
% related risks, each bank decides to finance at most $ 3 million
% over 8 years with different interest rates for the shops. Determine
% the amount to borrow from each bank for financing each shop in
% order to minimize the total expenses of Mr Chic.
%
% VARIABLES
%
% rates The rates
% costs Cost per site
% maxloan Max loan per bank
% loanlength Length of the loan in years
%
% RESULTS
%
% for an interpretation of the results, let PriLev > 1:
% Result = choiceofloansEx(2);
%
% REFERENCES
%
% Applications of optimization... Gueret, Prins, Seveaux
% http://web.univ-ubs.fr/lester/~sevaux/pl/index.php
%
% INPUT PARAMETERS
% PriLev Print Level
%
% OUTPUT PARAMETERS
% Result Result structure.
% Marcus Edvall, Tomlab Optimization Inc, E-mail: tomlab@tomopt.com
% Copyright (c) 2005-2005 by Tomlab Optimization Inc., $Release: 5.0.0$
% Written Nov 30, 2005. Last modified Nov 30, 2005.
function Result = choiceofloansEx(PriLev)
if nargin < 1
PriLev = 1;
end
rates = [ 5.0 6.5 6.1 ;...
5.2 6.2 6.2 ;...
5.5 5.8 6.5 ];
costs = [2.5 1.0 1.7]'*1e6;
maxloan = 3e6;
loanlength = 8;
Prob = choiceofloans(rates, costs, maxloan, loanlength);
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
[b,s] = size(rates); % banks/sites
temp = Result.x_k;
temp = reshape(temp,b,s)';
for i = 1:s,
site = temp(:,i);
idx = find(site);
disp(['To finance shop at site ' num2str(i)])
for j = 1:length(idx),
disp([' take a loan of ' num2str(site(idx(j))) ...
' in bank ' num2str(idx(j))])
end
end
end
% MODIFICATION LOG
%
% 051130 med Created.
% 060116 per Added documentation.
28.2 Publicity campaign
% function Result = publicitycampaignEx(PriLev)
%
% Creates a TOMLAB MIP problem for publicity campaign
%
% PUBLICITY CAMPAIGN
%
% The small company, Pronuevo, launches a new product into a regional
% market and wishes to have a publicity campaign using different
% media. It therefore contacts a regional publicity agency, PRCo,
% that specializes in this type of regional campaign and completely
% hands over this task for a total budget of $ 250,000. The agency
% knows the market well, that is, the impact of publicity in a local
% magazine or over the radio, or as a TV spot on the regional
% channel. It suggests addressing the market for two months through
% six different media. For each medium, it knows the cost and the
% number of people on which this medium has an impact. An index of
% the quality of perception of the campaign is also known for every
% medium.
%
% The publicity agency establishes a maximum number of uses of every
% medium (for instance, not more than eight transmissions of a TV
% spot). The table below lists all this information. Pronuevo wants
% the impact of the publicity campaign to reach at least 100,000
% people. Which media should be chosen and in which proportions to
% obtain a maximum index of perception quality?
%
% Data for the publicity campaign
% +------+---------------------+-------------------+------+-------------+----------+
% | | | People | Unit |Maximum |Perception|
% |Number|Media type |potentially reached| cost | use | quality |
% +------+---------------------+-------------------+------+-------------+----------+
% | 1 |Free weekly newspaper| 12,000 | 1,500| 4 weeks | 3 |
% | 2 |Monthly magazine | 1,500 | 8,000| 2 months | 7 |
% | 3 |Weekly magazine | 2,000 |12,000| 8 weeks | 8 |
% | 4 |Radio spot | 6,000 | 9,000|60 broadcasts| 2 |
% | 5 |Billboard 4x3 m | 3,000 |24,000| 4 boards | 6 |
% | 6 |TV spot | 9,000 |51,000| 8 broadcasts| 9 |
% +------+---------------------+-------------------+------+-------------+----------+
%
% VARIABLES
%
% budget Budget
% people Persons potentially reached per media
% costs Unit costs
% maxuse Maximum use
% quality Perception quality
% minpeople
%
% RESULTS
%
% For an interpretation of the results, set PriLev > 1, for example:
% Result = publicitycampaignEx(2);
%
% REFERENCES
%
% Applications of optimization... Gueret, Prins, Seveaux
% http://web.univ-ubs.fr/lester/~sevaux/pl/index.php
%
% INPUT PARAMETERS
% PriLev Print Level
%
% OUTPUT PARAMETERS
% Result Result structure.
% Marcus Edvall, Tomlab Optimization Inc, E-mail: tomlab@tomopt.com
% Copyright (c) 2005-2005 by Tomlab Optimization Inc., $Release: 5.0.0$
% Written Dec 1, 2005. Last modified Dec 1, 2005.
function Result = publicitycampaignEx(PriLev)
if nargin < 1
PriLev = 1;
end
budget = 250000;
people = [12000 1500 2000 6000 3000 9000]';
costs = [1500 8000 12000 9000 24000 51000]';
maxuse = [4 2 8 60 4 8]';
quality = [3 7 8 2 6 9]';
minpeople = 100000;
Prob = publicitycampaign(budget, people, costs, maxuse, quality, minpeople);
Result = tomRun('cplex', Prob, PriLev);
if PriLev >1,
invest = Result.x_k;
for i = 1:length(invest),
if invest(i) ~= 0,
disp(['invest in ' num2str(invest(i)) ' uses of media number ' num2str(i)])
end
end
end
% MODIFICATION LOG
%
% 051201 med Created.
% 060116 per Added documentation.
% 060125 per Moved disp to end
28.3 Portfolio selection
% function Result = portfolioselectionEx(PriLev)
%
% Creates a TOMLAB MIP problem for portfolio selection
%
% PORTFOLIO SELECTION
%
% A consultant in finance has to choose for one of his wealthy female
% clients a certain number of shares in which to invest. She wishes
% to invest $ 100,000 in 6 different shares. The consultant estimates
% for her the return on investment that she may expect for a period
% of six months. The following table gives for each share its country
% of origin, the category (T: technology, N: non-technology) and the
% expected return on investment (ROI). The client specifies certain
% constraints. She wishes to invest at least $ 5,000 and at most
% $ 40,000 into any share. She further wishes to invest half of her
% capital in European shares and at most 30% in technology. How
% should the capital be divided among the shares to obtain the
% highest expected return on investment?
%
% List of shares
%
% +--+-------+--------+------------+
% |Nr|Origin |Category|Expected ROI|
% +--+-------+--------+------------+
% | 1|Japan | T | 5.3% |
% | 2|UK | T | 6.2% |
% | 3|France | T | 5.1% |
% | 4|USA | N | 4.9% |
% | 5|Germany| N | 6.5% |
% | 6|France | N | 3.4% |
% +--+-------+--------+------------+
%
% VARIABLES
%
% budget Budget
% mininvest Minimal investment
% maxinvest Maximal investment
% catinvest1min Minimal investment in category One (N)
% idx1cat Index of category One
% catinvest2max Maximal investment in category Two (T)
% idx2cat Index of category Two
% returns Expected ROI
%
% RESULTS
%
% For an interpretation of the results, try the following:
% Result = portfolioselectionEx(2);
%
% REFERENCES
%
% Applications of optimization... Gueret, Prins, Seveaux
% http://web.univ-ubs.fr/lester/~sevaux/pl/index.php
%
% INPUT PARAMETERS
% PriLev Print Level
%
% OUTPUT PARAMETERS
% Result Result structure.
% Marcus Edvall, Tomlab Optimization Inc, E-mail: tomlab@tomopt.com
% Copyright (c) 2005-2005 by Tomlab Optimization Inc., $Release: 5.0.0$
% Written Dec 1, 2005. Last modified Dec 1, 2005.
function Result = portfolioselectionEx(PriLev)
if nargin < 1
PriLev = 1;
end
budget = 100000;
mininvest = 5000;
maxinvest = 40000;
catinvest1min = 0.5;
idx1cat = [0 1 1 0 1 1]';
catinvest2max = 0.3;
idx2cat = [1 1 1 0 0 0]';
returns = [5.3 6.2 5.1 4.9 6.5 3.4]';
Prob = portfolioselection(budget, mininvest, maxinvest, catinvest1min, idx1cat,...
catinvest2max, idx2cat, returns);
Prob.MIP.SC = 1:Prob.N; % All variables are semi-continuous
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
invest = Result.x_k;
for i = 1:length(invest),
if invest(i) ~= 0,
disp(['invest $ ' num2str(invest(i)) ' in share ' num2str(i)])
end
end
end
% MODIFICATION LOG
%
% 051201 med Created.
% 060116 per Added documentation.
% 060125 per Moved disp to end
28.4 Financing an early retirement
% function Result = financinganearlyretirementEx(PriLev)
%
% Creates a TOMLAB MIP problem for financing an early retirement scheme
%
% FINANCING AN EARLY RETIREMENT SCHEME
%
% The National Agricultural Bank (NAB) decides to establish an early
% retirement scheme for fifteen employees who are taking early
% retirement. These employees will retire over a period of seven
% years starting from the next year. To finance this early retirement
% scheme, the bank decides to invest in bonds for this seven-year
% period. The necessary amounts to cover the pre-retirement leavers
% are given in the following table; they have to be paid at the
% beginning of every year.
%
% Amounts required every year
%
% +------------------+----+---+---+---+---+----+---+
% |Year | 1| 2| 3| 4| 5| 6| 7|
% +------------------+----+---+---+---+---+----+---+
% |Amount (in 1000 $)|1000|600|640|480|760|1020|950|
% +------------------+----+---+---+---+---+----+---+
%
% For the investments, the bank decides to take three different types
% of bonds, SNCF bonds, Fujitsu bonds, and Treasury bonds. The money
% that is not invested in these bonds is placed as savings with a
% guaranteed yield of 3.2%. The table below lists all information
% concerning the yield and the durations of the bonds and also the
% value of a bond. In this type of bond, it is only possible to buy
% an integer number of bonds, and the invested capital remains locked
% in for the total duration of the bond. Every year, only the
% interest on the capital is distributed. The person in charge of the
% retirement plan decides to buy bonds at the beginning of the first
% year, but not in the following years. How should he organize the
% investments in order to spend the least amount of money to cover
% the projected retirement plan?
%
% Information about loans
%
% +--------+----------------------+---------+--------+
% |Loan |Value of bonds (in k$)| Interest|Duration|
% +--------+----------------------+---------+--------+
% |SNCF | 1.0 | 7.0% | 5 years|
% |Fujitsu | 0.8 | 7.0% | 4 years|
% |Treasury| 0.5 | 6.5% | 6 years|
% +--------+----------------------+---------+--------+
%
% VARIABLES
%
% amounts Retirement costs
% baseinterest Interest from money not invested in bonds
% values Values of a bond
% interest Interest from bonds
% duration Years to place the money
%
% RESULTS
%
% For an interpretation of the results, try the following:
% Result = financinganearlyretirementEx(2);
%
% REFERENCES
%
% Applications of optimization... Gueret, Prins, Seveaux
% http://web.univ-ubs.fr/lester/~sevaux/pl/index.php
%
% INPUT PARAMETERS
% PriLev Print Level
%
% OUTPUT PARAMETERS
% Result Result structure.
% Marcus Edvall, Tomlab Optimization Inc, E-mail: tomlab@tomopt.com
% Copyright (c) 2005-2005 by Tomlab Optimization Inc., $Release: 5.0.0$
% Written Dec 1, 2005. Last modified Dec 1, 2005.
function Result = financinganearlyretirementEx(PriLev)
if nargin < 1
PriLev = 1;
end
amounts = [1000 600 640 480 760 1020 950]'*1000;
baseinterest = 3.2;
values = [1000 800 500]';
interest = [7.0 7.0 6.5]';
duration = [5.0 4.0 6.0]';
Prob = financinganearlyretirement(amounts, baseinterest, values, interest, duration);
Prob.MIP.cpxControl.EPGAP = 1e-10;
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
b = 3; % number of bonds
y = 7; % number of years
buy_bonds = Result.x_k(1:b);
buy_other = Result.x_k(b+1:b+1+y-1);
for i = 1:length(buy_bonds),
if buy_bonds(i) ~= 0,
disp(['buy ' num2str(buy_bonds(i)) ' bonds of type ' ...
num2str(i)])
end
end
for i = 1:length(buy_other),
if buy_other(i) ~= 0,
disp(['buy "other things" for $ ' ...
num2str(buy_other(i)) ' year ' num2str(i)])
end
end
end
% MODIFICATION LOG
%
% 051201 med Created.
% 060116 per Added documentation.
% 060125 per Moved disp to end
28.5 Family budget
% function Result = familybudgetEx(PriLev)
%
% Creates a TOMLAB MIP problem for family budget
%
% FAMILY BUDGET
%
% The mother of a family wishes to use her son’s computer. On the
% internet she has found optimization software and would now like to
% formulate a mathematical model to help plan their annual budget.
% She has prepared a list of the monthly expenses and receipts of
% money. Every month the expenses for living are $ 550. The monthly
% rent for the apartment is $ 630. She also budgets $ 135 for
% telephone every two months, $ 850 for gas and electricity bills
% every six months, $ 340 per month for the car and $ 100 of tax
% every four months. Her receipts of money are a monthly payment of
% $ 150 of state allowance for families with dependent children and a
% net salary of $ 1900 per month. She knows that she pays at least
% $ 165 for leisure every month (subscription to the swimming pool
% for the older children, football club for the youngest, gym for
% herself) but she would like to spend more (restaurant, cinema,
% holidays). How should the budget be balanced all through the year
% to maximize the money available for leisure?
%
% VARIABLES
%
% costs Various costs
% costfreq Frequency of the costs
% income Various incomes
% incomefreq Frequency of the income
% minhobby Mimial cost for hobbies
%
% RESULTS
%
% For an interpretation of the results, run:
% Result = familybudgetEx(2);
%
% REFERENCES
%
% Applications of optimization... Gueret, Prins, Seveaux
% http://web.univ-ubs.fr/lester/~sevaux/pl/index.php
%
% INPUT PARAMETERS
% PriLev Print Level
%
% OUTPUT PARAMETERS
% Result Result structure
% Marcus Edvall, Tomlab Optimization Inc, E-mail: tomlab@tomopt.com
% Copyright (c) 2005-2005 by Tomlab Optimization Inc., $Release: 5.0.0$
% Written Dec 1, 2005. Last modified Dec 1, 2005.
function Result = familybudgetEx(PriLev)
if nargin < 1
PriLev = 1;
end
costs = [550 630 135 850 340 100]';
costfreq = [ 1 1 2 6 1 4]';
income = [150 1900]';
incomefreq = [ 1 1]';
minhobby = 165;
Prob = familybudget(costs, costfreq, income, incomefreq, minhobby);
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
m = 12 ; % number of months
leisure = Result.x_k(1:m);
save = Result.x_k(m+1:2*m);
disp('Money for leisure and for savings per month')
for i = 1:m,
disp(['month ' num2str(i) ', leisure ' num2str(leisure(i)) ', save ' num2str(save(i))])
end
disp(['total leisure this year: ' num2str(sum(leisure))])
disp(['total to save this year: ' num2str(sum(save)) ])
end
% MODIFICATION LOG
%
% 051201 med Created.
% 060116 per Added documentation.
% 060117 per Minor change of documentation.
% 060125 per Moved disp to end
28.6 Choice of expansion projects
% function Result = choiceofexpansionprojectsEx(PriLev)
%
% Creates a TOMLAB MIP problem for choice of expansion projects
%
% CHOICE OF EXPANSION PROJECTS
%
% The large company Tatayo in the north of Italy has specialized in
% the construction of cars for more than ten years. The company
% wishes to expand and has issued internally a call for proposals for
% expansion projects for a planning period of five years. Among the
% many, often cranky, propositions the management has retained five
% projects. Every project has an annual cost and is designed to
% produce a benefit after five years. The first table below gives a
% list of the projects with short descriptions and the expected
% benefit after five years. The forecast annual costs of the projects
% for the next five years are detailed in the second table below,
% together with the funds available. Which project(s) should the
% management choose now to maximize the total benefit after five
% years?
%
% Estimated benefits of the projects (in million $)
%
% +-------+------------------------------+----------------+
% |Project|Description |Expected benefit|
% +-------+------------------------------+----------------+
% | 1 |Expand assembly line | 10.8 |
% | 2 |Reorganize the main shop | 4.8 |
% | 3 |New painting facilities | 3.2 |
% | 4 |Research for a new concept car| 4.44 |
% | 5 |Reorganize the logistics chain| 12.25 |
% +-------+------------------------------+----------------+
%
% Annual costs of projects and available funds (in million $)
%
% +-------+------+------+------+------+------+
% |Project|Year 1|Year 2|Year 3|Year 4|Year 5|
% +-------+------+------+------+------+------+
% | 1 | 1.8 | 2.4 | 2.4 | 1.8 | 1.5 |
% | 2 | 1.2 | 1.8 | 2.4 | 0.6 | 0.5 |
% | 3 | 1.2 | 1.0 | 0.0 | 0.48 | 0.0 |
% | 4 | 1.4 | 1.4 | 1.2 | 1.2 | 1.2 |
% | 5 | 1.6 | 2.1 | 2.5 | 2.0 | 1.8 |
% +-------+------+------+------+------+------+
% |Funds | 4.8 | 6.0 | 4.8 | 4.2 | 3.5 |
% +-------+------+------+------+------+------+
%
% VARIABLES
%
% benefit Expected benefit
% budget Funds available each year
% costmat Cost per project and year
%
% RESULTS
%
% For an interpretation of the results, run:
% Result = choiceofexpansionprojectsEx(2);
%
% REFERENCES
%
% Applications of optimization... Gueret, Prins, Seveaux
% http://web.univ-ubs.fr/lester/~sevaux/pl/index.php
%
% INPUT PARAMETERS
% PriLev Print Level
%
% OUTPUT PARAMETERS
% Result Result structure
% Marcus Edvall, Tomlab Optimization Inc, E-mail: tomlab@tomopt.com
% Copyright (c) 2005-2005 by Tomlab Optimization Inc., $Release: 5.0.0$
% Written Dec 1, 2005. Last modified Dec 1, 2005.
function Result = choiceofexpansionprojectsEx(PriLev)
if nargin < 1
PriLev = 1;
end
benefit = [10.8 4.8 3.2 4.44 12.25]'*1e6;
budget = [ 4.8 6.0 4.8 4.2 3.5]'*1e6;
costmat = [1.8 2.4 2.4 1.8 1.5;...
1.2 1.8 2.4 0.6 0.5;...
1.2 1.0 0.0 .48 0.0;...
1.4 1.4 1.2 1.2 1.2;...
1.6 2.1 2.5 2.0 1.8]*1e6;
Prob = choiceofexpansionprojects(benefit, budget, costmat);
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
names = [' Expand assembly line ' ;
' Reorganize the main shop ' ;
' New painting facilities ' ;
' Research for a new concept car' ;
' Reorganize the logistics chain'];
idx = find(Result.x_k);
disp('The management should choose the following projects:')
disp(names(idx,:))
end
% MODIFICATION LOG
%
% 051201 med Created.
% 060117 per Added documentation.
28.7 Mean variance portfolio selection
% function Result = meanvarianceportfolioselecEx(PriLev)
%
% Creates a TOMLAB MIQP problem for mean variance portfolio selection
%
% MEAN VARIANCE PORTFOLIO SELECTION
%
% An investor wishes to invest a certain amount of money. He is
% evaluating four different securities (assets) for his investment.
% The securities are US Treasury Bills (‘T-bills’), a computer
% hardware company, a computer software company, and a high-risk
% investment in a theater production. He estimates the mean yield on
% each dollar he invests in each of the securities, and also adopts
% the Markowitz idea of getting estimates of the variance/covariance
% matrix of estimated returns on the securities. (For example,
% hardware and software company worths tend to move together, but are
% oppositely correlated with the success of theatrical production, as
% people go to the theater more when they have become bored with
% playing with their new computers and computer games.) The return on
% theatrical productions are highly variable, whereas the T-bill
% yield is certain. The estimated returns and the variance/covariance
% matrix are given in the table below.
%
% Estimated returns and variance/covariance matrix
%
% +----------------+--------+--------+--------+-------+
% | |Hardware|Software|Show-biz|T-bills|
% +----------------+--------+--------+--------+-------+
% |Estimated return| 8 | 9 | 12 | 7 |
% +----------------+--------+--------+--------+-------+
% |Hardware | 4 | 3 | -1 | 0 |
% |Software | 3 | 6 | 1 | 0 |
% |Show-biz | -1 | 1 | 10 | 0 |
% |T-bills | 0 | 0 | 0 | 0 |
% +----------------+--------+--------+--------+-------+
%
% Question 1: Which investment strategy should the investor adopt to
% minimize the variance subject to getting some specified minimum
% target yield?
%
% Question 2: Which is the least variance investment strategy if the
% investor wants to choose at most two different securities (again
% subject to getting some specified minimum target yield)?
%
% VARIABLES
%
% estreturn Estimated return of securities
% covmat The variance/covariance matrix
% target Minimum target yield
% maxassets Number of securities
%
% RESULTS
%
% For an interpretation of the results, try the following:
% [Result1, Result2] = meanvarianceportfolioselecEx(2);
%
% REFERENCES
%
% Applications of optimization... Gueret, Prins, Seveaux
% http://web.univ-ubs.fr/lester/~sevaux/pl/index.php
%
% INPUT PARAMETERS
% PriLev Print Level
%
% OUTPUT PARAMETERS
% Result Result structure
% Marcus Edvall, Tomlab Optimization Inc, E-mail: tomlab@tomopt.com
% Copyright (c) 2005-2005 by Tomlab Optimization Inc., $Release: 5.0.0$
% Written Dec 2, 2005. Last modified Dec 2, 2005.
function [Result1, Result2] = meanvarianceportfolioselecEx(PriLev)
if nargin < 1
PriLev = 1;
end
estreturn = [8 9 12 7]';
covmat = [ 4 3 -1 0;...
3 6 1 0;...
-1 1 10 0;...
0 0 0 0];
target = 8.5;
Prob = meanvarianceportfolioselec(estreturn, covmat, target);
Result1 = tomRun('cplex', Prob, PriLev);
maxassets = 2;
Prob = meanvarianceportfolioselec(estreturn, covmat, target, maxassets);
Result2 = tomRun('cplex', Prob, PriLev);
if PriLev >1,
names = ['Hardware';
'Software';
'Show-biz';
'T-bills '];
disp('Answer to Question 1:')
for i = 1:length(Result1.x_k),
disp([' invest ' num2str(Result1.x_k(i)*100) ...
'% of the capital in ' names(i,:) ])
end
disp('Answer to Question 2 (limited number of securities):')
x = Result2.x_k(1:length(Result2.x_k)/2);
x(find(x < 1e-6)) = 0;
for i = 1:(length(Result2.x_k)/2),
if x(i) ~= 0,
disp([' invest ' num2str(x(i)*100) ...
'% of the capital in ' names(i,:) ])
end
end
end
% MODIFICATION LOG
%
% 051202 med Created.
% 060117 per Added documentation.
% 060125 per Moved disp to end
« Previous « Start » Next »