Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-09 - 43,50466/linpro.f4
There are no other files named linpro.f4 in the archive.
C	WESTERN MICHIGAN UNIVERSITY
C	LINPRO.F4 (FILENAME ON LIBRARY DECTAPE)
C	LINPRO, 2.13.1 (CALLING NAME SUBLST #)
C	LINEAR PROGRAMMING MANIPULATION PROGRAM
C	LINPRO.F4 WAS PROGRAMMED BY A. H. WRIGHT (MATH DEPT. WMU)
C	 MODIFIED BY R.R. BARR
C	LIBRARY DECTAPE PROGRAMS USED:  USAGE.MAC
C	INTERNAL SUBR. USED:  MATOUT, COND
C	ABOVE COMMENTS AND RIGHT ADJUSTED COMMENTS PUT IN BY WG
C
C	THIS IS A INTERACTIVE TUTORIAL PROGRAM TO TEACH THE SIMPLEX METHOD
C	OF LINEAR PROGRAMMING.  IT WILL WORK WITH ANY METHOD OF
C	LINEAR PROGRAMMING WHICH USES THE STANDARD SIMPLEX TABLEAU
C	AND STANDARD PIVOT OPERATIONS.  THE USER MUST CHOOSE THE PIVOT
C	ENTRY OF THE TABLEAU, AND THE PROGRAM WILL DO THE PIVOT COMPUTATIONS.
C
C	THE USER HAS THE CHOICE OF FOUR DIFFERENT TABLEAU FORMATS.
C	THE OBJECTIVE FUNCTION ROW MAY BE ON THE TOP OR BOTTOM OF
C	THE TABLEAU, AND THE CONSTANT COLUMN MAY BE ON THE RIGHT OR
C	ON THE LEFT.
C
C	IN ADDITION THE THE OPTIONS FOR PIVOTING AND FOR PRINTING
C	THE TABLEAU, THERE ARE A NUMBER OF EDITING OPTIONS.  A LIST
C	OF OPTIONS MAY BE OBTAINED BY TYPING HELP WHEN THE COMPUTER
C	ASKS FOR AN OPTION.
C
C *******************************************************************
C
C	REQUIRED SUBROUTINES:
C
C	MATOUT(INTERN.)	PRINTS TABLEAU
C	COND(INTERN.)	DETERMINES COLUMNS OF THE TABLEAU WHICH CONTAIN
C				ONLY ZEROS, ONES, AND MINUS ONES
C	USAGEB		APPLICATIONS ROUTINE(APLIB)
C
C *******************************************************************
C
C	LOAD PROCEDURE: LOA LINPRO,USAGE
C
C *******************************************************************
C
C	LIST OF IMPORTANT VARIABLES:
C
C	J	IS ALWAYS USED AS A ROW INDEX
C	P	IS THE HIGHEST INDEX OF A ROW
C	P0	IS THE LOWEST INDEX OF A ROW
C	P00	IS THE INDEX OF THE OBJECTIVE FUNCTION ROW
C
C	I	IS ALWAYS USED AS A COLUMN INDEX
C	N	IS THE HIGHEST INDEX OF A COLUMN
C	N0	IS THE LOWEST INDEX OF A COLUMN
C	N00	IS THE INDEX OF THE CONSTANT COLUMN
C
C	T	STORES THE TABLEAU
C	TOLD	SAVES THE TABLEAU FOR THE "RETURN" OPTION
C	TSAVE	SAVES THE TABLEAU FOR THE "SAVE" AND THE "RECALL" OPTIONS
C	
C	IND(J)	A LOGICAL VARIABLE WHICH IS TRUE IF COLUMN I
C			CONTAINS ONLY ZEROS, ONES, AND MINUS ONES.
C			OTHERWISE IT IS FALSE.
C
C
	LOGICAL IND,INDSAVE,INDOLD,IP,IN
	INTEGER P,POLD,PSAVE,P0,P00,P9
	DIMENSION T(0/35,0/35),IND(0/35),TOLD(0/35,0/35),
     1	INDOLD(0/35),TSAVE(0/35,0/35),INDSAVE(0/35)
	COMMON N0,P0,N00,P00
C *******************************************************************
C	
C	THIS SECTION SETS UP THE TABLEAU FORMAT AND INPUTS THE TABLEAU
C
C *********************************************************************
	WRITE(5,8)
8	FORMAT(' TABLEAU OPTIONS')
C	CALL USAGEB('LINPRO')
400	WRITE(5,401)
401	FORMAT(' OBJECTIVE FUNCTION (TOP OR BOTTOM)?'$)
	READ(5,402)ANS,ANS1
402	FORMAT(2A5)
	IF(ANS.EQ.3HTOP.OR.ANS.EQ.5H"TOP")GO TO 405
	IF((ANS.EQ.5HBOTTO.AND.ANS1.EQ.1HM).OR.(ANS.EQ.5H"BOTT.AND.ANS1
     1	.EQ.3HOM"))GO TO 410
	WRITE(5,403)
403	FORMAT(' IF YOU WANT THE ROW FOR THE OBJECTIVE FUNCTION TO 
     1	 BE PRINTED ON THE'/' TOP OF THE TABLEAU, ANSWER "TOP".
     2	IF YOU WANT THE ROW FOR THE OBJECTIVE'/' FUNCTION TO BE PRINTED
     3	AT THE BOTTOM OF THE TABLEAU, ANSWER "BOTTOM".')
	GO TO 401
405	P0 = 0
	P00 = 0
	IP = .FALSE.
	GO TO 450
410	P0 = 1
	IP = .TRUE.
450	WRITE(5,451)
451	FORMAT(' CONSTANT COLUMN (RIGHT OR LEFT)?'$)
	READ(5,452)ANS,ANS1
452	FORMAT(2A5)
	IF((ANS.EQ.5HRIGHT).OR.(ANS.EQ.5H"RIGH.AND.ANS1.EQ.2HT"))GO TO 460
	IF((ANS.EQ.4HLEFT).OR.(ANS.EQ.5H"LEFT))GO TO 455
	WRITE(5,453)
453	FORMAT(' IF THE WANT THE COLUMN OF CONSTANTS IN THE TABLEAU
     1	TO BE PRINTED ON THE'/' LEFT SIDE OF THE TABLEAU, ANSWER
     2	 "LEFT".  IF YOU WANT THE COLUMN OF CONSTANTS TO '/' BE PRINTED
     3	 ON THE RIGHT SIDE OF THE TABLEAU, ANSWER "LEFT".')
455	NO = 0
	NOO = 0
	IN = .FALSE.
	GO TO 1
460	N0 = 1
	IN = .TRUE.
1	IF(IP)GO TO 2
	WRITE(5,5)
5	FORMAT(' INPUT THE NUMBER OF CONSTRAINTS?'$)
	READ(5,6)P
6	FORMAT(I)
	GO TO 15
2	WRITE(5,3)
3	FORMAT(' INPUT THE NUMBER OF ROWS?'$)
	READ(5,6)P
	P00 = P
15	IF(IN)GO TO 22
	WRITE(5,16)
16	FORMAT(' INPUT THE NUMBER OF VARIABLES?'$)
	READ(5,6)N
	GO TO 29
22	WRITE(5,17)
17	FORMAT(' INPUT THE NUMBER OF COLUMNS?'$)
	READ(5,6)N
	N00 = N
29	WRITE(5,10)
10	FORMAT(' INPUT TABLEAU'/)
	DO 11 J = P0,P
	WRITE(5,30)J
30	FORMAT('+ROW',I2,'?',$)
11	READ(5,21)(T(J,I),I = N0,N)
21	FORMAT(35F)
39	CALL COND(T,IND,P,N)
C *********************************************************************
C
C	THIS SECTION CHOSSES THE OPTION
C
C *********************************************************************
40	WRITE(5,41)
41	FORMAT(' OPTION?'$)
	READ(5,42)OPT
42	FORMAT(A5)
	IF(OPT.EQ.'PIV  '.OR.OPT.EQ.'PIVOT')GO TO 49
	IF(OPT.EQ.'STOP ')GO TO 1000
	IF(OPT.EQ.'P'.OR.OPT.EQ.'PRINT')GO TO 300
	IF(OPT.EQ.'CROW ')GO TO 2000
	IF(OPT.EQ.'CCOL ')GO TO 3000
	IF(OPT.EQ.'DROW ')GO TO 5000
	IF(OPT.EQ.'DCOL')GO TO 5500
	IF(OPT.EQ.'PROW')GO TO 6000
	IF(OPT.EQ.'PCOL')GO  TO 6500
	IF(OPT.EQ.'AROW')GO TO 7000
	IF(OPT.EQ.'ACOL')GO TO  7500
	IF(OPT.EQ.'CENT')GO TO 3400
	IF(OPT.EQ.'PENT')GO TO 3600
	IF(OPT.EQ.'RETUR')GO TO 8000
	IF(OPT.EQ.'SAVE')GO TO 8200
	IF(OPT.EQ.'RECAL')GO TO 8400
	IF(OPT.EQ.'HELP '.OR.OPT.EQ.'H    '.OR.OPT.EQ.'"HELP')GO TO 4000
	WRITE(5,44)
44	FORMAT(' TYPE "HELP" FOR A LIST OF OPTIONS')
	GO TO 40
C *********************************************************************
C
C	PIVOT OPTION SECTION
C
C *********************************************************************
49	POLD = P
	NOLD = N
	DO 55 I = N0,N
	INDOLD(I) = IND(I)
	DO 55 J = P0,P
55	TOLD(J,I) = T(J,I)
	WRITE(5,50)
50	FORMAT(' INPUT THE PIVOT COLUMN?'$)
	READ(5,60,ERR=8998)I0
60	FORMAT(I)
	IF(I0.EQ.N00)GO TO 64
	IF(I0.GE.N0.AND.I0.LE.N)GO TO 65
	WRITE(5,9001)
	GO TO 40
64	WRITE(5,63)N00
63	FORMAT(' ARE YOU SURE YOU WANT TO PIVOT IN COLUMN',I2 ,'?'$)
	READ(5,62,ERR=8998)ANS
62	FORMAT(A5)
	IF(ANS.EQ.'NO')GO TO 49
65	WRITE(5,70)
70	FORMAT('+DO YOU WANT RATIOS PRINTED (YES OR NO)?'$)
	READ(5,80,ERR=8998)ANS
80	FORMAT(A3)
	IF(ANS.EQ.2HNO)GO TO 100
	IF(ANS.EQ.3HYES)GO TO 71
	WRITE(5,72)
72	FORMAT(' ANSWER YES OR NO'/)
	GO TO 65
71	DO 90 J = 1,P
	IF(J.EQ.P00)GO TO 90
	IF(T(J,I0).NE.0.)GO TO 81
	WRITE(5,82)
82	FORMAT(' DIVISION BY ZERO')
	GO TO 90
81	QUOT = T(J,N00)/T(J,I0)
	WRITE(5,85)QUOT
85	FORMAT(1X,G9.3)
90	CONTINUE
	WRITE(5,99)
99	FORMAT()
100	WRITE(5,110)
110	FORMAT('+INPUT THE PIVOT ROW?'$)
	READ(5,120,ERR=8998)J0
120	FORMAT(I)
	IF(J0.EQ.P00)GO TO 128
	IF(J0.GE.P0.AND.J0.LE.P)GO TO 129
	WRITE(5,9000)
	GO TO 40
128	WRITE(5,124)P00
124	FORMAT(' ARE YOU SURE YOU WANT TO PIVOT IN ROW',I2,'?'$)
	READ(5,123,ERR=8998)ANS
123	FORMAT(A5)
	IF(ANS.EQ.'NO')GO TO 100
129	DO 180 I = N0,N
	IF(.NOT.IND(I))GO TO 180
	IF(T(J0,I).EQ.-1.OR.T(J0,I).EQ.1)IND(I) = .FALSE.
180	CONTINUE
	IND(I0) = .TRUE.
	PIV = T(J0,I0)
	IF(PIV.NE.0.)GO TO 349
	WRITE(5,348)
348	FORMAT(' YOU CANNOT PIVOT AT A ZERO ENTRY IN THE TABLEAU')
	GO TO 40
349	DO 350 I = N0,N
350	T(J0,I) = T(J0,I)/PIV
	DO 200 J = P0,P
	IF(J.EQ.J0)GO TO 200
	E = T(J,I0)
	DO 190 I = N0,N
190	T(J,I) = T(J,I)-E*T(J0,I)
200	CONTINUE
	DO 210 J=P0,P
	DO 210 I=N0,N
	IF(ABS(T(J,I)).GE.2E-7)GO TO 201
	T(J,I) = 0.
	GO TO 210
201	IF(ABS(T(J,I)-1.).GE.2E-7)GO TO 202
	T(J,I) = 1.
	GO TO 210
202	IF(ABS(T(J,I)+1.).GE.2E-7)GO TO 210
	T(J,I) = -1
210	CONTINUE
	GO TO 40
C *********************************************************************
C
C	PRINT SECTION (PRINTS TABLEAU)
C
C *********************************************************************
300	CALL MATOUT (T,IND,P,N)
	GO TO 40
C *********************************************************************
C
C	STOP OPTION SECTION
C
C *********************************************************************
1000	WRITE(5,1010)
1010	FORMAT(' DO YOU WANT TO DO ANOTHER PROBLEM?'$)
	READ(5,1020,ERR=8998)ANS
1020	FORMAT(A5)
	IF(ANS.EQ.'YES  ')GO TO 1
	STOP
C *********************************************************************
C
C	CROW (CHANGE ROW) OPTION SECTION
C
C *********************************************************************
2000	WRITE(5,2010)
2010	FORMAT(' INPUT THE NUMBER OF THE ROW YOU WANT TO CHANGE?'$)
	READ(5,2020,ERR=8998)J0
2020	FORMAT(I)
	IF(J0.GE.P0.AND.J0.LE.P)GO TO 2021
	WRITE(5,9000)
	GO TO 40
2021	WRITE(5,2030)J0
2030	FORMAT(' INPUT ROW',I3,/' ?'$)
	READ(5,2040,ERR=8998)(T(J0,I),I=N0,N)
2040	FORMAT(35F)
	CALL COND(T,IND,P,N)
	GO TO 40
C *********************************************************************
C
C	CCOL (CHANGE COLUMN) OPTION SECTION
C
C *********************************************************************
3000	WRITE(5,3010)
3010	FORMAT(' INPUT THE NUMBER OF THE COLUMN YOU WANT TO CHANGE?'$)
	READ(5,3020,ERR=8998)I0
3020	FORMAT(I)
	IF(I0.GE.N0.AND.I0.LE.N)GO TO 3021
	WRITE(5,9001)
	GO TO 40
3021	WRITE(5,3030)I0
3030	FORMAT(' INPUT COLUMN',I3,' (IN A ROW)'/' ?'$)
	READ(5,3040,ERR=8998)(T(J,I0),J=P0,P)
3040	FORMAT(35F)
	IF(N.GT.8)CALL COND(T,IND,P,N)
	GO TO 40
C *********************************************************************
C
C	CENT (CHANGE ENTRY) OPTION SECTION
C
C *********************************************************************
3400	WRITE(5,3410)
3410	FORMAT(' INPUT THE ROW AND COLUMN INDICES OF THE ENTRY YOU',
     1	' WANT TO CHANGE?'$)
	READ(5,3420,ERR=8998)J0,I0
3420	FORMAT(2I)
	IF(J0.GE.P0.AND.J0.LE.P)GO TO 3425
	WRITE(5,9000)
	GO TO 40
3425	IF(I0.GE.N0.AND.I0.LE.N)GO TO 3429
	WRITE(5,9001)
	GO TO 40
3429	WRITE(5,3430)
3430	FORMAT(' INPUT THE NEW ENTRY?'$)
	READ(5,3440,ERR=8998)T(J0,I0)
3440	FORMAT(F)
	GO TO 39
C *********************************************************************
C
C	PENT (PRINT ENTRY) OPTION SECTION
C
C *********************************************************************
3600	WRITE(5,3610)
3610	FORMAT(' INPUT THE ROW AND COLUMN INDICES OF THE ENTRY YOU',
     1	' WANT TO PRINT?'$)
	READ(5,3620,ERR=8998)J0,I0
3620	FORMAT(2I)
	IF(J0.GE.P0.AND.J0.LE.P)GO TO 3625
	WRITE(5,9000)
	GO TO 40
3625	IF(I0.GE.N0.AND.I0.LE.N)GO TO 3629
	WRITE(5,9001)
	GO TO 40
3629	WRITE(5,3630)J0,I0,T(J0,I0)
3630	FORMAT(' THE ENTRY IN ROW',I3,' AND COLUMN',I3,' IS',G15.7)
	GO TO 40
C *********************************************************************
C
C	HELP (LIST OF OPTIONS) OPTION SECTION
C
C *********************************************************************
4000	WRITE(5,4010)
4010	FORMAT(' LIST OF OPTIONS:'/' PRINT',T25,'PRINTS TABLEAU'/
     1  ' PIV',T25,'ALLOWS USER TO DO A PIVOT OPERATION'/
     2  ' CROW',T25,'ALLOWS USER TO CHANGE A ROW OF THE TABLEAU'/
     3  ' CCOL',T25,'ALLOWS USER TO CHANGE A COLUMN'/
     4  ' DROW',T25,'ALLOWS USER TO DELETE A ROW OF THE TABLEAU'/
     5  ' DCOL',T25,'ALLOWS USER TO DELETE A COLUMN OF THE TABLEAU'/
     6  ' PROW',T25,'ALLOWS USER TO PRINT A ROW OF THE TABLEAU'/
     7  ' PCOL',T25,'ALLOWS USER TO PRINT A COLUMN OF THE TABLEAU'/
     8  T35,'(TO SIX SIGNIFICANT FIGURE ACCURACY)')
	WRITE(5,4020)
4020	FORMAT(' AROW',T25,'ALLOWS USER TO ADD A NEW ROW'/
     1  ' ACOL',T25,'ALLOWS USER TO ADD A NEW COLUMN'/
     2	' CENT',T25,'ALLOWS USER TO CHANGE ONE ENTRY OF THE TABLEAU'/
     3	' PENT',T25,'ALLOWS USER TO PRINT ONE ENTRY OF THE TABLEAU'/
     4	T35,'(TO SEVEN SIGNIFICANT FIGURE ACCURACY)'/
     5	' RETURN',T25,'RETURNS TABLEAU TO WHAT IT WAS'/
     6	T35,'BEFORE THE LAST PIVOT'/
     7	' SAVE',T25,'SAVES TABLEAU'/
     7	' RECALL',T25,'RECALLS TABLEAU SAVED BY SAVE OPTION'/
     8	' STOP',T25,'STOP')
	GO TO 40
C *********************************************************************
C
C	DROW (DELETE ROW) OPTION SECTION
C
C *********************************************************************
5000	WRITE(5,5010)
5010	FORMAT(' INPUT THE NUMBER OF THE ROW TO BE DELETED?',$)
	READ(5,5020,ERR=8998)J0
5020	FORMAT(I)
	IF(J0.GE.P0.AND.J0.LE.P)GO TO 5021
	WRITE(5,9000)
	GO TO 40
5021	DO 5030 J = J0+1,P
	DO 5030 I = N0,N
5030	T(J-1,I) = T(J,I)
	P = P-1
	IF(IP)P00 = P
	GO TO 40
5500	WRITE(5,5510)
5510	FORMAT(' INPUT THE NUMBER OF THE COLUMN TO BE DELETED?',$)
	READ(5,5520,ERR=8998)I0
5520	FORMAT(I)
	IF(I0.GE.N0.AND.I0.LE.N)GO TO 5521
	WRITE(5,9001)
	GO TO 40
5521	DO 5530 I = I0+1,N
	IND(I-1)=IND(I)
	DO 5530 J = P0,P
5530	T(J,I-1) = T(J,I)
	N = N-1
	IF(IN)N00 = N
	GO TO 40
C *********************************************************************
C
C	PROW (PRINT ROW) OPTION SECTION
C
C *********************************************************************
6000	WRITE(5,6010)
6010	FORMAT(' INPUT THE NUMBER OF THE ROW TO BE PRINTED?',$)
	READ(5,6020,ERR=8998)J0
6020	FORMAT(I)
	IF(J0.GE.P0.AND.J0.LE.P)GO TO 6021
	WRITE(5,9000)
	GO TO 40
6021	WRITE(5,6030)(T(J0,I),I=N0,N)
6030	FORMAT(5(1X,G10.4,1X))
	GO TO 40
C *********************************************************************
C
C	PCOL (PRINT COLUMN) OPTION SECTION
C
C *********************************************************************
6500	WRITE(5,6510)
6510	FORMAT(' INPUT THE NUMBER OF THE COLUMN TO BE PRINTED?',$)
	READ(5,6520,ERR=8998)I0
6520	FORMAT(I)
	IF(I0.GE.N0.AND.I0.LE.N)GO TO 6521
	WRITE(5,9001)
	GO TO 40
6521	WRITE(5,6530)(T(J,I0),J=P0,P)
6530	FORMAT(1X,G12.6)
	GO TO 40
C *********************************************************************
C
C	AROW (ADD ROW) OPTION SECTION
C
C *********************************************************************
7000	P9 = P0-1
	WRITE(5,7010)P9
7010	FORMAT(' INPUT THE NUMBER OF THE ROW
     1 JUST BEFORE THE ROW YOU
     2 WANT TO ADD,'/' (INPUT',I3,' IF YOU WANT A NEW FIRST ROW)?',$)
	READ(5,7020,ERR=8998)J0
7020	FORMAT(I)
	IF(J0.GE.P9.AND.J0.LE.P)GO TO 7030
	WRITE(5,9000)
	GO TO 40
7030	DO 7040 J= P,J0+1,-1
	DO 7040 I = N0,N
7040	T(J+1,I) = T(J,I)
	WRITE(5,7050)
7050	FORMAT(' INPUT THE NEW ROW?'$)
	READ(5,7060,ERR=8998)(T(J0+1,I),I=N0,N)
7060	FORMAT(35F)
	P = P+1
	IF(IP)P00 = P
	CALL COND(T,IND,P,N)
	GO TO 40
C *********************************************************************
C
C	ACOL (ADD COLUMN) OPTION SECTION
C
C *********************************************************************
7500	N9 =N0-1
	WRITE(5,7510)N9
7510	FORMAT(' INPUT THE NUMBER OF THE COLUMN JUST BEFORE THE
     1 COLUMN YOU WANT TO ADD,'/' (INPUT',I3,' IF YOU WANT A NEW
     2 FIRST COLUMN)?',$)
	READ(5,7520,ERR=8998)I0
7520	FORMAT(I)
	IF(I0.GE.N9.AND.I0.LE.N)GO TO 7530
	WRITE(5,9001)
	GO TO 40
7530	DO 7540 I = N,I0+1,-1
	DO 7540 J = P0,P
7540	T(J,I+1) = T(J,I)
	WRITE(5,7550)
7550	FORMAT(' INPUT THE NEW COLUMN (IN A ROW)?'$)
	READ(5,7560,ERR=8998)(T(J,I0+1),J=P0,P)
7560	FORMAT(35F)
	N = N+1
	IF(IN)N00 = N
	CALL COND(T,IND,P,N)
	GO TO 40
C *********************************************************************
C
C	RETURN (TO TABLEAU BEFORE LAST PIVOT) OPTION SECTION
C
C *********************************************************************
8000	P = POLD
	N = NOLD
	IF(IP)P00 = P
	IF(IN)N00 = N
	DO 8001 I = N0,N
	IND(I) = INDOLD(I)
	DO 8001 J = P0,P
8001	T(J,I) = TOLD(J,I)
	GO TO 40
C *********************************************************************
C
C	SAVE (TABLEAU) OPTION SECTION
C
C *********************************************************************
8200	PSAVE = P
	NSAVE = N
	DO 8201 I = N0,N
	INDSAVE(I) = IND(I)
	DO 8201 J = P0,P
8201	TSAVE(J,I) = T(J,I)
	GO TO 40
C *********************************************************************
C
C	RECALL (SAVED TABLEAU) OPTION SECTION
C
C *********************************************************************
8400	P = PSAVE
	N = NSAVE
	IF(IP)P00 = P
	IF(IN)N00 = N
	DO 8401 I = N0,N
	IND(I) = INDSAVE(I)
	DO 8401 J = P0,P
8401	T(J,I) = TSAVE(J,I)
	GO TO 40
8998	WRITE(5,8999)
8999	FORMAT(' INPUT DATA NOT IN CORECT FORM.  START OVER.')
	GO TO 40
9000	FORMAT(' ILLEGAL ROW NUMBER')
9001	FORMAT(' ILLEGAL COLUMN NUMBER')
	END
C *********************************************************************
C
C---------------T=TABLEAU ARRAY, IND INDICATES WHICH COLS. HAVE ONLY
C--------------- ZEROS, ONES, AND MINUS ONES, P=HIGHEST INDEX OF A ROW,
C--------------- N=HIGHEST INDEX OF A COL.  SEE LIST OF IMPORTANT VARS.
C--------------- ON FIRST PAGE.
C---------------ALL ARGS ARE INPUT.  N0, N00, P0 ARE INPUT THRU COMMON.
C	SUBROUTINE MATOUT FOR MAIN PROGRAM LINPRO.F4
C
C *********************************************************************
	SUBROUTINE MATOUT(T,IND,P,N)
	LOGICAL IND,INDSAVE,INDOLD
	COMMON N0,P0,N00,P00
	INTEGER P,P0,P00
	DIMENSION T(0/35,0/35),IND(0/35)
60	N1 = N0
61	M=0
	DO 66 I = N1,N
	M = M+4
	IF(.NOT.IND(I))M = M+6
	IF(M.GT.72)GO TO 69
66	CONTINUE
	N2 = N
	GO TO 68
69	N2 = I-1
68	DO 99 I = N1,N2
	IF(I.EQ.N00)GO TO 77
	IF(IND(I))GO TO 72
	IF(I.GT.9)GO TO 97
	WRITE (5,75)I
75	FORMAT(3H+ X,I1,7X,$)
	GO TO 99
97	WRITE(5,78)I
78	FORMAT(3H+ X,I2,6X,$)
	GO TO 99
72	IF(I.GT.9)GO TO 95
	WRITE(5,93)I
93	FORMAT(3H+ X,I1,1X,$)
	GO TO 99
95	WRITE(5,96)I
96	FORMAT(3H+ X,I2,$)
	GO TO 99
77	IF(IND(I))GO TO 88
	WRITE(5,86)
86	FORMAT(3H+ B,8X,$)
	GO TO 99
88	WRITE(5,76)
76	FORMAT(3H+ B,2X$)
99	CONTINUE
	DO 70 J = P0,P
	WRITE(5,80)
80	FORMAT(/)
	DO 70 I = N1,N2
	IF(IND(I))GO TO 62
	WRITE(5,65)T(J,I)
65	FORMAT(1H+,G9.3,1X,$)
	GO TO 70
62	WRITE(5,63)T(J,I)
63	FORMAT(1H+,F3.0,1X,$)
70	CONTINUE
	WRITE(5,80)
	IF(N2.GE.N)RETURN
	N1 = N2+1
	WRITE(5,401)
401	FORMAT()
	GO TO 61
	END
C *********************************************************************
C
C---------------SEE DEP. OF T, IND, P, N IN SUBR. MATOUT JUST ABOVE
C--------------- THIS SUBR. IS CALLED BY MAIN PROG. ST. 39 (SECTION
C--------------- THAT SETS UP TABLEAU FORMAT AND INPUTS TABLEAU), CROW
C--------------- OPTION, CCOL OPTION, AROW OPTION, ACOL OPTION.  THIS
C--------------- SUBR. UPDATES IND(I) AFTER USER INPUTS TABLEAU, AND/OR
C--------------- ROWS AND/OR COLS.
C---------------N,P,T ARE INPUT.  IND IS RETURNED.  N0, P0 ARE INPUT
C--------------- THRU COMMON
C	SUBROUTINE COND FOR MAIN PROGRAM LINPRO.F4
C
C *********************************************************************
	SUBROUTINE COND(T,IND,P,N)
	LOGICAL IND,INDOLD,INDSAVE
	COMMON N0,P0,N00,P00
	INTEGER P,P0,P00
	DIMENSION T(0/35,0/35),IND(0/35)
	DO 30 I = N0,N
	IND(I) = .TRUE.
	DO 10 J = P0,P
	IF(T(J,I).NE.0..AND.T(J,I).NE.1..AND.T(J,I).NE.-1.)GO TO 20
10	CONTINUE
	GO TO 30
20	IND(I) = .FALSE.
30	CONTINUE
	END