Document not found! Please try again

Solving a Quadratic Program arising in Capacitated

0 downloads 0 Views 205KB Size Report
Oct 28, 1996 - 6400, Molde, Norway .... in a way that easily can be used to substitute the demand variables out of the ... We do this by using the elimination.
Solving a Quadratic Program arising in Capacitated Lot Sizing Kjetil K. Haugen Applied Economics The Foundation for Scientic and Industrial Research at the Norwegian Institute of Technology N-7034 Trondheim, Norway E-mail: [email protected] Bj rn Nygreen Department of Industrial Economics and Technology Management Norwegian University of Science and Technology N-7034 Trondheim, Norway E-mail: [email protected] Asmund Olstad M re og Romsdal Regional College 6400, Molde, Norway E-mail: [email protected] Mon 28.10.1996 Abstract

This paper describes an algorithm for a quadratic programming problem with a special structure. The algorithm is implemented and tested against standard commercial mathematical programming code { MINOS version 5.2. The algorithm competes favorably against MINOS. The quadratic programming problem arises as a sub-problem in a prot maximizing version of the Capacitated Lot Sizing Problem (CLSP).

1

1 Introduction Various authors have presented solution alternatives for the Capacitated Lot-Size Problem (CLSP) - see for instance 1], 3], 6]. This problem focuses on the trade o between holding and setup costs with scarce production capacity in a multi-item environment. Many of the proposed exact and heuristic methods have been based on decomposition and relaxation of the capacity constraints. The work of Van Wassenhove and Thizy 4] is a typical example of such approaches. The reason for the popularity of heuristics based on similar procedures is evident, as Wagner and Whitin 7] (later extended by Eppen et. al. 2] ) proposed an algorithm for the Uncapacitated Lot-Size Problem in the late fties. This algorithm is based on a forward Dynamic Programming approach with the inclusion of a set of planning horizon theorems. This algorithm is very e ective and hence utilizing a decomposition structure where sub-problems may be solved by this algorithm, is very appealing. Event though substantial e ort have been put into the task of constructing heuristic and/or exact methods for such problems, it is hard to see that the proposed methods constitute a "nal solution" to the CLSP problem. This paper deals with a di erent approach. A signicant contribution by Thomas 5] proposes an algorithm for an augmented version of the Uncapacitated Lot Size Problem. Here, the demand is assumed dependent on the prices in each period { by demand functions. These prices then increase the decision space of the model, simultaneously enhancing the degrees of freedom. Thomas proposes an algorithm based on the "Wagner/Whitin-principles" which turns out to have the same order of complexity. (Actually this algorithm should need around twice the numerical work as that of Wagner/Whitin.) Our basic idea is to extend these principles into the capacitated case. It seems sensible to assume { at least in certain cases { that the pricing instrument may be used to "smoothe" a violated production constraint. That is if we solve the uncapacitated problem, and one or several production capacity constraints are violated, we may immediately nd a feasible solution to the full problem by a price manipulation strategy. It should be possible to utilize such a fact in the construction of an algorithm which should behave di erently and possibly better than in the strict cost-minimizing (CLSP) case.

2 The original quadratic program This paper deals with a certain set of sub-problems which arise in the setting described above. When the integer part of the problem is xed, the following problems arise:1 Whichever method we actually intend to use in order to solve the 1

We restrict ourselves to the single product case to make things as simple as possible.

2

full problem, the ability to solve the problems dened in this section as fast as possible is of critical importance.

Problem data: T i0 rt ht vt t t

= = = = = = =

time horizon starting inventory in period 0, i0 0 maximal production capacity in period t, rt 0 8t unit inventory holding cost in period t, ht > 0 8t unit production costs in period t, 0 < vt < t=t 8t demand if price is zero in period t, t > 0 8t proportional part of demand function in period t, t > 0 8t

(1)

Decision variables: xt pt dt it Z

= = = = =

amount to be produced in period t, 8t unit selling price in period t, 8t demand in period t, 8t ending inventory in period t, 8t net revenue (objective) to be maximised

(2)

Objective and constraints: max Z = subject to

T X t=1

dtpt ; htit ; vtxt]

xt + it;1 ; it = dt dt = t ; tpt xt  rt xt 0 pt 0 dt 0 it 0

Comments

8t 8t 8t 8t 8t 8t 8t

(3)

(4)

We have here a multi period problem formulated with 4 sets of non-negative variables. We have assumed that the demand is a linear function of the selling price, and that demand and production is the only way to change the inventory level. The objective is to maximize the di erence between the sales revenue and the holding and production costs. The production constraints are very simple, they consist only of upper bounds on the production in each period. These bounds may vary from period to period, and some may be zero. The upper bound specied for 3

vt in (1), is such that for every period, the unit production cost is assumed less than

the maximal price that gives positive demand. All the constraints are linear and the objective is quadratic, so we have a quadratic program. If the demand equations are used to eliminate the demand variables from the objective, we see that the only non-linear terms in the formulation are negative p2t terms in the objective. The objective is therefore concave and we have a convex problem. The problem as such is easy to solve by an algorithm for quadratic programming, by an algorithm for general convex non-linear programming or by an algorithm for linear programming after piece-wise linearization. But we will show that the structure of the problem can be utilized to solve it by a specialized algorithm.

3 Reducing the number of explicit variables

In order to get a formulation, that is easier to treat analytically we eliminate it and dt as explicit variables from (3) - (4). The demand equations are already written in a way that easily can be used to substitute the demand variables out of the formulation. The inventory balances need to be used recursively after eliminating the demand variables to get the following explicit expression for each inventory variable:

it = i0 +

t X j =1

xj ; (j ; j pj )]

(5)

We dene some new constants by the equations we use to calculate them:

! t X t = j ; i0 8t

(6)

j =1

t = t ; t

T X j =t

hj 8t

(7)

T X

t = vt + hj > 0 8t j =t "X !# X T T T X = t hj ; i0 ht t=1

j =t

We use these constants and the fact that: t T X X t=1 j =1

atbj =

T X T X t=1 j =t

t=1

aj bt

together with (3) - (5) to rewrite our problem as: 4

(8) (9)

(10)

T X   max Z = tpt ; tp2t ; txt +  t=1

subject to

(11)

xt  rt 8t xt 0 8t pt 0 8t

(12)

dt 0 ) pt  t > 0 8t

