Simulated annealing in lot sizing problems

Preview:

Citation preview

ARTICLE IN PRESS

Int. J. Production Economics 88 (2004) 173–181

$Paper presen

6–10, 2001, Loft

*Correspondin

288975.

E-mail addre

0925-5273/$ - see

doi:10.1016/j.ijpe

Simulated annealing in lot sizing problems$

Ou Tang*

Department of Production Economics, Link .oping Institute of Technology, SE-581 83 Link .oping, Sweden

Abstract

This paper provides a brief presentation of simulated annealing techniques and their application in lot sizing

problems. By using a binary matrix to describe lot sizing decisions, it is ready to model this type of production/

inventory system as a combinatorial optimisation problem and solve it within the simulated annealing framework.

Experiments are conducted in order to understand how different aspects of the algorithm, especially the annealing

schedule, affect the quality of the solution.

r 2003 Elsevier B.V. All rights reserved.

Keywords: Simulated annealing; Lot sizing; Multi-level system; Binary index

1. An introduction to the simulated annealing

algorithm

Simulated annealing was formally introduced in1983 (Kirkpatrick et al., 1983), for solving combi-natorial optimisation problems. It is motivated byan analogy to the thermodynamics of annealing insolids, such as growing silicon in the form of highlyordered, defect-free crystals. In order to accomplishthis, the material is annealed. It is first heated to atemperature that permits many molecules to movefreely with respect to each other, then it is cooledcarefully, slowly, until the material freezes into acrystal, which is completely ordered, and thus thesystem is at the state of minimum energy. Incombinatorial optimisation, simulated annealing

ted at the Fifth ISIR Summer School, August

ahammar, Sweden.

g author. Tel.: +46-13-281773; fax: +46-13-

ss: ou.tang@ipe.liu.se (O. Tang).

front matter r 2003 Elsevier B.V. All rights reserve

.2003.11.006

techniques use an analogous cooling operation fortransforming a poor, unordered solution into anordered, desirable solution, so as to optimise theobjective function.One essential factor of the annealing process is

the cooling schedule. Only a slow cooling ensuresthat a low energy state will be achieved. Ingradient-based minimisation algorithms such asthe Newton–Raphson algorithm, we allow onlydownhill moves and we always move downhill asfast as possible. However, the annealing algorithmtakes not only downhill moves, but also permitsuphill moves with an assigned probability depend-ing on the state temperature. Due to introducingof this artificial noise, it is more likely that thesolution set escapes from the traps of local optima(see Fig. 1). Thus, the simulated annealingtechnique is suitable for the optimisation problemwhere a desired global optimum is hidden amongmany, poor, local optima.To accomplish the above moves, the Metropolis

algorithm (Metropolis et al., 1953) is frequently

d.

ARTICLE IN PRESSC

ost

Configurations

Downhill move, always allowed

Uphill move, sometimes allowed

Fig. 1. Simulated annealing strategy in a minimisation pro-

blem.

O. Tang / Int. J. Production Economics 88 (2004) 173–181174

used. The probability of accepting uphill movefollows a Boltzman distribution e�DE=Tc ; whereDE is the change of energy and Tc the current statetemperature. Besides this probability, an anneal-ing algorithm also includes the following fourcomponents:

Configuration: A description of possible pro-blem solutions among which we search for anoptimal one. Very often, the decision variables aremultidimensional, discrete and have upper andlower bounds.

Cost function: An objective function to measurehow well the system performs when a certainconfiguration is given.

Move set: A generator of random changes in theconfiguration. It is a set of allowable moves thatwill reach all feasible configurations.

Cooling schedule: A definition of the coolingspeed to anneal the problem from a randomsolution to a good, frozen one. In its details, itmust provide a starting temperature, together withthe rules to determine when and how much thetemperature should be reduced and when anneal-ing should be terminated.From this introduction, it is clear that the

configuration and cost function are often attachedwith the nature (or simply a description) of theproblem. However, the other two components, themove set and cooling schedule require deeperinsights and some experience towards solving theactual problem. The quality of the simulatedannealing algorithm largely depends on the designof the move set and cooling schedule. The resultsare the trade-off between the convergent speed and

