Critical Path Method

See all articles from CATS v3 n4
Author(s): Harvey Altergott
Publication: CATS Newsletter
Pub Details: CATS v3 n4 (Volume 3, Issue 4)
Date: July 1985
Pages: 5, 11

This 2068 program calculates the minimum amount of time required to perform a set of related activities and identifies the “critical” path. The critical path is that set of activities that togeather determine the minimum amount of time required.

Each activity begins and ends with a “node” or milestone, as in a PERT chart. For example, if activity 1 was to go from Washington to Chicago, the leaving of Washington would be the start node which could be identified by any number , and the arrival in Chicago would be the end node which would also be identified by a number.

As an example, getting to work could be considered to be five activities: 1 getting dressed, 2 getting a shower, 3 shaving, 4 getting breakfast at restaurant, and 5 taking subway; as shown in the table.

activity  start/end  time cost

1 shave     1     2  10    0
2 shower    1     2  15    0
3 dress     2     3  18    0
4 eat       3     4  44    4.25
5 ride      4     5  55    2.75

In this case activities 2,3,4, & 5 form the critical path of 132 minutes and total cost is $7.00.

The program can handle 100 different activities. This can be increased by changing line 70.

Harvey Altergott

  10 REM  CPM
11 REM TS2068 - to calculate c
ritical path of network
12 REM events begin & end at "
nodes"
20 REM A$=START AND END NODES
FOR EACH ACTIVITY
30 REM S$=EARLY START TIMES FO
R EACH ACTIVITY
40 REM F$=LATE FINISH TIMES FO
R EACH ACTIVITY
50 REM E$=DURATIONS AND COSTS
OF NORMAL ACTIVITIES
60 REM C$=DURATIONS AND COSTS
OF CRASH ACTIVITIES
70 DIM A(100,2)
71 DIM S(100)
72 DIM F(100)
73 DIM E(100,2)
74 DIM C(100,2)
90 PRINT "CRITICAL PATH METHOD
"
100 PRINT
110 PRINT "HOW MANY ACTIVITIES"
111 PRINT "IN THIS NETWORK?"
120 INPUT N
130 FOR I=1 TO N
140 PRINT
150 PRINT "ENTER DATA FOR EACH
EVENT"
151 PRINT "EVENT START END
TIME COST"
152 FOR I=1 TO N
153 PRINT I;
154 INPUT A(I,1)
155 PRINT " ";A(I,1);
156 INPUT A(I,2)
157 PRINT " ";A(I,2);
170 IF A(I,2)<=A(I,1) THEN GO T
O 200
190 IF A(I,2)<(N+2) THEN GO TO
260
200 PRINT "START NODE MUST BE N
UMBERED LOWER THAN END NODE, AND
END NODE CAN NOT EXCEED THE NUMB
ER ACTIVITIES BY MORE THAN ONE."
230 PRINT " ***TRY AGAIN***"
240 PRINT
250 GO TO 153
270 INPUT E(I,1)
271 PRINT " ";E(I,1);
272 INPUT E(I,2)
273 PRINT " ";E(I,2)
280 LET S(I)=0
290 LET F(I)=0
300 NEXT I
310 REM LOOP TO FIND EARLY STAR
T TIMES FOR NETWORK
320 FOR I=1 TO N
330 IF S(A(I,2))>=S(A(I,1))+E(I
,1) THEN GO TO 350
340 LET S(A(I,2))=S(A(I,1))+E(I
,1)
350 NEXT I
360 LET F(A(N,2))=S(A(N,2))
370 REM LOOP TO CALCULATE LATE
FINISH TIMES FOR NETWORK
380 FOR I=N TO 1 STEP -1
390 IF F(A(I,1))=0 THEN GO TO 4
20
400 IF F(A(I,1))>F(A(I;2))-E(I,
1) THEN GO TO 420
410 GO TO 430
420 LET F(A(I,1))=F(A(I,2))-E(I
,1)
430 NEXT I
440 LET C1=0
450 LET L=0
460 LPRINT
470 REM CALCULATE SLACK TIME IN
S1
480 LPRINT "START END EAR
LY LATE"
490 LPRINT "NODE NODE STA
RT FINISH DURATION SLCK
COST"
500 FOR I=1 TO N
501 LPRINT
510 LPRINT A(I,1);TAB (9);A(I,2
);TAB (17);S(A(I,1));TAB (25);
520 LPRINT F(A(I,2));TAB (33);E
(I,1);TAB (45);
530 LET S1=F(A(I,2))-S(A(I,1))-
E(I,1)
540 IF S1>0 THEN GO TO 590
550 LPRINT "CRITICAL";
560 LET L=L+E(I,1)
570 GO TO 600
590 LPRINT
600 LPRINT TAB (56);E(I,2)
610 LET C1=C1+E(I,2)
620 NEXT I
630 LPRINT
640 LPRINT "THE CRITICAL PATH L
ENGTH IS ";L
650 LPRINT "TOTAL COST OF THIS
NETWORK= ";C1
660 LPRINT
670 PRINT "DO YOU WANT TO CHANG
E DURATION OR COST OF ANY EVENT?
"
690 INPUT A$
700 IF A$="N" THEN GO TO 870
710 IF A$<>"Y" THEN GO TO 660
720 PRINT
730 PRINT "WHICH ACTIVITY?";
740 INPUT I
750 IF I<1 THEN GO TO 720
760 IF I>N THEN GO TO 720
770 PRINT "CURRENT DURATION OF
";I;" = ";E(I,1);",COST = ";E(I,
2)
780 PRINT "ENTER NEW DURATION A
ND COST";
790 INPUT E(I,1),E(I,2)
800 PRINT "---RECALCULATING NET
WORK---"
810 LPRINT
820 FOR I=1 TO N
830 LET S(I)=0
840 LET F(I)=0
850 NEXT I
860 GO TO 310
870 STOP

PLEASE! Use Radio Shack thermal paper, and BOLD CHARACTERS, as shown in the June and April newsslegtters. Ed.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.