(13)

We have here eliminated the inventory and demand variables, together with the equations we used to eliminate them. But we have so far also eliminated their non-negativity constraints. To keep the original feasible region, we need to take these constraints into the formulation again. We do this by using the elimination equations as inequality constraints. t

it 0 )

t X j =1

xj +

t X j =1

j pj t 8t

(14)

The formulation, (11) - (14), has to sets of variables, all with explicit lower and upper bounds and one type of multi term linear constraints. The objective is linear in one of the variable types and quadratic, only with square terms, in the other variable type.

4 The decomposed reformulation 4.1 Aggregation

Our problem as formulated in (11) - (14) contains two sets of variables, pt and xt. Of the constraints, only the last one has variables from more than one period. But both the variable sets are present there. It is possible to get only one variable from each period in these constraints by dening a new set of variables. This can be regarded as a form of aggregating. Dene

yt = xt + tpt 8t

(15) In the original formulation of the problem, we assumed that the demand decreased with increased price, t > 0. This assumption together with the bounds on xt and pt given by (12) - (13), give the following redundant bounds on the aggregated variables: yt 0 8t (16) y  r +  8t t

t

5

t

To get fewer variables in the main constraints, we need to use the yt variables there. To avoid getting more variables in all, we have to use (15) to eliminate either xt or pt . We have chosen to eliminate xt. But we need to keep the bounds on xt expressed as constraints on pt and yt. We use (12), (13) and (15) to express these constraints as bounds on pt that depends on yt in the following way:

 y   y ;r  t t  pt  min t t 8t max 0  t

t

t

