From: AAAI Technical Report SS-92-01. Compilation copyright © 1992, AAAI (www.aaai.org). All rights reserved. Global planning of several plants Sylvie Bescos BIM sa/nv Kwikstraat,4 B-3078 Everberg (Belgium) e-mail: sb@sunbim.be need for the phone call based coordination, although it is not expectedto suppress it totally. As it is far too complexto take into account all details of the local data of each individual plant, the considered global planning tool is based on an approximation of the local reality. Thus, the output of this tool is only a "rough" global plan, that will then be further refined at each plant, by the local scheduling tool (in this case a job-shop scheduling tool). The implementation tool chosen was the Prolog III system [Col90], in order to take advantage of the recent advances in the Constraint Logic Programmingfield [Coh90, VH89]. Abstract This paper discusses an attempt to solve the problem of planning several pharmaceutical plants at a global level. The interest in planning at this level is to increase the global control over the production process, to improve its overall efficiency and to reduce the need for interaction between production plants. In order to reduce the complexity of this problem and to make it tractable, some abstractions have been made. Based on these abstractions, a prototype is being developed within the framework of the EUREKA project PROTOS,using Constraint Logic Programming techniques. 1 Introduction This paper describes the development of a prototype "global planning tool" within the framework of the EUREKAproject PROTOS[PROTOS90]. PROTOS aims at the application of Prolog-based techniques to real-life planning and scheduling problems. The problem addressed by this prototype was proposed by one of the PROTOSpartners, which is a large swiss pharmaceutical company. The whole production of this companyis split over several plants. The aim is to computea global production plan for all these plants. Up to now, there is no such global plan, and all the coordination and adjustments of the production process between the different plants is achieved through phone calls between plant managers; there is no global control. This scheme works because of the experience and know-howof the plant managers, but the result is far from optimal. If a good global plan could be provided, ensuring that no major coordination problem should occur, then each plant could make local optimisations as long as the constraints imposedby the global plan aloe respected; also the resulting production process would becomemuch closer to optimality As a side effect, this global plan would also reduce the 32 Problem description Scheduling problems are known to become quickly intractable, because of combinatorial explosion. This gets even worse when trying to compute a global plan for several plants, as it is practically impossible to consider all details of each plant. This problem has to be simplified somehow. Theworkdescribed hereis basedon oneapproximation of thelocalreality, whichis theabstractionof individual machines in machine groups. In orderto define a machine group, someterms haveto be introduced: ¯ theword"product" designates bothintermediateandfinished products. ¯ severalproduction stepsare neededto go fromoneor several intermediates to theproductof thenextupperlevel; allthesestepsare grouped in a single "production order". A machine groupis a setof machines located physically close to eachother, andeachorder canbe completely executed usingonlymachines within one machine group. Also,attheglobal planning level, thedifferent production stepsof oneorderareabstracted in only oneproduction task.Thus,oneorderis considered asbeingonetaskusingoneresource. Theglobal planning tooltakesas input: to minimize stocks. I beforfinished products, a demand 1.demands inga pair(amount, duedate), While it is hoped that a conflict-free solution can be found in most cases, this might not always be 2. theallocation of machine groups to products the case because of the abstractions/approxima(eachproductis considered as beingalways tions made. Whenno conflict-free solution exists, produced on thesamemachinegroup), the global planning tool has to generate the best imperfect solution (i.e. featuring some conflicts on 3. the dispositive bill of materials: resource allocations). This best imperfect solution E.g. dispositive bill of materials with machine can then be used at the local scheduling level, group allocation to products: which still has some flexibility that does not appear at the global planning level, and which could disposition possibly solve conflicts. level 0 ~ The complexityof the problemnot only comes from the numberof demandsto plan,but also fromthehandling of stocks andresiduals: ¯ stocksmay be available at the beginning of theplanning period; ¯ additional stocksarelikelyto be generated duringthe productionprocessbecauseof someproduction constraints: it is notpossible to producelessthana minimum quantity of a product at once(minimal lotsize); Legend: ¯ residuals canbe regenerated duringthepro* circles are products, duction process: e.g.theproduction of Z3 re* an arrowfromA to B meansthatproduct generates a certainamountof Z7,thatcould A is an inputto theproduction of B, be usedas inputfor the nextdemandof Z3 (notshownon thedispositive billof materials * a numbern nearan arrowbetweenA and drawn above). B meansthat n unitsof productA are needed to produce 1 unitof product B, Thisresults in a "chicken andegg"problem: * shapesroundproducts represent machine ¯ to find a sequencebetweenthe production groupallocation: e.g.,products P1,P2and tasks, it is needed to knowtheamounts to be P3 will be producedon machinegroup produced, as theduration of a production task rag1. depends on theamountto be produced; 4. stock data, ¯ theamounts to be produced dependon stocks, and the stocks evolve with time duringthe 5.eventually, existingmachinegroupallocaplanning period depending on the chosensetionsto someorders. quence of production. Therequirement is to generate timewindowsfor Cutting the complexity allfinished andintermediate products appearing 2 in thedispositive billof materials, fromthedemandsof finished products. Forthis,a convenient2.1 Decomposition of the planning sequence fortheproduction of therequired finhorizon into sub-periods ishedandintermediate products hasto be found. To solve this "chicken and egg" problem, a further The prototype has to perform backward schedulapproximation was introduced in the planning ing where planning starts from the finished prodprocess model. This approximation divides the ucts and the allocations are made as late as planning horizon into several "sub-periods". This possible. Backward scheduling in this way tends means that stocks are taken into account as if they were available only at the frontiers between these sub-periods. 1. In the following, "order", "production task", "demand"will be used indiscriminately. 33 Inthisway,itisstill possible thatmoreisproed to loweror higher levels of thedispositive ducedduring a sub-period thanis strictly necessary: billofmaterials), somestocks created during thissub-period (because ¯ foreachmachine groupin turn: of minimal lotsizeconstraints) couldhavebeen * a sequence and particular datesforthe usedto reduce somedemands forthesameproducts tasks are chosen; occurring laterin the samesub-period. However thesestocks arelikely to be usedduring thenext * thesechoices arecommitted; sub-period, asa particular product is often produced 2 * duedatesand earliest beginning dates I. Thusstocklevels againseveral timesin theyear fortasksallocated to theremaining maoverthewholeplanning horizon should remain relachinegroupsarepropagated. tively stable. It isnotnecessary to actually perform theplanningof a sub-period in orderto knowhow much 2.3 Cycles in the machine group graph stocks willbe available at theend:allthedemands in thissub-period willbe produced, so it is not neededto knowtheexactsequence to compute the There is a cycle in the machine group graph when, global result interms ofstocks available attheend. between two production tasks that are allocated to the same machine group, there exists one or Itisthensufficient to: several intermediate production tasks to be per¯ groupthedemandsintosub-periods, accord- formed on other machine groups. According to the ingtotheirduedates; experts of the pharmaceutical company,this is un¯ rearrangethe demands,within each sub- usual, and it is acceptable in such cases if the reperiod, taking intoaccount stocks available at sult is not as good. the end of the precedingsub-period, and E.g.: mgl compute thenewstocklevels at theendof the current sub-period. Thisprocess is repeated foreachdisposition level inturn, starting withlevel 0 (i.e. finished products).Thereasonfor starting withdisposition level0 is simplythatinitially, thereareonly demands forfinished products, fromwhichdemands forintermediate products haveto be successively derived. 2.2 Decomposition of the problem according to machine groups mg3 In this example, there is a cycle between mg2 and mg3, because of the links between P1 and Z2, The planning problem consists in making choices Z2 and Z6, and Z2 and Z7. If mg2is treated before about a sequence and precise dates for all the demg3, the demandon Z2 coming from that on P1 will mands to be produced. This search space is too be planned as late as possible with respect to the wide to expect reasonable computation times. It is precedence constraints, which will eventually result then needed to decompose the search space into in no freedom being left for the demandof P1. If several sub-spaces that can be treated independrag3 is treated before mg2, then the demandson Z2 ently. Themachine groupsserves as a basisforthis and even Z3 will eventually be too constrained. Such cycles must be cut. The minimumnumber decomposition: of links in the dispositive bill of materials that have ¯ thelistof machine groups is ordered accordto be cut in order to eliminate the cycle are marked ingto dependency links, to obtain a so-called (in the above example, the link Z2 --> P1 is cut machine group graph (this more or less rerather than the links Z6 "--> Z2 and Z7 "--> Z2). flects the fact that a machinegroup is allocatWhenthere is a dependency between two production tasks along one of these links, these tasks are 1.Regulations require a pharmaceutical company tohaveseveralyears ofstocks, soexternal demands arenotcustomerdriven. Formostfinished products, theyearly demand issplit intoseveral oneswithduedates distributed overtheyem: 34 2. The earliest beginning date of a demandis the date whenall input products are available. further constrained so thattheplanning freedom is equally shared outamongthesetasks. 3 The program The program has been implemented using Prolog III, a prolog interpreter with integrated constraints over rationals, booleans, and lists. The basic algorithm is: ¯ first the machine group graph is computed from the dispositive bill of materials and the machine group allocation to products; location forthisproduct duringthepreceding sub-period. * a demandthatwill takesome amountof an input productfrom stocksis constrained to beginlaterthanthisdate. ¯ residuals availability constraints: theuseof residuals is allowed onlyif thedemand is alreadyconstrained to beginlaterthantheend dateof theresiduals production. Planning, making choices Even after decomposing the problem according to machine groups, thesearch spacestillneedsto be reducedin orderto makethe programreasonably efficient. As itseemssensible totreattogether demandsthatareclosein time,sub-periods willbe introduced againhere.Choices willbe committed afterplanning eachsub-period. Howeverthisdecomposition intosub-periods impliessomeadditional constraints. In orderto Theconstruction of thedatastructure andthe express these constraints, it is needed todefine the planning process willnowbe described: "planning limit" fora machine groupas thelatest enddateof allallocations of thismachine groupfor Data structure thedemands of theprevious sub-period. TheaddiThedata structure is a list of demands/ordersrep- tional constraints arethatnoallocation forthecurresented each by a term: rentsub-period canbe madebeforethisplanning limit(toreduce thecomplexity, otherwise it would [ id, product, machine group, due date, be needed to check disjunction with allocations of duration, end dater dependency Anfo ] preceding sub-periods). Foreachmachine groupin turn(starting from It is constructed starting fromthehighest level the machine groups allocated to the higher levels of ofthedispositive billofmaterials (i.e. finished prodthe dispositive bill of materials): ucts)goingto thelowerlevels. At eachlevel, for ¯ thedemands aregrouped intosub-periods, aceachproduct: cording to theirduedates; 1.demandsaregrouped intosub-periods accord¯ foreachsub-period: ingto their duedates; * ifIt.ispossible to finda conflict-free se2. foreachofthese sub-periods inturn: quence, a maximisation of the minimum a.demandsare rearrangedaccordingto of allenddatesis performed (sothatthe minimal lotsizesconstraints, residuals whole set of production tasks is planned andstocks available at thebeginning; thelatest aspossible); b.stocks thatwillbe available at theend * ifnoconflict-free solution exists, conflicts are computed; areprogressively allowed butminimised. 3. fromalltheserearranged demands (overthe Thisminimisation has to be basedon a wholeplanning horizon), demandsforinterconflict evaluation. However, findinga mediate products arederived, and dataabout convenient costfunction of conflicts is a residuals is updated. problem in itself, andoneof theobjectives of thisprototype is to experiment with During theconstruction of thisdatastructure, different ones.Up to now,theimplementseveral kinds ofconstraints areenforced: ed measureis simply a count of the ¯ precedence constraints, number of daysin overlaps. ¯ stocks availability constraints: Theseoptimisations are localto onemachine * stocksof a product areconsidered to be groupduring onesub-period because a global optiavailable onlyaftertheendof thelastal¯ then the data structure, which is a network of demands linked by constraints, is constructed; ¯ a schedule is computed; ¯ finally, the resulting plan is shown in a graphical form. 35 withdifferent evaluation functions of misation wouldbe too expensive in computation to experiment conflicts, andto investigate about thevalidation of time. theresulting plan. Theresulting plancontains precise datesforeach production taskinstead of justtimewindows, as Acknowledgements wasrequested at thebeginning. In fact,thisresultcanbe viewed as a particular "fully instanti- I would like to thank all PROTOSpartners for ated"solution of theproblem. In orderto leave many fruitful discussions. I would also like to somefreedom to the localplants, a moregeneral thank Pierre-Joseph Gailly and Paul Massey for solution couldbe retrieved, by deducing timewin- their helpful comments on earlier drafts of this dowsfrom theseprecisedatesand from the de- paper. Partial funding for this work was provided pendency information whichwaskeptin the data by the ESPRIT II project 5246 PRINCE(PRolog INtegrated with Constraints and Environment for structure. industrial and financial applications). 4 Computational results Bibliography Twoversions of the program exist: [PROTOS90] The EUREKA Project PROTOS.H.-J. Appelrath, A. B. Cremers, and O. Herzog Ed., Zurich, Switzerland, April 9, 1990. ¯ a coarse one for getting a rough idea of the resulting plan quality allowed by a given machine group allocation, ¯ a finer (but slower) one for getting the best possible plan for a given machine group allocation. There is currently a dearth of representative examples (the extraction of the machinegroup information from the detailed description of each plant is still an open problem being tackled by people from the pharmaceutical company), and so no figures are yet available. However,what has been learned from the developmentof the current prototype is the adequacy of the CLP approach for prototyping. The CLP approach allowed a switch from one version of the algorithm to alternative ones in a very short time, because of the declarativity and expressiveness of CLPlanguages. [Coh90] Jacques Cohen. Constraint Logic Programming Languages. Communications of the ACM,Vol.33, No.7, July 1990. [Col90] Alain Colmerauer. An Introduction to Prolog HL Communications of the ACM, Vol.33, No.7, July 1990. [VH89] P. Van Hentenryck. Constraint Satisfaction in Logic Programming. Logic Programming Series, The MIT Press, Cambridge, MA, 1989. Conclusion The validation of the approach described in this paper can only come from the experimental use of thisprototype together withseveral instances of a localplantscheduling tool,in orderto check whether feasible plansareobtained. Suchexperimentshavenotyet beenpossible becauseof the difficulty in extracting tilemachine groupinformation fromthedetailed data. Up to now,themaininterest in thisworkhas beentherefinement of theapproach during discussionswithexpertsfromthepharmaceutical company.Thesediscussions werebasedon hypothetical examples andon thesuccessive versions of theprogramwhichhaveleadto theonepresented here. Whenrepresentative examples becomeavailable, thisresearch willgoon byusing thisprototype 36