« Previous « Start » Next »
23 Planning
23.1 Planning the production of bicycles
% function Result = planningtheprodofbicyclesEx(PriLev)
%
% Creates a TOMLAB MIP problem for planning the production of bicycles
%
% PLANNING THE PRODUCTION OF BICYCLES
%
% A company produces bicycles for children. The sales forecast in
% thousand of units for the coming year are given in the following
% table. The company has a capacity of 30,000 bicycles per month.
% It is possible to augment the production by up to 50% through
% overtime working, but this increases the production cost for a
% bicycle from the usual $ 32 to $ 40.
%
% Sales forecasts for the coming year in thousand units
%
% +---+---+---+---+---+---+---+---+---+---+---+---+
% |Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|
% +---+---+---+---+---+---+---+---+---+---+---+---+
% | 30| 15| 15| 25| 33| 40| 45| 45| 26| 14| 25| 30|
% +---+---+---+---+---+---+---+---+---+---+---+---+
%
% Currently there are 2,000 bicycles in stock. The storage costs have
% been calculated as $ 5 per unit held in stock at the end of a month.
% We assume that the storage capacity at the company is virtually
% unlimited (in practice this means that the real capacity, that is
% quite obviously limited, does not impose any limits in our case).
% We are at the first of January. Which quantities need to be
% produced and stored in the course of the next twelve months in order
% to satisfy the forecast demand and minimize the total cost?
%
% VARIABLES
%
% normcapacity the normal production capacity
% extracapacity extra capacity
% normcost normal cost
% extracost cost per bike if overtime
% demand bikes wanted per month
% startstock bikes in store
% storagecost cost to have a bike in store one month
%
% RESULTS
%
% For an interpretation of the results, try this:
% Result = planningtheprodofbicyclesEx(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 Oct 17, 2005. Last modified Oct 17, 2005.
function Result = planningtheprodofbicyclesEx(PriLev)
if nargin < 1
PriLev = 1;
end
normcapacity = 30000;
extracapacity = 15000;
normcost = 32;
extracost = 40;
demand = [30;15;15;25;33;40;45;45;26;14;25;30]*1000;
startstock = 2000;
storagecost = 5;
Prob = planningtheprodofbicycles(normcapacity, extracapacity, normcost,...
extracost, demand, startstock, storagecost);
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
months = length(demand);
temp = reshape(Result.x_k,months,3);
for i = 1:months,
disp(['Month ' num2str(i) ':'])
disp([' produce ' num2str(temp(i,1)) ' regular bikes' ])
if temp(i,2) > 0,
disp([' and ' num2str(temp(i,2)) ' extras' ])
end
if temp(i,3) > 0,
disp([' let ' num2str(temp(i,3)) ' be stored' ])
end
end
end
% MODIFICATION LOG
%
% 051017 med Created.
% 060110 per Added documentation.
% 060125 per Moved disp to end
23.2 Production of drinking glasses
% function Result = productionofdrinkingglassesEx(PriLev)
%
% Creates a TOMLAB MIP problem for production of drinking glasses
%
% PRODUCTION OF DRINKING GLASSES
%
% The main activity of a company in northern France is the production
% of drinking glasses. It currently sells six different types
% (V1 to V6), that are produced in batches of 1000 glasses, and wishes
% to plan its production for the next 12 weeks. The batches may be
% incomplete (fewer than 1000 glasses). The demand in thousands for
% the 12 coming weeks and for every glass type is given in the
% following table.
%
% Demands for the planning period (batches of 1000 glasses)
%
% +----+--+--+--+--+--+--+--+--+--+--+--+--+
% |Week| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|
% +----+--+--+--+--+--+--+--+--+--+--+--+--+
% |V1 |20|22|18|35|17|19|23|20|29|30|28|32|
% |V2 |17|19|23|20|11|10|12|34|21|23|30|12|
% |V3 |18|35|17|10| 9|21|23|15|10| 0|13|17|
% |V4 |31|45|24|38|41|20|19|37|28|12|30|37|
% |V5 |23|20|23|15|10|22|18|30|28| 7|15|10|
% |V6 |22|18|20|19|18|35| 0|28|12|30|21|23|
% +----+--+--+--+--+--+--+--+--+--+--+--+--+
%
% For every glass type the initial stock is known, as well as the
% required final stock level (in thousands). Per batch of every glass
% type, the production and storage costs in $ are given, together
% with the required working time for workers and machines (in hours),
% and the required storage space (measured in numbers of trays).
%
% The number of working hours of the personnel is limited to 450
% hours per week, and the machines have a weekly capacity of 850
% hours. Storage space for up to 1000 trays is available. Which
% quantities of the different glass types need to be produced in
% every period to minimize the total cost of production and storage?
%
% Data for the six glass types
%
% +--+----------+-------+-------+-----+----------+-----------+-------+
% | |Production|Storage|Initial|Final| | |Storage|
% | | cost | cost | stock |stock|Timeworker|Timemachine| space |
% +--+----------+-------+-------+-----+----------+-----------+-------+
% |V1| 100 | 25 | 50 | 10 | 3 | 2 | 4 |
% |V2| 80 | 28 | 20 | 10 | 3 | 1 | 5 |
% |V3| 110 | 25 | 0 | 10 | 3 | 4 | 5 |
% |V4| 90 | 27 | 15 | 10 | 2 | 8 | 6 |
% |V5| 200 | 10 | 0 | 10 | 4 | 11 | 4 |
% |V6| 140 | 20 | 10 | 10 | 4 | 9 | 9 |
% +--+----------+-------+-------+-----+----------+-----------+-------+
%
% VARIABLES
%
% demand Weekly demand of V1-V6
% workermax The staffs weekly capacity in hours
% machinemax The machines weekly capacity in hours
% maxstorage Maximal storage space
% productioncost Cost to produce a batch of a glasstype.
% storagecost Cost to store a batch of a glasstype
% initialstock Initial stock of glasstypes
% finalstock Required final stock
% timeworker Personnel-time required for a batch
% timemachine Machine-time required for a batch
% storagespace Space required by batch in storage
%
% RESULTS
%
% for an interpretation of the results, try
% Result = productionofdrinkingglassesEx(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 Oct 17, 2005. Last modified Oct 17, 2005.
function Result = productionofdrinkingglassesEx(PriLev)
if nargin < 1
PriLev = 1;
end
demand = [20 22 18 35 17 19 23 20 29 30 28 32;...
17 19 23 20 11 10 12 34 21 23 30 12;...
18 35 17 10 9 21 23 15 10 0 13 17;...
31 45 24 38 41 20 19 37 28 12 30 37;...
23 20 23 15 10 22 18 30 28 7 15 10;...
22 18 20 19 18 35 0 28 12 30 21 23];
workermax = 450; % Modified from 390, otherwise infeasible
machinemax = 850;
maxstorage = 1000;
productioncost = [100;80;110;90;200;140];
storagecost = [25;28;25;27;10;20];
initialstock = [50;20;0;15;0;10];
finalstock = [10;10;10;10;10;10];
timeworker = [3;3;3;2;4;4];
timemachine = [2;1;4;8;11;9];
storagespace = [4;5;5;6;4;9];
Prob = productionofdrinkingglasses(demand, workermax, machinemax, maxstorage...
, productioncost, storagecost, initialstock, finalstock, timeworker...
, timemachine, storagespace);
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
[g,w] = size(demand); % g = glass_types, W = weeks
temp = reshape(Result.x_k,g,2,w);
for i = 1:w,
disp(['results for week ' num2str(i) ':'])
for j = 1:g,
if temp(j,1,i) > 0,
disp([' ' num2str(temp(j,1,i)) ' batches of type ' num2str(j) ' should be produced' ])
end
if temp(j,2,i) > 0,
disp([' ' num2str(temp(j,2,i)) ' batches of type ' num2str(j) ' should be stored to next month' ])
end
end
end
end
% MODIFICATION LOG
%
% 051017 med Created.
% 060109 per Added documentation.
% 060125 per Moved disp to end
23.3 Material Requirement Planning
% function Result = materialrequirementplanningEx(PriLev)
%
% Creates a TOMLAB MIP problem for material requirement planning
%
% MATERIAL REQUIREMENT AND PLANNING
%
% The company Minorette produces two types of large toy lorries for
% children: blue removal vans and red tank lorries. Each of these
% lorries is assembled from thirteen items. See below for the
% breakdown of components and the table below for the prices of the
% components.
%
% Prices of components
%
%+----------+--------------+--------+----------+---------+-----------+
%| Wheel |Steel bar |Bumper | Chassis | Cabin |Door window|
%+----------+--------------+--------+----------+---------+-----------+
%| $ 0.30 | $ 1 |$ 0.20 | $ 0.80 | $ 2.75 | $ 0.10 |
%+----------+--------------+--------+----------+---------+-----------+
%|Windscreen|Blue container|Red tank|Blue motor|Red motor| Headlight |
%+----------+--------------+--------+----------+---------+-----------+
%| $ 0.29 | $ 2.60 | $ 3 | $ 1.65 | $ 1.65 | $ 0.15 |
%+----------+--------------+--------+----------+---------+-----------+
%
%
% Breakdown of components (Gozinto graph)
%
% Blue lorry
% (or red)
% |
% |
% |
% +-----------+---------------+----------+-----------+
% | | | | |
% 1| 1| 1| 1| 2|
% | | | | |
% Assembled Blue container Assembled Blue motor Headlight
% chassis (or red tank) cabin (or red)
% | |
% | |
% +-------+-----+ +------+-------+
% | | | | | |
% 2| 2| 1| 1| 2| 1|
% | | | | | |
% Bumper Axle Chassis Cabin Door Windscreen
% | window
% |
% +--+---+
% | |
% 2| 1|
% | |
% Wheel Steel bar
%
% The subsets (axles, chassis, blue or red cabin) may be assembled by
% the company using the components, or subcontracted. The following
% table lists the costs for assembling and for subcontracting these
% subsets, together with the capacities of the company. The assembly
% costs do not take into account the buying prices of their
% components.
%
% Subcontracting and assembly costs, assembly capacities
%
% +--------------+------+-----------------+---------------+----------+---------+
% | | Axle |Assembled chassis|Assembled cabin|Blue lorry|Red lorry|
% +--------------+------+-----------------+---------------+----------+---------+
% |Subcontracting|$12.75| $ 30 | $ 3 | - | - |
% |Assembly |$6.80 | $ 3.55 | $ 3.20 | $ 2.20 | $ 2.60|
% |Capacity | 600 | 4000 | 3000 | 4000 | 5000 |
% +--------------+------+-----------------+---------------+----------+---------+
%
% For the next month, Minorette has the same demand forecast of 3000
% pieces for the two types of lorries. At present, the company has no
% stock. Which quantities of the different items should Minorette buy
% or subcontract to satisfy the demand while minimizing the
% production cost?
%
% VARIABLES
%
% demand The demand for tank and container lorries
% compprices The price of the components
% subcontr Cost for using a subcontracter to assemble
% assembly Price for own assembly
% finalassembly Price for final assembly
% capacity Capacity to assemble components
% finalcapacity Capacity to assemble final step
% assemmat 12 first columns: component prices
% next 3 columns: subcontracter price
% next 3 columns: own assembly price
% last 2 columns: final assembly
%
% RESULTS
%
% For an interpretation of the results, try:
% Result = materialrequirementplanningEx(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 Oct 18, 2005. Last modified Oct 18, 2005.
function Result = materialrequirementplanningEx(PriLev)
if nargin < 1
PriLev = 1;
end
demand = [3000;3000];
compprices = [.3;1;.2;.8;2.75;.1;.29;2.6;3;1.65;1.65;.15];
subcontr = [12.75;30;3];
assembly = [6.8;3.55;3.20];
finalassembly = [2.2;2.6];
capacity = [600;4000;3000];
finalcapacity = [4000;5000];
%Buy preprod (12), Buy subcontr (3), assemble (3), finalass (2)
assemmat = [ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2 0 0 0 0;...
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0;...
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 -2 0 0 0;...
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -2 0 0 0;...
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0;...
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0;...
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -2 0 0;...
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -1 0 0;...
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 -1 -1;...
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -1 0;...
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -1;...
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 -1 -1;...
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -1 0;...
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -1;...
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 -2 -2];
Prob = materialrequirementplanning(demand, compprices, assemmat...
, subcontr, assembly, finalassembly, capacity, finalcapacity);
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
l = length(compprices);
l2 = length(subcontr);
l3 = length(assembly);
l4 = length(finalassembly);
buycomponent = Result.x_k(1 : l);
buysubcontracter = Result.x_k(1+l : l+l2);
buyassembly = Result.x_k(1+l+l2 : l+l2+l3);
buyfinalassembly = Result.x_k(1+l+l2+l3 : l+l2+l3+l4);
disp('Buy these components:')
for i = 1:l,
if buycomponent(i) > 0,
disp([' ' num2str(buycomponent(i)) ' units of type ' num2str(i) ])
end
end
disp('Use these subcontracters:')
for i = 1:l2,
if buysubcontracter(i) > 0,
disp([' ' num2str(buysubcontracter(i)) ' assemblies of type ' num2str(i) ])
end
end
disp('Do this assembly:')
for i = 1:l3,
if buyassembly(i) > 0,
disp([' ' num2str(buyassembly(i)) ' assemblies of type ' num2str(i) ])
end
end
disp('Do this final assembly:')
for i = 1:l4,
if buyfinalassembly(i) > 0,
disp([' ' num2str(buyfinalassembly(i)) ' assemblies of type ' num2str(i) ])
end
end
end
% MODIFICATION LOG
%
% 051018 med Created.
% 060110 per Added documentation.
% 060125 per Moved disp to end
23.4 Planning the production of electronic components
% function Result = planningtheprodofeleccompEx(PriLev)
%
% Creates a TOMLAB MIP problem for planning the production of
% electronic components
%
% PLANNING THE PRODUCTION OF ELECTRONIC COMPONENTS
%
% To augment its competitiveness a small business wishes to improve
% the production of its best selling products. One of its main
% activities is the production of cards with microchips and
% electronic badges. The company also produces the components for
% these cards and badges. Good planning of the production of these
% components therefore constitutes a decisive success factor for the
% company. The demand for components is internal in this case and
% hence easy to anticipate.
%
% For the next six months the production of four products with
% references X43-M1, X43-M2, Y54-N1, Y54-N2 is to be planned. The
% production of these components is sensitive to variations of the
% level of production, and every change leads to a non-negligible
% cost through controls and readjustments. The company therefore
% wishes to minimize the cost associated with these changes whilst
% also taking into account the production and storage costs.
%
% The demand data per time period, the production and storage costs,
% and the initial and desired final stock levels for every product
% are listed in the following table. When the production level
% changes, readjustments of the machines and controls have to be
% carried out for the current month. The cost incurred is
% proportional to the increase or reduction of the production
% compared to the preceding month. The cost for an increase of the
% production is $ 1 per unit but only $ 0.50 for a decrease of the
% production level.
%
% Data for the four products
%
% +------------------------------------+------------------+-------------+
% | Demands | Cost | Stock |
% +------+----+----+----+----+----+----+----------+-------+-------+-----+
% | Month| 1 | 2 | 3 | 4 | 5 | 6 |Production|Storage|Initial|Final|
% +------+----+----+----+----+----+----+----------+-------+-------+-----+
% |X43-M1|1500|3000|2000|4000|2000|2500| 20 | 0.4 | 10 | 50 |
% |X43-M2|1300| 800| 800|1000|1100| 900| 25 | 0.5 | 0 | 10 |
% |Y54-N1|2200|1500|2900|1800|1200|2100| 10 | 0.3 | 0 | 10 |
% |Y54-N2|1400|1600|1500|1000|1100|1200| 15 | 0.3 | 0 | 10 |
% +------+----+----+----+----+----+----+----------+-------+-------+-----+
%
% What is the production plan that minimizes the sum of costs
% incurred through changes of the production level, production
% and storage costs?
%
% VARIABLES
%
% demand the demand for each component and month
% prodcost Cost to produce a component
% storagecost Cost to store a component
% initialstock Initial stock
% finalstock Final stock
% increasecost, decreasecost Increase or decrease in cost
% when producing more or less this month
% than last month.
%
% RESULTS
%
% for an interpretation of the results, try:
% Result = planningtheprodofeleccompEx(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-2006 by Tomlab Optimization Inc., $Release: 5.1.0$
% Written Oct 18, 2005. Last modified Feb 3, 2006.
function Result = planningtheprodofeleccompEx(PriLev)
if nargin < 1
PriLev = 1;
end
demand = [1500 3000 2000 4000 2000 2500;...
1300 800 800 1000 1100 900;...
2200 1500 2900 1800 1200 2100;...
1400 1600 1500 1000 1100 1200];
prodcost = [20;25;10;15];
storagecost = [.4;.5;.3;.3];
initialstock = [10;0;50;0];
finalstock = [50;10;30;10];
increasecost = 1;
decreasecost = 0.5;
Prob = planningtheprodofeleccomp(demand, prodcost,...
storagecost, initialstock, finalstock, increasecost, decreasecost);
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
l1 = 10; % 4 components + 4 stockslots + increase + decrease
l2 = 6; % the number of time segments
temp = reshape(Result.x_k,l1,l2);
for month = 1:l2,
disp(['Solution for month ' num2str(month)])
disp(['produce ' num2str(temp( 1: 4,month)')])
disp(['stock ' num2str(temp( 5: 8,month)')])
disp(['increase ' num2str(temp( 9: 9,month)')])
disp(['decrease ' num2str(temp(10:10,month)')])
disp(' ')
end
end
% MODIFICATION LOG
%
% 051018 med Created.
% 060110 per Added documentation.
% 060125 per Moved disp to end
% 060203 med Removed printing of temp
23.5 Planning the Production of Fiberglass
% function Result = planningtheprodoffiberglassEx(PriLev)
%
% Creates a TOMLAB MIP problem for planning the production of
% fiber glass
%
% PLANNING THE PRODUCTION OF FIBERGLASS
%
% A company produces fiberglass by the cubic meter and wishes to plan
% its production for the next six weeks. The production capacity is
% limited, and this limit takes a different value in every time
% period. The weekly demand is known for the entire planning period.
% The production and storage costs also take different values
% depending on the time period. All data are listed in the following
% table.
%
% Data per week
%
% +----+------------+------+----------+-----------+
% | | Production |Demand|Production| Storage |
% |Week|capacity(m3)| (m3) |cost($/m3)|cost ($/m3)|
% +----+------------+------+----------+-----------+
% | 1 | 140 | 100 | 5 | 0.2 |
% | 2 | 100 | 120 | 8 | 0.3 |
% | 3 | 110 | 100 | 6 | 0.2 |
% | 4 | 100 | 90 | 6 | 0.25 |
% | 5 | 120 | 120 | 7 | 0.3 |
% | 6 | 100 | 110 | 6 | 0.4 |
% +----+------------+------+----------+-----------+
%
% Which is the production plan that minimizes the total cost of
% production and storage?
%
% VARIABLES
%
% capacity Production capacity over time
% demand Demand over time
% prodcost Cost to produce over time
% storcost Cost to store over time
%
% RESULTS
%
% For an interpretation of the results, try:
% Result = planningtheprodoffiberglassEx(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 Oct 18, 2005. Last modified Oct 18, 2005.
function Result = planningtheprodoffiberglassEx(PriLev)
if nargin < 1
PriLev = 1;
end
capacity = [140;100;110;100;120;100];
demand = [100;120;100; 90;120;110];
prodcost = [ 5; 8; 6; 6; 7; 6];
storcost = [ .2; .3; .2;.25; .3; .4];
Prob = planningtheprodoffiberglass(capacity, demand,...
prodcost, storcost);
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
times = length(capacity);
produce = Result.x_k(1:times);
store = [Result.x_k(times+1:end)' 0]';
for t = 1:times,
if produce(t) > 0 | store(t) > 0,
disp(['during month ' num2str(t) ])
if produce(t) > 0,
disp([' produce ' num2str(produce(t))])
end
if store(t) > 0,
disp([' store ' num2str(store(t)) ' to next month'])
end
end
end
end
% MODIFICATION LOG
%
% 051018 med Created.
% 060110 per Added documentation.
% 060125 per Moved disp to end
23.6 Assignment of production batches to machines
% function Result = assignmentofprodbatchestomEx(PriLev)
%
% Creates a TOMLAB MIP problem for assignment of production batches to machines
%
% ASSIGMNENT OF PRODUCTION BATCHES TO MACHINES
%
% Having determined a set of ten batches to be produced in the next
% period, a production manager is looking for the best assignment of
% these batches to the different machines in his workshop. The five
% available machines in the workshop may each process any of these
% batches, but since they are all models from different years of
% manufacture the speed with which they process the batches changes
% from one machine to another. Furthermore, due to maintenance
% periods and readjustments, every machine may only work a certain
% number of hours in the planning period. The table below lists the
% processing times of the production batches on all machines and the
% capacities of the machines.
%
% Processing durations and capacities (in hours)
%
% +-------+-----------------------------+--------+
% | | Production batches | |
% | +--+--+--+--+--+--+--+--+--+--+--------+
% |Machine| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|Capacity|
% +-------+--+--+--+--+--+--+--+--+--+--+--------+
% | 1 | 8|15|14|23| 8|16| 8|25| 9|17| 18 |
% | 2 |15| 7|23|22|11|11|12|10|17|16| 19 |
% | 3 |21|20| 6|22|24|10|24| 9|21|14| 25 |
% | 4 |20|11| 8|14| 9| 5| 6|19|19| 7| 19 |
% | 5 | 8|13|13|13|10|20|25|16|16|17| 20 |
% +-------+--+--+--+--+--+--+--+--+--+--+--------+
%
% The production cost of a batch depends on the machine that
% processes it. The hourly usage cost for every machine depends on
% its technology, its age, its consumption of consumables (such as
% electricity, machine oil) and the personnel required to operate it.
% These differences are amplified by the variation in the processing
% durations of a batch depending on the machine. The table below
% lists the production costs in thousand $. On which machine should
% each batch be executed if the production manager wishes to minimize
% the total cost of production?
%
% Production cost depending on the assignment (in k$)
%
% +-------+-----------------------------+
% | | Production batches |
% | +--+--+--+--+--+--+--+--+--+--+
% |Machine| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|
% +-------+--+--+--+--+--+--+--+--+--+--+
% | 1 |17|21|22|18|24|15|20|18|19|18|
% | 2 |23|16|21|16|17|16|19|25|18|21|
% | 3 |16|20|16|25|24|16|17|19|19|18|
% | 4 |19|19|22|22|20|16|19|17|21|19|
% | 5 |18|19|15|15|21|25|16|16|23|15|
% +-------+--+--+--+--+--+--+--+--+--+--+
%
% VARIABLES
%
% batches Hours needed to produce batches
% capacity Hours available per machine
% costs Cost to produce batches
%
% RESULTS
%
% For an interpretation of the results, use PriLev > 1, for example:
% Result = assignmentofprodbatchestomEx(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 Oct 18, 2005. Last modified Oct 18, 2005.
function Result = assignmentofprodbatchestomEx(PriLev)
if nargin < 1
PriLev = 1;
end
batches = [ 8 15 14 23 8 16 8 25 9 17;...
15 7 23 22 11 11 12 10 17 16;...
21 20 6 22 24 10 24 9 21 14;...
20 11 8 14 9 5 6 19 19 7;...
8 13 13 13 10 20 25 16 16 17];
capacity = [18 ;19 ;25 ;19 ;20];
costs = [17 21 22 18 24 15 20 18 19 18;...
23 16 21 16 17 16 19 25 18 21;...
16 20 16 25 24 16 17 19 19 18;...
19 19 22 22 20 16 19 17 21 19;...
18 19 15 15 21 25 16 16 23 15];
Prob = assignmentofprodbatchestom(batches, capacity, costs);
Result = tomRun('cplex', Prob, PriLev);
if PriLev > 1,
[m,b] = size(batches);
temp = reshape(Result.x_k,m,b);
for i = 1:m,
tempidx = find(temp(i,:)>0.5);
disp([' machine ' num2str(i) ' deals with ' num2str(tempidx)])
end
end
% MODIFICATION LOG
%
% 051018 med Created.
% 060111 per Added documentation.
% 060125 per Moved disp to end
« Previous « Start » Next »