Compucolor.org – Virtual Media

Listing of file='DEFLOA.BAS;01' on disk='vmedia/pert_planner-sector.ccvf'

90 REM  DEFINITION & LOADING OF NETWORK PARAMETERS PRGM (DEFLOA) VERS.811212
100 CLEAR 2000:DIM A(200,5),S(200),F(200),E(200,2),DE$(200)
110 DEF  FN  R(Z1)= (INT (Z1* 10^ 3+ .5))/ 10^ 3
120 PLOT  12,3,0,7,14,29,21:PRINT  TAB( 21)"PERT PROGRAMME"
130 PLOT  29,18,15
140 PRINT
150 INPUT  "ENTER THE NUMBER OF ACTIVITIES IN THIS NETWORK    :";N
160 PRINT :PRINT
170 FOR  I= 1 TO  N
180 PRINT :PRINT
190 PRINT  "======ACTIVITY";I;"======"
191 PRINT "DESCRIPTION:                         ";
192 FOR X= 1TO 11:PLOT 26:NEXT X
193 PLOT 6,38:INPUT "";DE$(I)
200 PLOT 6,2:INPUT "ENTER START NODE AND END NODE # (S,E)             :";A(I,1),A(I,2)
210 PRINT
220 IF  A(I,2)< =  A(I,1) THEN  250
230 IF  A(I,2)< N THEN  290
240 PRINT
250 PRINT  "START NODE MUST BE NUMBERED LOWER THAN END NODE,"
260 PRINT  "AND END NODE MUST BE LESS THAN THE NUMBER OF ACTIVITIES"
266 PRINT
268 PLOT  29,21:PRINT  TAB( 16)"***  TRY AGAIN  ***":PLOT  29,18
270 PRINT
280 GOTO 180
290 PRINT  "ENTER THE THREE TIME ESTIMATES FOR THIS ACTIVITY"
300 INPUT  "(OPTIMISTIC-,MOST LIKELY-,AND PESSIMIATIC VALUE ) :";A(I,3),A(I,4),A(I,5)
310 REM  E(I,1) IS THE EXPECTED DURATION!
320 E(I,1)= FN R((A(I,3)+ A(I,4)* 4+ A(I,5))/ 6)
330 REM E(I,2) IS THE ACTIVITY VARIANCE
340 E(I,2)= FN R((A(I,5)- A(I,3))/ 6)^ 2
350 S(I)= 0
360 F(I)= 0
370 NEXT I
371 PLOT  12,3,5,2
372 INPUT  "SHALL THE JUST ENTERED PARAMETERS BE STORED?  ";PS$
373 IF  LEFT$ (PS$,1)= "Y" THEN  1600
374 PLOT  12,3,5,2
375 INPUT  "SHALL NETWORK ANALYSIS BE PERFORMED AND DISPLAYED?  "  ;NA$
376 IF  LEFT$ (NA$,1)= "N" THEN  1320
380 REM  LOOP TO FIND EARLY START TIMES FOR NETWORK
390 FOR  I= 1 TO  N
400 IF  S(A(I,2))> = S(A(I,1))+ E(I,1) THEN  420
410 S(A(I,2))= S(A(I,1))+ E(I,1)
420 NEXT  I
430 F(A(N,2))= S(A(N,2))
440 REM  LOOP TO CALCULATE LATE FINISH TIMES FOR NETWORK
450 FOR  I= N TO  1 STEP - 1
460 IF  F(A(I,1))= 0 THEN  490
470 IF  F(A(I,1))> F(A(I,2))- E(I,1) THEN  490
480 GOTO  500
490 F(A(I,1))= F(A(I,2))- E(I,1)
500 NEXT  I
510 V= 0
520 C= 0
530 L= 0
540 K= 0
550 B= 0:GOSUB 1190
560 PRINT  "THE COMPUTED RESULTS ARE:"
570 FOR  I= 1 TO  N
580 REM  CALCULATE SLACK TIME IN S1
590 S1= F(A(I,2))- S(A(I,1))- E(I,1)
600 S1= (INT (10^ 3* S1))/ 10^ 3
610 K= K+ 1
620 IF  K< > 3 THEN 670
630 PLOT  3,33,30,29,17
640 INPUT "HIT ENTER TO CONTINUE";EN
650 PLOT  29,18:B= 1:GOSUB 1190
660 K= 0
670 PRINT "------------------------------------------------------------"
680 PRINT
690 PRINT  "ACTIVITY";I;"(NODE";A(I,1);" TO NODE";A(I,2);")"
700 PRINT  "IS A ";
710 IF  S1< = 0 THEN 730
720 PRINT "NON-CRITICAL EVENT.":GOTO 750
730 PLOT  29,17:PRINT "CRITICAL EVENT.":PLOT  29,18
740 PRINT
750 PRINT :PRINT "EXPECTED DURATION   :";E(I,1);TAB( 33);"STANDARD DEVIATION  :";
760 PRINT  SQR (E(I,2))
770 IF  S1> 0 THEN 850
780 PRINT "START NO LATER THAN :";S(A(I,1))
790 PRINT "MUST BE COMPLETED BY:";F(A(I,2))
800 REM  ACCUMULATE PATH LENGTH IN L, VARIANCE IN V
810 IF  L> = F(A(I,2)) THEN 830
820 L= F(A(I,2))
830 V= V+ E(I,2)
840 GOTO 900
850 PRINT  "EARLY START         :";S(A(I,1));TAB( 33);"LATE START :";
860 PRINT  F(A(I,2))- E(I,1)
870 PRINT  "EARLY FINISH        :";S(A(I,1))+ E(I,1);TAB( 33);
880 PRINT "LATE FINISH:";F(A(I,2))
890 PRINT "SLACK TIME          :";S1
900 NEXT  I
910 PLOT  3,33,30,29,17:INPUT "HIT ENTER TO CONTINUE";EN
920 PLOT  29,18
930 B= 2:GOSUB 1190
940 P= SQR (V)
950 P= INT (P* 10^ 3+ .5)/ 10^ 3
960 PLOT 3,0,12
970 PRINT "THE CRITICAL PATH LENGTH IS                 :";L;" +/-";P
980 PRINT
990 INPUT  "ENTER DESIRED COMPLETION TIME ( 0 TO END )  : ";D
1000 PRINT
1010 IF  D< = 0 THEN 1180
1020 REM  CALCULATE Z-SCORE FOR DESIRED DURATION
1030 Y= (D- L)/ P
1040 REM  CALCULATE CUMULATIVE AREA UNDER NORMAL DISTRIBUTION
1050 REM  REF:SOME COMMON BASIC PROGRAMS, 3RD ED. P 128
1060 R= EXP (- (Y^ 2)/ 2)/ 2.5066282746
1070 Z= Y
1080 Y= 1/ (1+ .33267* ABS (Y))
1090 T= 1- R* (.4361836* Y- .1201676* Y^ 2+ .937298* Y^ 3)
1100 IF  Z> = 0 THEN 1130
1110 T= 1- T
1120 PRINT
1130 PRINT  "PROBABILITY OF COMPLETION WITH DURATION OF  :";D;" =";T
1140 PRINT
1150 INPUT "SHALL PROBABILITY BE CALCULATED FOR OTHER COMPLETION TIMES? ";CT$
1160 PRINT
1170 IF  LEFT$ (CT$,1)= "Y" THEN 980
1180 GOTO 1280
1190 REM  ERASE PART OF PAGE
1200 FOR  Y= 31 TO  B STEP  - 1
1210 PLOT  3,0,Y,11
1220 NEXT  Y
1230 RETURN
1240 REM  FILE TRAP
1250 PLOT  12,3,5,15
1260 PRINT "SORRY WRONG DISK":PRINT :PRINT
1265 PRINT TAB( 5):INPUT "** INSERT CORRECT DISK AND HIT RETURN **";EN
1270 GOTO 1607
1280 B= 0:GOSUB 1190
1290 PLOT  3,5,12
1300 INPUT "ARE OTHER TASKS TO BE PERFORMED?  ";OT$
1310 IF  LEFT$ (OT$,1)= "Y" THEN 1380
1320 B= 0:GOSUB 1190
1330 PLOT  3,15,15
1340 PRINT  "THANK YOU AND TOT ZIENS"
1350 PLOT  3,0,0
1360 INPUT "";EN
1370 RUN
1380 PLOT  3,5,15,29,21
1390 INPUT "INSERT PROGRAMME DISK AND HIT RETURN";P$
1400 PLOT  29,18
1410 FILE "T",1240
1420 LOAD  "MENU":RUN
1600 REM  STORAGE OF ENTERED DATA
1602 PLOT 3,5,5
1605 INPUT "INSERT DATA DISK AND HIT RETURN";EN
1607 FILE "T",1240
1610 PLOT  12,3,5,2
1620 INPUT "ENTER # OF FILE TO BE USED (1,2,3,4,5,6,OR 7)  ";PD
1640 ON  PD GOTO  1650,1660,1670,1680,1690,1700,1710
1650 FILE "R",1,"PERT1",16:GOTO 1720
1660 FILE "R",2,"PERT2",16:GOTO 1720
1670 FILE "R",3,"PERT3",16:GOTO 1720
1680 FILE "R",4,"PERT4",16:GOTO 1720
1690 FILE "R",5,"PERT5",16:GOTO 1720
1700 FILE "R",6,"PERT6",16:GOTO 1720
1710 FILE "R",7,"PERT7",16
1720 FOR  I= 1 TO  N
1730 PUT PD,I;A(I,1),A(I,2),A(I,3),A(I,4),A(I,5),DE$(I)[11]
1740 NEXT  I
1750 FILE  "C",PD
1760 PLOT  12,3,5,2:PRINT  "ALL YOUR INPUTS HAVE BEEN STORED!"
1770 GOTO  1280