Compucolor.org – Virtual Media

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

90 REM  AUTHOR J.DE WAARD, MODIFIED BY EIKE MUELLER, V811212
100 REM  READ NETWORK PARAMETERS FROM FILE AND PERFORM ANALYSIS
110 CLEAR 2000:DIM A(200,5),S(200),F(200),E(200,2),DE$(200)
130 PLOT  12,3,0,7,14,29,21
140 PRINT  TAB( 10)"READ NETWORK PARAMETERS FROM"
150 PRINT  TAB( 10)"FILE AND PERFORM ANALYSIS"
160 PLOT  29,18,15:PRINT
170 PRINT  TAB( 5):INPUT "** INSERT DATA DISK AND HIT RETURN **";EN
180 B= 10:GOSUB 4000
185 FILE  "T",5000
190 PLOT  3,5,11
200 INPUT "ENTER # OF FILE TO BE READ (1,2,3,4,5,6,OR 7):  ";PD
210 ON  PD GOTO  220,240,260,280,300,320,340
220 FILE "R",1,"PERT1",16
230 GOTO  400
240 FILE "R",2,"PERT2",16
250 GOTO  400
260 FILE "R",3,"PERT3",16
270 GOTO  400
280 FILE "R",4,"PERT4",16
290 GOTO  400
300 FILE "R",5,"PERT5",16
310 GOTO  400
320 FILE "R",6,"PERT6",16
330 GOTO  400
340 FILE "R",7,"PERT7",16
400 FOR  I= 1 TO  200
410 GET PD,I;A(I,1),A(I,2),A(I,3),A(I,4),A(I,5),DE$(I)[11]
420 IF  I= 1 AND  A(I,2)< 1 THEN  500
430 IF  I> 1 AND  A(I,2)< 1 THEN  600
440 IF  A(200,1)> 0 THEN  700
450 NEXT  I
460 FILE  "C",PD
500 B= 11:GOSUB  4000
510 N= 0:PLOT  3,5,13
520 PRINT "THIS FILE IS EMPTY!"
530 PLOT  3,5,15
535 FILE  "C",PD
540 INPUT "ARE OTHER FILES TO BE ACCESSED?  ";FA$
550 IF  LEFT$ (FA$,1)= "Y" THEN  130
560 GOTO  7000
600 B= 11:GOSUB  4000
610 N= I- 1:PLOT  3,5,13
620 PRINT "THE NUMBER OF STORED ACTIVITIES IS: ";N
630 PLOT  3,5,15
635 FILE  "C",PD
640 INPUT "SHALL DATA BE PROCESSED?  ";DP$
650 IF  LEFT$ (DP$,1)= "N" THEN  7000
660 GOTO 1110
700 B= 11:GOSUB  4000
710 N= 200:PLOT  3,5,12
720 PRINT "THIS FILE IS ALREADY FULL ";N;" ACTIVITIES STORED!"
730 GOTO  1110
1110 FOR I= 1TO N
1120 REM  E(I,1) IS THE EXPECTED DURATION!
1130 E(I,1)= (A(I,3)+ 4* A(I,4)+ A(I,5))/ 6
1135 E(I,1)= (INT (E(I,1)* 1000+ .5))/ 1000
1140 REM E(I,2) IS THE ACTIVITY VARIANCE
1150 E(I,2)= ((A(I,5)- A(I,3))/ 6)^ 2
1160 E(I,2)= (INT (E(I,2)* 1000+ .5))/ 1000
1170 S(I)= 0
1180 F(I)= 0
1190 NEXT I
1200 REM  LOOP TO FIND EARLY START TIMES FOR NETWORK
1210 FOR  I= 1 TO  N
1220 IF  S(A(I,2))> = S(A(I,1))+ E(I,1) THEN 1240
1230 S(A(I,2))= S(A(I,1))+ E(I,1)
1240 NEXT  I
1250 F(A(N,2))= S(A(N,2))
1260 REM  LOOP TO CALCULATE LATE FINISH TIMES FOR NETWORK
1270 FOR  I= N TO  1 STEP - 1
1280 IF  F(A(I,1))= 0 THEN 1310
1290 IF  F(A(I,1))> F(A(I,2))- E(I,1) THEN 1310
1300 GOTO 1320
1310 F(A(I,1))= F(A(I,2))- E(I,1)
1320 NEXT  I
1330 V= 0
1340 C= 0
1350 L= 0
1352 K= 0
1354 B= 0:GOSUB  4000
1355 INPUT "ARE RESULTS TO BE DISPLAYED ON SCREEN OR PRINTED?   ";SP$
1356 B= 0:GOSUB  4000
1357 IF  LEFT$ (SP$,1)= "P" THEN  2000
1358 PRINT  "THE COMPUTED RESULTS ARE:"
1360 FOR  I= 1 TO  N
1370 REM  CALCULATE SLACK TIME IN S1
1380 S1= F(A(I,2))- S(A(I,1))- E(I,1)
1390 S1= (INT (10^ 3* S1+ .5))/ 10^ 3
1392 K= K+ 1
1394 IF  K< > 3 THEN  1400
1395 PLOT  3,33,30,29,17
1396 INPUT "HIT ENTER TO CONTINUE";EN
1397 PLOT  29,18:B= 1:GOSUB  4000
1398 K= 0
1400 PRINT "--------------------------------------------------------------"
1410 PRINT
1420 PRINT "ACTIVITY";I;",  ";DE$(I);"  (NODE";A(I,1);" TO NODE";A(I,2);")"
1430 PRINT  "IS A ";
1440 IF  S1< = 0 THEN 1460
1450 PRINT "NON-CRITICAL EVENT.":GOTO 1480
1460 PRINT "CRITICAL EVENT."
1470 PRINT
1480 PRINT :PRINT "EXPECTED DURATION   :";
1481 N= E(I,1):T= 21:GOSUB  3000
1485 PRINT  TAB( 33);"STANDARD DEVIATION:";
1486 N= SQR (E(I,2)):T= 52:GOSUB  3000
1488 PRINT
1500 IF  S1> 0 THEN 1580
1510 PRINT "START NO LATER THAN :";
1511 N= S(A(I,1)):T= 21:GOSUB  3000
1512 PRINT
1520 PRINT "MUST BE COMPLETED BY:";
1521 N= F(A(I,2)):T= 21:GOSUB  3000
1522 PRINT
1530 REM  ACCUMULATE PATH LENGTH IN L, VARIANCE IN V
1540 IF  L> = F(A(I,2)) THEN 1560
1550 L= F(A(I,2))
1560 V= V+ E(I,2)
1570 GOTO 1630
1580 PRINT  "EARLY START         :";
1581 N= S(A(I,1)):T= 21:GOSUB  3000
1585 PRINT  TAB( 33);"LATE START :";
1586 N= F(A(I,2))- E(I,1):T= 46:GOSUB  3000
1590 PRINT
1600 PRINT  "EARLY FINISH        :";
1601 N= S(A(I,1))+ E(I,1):T= 21:GOSUB  3000
1605 PRINT  TAB( 33)"LATE FINISH:";
1606 N= F(A(I,2)):T= 46:GOSUB  3000
1610 PRINT
1620 PRINT "SLACK TIME          :";
1621 N= S1:T= 21:GOSUB  3000
1622 PRINT
1630 NEXT  I
1635 PLOT  3,33,30,29,17:INPUT "HIT ENTER TO CONTINUE";EN
1637 PLOT  29,18
1640 B= 2:GOSUB 4000
1645 P= SQR (V)
1646 P= INT (P* 10^ 3+ .5)/ 10^ 3
1647 PLOT 3,0,12
1650 PRINT "THE CRITICAL PATH LENGTH IS           :";L;" +/-";P
1675 PRINT
1678 IF  LEFT$ (SP$,1)= "P" THEN  7500
1680 INPUT  "ENTER DESIRED COMPLETION TIME ( 0 TO END )  : ";D
1685 PRINT
1690 IF  D< = 0 THEN 1840
1700 REM  CALCULATE Z-SCORE FOR DESIRED DURATION
1710 Y= (D- L)/ P
1720 REM  CALCULATE CUMULATIVE AREA UNDER NORMAL DISTRIBUTION
1730 REM  REF:SOME COMMON BASIC PROGRAMS, 3RD ED. P 128
1740 R= EXP (- (Y^ 2)/ 2)/ 2.5066282746
1750 Z= Y
1760 Y= 1/ (1+ .33267* ABS (Y))
1770 T= 1- R* (.4361836* Y- .1201676* Y^ 2+ .937298* Y^ 3)
1780 IF  Z> = 0 THEN 1800
1790 T= 1- T
1795 PRINT
1800 PRINT  "PROBABILITY OF COMPLETION WITH DURATION OF  :";D;" =";T
1805 PRINT
1810 INPUT "SHALL PROBABILITY BE CALCULATED FOR OTHER COMPLETION TIMES? ";CT$
1820 PRINT
1830 IF  LEFT$ (CT$,1)= "Y" THEN  1675
1835 IF  LEFT$ (SP$,1)= "P" THEN  7500
1840 GOTO  7000
2000 REM  PRINTER SBR
2002 PRINT "VERIFY PRINTER READINESS!"
2005 PRINT
2006 INPUT "HIT ENTER TO CONTINUE";EN
2007 B= 0:GOSUB  4000
2008 PLOT  3,14,15
2009 PRINT "** COMPUTED RESULTS ARE PRINTED **"
2014 PLOT 27,18,7:REM  ...,7 = 9600 BAUD!
2016 POKE 33265,14:OUT 8,199:REM   SEND TO PRINTER
2017 PLOT 27,69:REM   EMPHASIZED PRINTING ON EPSON
2018 POKE 33289,120
2019 PLOT 14:PRINT "PERT ANALYSIS              ICS":PRINT
2020 PRINT "THE COMPUTED RESULTS FOR FILE";PD;" ARE :"
2025 PLOT 27,70,15:REM  CONDENSED PRINTING
2030 PRINT :PRINT :GOSUB  8000
2090 FOR  I= 1 TO  N
2095 IF  I= 26 OR  I= 51 OR  I= 76 OR  I= 101 OR  I= 126 OR  I= 151 OR  I= 176 THEN 8100
2100 S1= F(A(I,2))- S(A(I,1))- E(I,1)
2110 S1= (INT (10^ 3* S1))/ 10^ 3
2115 PRINT "!-----!-----------!--------!--------!-----------!-----------!-----------!-----------!-----------!----------!"
2118 PRINT  TAB( 1)RIGHT$ ("    "+ STR$ (I),4);
2119 PRINT TAB( 7)DE$(I);
2120 PRINT TAB( 20)RIGHT$ ("    "+ STR$ (A(I,1)),4);
2130 PRINT TAB( 28)RIGHT$ ("    "+ STR$ (A(I,2)),4);
2140 N= E(I,1):T= 37:GOSUB 3000
2145 IF  S1< = 0 THEN  2160
2150 N= S(A(I,1)):T= 49:GOSUB 3000
2160 N= F(A(I,2))- E(I,1):T= 61:GOSUB 3000
2165 IF  S1< = 0 THEN  2180
2170 N= S(A(I,1))+ E(I,1):T= 73:GOSUB 3000
2180 N= F(A(I,2)):T= 85:GOSUB 3000
2190 IF S1> 0THEN N= S1:T= 97:GOSUB 3000
2200 IF S1< = 0THEN PRINT TAB( 98)"CRITICAL";
2210 PRINT
2215 IF  S1> 0 THEN  2250
2220 IF  L> = F(A(I,2)) THEN  2240
2230 L= F(A(I,2))
2240 V= V+ E(I,2)
2250 NEXT  I
2255 PRINT "!-----!-----------!--------!--------!-----------!-----------!-----------!-----------!-----------!----------!"
2270 P= SQR (V):P= INT (P* 10^ 3+ .5)/ 10^ 3
2275 PRINT :PRINT
2280 PLOT 18,27,69:GOTO 1650
3000 D1= INT (N)
3010 Q= INT ((1+ N- D1)* 1000)
3020 PRINT TAB( T)RIGHT$ ("    "+ STR$ (D1)+ "."+ RIGHT$ (STR$ (Q),3),8);
3030 RETURN
4000 REM  ERASE PART OF PAGE
4010 FOR  Y= 31 TO  B STEP  - 1
4020 PLOT  3,0,Y,11
4030 NEXT  Y
4040 RETURN
5000 REM  FILE TRAP
5010 PLOT  12,3,5,15
5020 PRINT "SORRY WRONG DISK"
5030 GOTO  160
7000 B= 0:GOSUB  4000
7010 PLOT  3,5,12
7020 INPUT "ARE OTHER TASKS TO BE PERFORMED?  ";OT$
7030 IF  LEFT$ (OT$,1)= "Y" THEN  7100
7040 B= 0:GOSUB  4000
7050 PLOT  3,15,15
7060 PRINT  "THANK YOU AND TOT ZIENS"
7070 PLOT  3,0,0
7080 INPUT "";EN
7090 RUN
7100 PLOT  3,5,15,29,21
7110 INPUT "INSERT PROGRAMME DISK AND HIT RETURN";P$
7120 PLOT  29,18
7130 FILE  "T",5000
7140 LOAD  "MENU":RUN
7500 PLOT 12:WAIT 1,128,128:OUT 8,207:POKE 33265,0
7510 GOTO  7000
8000 REM  PRINTER PAGE HEADING
8004 IF  I< 25 THEN  8010
8006 PRINT :PRINT :PRINT
8010 PRINT "!-----!-----------!--------!--------!-----------!-----------!-----------!-----------!-----------!----------!"
8020 PRINT "!ACT.#!DESCRIPTION!  START !  END   !  EXP.     !   EARLY   !   LATEST  !  EARLY    ! MUST BE   !   SLACK  !
8030 PRINT "!     !           !  NODE  !  NODE  !  DURATION !   START   !   START   !  FINISH   ! COMPLETED !   TIME   !
8040 RETURN
8100 PLOT  12
8110 GOSUB  8000
8120 GOTO  2100