| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Planning problems Description
Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 8: Production planning
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
Data Files
c2glass.mos (!****************************************************** Mosel Example Problems ====================== file c2glass.mos ```````````````` Planning the production of glasses A French company produces 6 types of drinking glasses. Each product has varying production cost, storage cost, initial stock, and storage space requirements. The time it take a work and machine to create each batch of glasses also varies. How much of each type of glasses should be produced in each period so that the total (production and storage) cost be minimized? A balance constraint is necessary to define the glasses stored from one period to the next. Note that the production variable cannot be named 'prod' and the set of products cannot be named 'PROD' as 'prod' is a reserved word since it is a keyword of Mosel. (c) 2008 Fair Isaac Corporation author: S. Heipcke, Mar. 2002 *******************************************************!) model "C-2 Glass production" uses "mmxprs", "mmsystem" declarations NT = 12 ! Number of weeks in planning period WEEKS = 1..NT PRODS = 1.. 6 ! Set of products CAPW,CAPM: integer ! Capacity of workers and machines CAPS: integer ! Storage capacity DEM: array(PRODS,WEEKS) of integer ! Demand per product and per week CPROD: array(PRODS) of integer ! Production cost per product CSTOCK: array(PRODS) of integer ! Storage cost per product ISTOCK: array(PRODS) of integer ! Initial stock levels FSTOCK: array(PRODS) of integer ! Min. final stock levels TIMEW,TIMEM: array(PRODS) of integer ! Worker and machine time per unit SPACE: array(PRODS) of integer ! Storage space required by products produce: array(PRODS,WEEKS) of mpvar ! Production of products per week store: array(PRODS,WEEKS) of mpvar ! Amount stored at end of week end-declarations initializations from 'c2glass.dat' CAPW CAPM CAPS DEM CSTOCK CPROD ISTOCK FSTOCK TIMEW TIMEM SPACE end-initializations ! Objective: sum of production and storage costs Cost:= sum(p in PRODS, t in WEEKS) (CPROD(p)*produce(p,t) + CSTOCK(p)*store(p,t)) ! Stock balances forall(p in PRODS, t in WEEKS) store(p,t) = if(t>1, store(p,t-1), ISTOCK(p)) + produce(p,t) - DEM(p,t) ! Final stock levels forall(p in PRODS) store(p,NT) >= FSTOCK(p) ! Capacity constraints forall(t in WEEKS) do sum(p in PRODS) TIMEW(p)*produce(p,t) <= CAPW ! Workers sum(p in PRODS) TIMEM(p)*produce(p,t) <= CAPM ! Machines sum(p in PRODS) SPACE(p)*store(p,t) <= CAPS ! Storage end-do ! Solve the problem minimize(Cost) ! Solution printing writeln("Total cost: ",getobjval) writeln("Production plan:") write(" Week") forall(t in WEEKS) write(textfmt(t,7)) writeln forall(p in PRODS) do write(p,": Prod. ") forall(t in WEEKS) write(textfmt(getsol(produce(p,t)),7)) writeln write(" Store ") forall(t in WEEKS) write(textfmt("("+getsol(store(p,t))+")",7)) writeln end-do writeln("\nCapacities used:") writeln(formattext("Week%8s%9s%7s","Workers","Machines","Space")) forall(t in WEEKS) writeln(formattext("%2d%8g%10.2f%9.2f", t, getsol(sum(p in PRODS) TIMEW(p)*produce(p,t)), getsol(sum(p in PRODS) TIMEM(p)*produce(p,t)), getsol(sum(p in PRODS) SPACE(p)*store(p,t))) ) end-model | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
© Copyright 2023 Fair Isaac Corporation. |