(17)

Later, it will be more convenient to work with a minimization problem, so we change the optimization direction by dening a new objective, z, by:

z = ;Z + 

(18) This denition also remove the constant term from the objective we are going to use. From (11), (15) and (18) we get the new objective expressed as: T X  2  min z = tpt ; (t + tt) pt + tyt t=1

(19)

Our problem formulation, now consist of the objective (19), the multi terms constraints (14) after substituting in yt for xt and pt, the explicit bounds on yt, (16), and the bounds on pt, (17), that depends on yt. Even if the bounds on yt were redundant, when they were dened, they are needed now, to ensure feasible values for pt given by (17). > From this formulation it seems reasonable to try to nd optimal values of pt as functions of yt in all the periods before the problem of nding the optimal values for yt is solved. Doing this results in a decomposition of the total problem.

4.2 Formulation of the sub problems

Since each pt depends only on one yt, and the objective is additive in the contributions from di erent ( pt , yt) - pairs, the sub problem decomposes into a sub problem for each period. The objective in the sub problems will be to nd the optimal pt for every possible yt. This means that the problems need to be formulated in a way that makes it possible to solve them with yt as parameter. Since we will look at one period at a time, we will not write 8t after each expression even if it is valid for all periods. We now dene a function for the contribution to the objective from each period.

gt(yt pt) = tp2t ; t + tt] pt + tyt

We then dene: pt (yt) = value of pt that for given yt minimises gt (yt pt) ft (yt) = gtyt pt (yt)] 6

(20) (21)

The sub problem for period t can then be formulated as:

  y   y ;r  t t  pt  min t t (22) ft(yt) = min gt(yt pt ) j max 0  p t t t This problem has at least one feasible solution for all yt within the bounds given 

t

by (16).

4.3 Formulation of the master problem We can now state the overall master problem as: min z = subject to t X j =1

T X t=1

ft (yt)

yj t 8t

0  yt  rt + t 8t This problem has at least one feasible solution if: t X j =1

(rj + j ) t 8t

(23)

(24) (25) (26)

> From (6) we see that this is always true. If the production capacities is zero in many periods, it is possible to force the demand down to zero by increasing the price. If we are able to solve the parametric minimization problems dened by (22) in a simple way, the latter minimization may prove simpler to deal with than the full problem. This is the case here.

5 Solving the parametric sub problems We start this section by rewriting the sub problems in the following way:

ft(yt) = min gt (yt pt) p

(27)

pt 0 pt (yt ; rt) =t pt  yt=t pt  t=t

(28)

t

where gt(yt pt) is given by (20).

7

For each t these problems have to be 2solved parametricaly for yt in the interval @g given by (25). From (20) we see that @@pg2 > 0 so that @p = 0 gives the pt that minimizes ft(pt) if this is not in conict with the bounds in (28). This price, p+t , is given by: @gt = 0 ) p+ = t + tt (29) t @pt 2t The parametric solution of this problem depends on whether p+t is feasible for some values of yt or not. From (28) we see that if t=t < p+t , then p+t is not a feasible solution. From (29), (7) and (8) we see that this is equivalent to if t < tvt or not. But we have assumed in (1) that t > tvt. This means that p+t is feasible for at least one value of yt for every period. Without this assumption, we would have needed to treat t tvt as a separate case. This would not have changed the main steps in the algorithm we propose in this paper. t

t

t

t

5.1 The solutions for p (t) and dfdy(y ) t

t

t

> From (27) - (29) we see that it is possible to get @g @p = 0 for some values of yt, @g while the sign of @p is either positive or negative for all feasible values of pt for other values of yt. We want a value of pt equal to p+t . If that is not possible, we chose a feasible value for pt that is as close to the wanted value as possible. t t

t

t

8   yt=t for yt 2 0 tp+t < for yt 2 tp+t rt + tp+t  pt (yt) = : p+t yt ; rt] =t for yt 2 rt + tp+t rt + t

(30)

