Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50110/decid2.eng
There are 2 other files named decid2.eng in the archive. Click here to see a list.
100' NAME--DECIDE2
110'
120' DESCRIPTION--HELPS YOU TO DECIDE UPON THE APPROPRIATE TESTING
130' PROCEDURE FOR A DAMAGED MACHINE.
140'
150' SOURCE--JACQUES PEZIER, THAYRE SCHOOL OF ENGINEERING
160'
170' INSTRUCTIONS--TYPE "RUN" AND INSTRUCTIONS WILL BE GIVEN. FOR
180' FAST INPUT DELETE LINE 230 AND INSERT DATA AS INDICATED IN LINE 240.
190'
200'
210' * * * * * * * * MAIN PROGRAM * * * * * * * * *
220'
230 GO TO 300
240 READ W1,W2,W3,W4,A1,B1,C1,A2,B2,C2,H0
250 DATA 3000,-6000,1000,-3000
260 DATA .9,.2,400
270 DATA .7,.4,100
280 DATA .65
290 GO TO 630
300 PRINT "THIS PROGRAM HELPS YOU TO DECIDE THE FOLLOWING PROBLEM:"
310 PRINT "YOU HAVE A PIECE OF EQUIPMENT AND YOU SUSPECT IT IS DAMAGED."
320 PRINT "YOU DON'T KNOW WHETHER TO DECIDE ABOUT IT OR TO RUN A TEST."
330 PRINT "YOU CAN DECIDE NOW, ORDER THE FIRST TEST AND THEN DECIDE,"
340 PRINT "OR YOU CAN ORDER THE SECOND TEST AND THEN DECIDE, OR YOU"
350 PRINT "COULD ORDER BOTH TESTS AND THEN DECIDE. YOU COULD DECIDE"
360 PRINT "TO ORDER THE SECOND TEST AFTER SEEING THE RESULTS OF"
370 PRINT "THE FIRST TEST, AND VICE VERSA."
380 PRINT
390PRINT "THE PRIOR PROBABILITY THAT A PIECE OF EQUIPMENT IS GOOD IS H0"
400 PRINT"THE REWARDS MATRIX IS AS FOLLOWS"
410PRINT"IF YOU ACT AS THOUGH AND IT IS"
420PRINT" GOOD BAD"
430PRINT"IT WERE GOOD W1 W2"
440PRINT"IT WERE BAD W3 W4"
450PRINT
460PRINT"YOU CAN TAKE ONE OF FOUR ACTIONS:"
470 PRINT "ACT:T1='ORDER THE FIRST TEST',ACT:T2='ORDER SECOND TEST'"
480 PRINT "ACT:G='ASSUME EQUIPMENT 'GOOD'',ACT:B='ASSUME IT IS 'BAD''"
490PRINT "THE FIRST TEST HAS THE FOLLOWING CHARACTERISTICS:"
500 PRINT "IT COSTS C1 TO RUN, P(REPORT'GOOD'/REALLY 'GOOD')=A1"
510 PRINT "P(REPORTS 'GOOD'/REALLY'BAD')=B1"
520 PRINT "THE SECOND TEST IS DESCRIBED BY CORRESPONDING C2,A2,B2"
530 PRINT "IF YOU WANT TO USE A FASTER INPUT TO THIS PROGRAM, LIST"
540 PRINT "THE FIRST FEW LINES"
550
560 PRINT
570 PRINT "WHAT ARE W1,W2,W3,W4 (REWARDS MATRIX)";
580 INPUT W1,W2,W3,W4
590 PRINT "WHAT ARE A1,B1,C1,A2,B2,C2 (TEST CHARACTERISTICS)";
600 INPUT A1,B1,C1,A2,B2,C2
610PRINT "WHAT IS PRIOR PROBABILITY EQUIPMENT IS GOOD";
620INPUT H0
630 READ A$,B$,C$,D$,E$,F$
640 PRINT
650 LET R1=W1-W3
660 LET R2=W4-W2
670 LET U(1)=U(2)=C1
680 LET U(3)=U(4)=C2
690 LET I$(1)=I$(2)=B$
700 LET I$(3)=I$(4)=A$
710 DIM U(4),I$(4),D$(8),E$(8),F$(3)
720 MAT G=ZER(2,4)
730 MAT H=ZER(3,8)
740 MAT L=ZER(3,8)
750 LET F$(1)=A$
760 LET F$(2)=B$
770 LET G(1,1)= A1*H0+B1*(1-H0)
780 LET G(1,2)=A2*H0+B2*(1-H0)
790 LET H(2,1)=H0*A1/G(1,1)
800 LET H(2,2)=H0*(1-A1)/(1-G(1,1))
810 LET H(2,3)=H0*A2/G(1,2)
820 LET H(2,4)=H0*(1-A2)/(1-G(1,2))
830 LET G(2,1)=A2*H(2,1)+B2*(1-H(2,1))
840 LET G(2,2)=A2*H(2,2)+B2*(1-H(2,2))
850 LET G(2,3)=A1*H(2,3)+B1*(1-H(2,3))
860 LET G(2,4)=A1*H(2,4)+B1*(1-H(2,4))
870 LET H(3,1)=H(3,5)=H(2,1)*A2/G(2,1)
880 LET H(3,2)=H(3,7)=H(2,1)*(1-A2)/(1-G(2,1))
890 LET H(3,3)=H(3,6)=H(2,2)*A2/G(2,2)
900 LET H(3,4)=H(3,8)=H(2,2)*(1-A2)/(1-G(2,2))
910 FOR N=1 TO 8
920 IF H(3,N)*R1>(1-H(3,N))*R2 THEN 960
930 LET D$(N)=D$
940 LET L(3,N)=H(3,N)*W3+(1-H(3,N))*W4-C1-C2
950 GO TO 980
960 LET D$(N)=C$
970 LET L(3,N)=H(3,N)*W1+(1-H(3,N))*W2-C1-C2
980 NEXT N
990 FOR N = 1 TO 4
1000 LET L(2,N)=G(2,N)*L(3,2*N-1)+(1-G(2,N))*L(3,2*N)
1010 IF H(2,N)*R1>(1-H(2,N))*R2 THEN 1050
1020 LET E$(N+4)=D$
1030 LET L(2,N+4)=H(2,N)*W3+(1-H(2,N))*W4-U(N)
1040 GO TO 1070
1050 LET E$(N+4)=C$
1060 LET L(2,N+4)=H(2,N)*W1+(1-H(2,N))*W2-U(N)
1070 NEXT N
1080 FOR N=1 TO 4
1090 IF L(2,N)>L(2,N+4) THEN 1130
1100 LET E$(N)=E$(N+4)
1110 LET L(2,N)=L(2,N+4)
1120 GO TO 1140
1130 LET E$(N)=I$(N)
1140 NEXT N
1150 LET L(1,1)=G(1,1)*L(2,1)+(1-G(1,1))*L(2,2)
1160 LET L(1,2)=G(1,2)*L(2,3)+(1-G(1,2))*L(2,4)
1170 IF H0*R1>(1-H0)*R2 THEN 1210
1180 LET F$(3)=D$
1190 LET L(1,3)=H0*W3+(1-H0)*W4
1200 GO TO 1230
1210 LET F$(3)=C$
1220 LET L(1,3)=H0*W1+(1-H0)*W2
1230 FOR N=1 TO 3
1240 FOR S=1 TO 3
1250 IF L(1,N)<L(1,S) THEN 1280
1260 NEXT S
1270 GO TO 1290
1280 NEXT N
1290 ON N GO TO 1300,1300,1460
1300 PRINT "DO ";F$(N)
1310 PRINT E$;E$(2*N-1);
1320 IF E$(2*N-1)=C$ THEN 1370
1330 IF E$(2*N-1)=D$ THEN 1370
1340 PRINT TAB(8);E$;D$(4*N-3);TAB(48);"<L>=";L(3,4*N-3)
1350 PRINT TAB(8);F$;D$(4*N-2);TAB(48);"<L>=";L(3,4*N-2)
1360 GO TO 1380
1370 PRINT TAB(48);"<L>=";L(2,2*N-1)
1380 PRINT F$;E$(2*N);
1390 IF E$(2*N)=C$ THEN 1440
1400 IF E$(2*N)=D$ THEN 1440
1410 PRINT TAB(8);E$;D$(4*N-1);TAB(48);"<L>=";L(3,4*N-1)
1420 PRINT TAB(8);F$;D$(4*N);TAB(48);"<L>=";L(3,4*N)
1430 STOP
1440 PRINT TAB(48);"<L>=";L(2,2*N)
1450 STOP
1460 PRINT "DO";F$(3),"<L>=";L(1,3)
1470DATA "ACT:T1","ACT:T2","ACT:G","ACT:B"
1480 DATA "IF THE EQUIPMENT IS REPORTED 'GOOD', DO "
1490 DATA "IF THE EQUIPMENT IS REPORTED 'BAD', DO "
1500 END