The Model
MODEL:
! Data for this model is read from MRP.LDT;
SETS:
! The set of parts;
PART: LT;
! LT(i) = Lead time to produce part i;
! The set of time periods;
TIME;
! A relationship called USES between pairs of parts;
USES( PART, PART): NEEDS;
! Parent part i needs NEEDS(i, j) units of
child part j;
! For each part and time period we're interested in;
PXT( PART, TIME): ED, TD;
! ED(i, j) = External demand for part i at time j;
! TD(i, j) = Total demand for part i at time j;
ENDSETS
DATA:
! Load the data from an external file;
! Parts list;
PART = @FILE( 'MRP.LDT');
! Time periods;
TIME = @FILE( 'MRP.LDT');
! Get the parent child relations and the
number of parts required;
USES, NEEDS = @FILE( 'MRP.LDT');
! Get the lead times from the file;
LT = @FILE( 'MRP.LDT');
! Get the external demands
over time for each part;
ED = @FILE( 'MRP.LDT');
ENDDATA
! Set NP = no. of time periods in the problem;
NP = @SIZE( TIME);
! For each part P and period T, the total demand =
external demand + demand generated by parents
one lead time in the future;
@FOR( PXT( P, T) | T + LT( P) #LE# NP :
TD( P, T) = ED( P, T + LT( P)) +
@SUM( USES( P2, P): TD( P2, T + LT( P)) *
NEEDS( P2, P));
);
DATA:
! Display a table showing the production schedule;
@TEXT() = ' The production schedule:';
@TEXT() = @TABLE( TD);
ENDDATA
END
Model: MRP