8  + 2 y for y < t ; t ] =t t 2 0 t pt dft(yt) =  + + for y t t 2  t pt rt + t pt dyt : 2yt ; (t + 2rt)] =t for yt 2 rt + tp+ rt + t t

(31)

When this expression is substituted into (20), we get the solution for ft (yt). We are going to use this when we later solve the master problem. There we will only be needing the derivative of ft (yt), so we skip the expression for the function and only give the expression for its derivative:

We see that dfdy(y ) consists of 3 linear pieces. The middle piece is a constant function, while the other two are increasing. From (29) we see that if t 0, then df (y ) = 0, for a yt in the rst interval. If t < 0, then dfdy(y ) > 0 for all feasible yt. dy From (7), (8) and (31) it follows that dfdy(y ) is a continuous function of yt. > From (28) we see that if rt = 0, then there is no room for optimization and we then get: rt = 0 ) pt = yt (32) t

t

t

t

t

t

t

t

t

t

t

t

t

8

This is the same we get from (30) with rt = 0. Then the middle interval disappear and the other two get equal. The same happen with dfdy(y ) . t

t

t

5.2 Upper bounds on dfdy(y ) t

t

t

Equations (31) and (7) give the following expression for the maximal value of the derivative: T X  df t t (yt ) (33) max dy =  + hj t

t

j =t

If our data is such the maximal price for positive demand in each period increase less with time than the holding cost in the period, that is if:

t + h > t+1 t t t+1

(34)

then it follows that the maximal derivative decreases with time, that is: (yt+1) t (yt) > max dft+1 (35) max dfdy dy t

t+1

6 Solving the master problem The master problem is formulated in (23) - (25). We used the explicit bounds on yt to solve the sub problems analytically for all possible yt. While doing that, we found that all ft(yt) have a minimum for a positive yt, when t > 0. In such cases we do not need the lower bound on yt while we solve the master problem. But we need the bound for t < 0. Imagine for a moment that we have solved a smaller problem, where (t ; 1) was the last period. If we then want to nd the solution to a problem where t is the last period, we will do this as cheap as possible. This means that we will increase df (y ) the yj 's for j  t that have the smallest dy , until constraint (24) is true for t. > From (6) we see that maximal needed increase in the yj 's together is t. From the bounds on yt we see that it is feasible to only increase yt. If the data is such that (34) holds for all t, we know that if we only increase yt, then the derivative in this period will be less than the maximal possible derivatives in the earlier periods. As long as we increase the variables as cheap as possible, we will then never come in a conict with the upper bounds. That means that we do not need the upper bounds on yt if (34) holds for all t. If the data violate the constraint for some t, then we need to keep the upper bounds on yt. > From the reasoning in this section it also follows that if we do not get any yt at upper bound, then the derivative will decrease weakly with increasing time. j

j

j

9

6.1 How to increase yj when a derivative is constant

We will always increase the yj 's with the smallest derivative. If there is a smallest derivative that do not increase with increasing yj , then this derivative will continue to be smallest if we increase yj . If such a yj exist, we therefore increase the yj until the constraint is satised or the derivative start to increase.

6.2 How to increase yj when no derivative is constant

When we now increase the yj 's (one or more) with the smallest derivative, the smallest derivative will also increase. If there are more than one yj that have the smallest derivative, we need to increase them in such a way that their derivatives continue to be equal. To achieve this, we need some new variables, which we dene here.

New variables t O N B M

= = = = =

dft (yt ) dyt

Old value of used to udate the yj 's New value of to be used to update the yj 's Current upper bound on Current index set for the yj 's to update

We have here dened M as a variable because the content of the set changes from iteration to iteration. When we substitute t for dfdy(y ) in (31) and use it to express yt as a function of t, we get: t

t

t

8 for t 2 0 ti < = (t=+2) t + t=+2] yt : 2 tpt rt + tpt for t = t = (t=2) t + (rt + t=2)] for t 2 ht (2t ; t) =t]

(36)