the quality of solution. A fast cooling scheduleoften ends up in a local optimum whereas a slowcooling schedule requires a tremendous computa-tion time.Finally, we would like to mention that simulated

annealing is a heuristic for optimisation. It is oftenclaimed to be a slow algorithm, due to its nature ofiterative improvement, i.e. many configurationsneed to be visited at many state temperatures inorder to obtain a good solution.

2. Description of lot sizing problems using a binary

matrix

We consider a discrete-time, multi-level produc-tion/inventory system with an assembly structureand one finished item. The total cost approach isapplied. External demand Dt; which is the demandof the finished item in period t is known inadvance. Backlogging is not allowed for any items.We also assume zero lead times for production/replenishments in order to simplify the problem.The planning horizon is n periods and there are m

items in the system. We also let dðiÞ be the set ofindices of immediate downstream items of item i:The objective is then to minimise the sum ofinventory holding and set-up costs

C ¼Xm

i¼1

Xn

t¼1

ðhi;tSi;t þ Ki;tai;tÞ; ð1Þ

with constraints

Si;t � Si;t�1 ¼ Pi;t � Di;t 8i; t; ð2Þ

Di;t

Dt;PkAdðiÞ Pk;t;

(if dðiÞ ¼ +

otherwise8i; t ; ð3Þ

Si;tX0;Pi;tX0 8i; t; ð4Þ

ai;tA 0; 1f g 8i; t; ð5Þ

where hi;t is the inventory holding cost, Ki;t the set-up cost, Si;t the ending inventory of item i inperiod t; Pi;t the amount of production/replenish-ment for item i in period t and the Di;t

corresponding requirements, including both exter-nal and internal demand. The parameter ai;t is abinary decision index which is unit if there is a

ARTICLE IN PRESS

O. Tang / Int. J. Production Economics 88 (2004) 173–181 175

set-up and zero otherwise. The first constraint(Eq. (2)) stands for the balance equation ofproduction/replenishment, inventory and demand.The second constraint (Eq. (3)) provides a formulato calculate the internal demand. This is a typicalformat of modelling the multi-level lot sizing issue,for instance in Crowston and Wagner (1973) whereeach item supplies at most one immediate down-stream item. This type of model finally ends upwith a mixed-integer programming problem.If the simulated annealing approach is applied

to solve the above problem, we would rather preferto consider the binary index as a decision variable.In this case, the relation between the binary indexand the replenishment decision needs to bediscussed.When there is a replenishment decision for the

finished item, it generates demand to its sub-components (upstream items), which is calledinternal demand. The internal demand relation-ship is often presented by the bill-of-materials(BOM), or alternatively by an input matrix(Grubbstr .om and Tang, 1999). The advantage ofapplying input matrix is that the minimum valueof internal demand of the lower-level items can beexploded immediately from the Leontief inverse.Regarding the replenishment decision, the inner

corner property is applicable when internal de-mand exists (a proof is given in Grubbstr .om andMolinder, 1996). It is stated that for two items with

an internal demand relationship, in the optimal

solution, the lower-level replenishments always must

lower level production

lead time

Fig. 2. Staircase functions for two items w

take place at the same time as some upper-level

replenishment and at that time (immediately prior to

the replenishment in question) both cumulative levels

coincide.

Geometrically, this means that the two stair-cases fit into each other at the ‘‘inner’’ cornerswhen lower-level replenishments take place(Fig. 2). This property immediately reduces thesolution space since the optimal replenishment hasto match the timing as well as the quantity ofinternal demand. Assuming there is always aninitial set-up for the first period, the total numberof staircase profiles satisfying the above property is2n�1: The problem is then to find the best staircase.In the multi-level assembly system, we collect

the binary indices from Eq. (1) into a matrix A

describing the setup decisions:

A ¼

a1;1 a1;2 y a1;n

a2;1 a2;2 y a2;n

^ ^ ^

am;1 am;2 y am;n

0BBB@

1CCCA: ð6Þ

In order to fulfil the inner corner property, weneed to have ai;tXaj;t if item i creates internaldemand for item j: This relation determines thetiming of setups as well as the size of thereplenishments. Assuming internal demand has aone-to-one relation, the lower-level cumulativereplenishment levels are related to the cumulativedemand of the finished item according to

%Pi;t ¼ ai;tþ1 %Dt þ ð1� ai;tþ1Þ %Pi;tþ1; ð7Þ

internal demand

upper level production

Time

ith an internal demand relationship.

ARTICLE IN PRESS

0011

0011

0011

0111

0001

0001

0011

0111

(a) Remove a setup

O. Tang / Int. J. Production Economics 88 (2004) 173–181176

where %Pi;t is the cumulative replenishment level ofthe lower-level item i in its tth period, and %Dt thecumulative demand of the finished item in its tthperiod. The cumulative replenishment level of acertain period depends on the setup decision forthe next period. It either equals the upper-levelcumulative replenishment level if there is a setup atthe next batch time, or otherwise it remains thesame quantity as before and after that batch time.At the end of the planning horizon, the inventoryfor the lower-level items must be zero in theoptimum, so that

%Pi;n ¼ %Dn: ð8Þ

Solving the difference (Eq. (7)) and considering theinitial condition (Eq. (8)), we finally obtain aclosed-form formula

%Pi;t ¼ ai;tþ1 %Dt þXn

j¼tþ1

ai;jþ1 %Dj

Yj

l¼iþ1

ð1� ai;lÞ; ð9Þ

where we also need to set ai;nþ1 ¼ 1 in order tomake the expression complete. Hence, replenish-ment level can be conveniently abandoned asdecision variables in favour of the binary indices.Now the solution procedure has changed: basedon the demand of finished item, a binary matrix isused to determine the cumulative replenishmentdecisions %Pi;t in Eq. (9), from which replenishmentdecision Pi;t is easily calculated since %Pi;t and Pi;t

are linearly related. The inventory levels and thetotal cost are then obtained according to Eqs. (1–3). Therefore, the original optimisation problem(Eqs. (1–5)) is equivalent to selecting an appro-priate binary matrix that minimises the objectivefunction (Eq. (1)). This binary matrix, from asimulated annealing viewpoint is the decisionconfiguration of the problem.

0001

0001

0001

0111

0001

0011

0011

0111

(b) Add a setup

Fig. 3. Examples of move sets where a32 has been randomly

selected.

3. Applying simulated annealing in lot sizing

problems

In this section, we put the lot sizing probleminto the framework of simulated annealing.Following the discussion in previous sections, itis straightforward to consider the binary matrix asthe decision variable and use it as the configura-

tion. The decision variables are apparently multi-dimensional. Its size depends on the planninghorizon and the number of items in the system.We also have Eq. (1) as the cost/energy func-

tion. After the configuration, the binary matrix isgiven, we can calculate the timing and volume ofproduction according to Eq. (9). Then we candetermine the inventory levels based on Eqs. (2)and (3) and finally obtain the total cost in Eq. (1).The move set depends on the design of the

simulated annealing algorithm. A simple but notso effective way is to randomly select an item and atime period, and then assign a set-up if there isnone previously, and vice versa. However, we mayneed some knowledge about the structure of themulti-level system. If there is an internal demandrelation between items, we must change the set-updecisions to the corresponding items so that theinner corner condition remains satisfied. Fig. 3illustrates a move set situation in a four-itemsystem with a series structure. Even though onlya32 has been randomly selected, a feasible moveinvolves either upper or lower level items.The most difficult part is the cooling schedule.

As stated by Davis (1987), determining an appro-priate annealing schedule for a given problem isfrequently a matter of trial and error. As a simplestarting point, we take reference from Rutenbar

ARTICLE IN PRESS

Table 2

Cooling schedule parameters

Low Medium High

Starting temperature T 25 50 100

Reducing rate R 0.8 0.4 0.2

Moves at

each temperature M

2 m n 4 m n 8 m n

O. Tang / Int. J. Production Economics 88 (2004) 173–181 177

(1989) and select a starting temperature so that thestarting accept rate is around 0.95. We alsopropose temperature reducing at a rate close to0.8–0.9. The number of moves at each temperatureapparently depends on the size of the binarymatrix. The simulated annealing stops either whenthe cost improvement as seen across severalsuccessive temperatures is sufficiently small, orwhen a total number of iterations have beenreached.

4. Design of computation experiments

The purpose of the experiments below is toillustrate and test the simulated annealing algo-rithm in lot sizing problems of single and simpleassembly structures. Our major concern is how thecooling schedule affects the solution quality. In themeantime, we also investigate the influences fromthe cost structure and the number of items in thesystem.We use a simple assembly structure (series

structure) with a one-to-one demand ratio. Theplanning horizon is n ¼ 12 periods. The number ofitem m varies among 1, 3 and 9. External demandis randomly generated and follows a uniformdistribution between 0 and 100. Table 1 shows theinventory holding cost and set-up cost, which areconstant over time.In order to study how the cooling schedule

affects the solution quality, we test differentstarting temperatures T ; temperature reducingrates R and the number of elements in the moveset at each temperature level. This number ofelement should depend on the complexity of thelot sizing problem, i.e. the number of items m andthe planning horizon n. We let the number ofelements be M m n; so that we can adjust the

Table 1

Inventory holding and set-up cost parameters

Item

1 2 3 4 5 6 7 8 9

Hi 10 1 10 10 1 10 10 1 10

Ki 100 10 10 100 10 10 100 10 10

computational time by changing M : The values ofthe above three factors are listed in Table 2. If weconsider a low cost change in which a set-up isremoved and the inventory hold cost is added forone period, we obtain the change of cost DC ¼jhD � K j ¼ j1 10� 50j ¼ 40: Thus the startingaccept rate is ¼ e�40=100 ¼ 67% when we let T ¼100: Based on the data in Table 1, each combina-tion will be replicated 10 times so that the totalnumber of experiments is 3 3 3 10=270. Inorder to keep the computation time within areasonable range, we also set an upper bound forthe number of iterations in the simulation anneal-ing algorithm. A preliminary test shows that3000 m is a reasonable value.The above simulation is repeated for the cases

when there are single, three and nine items in thesystem respectively, so that the impact fromsystem complexity is studied. The following threehypotheses are examined.

Hypothesis 1. There is no significant performancedifference from different starting temperatures T

tested.

Hypothesis 2. There is no significant performancedifference from different reducing rates R tested.

Hypothesis 3. There is no significant performancedifference from the number of elements in themove set at each temperature M :

As stated in Grubbstr .om (2001), the complexityof the lot sizing problem depends on the ratio ofinventory holding and set-up costs in the single-item system. Thus we investigate how the coststructure affects the solution quality in ourexamples. In this study, we only use a three-itemsystem and also adapt the best cooling schedule.

ARTICLE IN PRESS

O. Tang / Int. J. Production Economics 88 (2004) 173–181178

Each case will be replicated 50 times. The costparameters are illustrated in Table 3. We thenexamine the following hypothesis.

Hypothesis 4. There is no significant performancedifference if cost structure parameters, such as set-up costs and holding costs, change.

5. Results and discussions

We have run the experiments in a PC with aPentium II 400MHz processor. It took approxi-mately 8 and 40minutes to compute 270 examples

1200

1300

1400

1500

1600

1700

1800

1900

2000

0 20 40 60 80 100

Fig. 4. Cost vs. effective iterations.

Table 3

Cost structure parameters

K1 h1 K2 h2 K3 H3

Case 1 100 10 10 1 10 10

Case 2 100 10 10 10 10 1

Case 3 10 1 10 10 100 10

Case 4 10 1 100 10 10 10

Case 5 10 10 100 10 10 1

Case 6 10 10 10 1 100 1

Table 4

ANOVA results in single-item case

Source of variation Sum of squares Degree of fre

T 152956.30 2

R 111289.63 2

M 3400.74 2

T R 105390.37 4

T M 9145.93 4

R M 5079.26 4

T R M 16814.07 8

Error 1223250.00 243

in three-item and nine-item cases, respectively. Thecorresponding computation times for each exam-ple are 1.8 and 8.8 seconds, which are fairlyacceptable.Fig. 4 illustrates the annealing profile. Even

though we start with a very poor configuration, itshows that the cost reduces very quickly in thebeginning and then converges towards the mini-mum value. Essentially, most of the computationtime is spent during the late stage. In thisparticular example, there are close to 90 effectiveiterations among 3000 total iterations.The simulation results are studied by using the

analysis of variance (ANOVA) approach. This is astandard statistical method to study the effectsfrom two or more factors in simulation experi-ments (Montgomery, 1991). According to thisapproach, the hypotheses can be accepted orrejected with respect to results from testingstatistical significance. In Tables 4–6 the ratiobetween the mean square and the error of themean square provide the F -value, which is ameasure of how much variance is attributable tothe different factors (for example T ; R and M)versus the variance expected from random sam-pling. The F -value is then compared with thecritical value for the F statistic at 1% significanceF0:01; which can be obtained from a standardstatistic table. When the F -value is larger thanF0:01; we can conclude that the means across all theexperiment groups are not equal, therefore, weneed to reject the hypothesis.Following the above procedure, we examine our

experiment results. Concerning the solution qual-ity, the starting temperature is important as it isshown in Tables 4–6. We have to reject Hypothesis

edom Mean square F -value F0:01

76478.15 15.19 4.61

55644.81 11.05 4.61

1700.37 0.34 4.61

26347.59 5.23 3.32

2286.48 0.45 3.32

1269.81 0.25 3.32

2101.76 0.42 2.51

5033.95

ARTICLE IN PRESS

Table 5

ANOVA results in three-item case

Source of variation Sum of squares Degree of freedom Mean square F -value F0:01

T 165081.61 2 82540.80 15.48 4.61

R 96593.10 2 48296.55 9.06 4.61

M 6240.67 2 3120.34 0.59 4.61

T R 100967.61 4 25241.90 4.73 3.32

T M 20186.04 4 5046.51 0.95 3.32

R M 9804.01 4 2451.00 0.46 3.32

T R M 15055.27 8 1881.91 0.35 2.51

Error 1295782.90 243 5332.44

Table 6

ANOVA results in three-item case

Source of variation Sum of squares Degree of freedom Mean square F -value F0:01

T 372248.42 2 186124.21 9.26 4.61

R 406220.42 2 203110.21 10.11 4.61

M 8705.00 2 4352.50 0.22 4.61

T R 400940.56 4 100235.14 4.99 3.32

T M 4581.71 4 1145.43 0.06 3.32

R M 35956.44 4 8989.11 0.45 3.32

T R M 34935.51 8 4366.94 0.22 2.51

Error 4883677.30 243 20097.44

4260

4280

4300

4320

4340

4360

0 20 40 60 80 100 120

Fig. 5. Cost vs. starting temperature T in nine-item case.

4260

4280

4300

4320

4340

4360

0 0.2 0.4 0.6 0.8 1

Fig. 6. Cost vs. reducing rate R in nine-item case.

O. Tang / Int. J. Production Economics 88 (2004) 173–181 179

1 according to the F -values. It has also beenillustrated that a relative low starting temperatureshould end up with a high solution quality (Fig. 5).The explanation is that, in this case, the searchprocedure will converge quickly and most compu-tation time will be spent on small improvements inthe later stage. The best temperature 25 corre-sponds to a starting accept rate of ca 20%.According to the results in Tables 4–6, we have

to reject Hypothesis 2 as well. A fast reducing rate

often provides a better solution (Fig. 6). Similar tothe explanation concerning the starting tempera-ture, a fast cooling procedure is obtained here andsmall improvements have been highlighted interms of computation time. The risk of fastcooling, however as we have stated before, is thepossibility of getting trapped in a local optimum.We accept Hypothesis 3 due to the small

F -values in Tables 4–6. Compared with the othertwo factors in the cooling schedule, the number of

ARTICLE IN PRESS

4260

4280

4300

4320

4340

4360

0 2 4 6 8 10

Fig. 7. Cost vs. moves at each temperature M in nine-item case.

Table 7

ANOVA results in terms of cost structure

Source of variation Sum of squares Degree of freedom Mean square F -value F0:01

Cost structure 32124.22 5 6424.843 1.562249 3.02

Error 1209093.00 294 4112.561

O. Tang / Int. J. Production Economics 88 (2004) 173–181180

moves at each temperature has a small impact onthe final results. Should the moves be linear withthe size of our binary matrix, they will reduce thecomplexity of the algorithm for large multi-levelsystems without any loss of solution quality.When we repeat the experiment for systems with

different numbers of items, the results alwayssupport the above conclusions concerning the cool-ing schedule (cf. Tables 4–6). To assist the aboveconclusion, we also plot the objective function as aresponse of different factors for a nine-item case inFigs. 5–7. Nevertheless, those curves in one-item andthree-item cases follow the same profile. Our currentstudy is limited to a simple series system. Furtherstudies for other types of multi-level systems, forinstance general assembly systems with severalfinished items, should be of interest.Finally, it is shown that the cost structure has a

minor influence on the solution quality (Table 7).We should accept Hypothesis 4. This providesflexibility to the algorithm, since the cost para-meter in the system is not an important issue inthis case.

6. Summary and future studies

Above, we have presented a method to solve lotsizing problem using a simulated annealing algo-rithm. Experiments have been conducted in order

to select an appropriate annealing schedule. It isshown that the lot sizing model very well fits intothe simulated annealing framework after we haveapplied a binary matrix to represent the decisionconfiguration. The advantage of this solutionprocedure is its flexibility. For instance, it is easyto handle a system with inventory costs varyingover time. Even though we have just investigatedthe case of internal demand with a series structures,it should not be difficult to extend the algorithm toother assembly structure. A simple way is to modifythe module concerning the move set in the program.When we use this method to deal with a practical

lot sizing problem, an appropriate cooling schedulecan be obtained after some experiments. Eventhough simulated annealing methods are oftenclaimed to be slow, it is still possible to improvethe efficiency by better coding, for instance usingparallel annealing (Rutenbar, 1989) or by applyinghybrid algorithms starting with a fast heuristic lotsizing model and then continuing with simulatedannealing (Rose et al., 1990). One disadvantage ofsimulated annealing is that it is less transparent tousers. We may often lose insight into the lot sizingproblem by applying this solution method.Concerning future studies, it could be of interest

to investigate the possibility of solving lot sizingproblem applying other computational intelligentmethods, such as the Genetic Algorithm. Suchwork has already been carried out by someresearchers, e.g. Dellaert and Jeunet (2000). Acomparative study of different methods would beimportant.

Acknowledgements

The author is indebted to the two anonymousreferees for their valuable comments and sugges-tions that contributed significantly to the im-proved content of the paper.

ARTICLE IN PRESS

O. Tang / Int. J. Production Economics 88 (2004) 173–181 181

References

Crowston, W.B., Wagner, M.H., 1973. Dynamic lot size

models for multi-stage assembly systems. Management

Science 20 (1), 14–21.

Davis, L., 1987. Genetic Algorithms and Simulated Annealing.

Pitman, London.

Dellaert, N., Jeunet, J., 2000. Solving large unconstrained

multilevel lot-sizing problems using a hybrid genetic

algorithm. International Journal of Production Research

38 (5), 1083–1099.

Grubbstr.om, R.W., 2001. The Triple Algorithm for Dynamic

Lotsizing—Complexity Considerations, Keynote Address,

Sixteenth International Conference on Production Re-

search, Prague, The Czech Republic, July 29–August 3.

Grubbstr.om, R.W., Molinder, A., 1996. Safety stock plans in

MRP-systems using transform methodology. International

Journal of Production Economics 46–47, 297–309.

Grubbstr .om, R.W., Tang, O., 1999. Further developments on

safety stock in an MRP system applying Laplace transforms

and input–output analysis. International Journal of Produc-

tion Economics 60–61, 381–387.

Kirkpatrick, S., Gelatt, C.D., Vecchi, M.P., 1983. Optimization

by simulated annealing. Science 220, 671–680.

Metropolis, N., Rosenbluth, A., Rosenbluth, N., Teller, A.,

Teller, E., 1953. Equation of state calculations by fast comput-

ing machines. Journal of Chemical Physics 21, 1087–1092.

Montgomery, D.C., 1991. Design and Analysis of Experiments.

Wiley, New York.

Rose, J., Klebsch, W., Wolf, J., 1990. Temperature measure-

ment and equilibrium dynamics of simulated annealing

placement. IEEE Transactions on Computer-Aided Design

9 (9), 253–259.

Rutenbar, R.B., 1989. Simulated annealing algorithms: An

overview. IEEE Circuits and Devices Magazine (January),

pp. 19–26.

Recommended