Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/decide.eng
There are 2 other files named decide.eng in the archive. Click here to see a list.
100'  NAME--DECIDE
110'
120'  DESCRIPTION--HELPS TO DECIDE AMONG THREE ALTERNATIVES.
130'
140'  SOURCE--UNKNOWN
150'
160'  DESCRIPTION--TYPE "RUN" AND FOLLOW INSTRUCTIONS.
170'
180'
190'  *  *  *  *  *  *  *  MAIN PROGRAM  *  *  *  *  *  *  *  *  *  *  *  *
200'
210 PRINT "THIS PROGRAM IS DESIGNED TO HELP YOU DECIDE AMONG THREE"
220 PRINT "ALTERNATIVES.  ALTERNATIVE A0 CALLS FOR A TEST WHICH WILL"
230 PRINT "IMPERFECTLY DECIDE BETWEEN TWO COMPETING HYPOTHESES,H1 AND H2."
240 PRINT "ALTERNATIVE A1 CALLS FOR AN ACTION CONSISTENT WITH THE TRUTH"
250 PRINT "OF HYPOTHESIS H1.  A2 IS CONSISTENT WITH H2."
260 PRINT
270 PRINT "IF YOU CALL FOR A TEST TO BE RUN, IT WILL COST C."
280 PRINT
290 PRINT "THE REWARD MATRIX IS AS FOLLOWS:"
300 PRINT
310 PRINT"                                  IF H1 TRUE    IF H2 TRUE"
320 PRINT " AND YOU DO A1, THE REWARD IS        W1            W2"
330 PRINT "  OR YOU DO A2, THE REWARD IS        W3            W4"
340 PRINT
350 PRINT
360 PRINT " THE TEST PROCEDURE IS NOT PERFECT.  IT MAY TELL YOU THAT"
370 PRINT "H1 IS TRUE WHEN IN FACT H1 IS FALSE AND VICE VERSA.  THE"
380 PRINT "MATRIX OF POSSIBLE OUTCOMES IS AS FOLLOWS:"
390 PRINT
400 PRINT "           PROBABILITIES OF FOUR POSSIBLE OUTCOMES"
410 PRINT "                         IF H1 TRUE         IF H2 TRUE"
420 PRINT "THE TEST SAYS:"
430 PRINT "THAT H1 IS TRUE             G1                 G2"
440 PRINT "THAT H2 IS TRUE            1-G1             1-G2"
450 PRINT
460 PRINT
470 PRINT "THE FINAL PIECE OF INFORMATION NEEDED TO HANDLE THIS "
480 PRINT "DECISION FORMALLY IS THE PRIOR PROBABILITY YOU WOULD ASSIGN"
490 PRINT "TO THE TRUTH OF H1 IN THE ABSENCE OF ANY TEST DATA.  CALL"
500 PRINT "THIS P."
510 PRINT
520 PRINT
530 PRINT "INPUT C, THE TEST COST,AND W1,W2,W3,W4, THE REWARD MATRIX."
540 INPUT C,W1,W2,W3,W4
550 LET R1=W1-W3
560 LET R2=W4-W2
570 IF R1/R2>0 THEN 640
580 PRINT "YOU HAVE NO PROBLEM....LOOK CLOSELY AT YOUR REWARD MATRIX"
590 IF (W1-W3)*(W2-W4)>0 THEN 620
600 PRINT "IT TELLS YOU TO ALWAYS DO A2"
610 STOP
620 PRINT "IT TELLS YOU TO ALWAYS DO A1"
630 STOP
640 PRINT "INPUT PRIOR PROBABILITY FOR H1 (P)"
650 INPUT A
660 PRINT "INPUT TEST RELIABILITY DATA, I.E., G1=PROBABILITY TEST WILL"
670 PRINT "CORRECTLY SAY H1 IS TRUE WHEN IT IS AND G2=PROBABILITY TEST"
680 PRINT "WILL INCORRECTLY SAY H1 IS TRUE WHEN H2 IS TRUE."
690 INPUT G1,G2
700 LET Q0=A*R1/((1-A)*R2)
710 IF Q0>1 THEN 790
720 LET Q2=A*G1*R1-(1-A)*G2*R2
730 LET Q3=Q2
740 IF Q2>C THEN 850
750 PRINT "DO A2, IT IS BETTER THAN A1 BEFORE TESTING AND"
760 PRINT "THE BREAK EVEN COST IS ";Q2
770 PRINT
780 STOP
790 LET Q1=(1-A)*(1-G2)*R2-A*(1-G1)*R1
800 LET Q3=Q1
810 IF Q1>C THEN 850
820 PRINT "DO A1, IT IS BETTER THAN A2 BEFORE TESTING AND"
830 PRINT "THE BREAK EVEN COST IS ";Q1
840 STOP
850 PRINT "TEST FIRST, THEN DECIDE.  THE BREAK EVEN TEST COST"
860 PRINT "IS ";Q3
870 END