We have treated the middle case in the previous section., so here we can say that yt = 2t ( N ; O) (37) We do not want to increase the yt's more than needed, so we want constraint (24) to hold as an equation. If the indices for all the yj 's with the smallest j 's have been put into the set M , we can rewrite constraint (24) in the following way:

X j 2M

yj +

t X j =1

yj = t

Solving the last two equations for N gives: 10

(38)

t ; Ptj=1 yj = + P  N

(39)

O

j

j 2M 2

Even if we have data such that we never reach the upper bound on any t , we can not be sure that (39) gives a correct solution. If N is greater than a k with k 2= M or there is an i 2 M with O < i < N , then we need to stop the increasing of the j 's before they reach N . From the j 's for j 2 M and the j 's for j 2= M , weP can nd an upper bound, B, on N , for which (37) gives the cheapest increase in tj=1 yj . We therefore need to replace the last equation with:

(

t ; Ptj=1 yj N B O = min + P 

)

j

where

j 2M 2

 = min min iji > min f k jk  tg i2M k2 =M B





O



(40) (41)

After calculating N , we can update the yj by (37). If this does not give large enough increases in the variables, then we need a new iteration with a changed M .

7 An algorithm for the total problem We have solved the sub problems analytically and said how the master problem in principle should be solved. Here we use this, to give the main parts of an algorithm that nds an optimal (numerical) solution for the total problem. We have used upper bounds on yt and t in our implementation, but we leave those out in this presentation, because they are not binding for reasonable data. Neither will we treat the cases where rt = 0 as special cases even if we have done that in our program. Our implementation also takes care of the case where t < tvt, which we here have assumed is not true. We present the algorithm by rst giving pseudo code for a possible main program. We will afterwards give some comments and say what the subroutines should do without using pseudo code for them. We have assumed that all indexed program variables are available in all sub routines without being a call parameter.

11

program qp call init

sum := 0 for t:=1 to tmax do yval(t) := max(0,phi(t)/2) piold := (2*yval(t)-phi(t))/beta(t) intv(t):= 1 sum := sum + yval(t) gsum := gamma(t) - sum rst:= true while ( gsum > 0 ) do if (rst) then call fpi0(bsum,itheta,jrst,pibound,t) rst := false

else

call fpiup(bsum,itheta,jrst,pibound,t) endif if ( itheta > 0 ) then call update2(bsum,gsum,itheta,sum) else

end

piold := theta(itheta)

pinew := min( pibound , piold + gsum/bsum ) call update13(bsum,gsum,jrst,piold,pinew,sum,t) piold := pinew

endif endwhile endfor call nish

The meaning of the variables used in the pseudo code and not explained in the following, should follow from the mathematical description. Since we have assumed that none of the upper bounds will be binding, the set M consists of all the indices from a starting index, jrst, and up to and including the current period index, t. In init we read the original data and calculate all the needed coecients. The program uses yval for y and sum to hold the current sum of all the yval's. The current interval number, which of the linear pieces, for all the yval's are hold in intv. The numerator in the second right hand side term in (39) is hold in gsum, while the denominator is hold in bsum. For each period, t, we start by setting yval equal to the value that makes pi equal to its smallest possible non-negative value. We know that this value is in interval 1, so we set intv equal to one. The routines fpi0 and fpiup do more or less the same, but the work is a bit di erent when we start with a new t. 12

Both the routines nd bsum, itheta (the index j 2 jrst,t] for a period where pi(j) = theta(j), 0 if no such period exist), jrst (the smallest j for which pi(j) = pi(t)), and pibound (the upper bound on the new pi (pinew)). In update2, we increase yval(itheta) as much as needed or as much as we can without going out of interval 2. We then update sum and gsum. If we reach the end of interval 2, then we update intv(itheta) and bsum. In update13, we increase all the pi(j) and yval(j) in interval 1 or 3 for j2 jrst,t]. We then update sum and gsum. If for any j, we have got a pi(j) = theta(j), then we set intv(j) equal to 2 and update bsum. In nish, we rst split each yt into pt and xt. Then we print the results.

