Trailing-Edge
-
PDP-10 Archives
-
decuslib10-06
-
43,50377/invsim.bas
There is 1 other file named invsim.bas in the archive. Click here to see a list.
00010 REM INVSIM NADDOR SEP 75
00011 U$="22-SEP-75"
00012 FILE #1,"USING.SEQ"
00013 SCRATCH #1
00014 PRINT U$" VERSION"
00015 DIM P(10),Q(10),R(12),X(200),Z(5)
00020 DIM H$(4),I$(4),P$(2)
00025 DEF FNU(Q)=U*INT(Q/U+.5)
00030 D$="STOPARCOSDEMDETHEURAN---HELSIM"
00032 P$="TZSQSZ"
00034 P$(1)=" T S Z Q TOTAL/C"
00036 P$(2)="### ### ### ### ####.##"
00038 H$(1)="PER BEG DEM END OAO ORD REC "
00040 I$(1)="### ### ### ### ### ### ### "
00042 H$(2)="CARRY SHORT REPLE "
00044 I$(2)="###.# ###.# ##.## "
00046 H$(3)="C/C S/C R/C "
00048 I$(3)="### ### ### "
00050 H$(4)="TOTAL/C AVA/%"
00052 I$(4)="####.## ###.# "
00060 Q$=CHR$(34)
00085 PRINT
00086 GO TO 300
00095 PRINT "BAD DIRECTIVE"
00100 PRINT
00105 PRINT "DIR,PO,T-S,Z-Q,HOR,DET,PRI";
00110 MAT INPUT Z$
00111 GOSUB 9700
00120 IF Z$="" THEN 145
00125 D=INSTR(1,D$,LEFT$(Z$,3))
00130 IF D=0 THEN 95
00135 D=1+(D-1)/3
00145 PRINT
00146 ON D GOTO 9999,200,300,400,500,500,700,95,900,1000
00200 PRINT "CARRY/C SHORT/C REPLE/C LEADTIME AVAIL/%"
00205 PRINT USING " ###.## ###.## ###.## ## ###.##",C1,C2,C3,L,A2
00210 PRINT
00211 PRINT "DEMAND";
00215 U$=Q$+"###### "+Q$
00216 FOR X=X1 TO X9 STEP U
00217 PRINT #1,USING U$,X
00218 GOSUB 9900
00219 NEXT X
00220 PRINT
00221 PRINT "PROBAB";
00225 U$=Q$+"##.### "+Q$
00226 FOR K=1 TO K9
00227 PRINT #1,USING U$,P(K)
00228 GOSUB 9900
00229 NEXT K
00230 PRINT
00231 PRINT
00232 PRINT USING "MEAN = ###.## S.D. = ###.##",X5,S5
00233 GO TO 100
00300 PRINT "CAR,SHO,REP,LEA,AV%";
00305 MAT INPUT Z$
00306 GOSUB 9700
00310 Y9=5
00315 GOSUB 9200
00320 IF Z(1)<0 THEN 325
00321 C1=Z(1)
00325 IF Z(2)<0 THEN 330
00326 C2=Z(2)
00327 A2=100*C2/(C1+C2)
00330 IF Z(3)<0 THEN 335
00331 C3=Z(3)
00335 IF Z(4)<0 THEN 340
00336 L=Z(4)
00340 IF Z(5)<0 THEN 346
00341 A2=Z(5)
00342 IF A2<>100 THEN 345
00343 C2=999.99
00344 GO TO 346
00345 C2=C1*A2/(100-A2)
00346 IF D>0 THEN 100
00400 PRINT
00401 PRINT "MIN,MAX,STE";
00402 MAT INPUT Z$
00403 GOSUB 9700
00405 Y9=3
00406 GOSUB 9200
00407 IF Z(2)<Z(1) THEN 400
00410 X1=Z(1)
00415 X9=Z(2)
00416 IF X1<>X9 THEN 420
00417 U=X1
00418 GO TO 430
00420 IF Z(3)<=0 THEN 400
00421 U=Z(3)
00425 IF X1<>FNU(X1) THEN 400
00426 IF X9<>FNU(X9) THEN 400
00430 K9=1+(X9-X1)/U
00435 MAT Q=ZER(K9)
00440 IF K9<>1 THEN 445
00441 P(1)=1
00442 X5=X1
00443 S5=0
00444 GO TO 495
00445 PRINT
00446 PRINT K9;"PROBS";
00447 MAT INPUT P
00448 IF NUM<>K9 THEN 445
00450 X5=S5=F=0
00455 FOR K=1 TO K9
00460 F=F+P(K)
00465 X5=X5+(K-1)*P(K)
00470 S5=S5+(K-1)^2*P(K)
00475 NEXT K
00480 IF ABS(F-1)>.0001 THEN 445
00485 S5=U*SQR(S5-X5^2)
00490 X5=X1+X5*U
00495 Z9=100
00496 GOSUB 700
00497 GO TO 100
00500 C5=C1*C2/(C1+C2)
00505 T=SQR(2*C3/(X5*C5))
00506 T=INT(T+.5)
00507 IF T<>0 THEN 510
00508 T=1
00510 Q=T*X5
00511 Q=FNU(Q)
00512 IF Q<>0 THEN 515
00513 Q=U
00515 IF D<>6 THEN 520
00516 IF S5>0 THEN 600
00520 Z=Q*C2/(C1+C2)+L*X5
00521 IF Z>FNU(Z) THEN 524
00522 Z=FNU(Z)
00523 GO TO 525
00524 Z=FNU(Z)+U
00525 S=Z-Q
00530 K0=C1*(Z-L*X5)^2/(2*Q)+C2*(S-L*X5)^2/(2*Q)+C3/T
00535 PRINT P$(1)
00536 PRINT USING P$(2),T,S,Z,Q,K0
00540 GO TO 100
00600 V0=S5^2
00601 IF X1<>0 THEN 604
00602 P0=P(1)
00603 GO TO 605
00604 P0=0
00605 IF A2<.1 THEN 607
00606 IF A2<=99.9 THEN 610
00607 N=3
00608 GO TO 625
00610 IF A2<=50 THEN 613
00611 A6=1-A2/100
00612 GO TO 615
00613 A6=A2/100
00615 N6=SQR(-2*LOG(A6))
00620 N=N6-(2.308+.271*N6)/(1+.992*N6+.045*N6^2)
00625 N=N*SGN(A2-50)
00630 S1=SQR((L+T/3)*V0+(T*X5)^2/12+U^2*(1-P0^T)/6)
00635 Z=(L+T/2)*X5+N*S1
00636 Z=FNU(Z)
00638 S2=SQR((L+1/3)*V0+(X5^2+Q^2+U^2)/12-U^2*P0/6)
00645 S=(L+1/2)*X5+N*S2-(Q+U)/2
00646 S=FNU(S)
00650 M=EXP(-N^2/2)/SQR(6.2832)
00655 I3=(1-P0^T)/T
00660 K0=(C1+C2)*M*S1+C3*I3
00665 PRINT P$(1)
00666 PRINT USING P$(2),T,S,Z,Q,K0
00670 GO TO 100
00700 MAT Q=P
00705 F9=1
00710 Z7=1/Z9
00715 FOR J=1 TO Z9
00720 R=F9*RND
00725 F=Q(1)
00730 FOR K=1 TO K9
00735 IF F>R THEN 750
00740 F=F+Q(K+1)
00745 NEXT K
00750 X(J)=X1+(K-1)*U
00755 Q(K)=Q(K)-Z7
00760 F9=F9-Z7
00765 NEXT J
00770 IF D=7 THEN 100
00775 RETURN
00900 PRINT "DIRECTIVES:"
00905 PRINT "COSTS,DEMANDS,DETERMINISTIC,HELP"
00910 PRINT "HEURISTIC,PARAMETERS,RANDOM,SIMULATE,STOP"
00915 GO TO 100
01000 Z$=Z$+","
01001 GOSUB 9100
01002 IF Z$="" THEN 1100
01005 GOSUB 9100
01006 P=INSTR(1,P$,LEFT$(T$,2))
01010 IF P=0 THEN 95
01011 IF Z$="" THEN 95
01015 P=1+(P-1)/2
01020 G0=0
01021 GOSUB 9100
01025 GOSUB 9300
01026 W1=Z(1)
01027 W2=Z(2)
01030 IF Z$="" THEN 1100
01031 GOSUB 9100
01035 GOSUB 9300
01036 H1=Z(1)
01037 H2=Z(2)
01040 IF Z$="" THEN 1100
01041 GOSUB 9100
01045 Z8=VAL(T$)
01046 IF Z8=Z9 THEN 1050
01047 Z9=Z8
01048 GOSUB 700
01050 IF Z$="" THEN 1100
01051 GOSUB 9100
01055 D8=VAL(T$)
01056 IF Z$="" THEN 1100
01057 GOSUB 9100
01060 P8=VAL(T$)
01100 IF D8>0 THEN 1105
01101 GOSUB 9500
01105 IF P<>1 THEN 1110
01106 W0=1
01107 GO TO 1115
01110 W0=U
01111 W1=FNU(W1)
01112 W2=FNU(W2)
01115 H1=FNU(H1)
01116 H2=FNU(H2)
01200 FOR W=W1 TO W2 STEP W0
01201 T=S=W
01205 FOR H=H1 TO H2 STEP U
01206 Z=Q=H
01210 J1=J2=J3=A4=0
01215 IF P<>2 THEN 1218
01216 E=S+Q
01217 GO TO 1220
01218 E=Z
01220 MAT R=ZER(L+2)
01225 IF D8<=0 THEN 1300
01226 PRINT
01227 H$=H$(1)
01228 GOSUB 9505
01300 FOR J=1 TO L+Z8
01305 B=E+R(1)
01310 X=X(J-Z9*INT((J-1)/Z9))
01315 E=B-X
01320 IF E<0 THEN 1325
01321 I1=B-X/2
01322 A=100
01325 IF B<=0 THEN 1330
01326 IF E>=0 THEN 1330
01327 I1=B^2/2/X
01328 A=100*B/X
01330 IF B>0 THEN 1335
01331 I1=A=0
01332 IF B<>0 THEN 1335
01333 IF E<>0 THEN 1335
01334 A=50
01335 I2=I1-B+X/2
01400 V=E
01401 FOR I=2 TO L+1
01402 V=V+R(I)
01403 NEXT I
01405 Y=0
01406 ON P GOTO 1410,1415,1420
01410 IF J<>T*INT(J/T) THEN 1430
01411 GO TO 1425
01415 IF V+Y>S THEN 1430
01416 Y=Y+Q
01417 GO TO 1415
01420 IF V>S THEN 1430
01425 Y=Z-V
01430 IF Y<=0 THEN 1433
01431 I3=1
01432 GO TO 1435
01433 I3=0
01435 R(L+2)=Y
01436 FOR I=1 TO L+1
01440 R(I)=R(I+1)
01441 NEXT I
01500 IF J<=L THEN 1535
01505 J1=J1+I1
01510 J2=J2+I2
01515 J3=J3+I3
01520 A4=A4+A
01525 K1=C1*I1
01526 K2=C2*I2
01527 K3=C3*I3
01528 K0=K1+K2+K3
01530 IF D8<=0 THEN 1535
01531 IF J>D8+L THEN 1535
01532 GOSUB 9600
01535 NEXT J
01600 I1=J1/Z8
01601 I2=J2/Z8
01602 I3=J3/Z8
01603 A=A4/Z8
01605 K1=C1*I1
01606 K2=C2*I2
01607 K3=C3*I3
01610 K0=K1+K2+K3
01615 IF D8<=0 THEN 1620
01616 GOSUB 9500
01620 GOSUB 9605
01700 NEXT H
01701 NEXT W
01705 IF G0=0 THEN 1710
01706 G0=G0+1
01707 IF G0>10 THEN 1710
01708 GOSUB 700
01709 GO TO 1200
01710 GO TO 100
09100 G=INSTR(1,Z$,",")
09105 T$=LEFT$(Z$,G-1)
09110 Z$=MID$(Z$,G+1)
09111 RETURN
09200 Z$=Z$+","
09205 MAT Z=CON(Y9)
09210 MAT Z=(-1)*Z
09215 FOR Y=1 TO Y9
09220 IF Z$="" THEN 9245
09225 GOSUB 9100
09230 IF T$="" THEN 9240
09235 Z(Y)=VAL(T$)
09240 NEXT Y
09245 RETURN
09300 G=INSTR(2,T$,"-")
09305 IF G<>0 THEN 9310
09306 Z(1)=Z(2)=VAL(T$)
09307 GO TO 9325
09310 Z(1)=VAL(LEFT$(T$,G-1))
09315 Z(2)=VAL(MID$(T$,G+1))
09320 IF Z(1)<>Z(2) THEN 9325
09321 G0=1
09325 RETURN
09500 PRINT
09501 H$=" "+MID$(P$,2*P-1,1)+" "+MID$(P$,2*P,1)+" "
09505 IF P8<=0 THEN 9510
09506 H$=H$+H$(2)
09510 IF P8<>2 THEN 9515
09511 H$=H$+H$(3)
09515 H$=H$+H$(4)
09516 PRINT H$
09520 PRINT
09521 RETURN
09600 IF D8<=0 THEN 9605
09601 U$=Q$+I$(1)+Q$
09602 PRINT #1,USING U$,J-L,B,X,E,V,Y,R(1)
09603 GOSUB 9900
09604 GOTO 9610
09605 U$=Q$+"### ### "+Q$
09606 PRINT #1,USING U$,W,H
09607 GOSUB 9900
09610 IF P8<=0 THEN 9615
09611 U$=Q$+I$(2)+Q$
09612 PRINT #1, USING U$, I1,I2,I3
09613 GOSUB 9900
09615 IF P8<>2 THEN 9620
09616 U$=Q$+I$(3)+Q$
09617 PRINT #1,USING U$,K1,K2,K3
09618 GOSUB 9900
09620 U$=Q$+I$(4)+Q$
09621 PRILT #1,USING U$,K0,A
09622 GOSUB 9900
09623 PRINT
09625 RETURN
09700 Z$=Z$(1)
09705 FOR I=2 TO NUM
09710 Z$=Z$+","+Z$(I)
09715 NEXT I
09720 RETURN
09900 RESTORE #1
09905 INPUT #1,T$
09910 PRINT T$;
09915 SCRATCH #1
09920 RETURN
09999 END
IIIAAAA>>AAA> AA@@@@IIIAAA @ FIII1AA``III6~~FIII1*U*