Model Main_Seminararbeit_Version_5 { Parameter NumberOfItems { Definition: 2; } Parameter NumberOfMachines { Definition: 1; } Parameter NumberOfPeriods { Definition: 7; } Set Items { SubsetOf: Integers; Index: i; Definition: { {1..NumberOfItems} } } Set Machines { SubsetOf: Integers; Index: m; Definition: { {1..NumberOfMachines} } } Set Periods { SubsetOf: Integers; Index: t; Definition: { {1..NumberOfPeriods} } } Parameter MaxStock { IndexDomain: i; Definition: data {1:10000, 2:15000}; } Parameter InitialStock; Parameter StockCost { IndexDomain: i; Definition: data {1:20, 2:15}; } Parameter Capacity { IndexDomain: m; Definition: data {1:18000}; } Parameter SetUpCost; Parameter SetUpTime { IndexDomain: m; } Parameter Demand { IndexDomain: (i,t); } Variable S { IndexDomain: (i,t); Range: nonnegative; Comment: "Lagerbestand Produkt i am Ende von Periode t"; } Variable X { IndexDomain: (i,t,m); Range: nonnegative; Comment: "Produktionsmenge Produkt i in Periode t auf Maschine m"; } Variable Y { IndexDomain: (i,t,m); Range: binary; Comment: { "Produktionsvariable; 1 wenn Produkt i in Periode t auf Maschine m produziert wird (sonst Y=0)" } } Variable Z { IndexDomain: (i,t,m); Range: binary;
Comment: "Rüst-Variable: 1, wenn für die Produktion von Produkt i in Periode t+1 auf Maschine m gerüstet werden muss"; } Variable TotalCost { Range: free; Definition: sum ((i,t,m), SetUpCost * Y(i,t,m)) + sum ((i,t),StockCost(i) * S(i,t)); } Constraint AllOrNothingProduction { IndexDomain: (i,t,m); Definition: Y(i,t,m) + Z(i,t,m) <= 1; } Constraint FlowConstraint { IndexDomain: (i,t); Definition: S(i,t) = S(i,t-1) + sum (m, X(i,t,m)) - Demand(i,t); } Constraint NoBacklogging { IndexDomain: (i,t); Definition: S(i,t) >= 0; } Constraint CapacityConstraint { IndexDomain: (i,t,m); Definition: X(i,t,m) + SetUpTime(m) * Z(i,t,m) <= Capacity(m) * Y(i,t,m); } Constraint MachineConstraint { IndexDomain: (m,t); Definition: sum (i, Y(i,t,m)) <= 1; } MathematicalProgram OptimationLotSizing { Objective: TotalCost; Direction: minimize; Constraints: AllConstraints; Variables: AllVariables; Type: Automatic; } Procedure MainInitialization { Body: { SetUpCost := 1000; SetUpTime(m) := 50; Demand(i,t) 1 ! 0 ! 18000 ;
:= DATA 2 18000 0
TABLE 3 0 0
4 0 36000
5 0 18000
6 18000 0
7 0 18000
} Comment: "Add initialization statements here that do NOT require any library being initialized already."; } Procedure PostMainInitialization { Comment: { "Add initialization statements here that require that the libraries are already initialized properly, or add statements that require the Data Management module to be initialized." } } Procedure MainExecution { Body: { solve OptimationLotSizing; } } Procedure PreMainTermination { Body: { return DataManagementExit(); } Comment: { "Add termination statements here that require all libraries to be still alive. Return 1 if you allow the termination sequence to continue. Return 0 if you want to cancel the termination sequence." } } Procedure MainTermination {