Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-04 - decus/20-0113/cmodq.bas
There are 2 other files named cmodq.bas in the archive. Click here to see a list.
00020FILES RFILE1,RFILE2,RFILE3
00060RESTORE#1
00061  INPUT#  1,I1,I2,I3
00070SCRATCH#1
00071  PRINT #  1,20,I2,I3
00080PRINT L$
00090DIM M(9)
00100REM
00110PRINT "        NINE-POINT UNIVARIATE UTILITY-LEAST SQUARES FIT"
00120PRINT
00130PRINT "IF YOU WANT AN EXPLANATION TYPE '1' ELSE '0'.";
00140GOSUB 9000
00150S6=O1
00160IF O1=0 THEN 350
00170PRINT
00180PRINT "THIS MODULE WILL ASSIST YOU IN FITTING A UTILITY FUNCTION ON"
00190PRINT "A ONE-DIMENSIONAL ATTRIBUTE.  YOU ARE TO SPECIFY WHICH NINE"
00200PRINT "POINTS ALONG THIS ONE-DIMENSIONAL CONTINUUM YOU WANT TO USE"
00210PRINT "IN THE FITTING PROCEDURE.   IT IS ASSUMED  THAT YOU WANT TO"
00220PRINT "ASSIGN A UTILITY OF  0 TO THE FIRST POINT YOU SPECIFY AND A"
00230PRINT "UTILITY OF 1 TO THE LAST POINT.  THE OTHER SEVEN POINTS WILL"
00240PRINT "BE ASSIGNED UTILITIES BETWEEN 0 AND 1. CHOOSE YOUR POINTS SO"
00250PRINT "THAT THE MAJOR REGIONS IN WHICH YOUR UTILITIES  INCREASE ARE"
00260PRINT "IDENTIFIED BY AT LEAST ONE POINT. NO TWO POINTS SHOULD HAVE"
00270PRINT "APPROXIMATELY THE SAME UTILITY."
00280PRINT
00290PRINT "WHEN YOU ARE READY TO CONTINUE TYPE '1'.";
00300GOSUB 9000
00310PRINT L$
00320PRINT "THE POINTS YOU SPECIFY MUST BE EXPRESSIBLE IN XXX.XX FORMAT."
00330PRINT "THERE MUST NOT BE MORE THAN THREE DIGITS TO THE LEFT OF THE"
00340PRINT "DECIMAL POINT OR MORE THAN TWO TO THE RIGHT OF IT."
00350PRINT
00360PRINT "SPECIFY THE NINE POINTS YOU WANT BEGINNING WITH THE ONE TO "
00370PRINT "BE ASSIGNED UTILITY 0."
00380FOR K5=1 TO 9
00390PRINT
00400REM
00410PRINT"SPECIFY POINT ";K5;
00420GOSUB 9000
00430IF O1>999.99 THEN 310
00440IF O1<-999.99 THEN 310
00450M(K5)=O1
00460NEXT K5
00470FOR K5=9 TO 2 STEP -1
00480IF M(K5)>M(K5-1) THEN 520
00490PRINT
00500PRINT "REENTER.  POINTS ARE NOT IN MONOTONIC ORDER."
00510GOTO 350
00520NEXT K5
00530GOTO 580
00540FOR K5=1 TO 8
00550IF M(K5)>M(K5+1) THEN 570
00560GOTO 490
00570NEXT K5
00580PRINT L$
00590PRINT "HERE ARE THE POINTS YOU SPECIFIED."
00600PRINT
00610FOR K5=1 TO 9
00620:POINT  ##   ####.##
00630PRINT  USING 620,K5,M(K5)
00640NEXT K5
00650PRINT
00660PRINT "IF YOU WANT TO REENTER THE POINTS TYPE '1' ELSE '0'.";
00670GOSUB 9000
00680IF O1 <> 1 THEN 710
00690PRINT L$
00700GOTO 350
00710IF O1=0 THEN 750
00720PRINT
00730PRINT "REENTER.  INPUT MUST BE 0 OR 1."
00740GOTO 670
00750SCRATCH#3
00752FOR I=1 TO 9
00755  PRINT #  3,M(I)
00756NEXT I
00760IF S6=0 THEN 1280
00770PRINT L$
00780PRINT "WE SHALL HELP YOU DETERMINE YOUR UTILITIES FOR THESE  POINTS"
00790PRINT "BY PRESENTING YOU WITH A SUCCESSION OF GAMBLES.  FOR EXAMPLE,"
00800:SUPPOSE YOU WERE ASKED TO CHOOSE BETWEEN ####.##  FOR SURE
00810PRINT  USING 800,M(4)
00820:AND TAKING A GAMBLE THAT GIVES YOU ####.##  WITH PROBABILITY
00830PRINT  USING 820,M(5)
00840:P AND ####.##  WITH PROBABILITY  1-P.  IF P=1 THEN YOU WOULD
00850PRINT  USING 840,M(3)
00860PRINT"CERTAINLY PREFER TAKING THE GAMBLE BECAUSE IT IS SURE"
00880:TO GIVE YOU ####.##. HOWEVER IF P=0  YOU WOULD PREFER ####.##
00890PRINT  USING 880,M(5),M(4)
00900:FOR SURE BECAUSE THE GAMBLE IS GOING TO GIVE YOU ####.##. THUS
00910PRINT  USING 900,M(3)
00920PRINT "THERE IS A SET OF P VALUES  LESS THAN  1 FOR WHICH YOU PREFER"
00930PRINT "THE GAMBLE AND A SET OF P VALUES GREATER THAN O FOR WHICH YOU"
00940PRINT "PREFER THE SURE THING.  THERE IS A UNIQUE P SEPARATING THE TWO"
00950PRINT "SETS AND FOR THIS P YOU WOULD BE INDIFFERENT BETWEEN THE GAMBLE"
00960:AND ####.## FOR SURE.   WHAT WE SHALL NEED  FROM YOU IS YOUR
00970PRINT  USING 960,M(4)
00980PRINT "CAREFULLY CONSIDERED JUDGEMENT CONCERNING THIS INDIFFERENCE P."
00990PRINT
01000PRINT "WHEN YOU ARE READY TO CONTINUE TYPE '1'.";
01010GOSUB 9000
01020V7=O1
01030PRINT L$
01040PRINT "YOU WILL BE ASKED TO GIVE YOUR INDIFFERENCE P FOR EACH OF"
01050PRINT "A SUCCESSION OF CHOICES  BETWEEN A GAMBLE AND A SURE THING."
01060PRINT "FOR EXAMPLE, WHEN THE REQUEST"
01070PRINT
01080PRINT "   FOR                   GAMBLE                   P THAT MAKES"
01090PRINT "  SURE        WITH PROB P      WITH PROB 1-P    YOU INDIFFERENT"
01100:####.##       #####.##       #####.##                ?
01110PRINT  USING 1100,M(4),M(5),M(3)
01120PRINT
01130PRINT "APPEARS YOU ARE TO RESPOND BY TYPING THE VALUE OF P THAT WOULD"
01140:MAKE  YOU INDIFFERENT BETWEEN ####.## FOR SURE AND THE GAMBLE
01150PRINT  USING 1140,M(4)
01160:GIVING  YOU ####.##  WITH PROBABILITY P  AND  ####.##  WITH
01170PRINT  USING 1160,M(5),M(3)
01180PRINT "PROBABILTY  1-P."
01190PRINT
01200PRINT "IT MIGHT BE HELPFUL TO REMEMBER THAT IF WE ASSIGN UTILITY 0"
01210:TO ####.## AND UTILITY 1 TO ####.## THEN THE P  YOU ARE
01220PRINT  USING 1210,M(3),M(5)
01230:ASKED TO GIVE IS THE (RELATIVE) UTILITY OF ####.##.
01240PRINT  USING 1230,M(4)
01250PRINT
01260PRINT "WHEN YOU ARE READY TO CONTINUE TYPE '1'";
01270GOSUB 9000
01280DIM V(112)
01290MAT V=ZER
01300SCRATCH#2
01302FOR I=1 TO 112
01305  PRINT #  2,V(I)
01306NEXT I
01310SCRATCH#1
01311  PRINT #  1,99,I2,I3
01320CHAIN "CMODK"
09000REM--SUBROUTINE THAT DETERMINES IF RESTART HAS BEEN REQUESTED.
09005INPUT O1
09015IF O1=-9999 THEN 9025
09020RETURN
09025CHAIN "RSTRT"
09035REM*************END ROUTINE
09999END