ࡱ> Root EntryRoot Entry*0_^AContents {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Courier New;}} {\colortbl ;\red0\green0\blue255;\red0\green0\blue0;\red0\green175\blue0;} \viewkind4\uc1\pard\cf1\f0\fs20 MODEL\cf2 : \par \cf3 ! Reliable Construction Co. Project, PERT analysis. \par ! Generalized to generate random durations \par for a number of scenarios and calculate the \par probability of beating a specified target;\cf2 \par \cf1 SETS\cf2 : \par \cf3 ! There is a set of activities, each with a: \par Duration, Early Start(ES), Late Start(LS), \par Slack, and FreeSlack;\cf2 \par \cf3 ! There are a number of random scenarios;\cf2 \par SCENE: ProjectLength, BeatTarget; \par Activity : Duration, Var; \par \cf3 ! There is a set of predecessor,successor pairs;\cf2 \par PRED( Activity, Activity); \par SXA(SCENE, Activity) : RDuration, ES, LS, SLACK, Freeslk, U, Z; \par \cf1 ENDSETS\cf2 \par \par \cf1 DATA\cf2 : \par \cf3 ! Add a Scenario dimension, insert a subscript s \par as the first subscript for any variable that depends \par upon the random scenario;\cf2 \par \cf3 ! If 10000 scenarios are used, then the mean project \par length is about 44.3, and the probability the project \par length is <= 47 is about .828;\cf2 \par SCENE = 1..10; \par \cf3 ! Here are the Activity Durations;\cf2 \par Activity, Duration, Var = \par A 2 .1111\cf3 ! Weeks;\cf2 \par B 4 1 \par C 10 4 \par D 6 1 \par E 4 .4444 \par F 5 1 \par G 7 1 \par H 9 4 \par I 7 1 \par J 8 1 \par K 4 0 \par L 5 1 \par M 2 .1111 \par N 6 .4444 \par FINISH 0 0; \par \par \cf3 ! Here are the precedence pairs, the first Activity in the \par precedence relationship needs to be completed before the \par second Activity can be started;\cf2 \par PRED = A,B B,C C,D C,E E,F D,G E,H G,H C,I F,J I,J \par J,K J,L H,M K,N L,N M,FINISH N,FINISH; \par \par \cf3 ! Generate some uniform random numbers, using an arbitrary seed;\cf2 \par U = \cf1 @QRAND\cf2 (1813); \par \cf3 ! Target finish time;\cf2 \par Target = 47; \par \cf1 ENDDATA\cf2 \par \par \cf3 ! Calculate the random duration for each scenario, each activity;\cf2 \par \cf1 @FOR\cf2 (SXA(s,j): \par \cf1 @free\cf2 (Z(s,j)); \cf1 @free\cf2 (LS(s,j)); \cf1 @free\cf2 (slack(s,j));\cf1 @free\cf2 (FREESLK(s,j)); \par \cf3 ! Make the Z(s,j)'s standard Normal random variables;\cf2 \par \cf1 @PSN\cf2 (Z(s,j)) = U(s,j); \par \cf3 ! Give the RDurations appropriate means and sd's;\cf2 \par RDuration(s,j) = \cf1 @SMAX\cf2 (0, Duration(j)+z(s,j)*var(j)^.5); \par ); \par \par \cf3 ! Calculate the project length for each scenario;\cf2 \par \cf1 @FOR\cf2 (SCENE(s): \par \cf3 ! For the first Activity, earliest start = 0;\cf2 \par ES(s,1) = 0; \par \par \cf3 ! Compute earliest start for all but first Activity;\cf2 \par \cf1 @FOR\cf2 ( Activity( J)| J #GT# 1: \par ES(s, J) = \cf1 @MAX\cf2 ( PRED( I, J): ES(s, I) + RDuration(s,I));); \par \par \cf3 ! For the last Activity, earliest start = latest start;\cf2 \par LActivity = \cf1 @SIZE\cf2 ( Activity); \par LS(s, LActivity) = ES(s, LActivity); SLACK(s, LActivity) = 0; \par Freeslk(s, LActivity) = 0; \par \par \cf3 ! Compute latest start and Slack for all but last Activity;\cf2 \par \cf3 ! An activity can use up all its slack, as long as no \par other activity uses any of its slack;\cf2 \par \cf1 @FOR\cf2 ( Activity( I)| I #LT# LActivity: \par LS(s, I) = \cf1 @MIN\cf2 ( PRED( I, J): LS(s, J)) - RDuration(s, I); \par SLACK(s, I) = LS(s, I) - ES(s, I);); \par \par \cf3 ! Compute free slack for all but last Activity;\cf2 \par \cf3 ! Each activity can use up all its free slack, as long \par as no other activity uses up more than its free slack;\cf2 \par \cf1 @FOR\cf2 ( Activity( I)| I #LT# LActivity: \par Freeslk(s, I) = \cf1 @MIN\cf2 ( PRED( I, J): ES(s, J)) \par -( ES(s, I) + RDuration(s, I)); \par ); \par \par ProjectLength(s) = ES(s,LActivity); \par BeatTarget(s) = \cf1 @IF\cf2 ( ProjectLength(s) #LE# Target,1,0); \par ); \par \par \cf3 ! Compute prob\{Proj Length <= Target\};\cf2 \par PSuccess = \cf1 @sum\cf2 (SCENE(S): BeatTarget(s))/\cf1 @SIZE\cf2 (SCENE); \par MeanLength = \cf1 @sum\cf2 (SCENE(S): ProjectLength(s))/\cf1 @SIZE\cf2 (SCENE); \par \cf1 DATA\cf2 : \par \cf1 @TEXT\cf2 () = " Mean project length =", MeanLength; \par \cf1 @TEXT\cf2 () = " Prob\{ length <= target of", TARGET,"\} is", PSuccess; \par \cf1 ENDDATA\cf2 \par \cf1 END\cf2 \par }