8 Computational tests 8.1 Implementation

The algorithm was implemented in standard Fortran 77 and executed on a 25MhzSX 486 PC without math coprocessor2 . The reference optimizer was MINOS version 5.2 executed on the same PC with GAMS as matrix generator.

8.2 Numerical results

Some simple numerical tests are given in table 1. The time measurements are recorded total time in seconds and are hence not optimal from a measurement point of view. However, they indicate strong dominance in favor of our code. Table 1: A comparison between our code and GAMS/MINOS. 1 2 3 4 5 6 7 8 9 Our Code 3 2.5 2 1.5 2 2.5 3 4 5 GAMS/MINOS 45 38 22 68 111 157 - - The cases 1-5 are more or less random data while the cases 6 to 9 are versions where the number of time periods are gradually increased from 55 to 803. These cases data are based on the data in case 5. The other cases 1-5 have 50 time periods. The dashes in cases 7, 8 and 9 for GAMS/MINOS indicates unobtainable solutions4. The code was executed without DOS-extension possibilities to make a fair comparison against GAMS/MINOS 3 Case 6 has 55 time periods while case 7, 8 and 9 have 60, 70 and 80 time periods respectively. 4 The reason for this is lack of memory on the PC used for testing. MINOS is called directly from GAMS without DOS-extender such that the available memory is merely 580K. It is possible to tune MINOS 5.2 to solve these cases as well, but we have not put any e ort into that task. 2

13

9 Conclusion and suggestions for further work 9.1 Conclusion

We have demonstrated that a special algorithm may compete favorably against commercial MP software for a quadratic programming problem with a special structure arising as a sub problem in capacitated Lot Sizing. Even though the actual numerical testing was not substantial, the results indicate strong dominance in favor of our algorithm. The original reason for examining this problem was the fact that it arose as a sub problem in CLSP when the integer part of the problem is xed. Alternatively, one may look at the problem di erently. As discussed earlier, Thomas 5] proposed an algorithm for a prot maximizing single item uncapacitated Lot Size Problem in 1970. The actual di erence between his problem and our problem is the absence of set-up costs in our problem and the absence of capacity constraints in Thomas' version. Hence, our problem may be viewed as an augmented version (inclusion of periodic capacity constraints) of Thomas' problem under the assumption of negligible set-up costs. As modern exible manufacturing techniques develop, one may argue that the importance of set-up costs may decrease. As a consequence our problem may be of interest in a wider context.

9.2 Suggestions for further work

Obviously, we plan to establish an algorithm for a prot maximizing version of the CLSP. In such a process it is natural to investigate the multi item case. If the products do not share production (or storage) capacity and if the demand functions are independent between products, this case is simple. Each product may be solved independently by our algorithm. However, if any linkage between the products exist, alternative solution procedures must be applied. Still, one may investigate decomposition methods which try to utilize our algorithm or modied versions of it.

References 1] B. P. Dzielinski and R. E. Gomory. Optimal programming of lot sizes, inventory and labor allocations. Management Science, 11:874{890, 1965. 2] G. D. Eppen, F. J. Gould, and B. P. Pashihian. Extensions of the planning horizon theorem in the dynamic economic lot size model. Management Science, 15:268{277, 1969. 3] L. S. Lasdon and R. C. Terjung. An ecient algorithm for multi-itemscheduling. Operations Research, 19:946{969, 1971. 14

4] J. M. Thizy and L. N. Van Wassenhove. Lagrangian relaxation for the multi-item capacitated lot-sizing problem. a heuristic implementation. IIE Transactions, 17:308{313, 1985. 5] J. Thomas. Price-production decisions with deterministic demand. Management Science, 16:747{750, 1970. 6] Trigeiro, Thomas, and McClain. Capacitated lot sizing with setup times. Management Science, 3, 1989. 7] H. M. Wagner and T. M. Whitin. Dynamic version of the economic lot size formula. Management Science, 5:89{96, 1958.

15

Suggest Documents