Post Reply 
HP50G SIMPLEX Version14b Max Min Pivot Algorithm, multiple/unbounded, unfeasible sol
01-03-2023, 04:33 PM (This post was last modified: 01-10-2023 10:35 AM by Gil.)
Post: #15
HP49G-50G Version 8f Simplex Max Min Pivot Algorithm, multiple/unbounded solutions
Codes for all variables / subprograms
relative to Version 8e of SIMPLEX

"'INPUT.last'" "
" "[[ 2 1 'L' 50 ]
[ 2 5 'L' 100 ]
[ 2 3 'L' 90 ]
[ 4 10 0 'Max' ]]" "

" "'\\->GO'" "
" "\\<< \"1 Arg:
MATRIX [m+1 \\.x n+2]

m Row Inequat/Equat
n Var xi (\\>=0/\\<=0/Free)
&1 Z-Max/Min
last Row m+1:

[[1 0 0 0 0 'F' 0]
[0 1 0 0 0 'F' 0]
[0 1 0 0 0 'L' 9]
[]
[0 0 0 1 0 'E' 6]
[]
[Al1 Aln 'E' Cl]
[Am1 Amn 'G' Cm]
[ z1 zn C 0]]

\\|> Letters F L E G
(& possible number C):
in Matrix Col n+1

'F' Free var xi\\>=0, \\<=0
'L' Less \\-> \\<=
'E' Equal \\-> =
'G' Greater \\-> \\>=

\\|> Numbers Ci (Cl,Cm)
\\[] are free: \\>=0 or \\<=0
\\[] & in Col n+2

\\|> Input example
& explanations:

[[1 0 0 0 0 0 'F' 0]
Free var x1:-\\oo<x1<\\oo
Sign of xi unknown:
x1 may be \\>=0 or \\<=0

[0 1 0 0 0 0 'F' 0]
[0 1 0 0 0 0 'L' 9]
'x2 is Free but \\<=(L)9'
\\->2 rows for -\\oo<x2\\<=9!

[0 0 1 0 0 0 'L' 8]
 var 0 \\<= x3 \\<= 8
as by default:
x3 (xi) alw. \\>= 0!

 [0 0 0 1 0 0 'E' 6]
 var x4 = 6

 [0 0 0 0 1 0 'L' 0]
var x5:-\\oo< x5 \\<= 0

 [0 0 0 0 0 1 'L'-8]
var x6:-\\oo< x6 \\<= -8

[0 0 0 0 0 0 1 'G'-9]
 var x7: -9 \\<= x7<\\oo

 []

[Ak1 Akn 'L' Ck]
-\\oo< row k \\<= Ck

[Al1Aln 'E' Cl]
 row l = Cl

 [Am1Amn 'G' Cm]
Cm \\<= row m<\\oo

[ z1 zn C 0 ]]
or [ z1 zn C 'Max']]
or [ z1 zn C 'Min']]
 for Z=z1x1+znxn+C
\\[] Z-row in last row
 \\[] C(often 0) of Z in
Col n+1 (not n+2!)
\\[] 0 'Max' or 'Min':
not important
but in Col n+2

\\|>Order for the Rows of
the Ineq/Equ is free

\\|>Only Z-coef must alw.
be in last MatRow m+1

\\|>At 1st question
further, reply:
1 for MAX
or 0 for MIN
& press ENTER & wait

\\|> For the other 4 less
important questions:

\\[]General sol (slow)\\->1
* Only SIMPLEX sol \\->0
\\[]Lin comb:all xi\\>=0 \\->1
Lin comb:allow x<0\\->0
\\[]Auto/direct exec \\->1
Step-by-step \\->0
\\[]Fractions (slow) \\->1
* Fast (no fract.) \\->0
\\[]Full steps saved \\->1
* If lack of memory \\->0

choose 1/0 & ENTER
(1 is default sett.)

0 to above * Quest.
to speed up (\\-> less
details & no fract.)

\\|> Review data/results
after output?

\\->Press (at 1st Page)

\\[]INPUT.last
\\[]SOL
\\[]S.1\\173N 

S.LIN

d.LIN 

\\->Press (at 2nd Page)

\\[]SLACK.\\Gb
\\[]RESULT\\166Ci.rows
\\[]STEPS

\\|> Save all your
Matrixes in DATA Dir
(last menu page)\" DROP 'INPUT.last' STO 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 { } DUP DUP 0 0 0 0 0 RCLF 0 0 0 0 0 0 { } 0 \\-> \\<-Rnd \\<-STACK.full \\<-Auto \\<-MiMa.s \\<-m \\<-l.xi \\<-l.xi.s \\<-time \\<-m0 \\<-m00 \\<-minCi \\<-Zrow \\<-I \\<-J \\<-VECT\\Gbi \\<-step0 \\<-STEPS.x\\Gb \\<-l.check \\<-INP.cut \\<-Ci.sol \\<-I.INP \\<-F.l \\<-F.l2 \\<-Jor \\<-l.xi.or \\<-fraction \\<-INPUTmod \\<-\\ooSOL \\<-fg \\<-SOL1 \\<-jj \\<-SLACK1.\\Gb \\<-STEPS1 \\<-RESULT1.ROW \\<-xab \\<-row.prob.l \\<-Z
\\<< GO.NEXT
\\>>
\\>>" "

" "'SOL'" "
" "{ :\\GlSol 1+(1-\\Gl)Sol 2: \\Gl\\184GE\\1660\\183and\\183\\Gl\\184LE\\1661 :
Main Sol 1,as Zrow=0: in.Col\\1661\\166final.STEPS Var\\|>2\\166Steps\\|>2 Time\\|>0\\166s :

Z-Max: 200 :x1: [ '75/4' 18.75 ] :x2: [ '25/2' 12.5 ] :
Main Sol 2,as Zrow=0: inCol\\1661\\166addit.STEPS Var\\|>2\\166Steps\\|>3 Time\\|>0\\166s :

Z-Max: 200 :x1: 0 :x2: 20 }" "

" "'S.1\\173N'" "
" "{ [ '75/4' '25/2' ] [ 0 20 ] }" "

" "'S.LIN'" "
" "\\<<
CASE Mult.Lin.D 1 ==
THEN S.lin 0 \\=/
IF
THEN S.lin xP 1 ==
IF
THEN \"S\\>=0\"
ELSE \"Sfree\"
END \" \\Gax1+\\Ganxn=Ci\" + \\->TAG
ELSE No\\|>Exact\\166lin.comb\\166S xP 1 ==
IF
THEN \"xi\\>=0\"
ELSE \"xfree\"
END \" \\Gax1+\\Ganxn\\=/Ci\" + \\->TAG
END
END at.Question.2 \"No calc request\" \\->TAG
END
\\>>" "

" "'d.LIN'" "
" "\\<<
CASE Mult.Lin.D 1 ==
THEN d\\Gm 0 \\=/
IF
THEN d\\Gm \"S\\|>Sol i+\\Gm\" xP 1 ==
IF
THEN \"[\\>=0]\"
ELSE \"free\"
END + \"*d, d\" + \\->TAG
ELSE No\\|>Exact\\166lin.comb\\166d xP 1 ==
IF
THEN \"xi\\>=0\"
ELSE \"xfree\"
END \" \\Ga1x1+\\Ganxn\\=/0\" + \\->TAG
END
END at.Question.2 \"No calc request\" \\->TAG
END
\\>>" "

" "'RESULT\\166Ci.rows'" "
" "\\<< SOL TYPE 5 ==
IF
THEN RESULT.ROW row.prob 1 ==
IF
THEN \"SolviolatesRowInCi\"
ELSE \"CiCalc\\[]CiInSyst\\->OK\"
END \\->TAG
ELSE :Interrupt Cycling?: \\->no\\166result.calc
END
\\>>" "

" "'STEPS'" "
" "{ :Step-0 (total: 2):
[[ 0 'x1' 'x2' 'Con1' ]
[ 'y1' -2 -1 50 ]
[ 'y2' -2 -5 100 ]
[ 'y3' -2 -3 90 ]
[ 'Z' 4 10 0 ]] { \"Ratios w/ C1\" :L1: -25 :L2: -50 :L3: -45 :Max: L1 }
[[ 1 'y1' 'x2' 'Con1' ]
[ 'x1' '-1/2' '-1/2' 25 ]
[ 'y2' 1 -4 50 ]
[ 'y3' 1 -2 40 ]
[ 'Z' -2 8 100 ]] { \"Ratios w/ C2\" :L1: '-50' :L2: '-25/2' :L3: -20 :Max: L2 } :Final Step:
[[ 2 'y1' 'y2' 'Con1' ]
[ 'x1' '-5/8' '1/8' '75/4' ]
[ 'x2' '1/4' '-1/4' '25/2' ]
[ 'y3' '1/2' '1/2' 15 ]
[ 'Z' 0 -2 200 ]] :Additional Step: For\\1662nd.Main.Sol
[[ 3 'x1' 'y2' 'Con1' ]
[ 'y1' '-8/5' '1/5' 30 ]
[ 'x2' '-2/5' '-1/5' 20 ]
[ 'y3' '-4/5' '3/5' 30 ]
[ 'Z' 0 -2 200 ]] }" "

" "'GO.NEXT'" "
" "\\<< OPTION TICKS '\\<-time' STO -100 CF RAD \"Interr.\\->no\\166result\" 'SOL' STO \"Interr.\\->no\\166saving\" 'STEPS' STO 0 'row.prob' STO \"No transf/slack \\Gb\" 'SLACK.\\Gb' STO 0 { S.lin d\\Gm } STO { } 'S.1\\173N' STO ADD.MIN\\166MAX C\\<-\\->Max\\166Min 2 SF TEST.EXACT CHECK.lin.comb \\->INP.cut EQ\\1831\\->INEQ\\1832 FREExi\\1661C\\->2C \\->LIST.xi { } 1 \\<-J 1 -
START 1 +
NEXT '\\<-l.xi.s' STO INEQ.INPUT\\166G\\->INEQ\\166L INEQ.LESS\\->TAB.OPPs \\->SIGN.xi\\166&xiL0\\->XiG0 \\<-m0 \\<-I ROW- \\<-MiMa.s * '\\<-Zrow' STO DUP '\\<-m0' STO '\\<-m00' STO \\->TAB.\\Gb0\\166MinCi\\166LESS?0 \\<-minCi 0 <
IF
THEN 1 SF MAIN DROP2 \\->SLACK.\\Gb STEPS '\\<-STEPS.x\\Gb' STO SOL\\Gbi\\->VECT\\Gbi \\->M\\166FOR.2ndMAIN
END 1 CF MAIN
\\>>" "

" "'OPTION'" "
" "\\<< \" Max Problem \\-> 1
or
Min Problem \\-> 0

* * * *\" INPUT.last DUP SIZE OBJ\\-> DROP * GET \"\" + 2 3 SUB DUP \"in\" SAME SWAP \"IN\" SAME OR
IF
THEN { \":Your choice (1/0): 0\" -21 }
ELSE { \":Your choice (1/0): 1\" -21 }
END INPUT OBJ\\-> 0 ==
IF
THEN -1 '\\<-MiMa.s' STO
END \"All Gen/Mult Sol:check
lin dep \\-> exact mode
only (slower) \\-> 1
Or only SIMPLEX sol
(faster result) \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\-> 'Mult.Lin.D' STO Mult.Lin.D 1 ==
IF
THEN \"For Gen/Mult Sol: lin
dep. w/ all xi\\>=0 \\-> 1

Or accept lin. depend.
with some xi<0 \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\-> 'xP' STO
END \"Automatic/direct exec
& no Col choice \\-> 1

Or Step-by-Step execut
& Col choice \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\-> '\\<-Auto' STO Mult.Lin.D 0 ==
IF
THEN \"Fractions: exact calc,
but (much) slower\\-> 1

Or Fast calculation
& no fractions \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\->
ELSE 1
END '\\<-fraction' STO \"Stack: Keep all steps
if enough memory \\-> 1

Or only 4 levels Stack
if lack of space \\-> 0\" { \":Your choice (1/0): 1\" -21 } INPUT OBJ\\-> '\\<-STACK.full' STO
\\>>" "

" "'Mult.Lin.D'" "
" "1" "

" "'xP'" "
" "1" "

" "'ADD.MIN\\166MAX'" "
" "\\<< INPUT.last DUP SIZE OBJ\\-> DROP * \\<-MiMa.s 1 == 'Max' 'Min' IFTE PUT 'INPUT.last' STO
\\>>" "

" "'C\\<-\\->Max\\166Min'" "
" "\\<< INPUT.last DUP SIZE OBJ\\-> DROP * 1 - GETI UNROT DUP UNROT GETI UNROT 4 ROLL SWAP - ROT PUTI ROT PUT
\\>>" "

" "'TEST.EXACT'" "
" "\\<< -3 CF \\<-fraction 1 ==
IF
THEN -105 CF :: \\->Q MAP :: EVAL MAP
ELSE -105 SF \\->NUM
END DUP '\\<-m0' STO '\\<-INPUTmod' STO
\\>>" "

" "'CHECK.lin.comb'" "
" "\\<< Mult.Lin.D 1 ==
IF
THEN \\<-INPUTmod DUP SIZE OBJ\\-> DROP 0 0 \\-> m I J L.Comb L.s
\\<< m J COL- DROP J 1 - COL- DROP 'm' STO -2 'J' STO+ { } I 1 + J MIN 1 J
FOR j j
NEXT J \\->LIST Comb DUP 'L.Comb' STO SIZE 'L.s' STO 1 L.s
FOR i L.Comb i GET 0 \\-> l0 l01
\\<< { I 1 } 0 CON 2 I 1 + J MIN
FOR i m l0 i GET COL- SWAP DROP i COL+
NEXT m l0 1 GET COL- SWAP DROP I 2 + J 1 + MIN COL+ 1 COL- DROP RREF \\-> r
\\<< 1 1 I
FOR i r i ROW- SWAP DROP DUP DOT 0 == r i ROW- I 1 + J MIN COL- DROP SWAP DROP DUP DOT 0 \\=/ OR
IF
THEN 1
ELSE 0
END *
NEXT xP 1 ==
IF
THEN 1 I
FOR i r i I 1 + J MIN 2 \\->LIST GET 0 >
IF
THEN I 'i' STO 0 *
END
NEXT
END 0 \\=/
IF
THEN r I 1 + J MIN COL- SWAP DROP l0 1 GET 'l01' STO
WHILE l01 1 >
REPEAT -1 'l01' STO 0 1 COL+
END -1 l0 1 GET COL+ l0 2 GET J
FOR j l0 j DUP UNROT POS 0 ==
IF
THEN 0 SWAP COL+
ELSE DROP
END
NEXT NEG :: \\->Q MAP I J \\>=
IF
THEN J I
START J 1 + COL- DROP
NEXT
END +
END
\\>>
\\>>
NEXT DUP SIZE 0 >
IF
THEN EXPAND SAME.Sol DUP SIZE 1 ==
IF
THEN 1 GET
END 'd\\Gm' STO
ELSE DROP
END
\\>>
END
\\>>" "

" "'Comb'" "
" "\\<< \"By Thomas Klemm\" DROP
\\<< \\-> m s
\\<<
CASE m s SIZE >
THEN { }
END m 1 ==
THEN s 1
\\<< 1 \\->LIST
\\>> DOLIST
END m s SIZE ==
THEN s 1 \\->LIST
END m 1 - s TAIL \\<-C EVAL 1
\\<< s HEAD SWAP +
\\>> DOLIST m s TAIL \\<-C EVAL +
END
\\>>
\\>> \\-> \\<-C
\\<< \\<-C EVAL
\\>>
\\>>" "

" "'d\\Gm'" "
" "0" "

" "'SAME.Sol'" "
" "\\<< \"By Werner\" DROP \\-> L
\\<< L 1
\\<< L OVER POS NSUB \\=/ DROPN
\\>> DOSUBS
\\>>
\\>>" "

" "'SAME.SOL'" "
" "\\<< \"Not used \\->
Can be deleted
Own 1st version
\" DROP DUP \\->STR \\-> l.s s
\\<< l.s SIZE 1
FOR i s l.s i GET DUP UNROT \"\" SREPL DROP + 's' STO -1
STEP \"\\|>\" s + \"\\|>\" \"{\" SREPL DROP \"\\|>\" + \"\\|>\" \"}\" SREPL DROP OBJ\\-> OBJ\\-> SWAP DROP 1 - \\->LIST
\\>>
\\>>" "

" "'\\->INP.cut'" "
" "\\<< \\<-m0 DUP SIZE OBJ\\-> DROP \\-> J
\\<< '\\<-I.INP' STO J DUP '\\<-Jor' STO COL- DROP J 1 - COL- DROP \\<-I.INP ROW- DROP '\\<-INP.cut' STO
\\>>
\\>>" "

" "'EQ\\1831\\->INEQ\\1832'" "
" "\\<< \\<-m0 0 \\-> ii
\\<< DUP SIZE OBJ\\-> DROP '\\<-J' STO '\\<-I' STO DUP '\\<-m0' STO 1 \\<-I 1 - 2 *
FOR i 2 'ii' STO+ i ROW- DUP \\<-J 1 - GET 'E' SAME
IF
THEN \\<-J 1 - 'G' PUT DUP \\<-J 1 - 'L' PUT UNROT i ROW+ SWAP i ROW+ 1 'i' STO+
ELSE i ROW+
END ii 2 \\<-I 1 - * ==
IF
THEN ii 'i' STO
END
NEXT DUP SIZE OBJ\\-> DROP2 '\\<-I' STO '\\<-m0' STO
\\>>
\\>>" "

" "'FREExi\\1661C\\->2C'" "
" "\\<< 0 \\-> ii
\\<< \\<-m0 1 \\<-I 1 -
FOR i i ii - ROW- \\-> r
\\<< r \\<-J 1 - GET 'F' SAME
IF
THEN 1 '\\<-xab' STO 1 'ii' STO+ 1 \\<-J 2 -
FOR j r j GET 1 ==
IF
THEN j '\\<-F.l' STO+ \\<-J 2 - 'j' STO
END
NEXT
ELSE r i ii - ROW+
END
\\>>
NEXT '\\<-m0' STO \\<-F.l SORT '\\<-F.l' STO 1 \\<-J 2 -
FOR j j \\<-F.l j POS 0 \\=/
IF
THEN DUP
END
NEXT \\<-J 2 - \\<-F.l SIZE + \\->LIST '\\<-F.l2' STO 1 \\<-J 2 -
FOR j \\<-m0 j COL- SWAP DROP \\<-F.l j POS 0 \\=/
IF
THEN DUP -1 *
END
NEXT \\<-m0 \\<-J 1 - COL- SWAP DROP \\<-m0 \\<-J COL- SWAP DROP \\<-J \\<-F.l SIZE + COL\\-> DUP SIZE OBJ\\-> DROP '\\<-J' STO '\\<-I' STO '\\<-m0' STO
\\>>
\\>>" "

" "'INEQ.INPUT\\166G\\->INEQ\\166L'" "
" "\\<< \\<-m0 1 \\<-I 1 -
FOR i i ROW- DUP \\<-J 1 - GET 'G' SAME
IF
THEN -1 * \\<-J 1 - 'L' PUT
END i ROW+
NEXT '\\<-m0' STO
\\>>" "

" "'INEQ.LESS\\->TAB.OPPs'" "
" "\\<< \\<-m0 1 \\<-I 1 -
FOR i 1 \\<-J 2 -
FOR j { i j } DUP2 GET -1 * PUT
NEXT
NEXT :: EVAL MAP '\\<-m0' STO
\\>>" "

" "'\\->SIGN.xi\\166&xiL0\\->XiG0'" "
" "\\<< \\<-m0 1 \\<-I 1 -
FOR i i ROW- DUP \\<-J COL- SWAP \\<-J 1 - COL- DROP DUPDUP DOT \\v/ \\-> Ci row Rdot
\\<< i ROW+ 1 \\<-J 2 -
FOR j row j GET ABS Rdot ==
IF
THEN row j GET SIGN -1 == Ci 0 \\<= AND
IF
THEN j COL- -1 * j COL+ \\<-l.xi.s j -1 PUT '\\<-l.xi.s' STO
END
END
NEXT
\\>>
NEXT '\\<-m0' STO
\\>>" "

" "'\\->TAB.\\Gb0\\166MinCi\\166LESS?0'" "
" "\\<< \\<-m0 SIZE OBJ\\-> DROP R\\->I '\\<-J' STO '\\<-I' STO \\oo '\\<-minCi' STO 1 \\<-I
FOR i \\<-m0 { i \\<-J } GET DUP 0 <
IF
THEN DUP \\<-minCi <
IF
THEN '\\<-minCi' STO
ELSE DROP
END
ELSE DROP
END
NEXT \\<-minCi 0 <
IF
THEN 1 \\<-I
FOR i \\<-m0 { i \\<-J } DUP2 GET \\<-minCi - PUT '\\<-m0' STO
NEXT { 1 \\<-J } 0 CON 1 \\<-J 1 - 2 \\->LIST 1 PUT { 1 \\<-J } \\<-minCi NEG PUT DUP -1 * \\<-m0 ROT \\<-I 1 + ROW+ SWAP \\<-I 2 + ROW+ 1 \\<-I
FOR i i \\<-J 1 - 2 \\->LIST 1 PUT
NEXT
ELSE \\<-m0 \\<-Zrow \\<-MiMa.s * \\<-I 1 + ROW+ \\<-J 1 - COL- DROP DUP '\\<-m0' STO
END
\\>>" "

" "'\\->LABEL'" "
" "\\<< DTAG DUP SIZE OBJ\\-> DROP \\-> I J
\\<< \\<-l.xi OBJ\\-> J 1 - <
IF
THEN DUP \"\" + \"b\" \"\" SREPL DROP \"x\" \"\" SREPL DROP OBJ\\-> 1 + R\\->I \"x\" SWAP + OBJ\\->
END 'Con1' { 1 J } \\->ARRY 1 ROW+ 0 1 I 1 -
FOR i \"y\" I 11 \\>= i 10 < AND
IF
THEN 0 +
END i R\\->I + OBJ\\->
NEXT 'Z' I 1 + 1 2 \\->LIST \\->ARRY 1 COL+ \\->\\Gb? CLLCD \"\\|> Check/Edit Stack \\|^
 for added Var \\Gbi \\<- \\->
when Axi + <Ci, \\|v
Ci<0 \\-> xi=\\Gbi\\177\\Ga
 or when xi\\<=0 \\->xi=-\\Gbi

\\|> If OK: ENTER & CONT\" \"3 DISP 2 FREEZE HALT\" \"Now 3 lines useless\" 3 DROPN
\\>>
\\>>" "

" "'\\->\\Gb?'" "
" "\\<< DUP SIZE OBJ\\-> DROP \\-> m I J
\\<< 2 I 1 -
FOR i m i ROW- SWAP DROP 1 COL- DROP J 1 - COL- DROP 0 0 \\-> v t ij
\\<< 1 J 2 -
FOR j v j GET ABS 1 ==
IF
THEN j 'ij' STO J 'j' STO
END
NEXT ij 0 >
IF
THEN v DUP DOT \\-> dot
\\<< dot 1 ==
IF
THEN 1 'ij' STO+ m { 1 ij } GET \\->STR 1 2 SUB \"'\\Gb\" \\=/
IF
THEN
IF m { i ij } GET -1 == m { i J } GET 0 \\<= AND
THEN \"no more relevant\" DROP
END m { i ij } GET -1 == m { i J } GET 0 > AND NOT
IF
THEN m { 1 ij } '\\Gb' ij 1 - R\\->I \\->STR + OBJ\\-> PUT { i 1 } 1 FS?
IF
THEN 'x' ij 1 - R\\->I \\->STR + OBJ\\->
ELSE \\<-l.xi ij 1 - GET
END PUT 'm' STO
END
END
END
\\>>
END
\\>>
NEXT m
\\>>
\\>>" "

" "'STEP0'" "
" "\\<< \"DUP SIZE OBJ\\-> DROP
\\-> m I J
\\<< 2 J 1 -
FOR i m { I i }
DUP2 GET \\<-MiMa.s *
PUT 'm' STO
NEXT m\" DROP DUP DUP \"Step 0\" \\->TAG UNROT
\\>>" "

" "'\\->LIST.xi'" "
" "\\<< \\<-F.l2 DUP SIZE \\-> l s
\\<< { } 1 s 1 -
FOR j l j GET l j 1 + GET ==
IF
THEN \"x\" \\<-J 11 > l j GET 10 < AND
IF
THEN 0 +
END l j GET R\\->I + DUP \"b\" + OBJ\\-> UNROT \"a\" + OBJ\\-> + SWAP + 1 'j' STO+
ELSE \"x\" \\<-J 11 > l j GET 10 < AND
IF
THEN 0 +
END l j GET R\\->I + OBJ\\-> +
END
NEXT DUP SIZE s <
IF
THEN \"x\" l s GET R\\->I + OBJ\\-> +
END '\\<-l.xi' STO
\\>>
\\>>" "

" "'TEST.auto'" "
" "\\<< \\<-Auto 0 ==
IF
THEN HALT
END
\\>>" "

" "'LOOP'" "
" "\\<< { \"Col#: Var Possib\\->\" } DUP DUP \\-> \\<-\\Gb.l \\<-N.l \\<-v.l
\\<< \\->Col DUP 'F' SAME
IF
THEN DROP 1
ELSE 0
END C\\->L \\->PIVOT\\166&COL.ROW \\<-STACK.full 0 ==
IF
THEN 4 ROLL DROP 4 ROLL DROP
END TEST.auto DUP SIZE OBJ\\-> DROP \\-> m I J
\\<<
CASE \\<-\\Gb.l SIZE 2 >
THEN m LOOP
END \\<-\\Gb.l SIZE 2 == \\<-N.l SIZE 1 > AND \\<-\\Gb.l SIZE 1 == \\<-N.l SIZE 2 > AND OR
THEN m LOOP
END
END 0 2 J 1 -
FOR j m { I j } GET 0 >
IF
THEN 1 +
END
NEXT 0 ==
IF
THEN m \\->SOL
ELSE m LOOP
END
\\>>
\\>>
\\>>" "

" "'\\->Col'" "
" "\\<< DUP SIZE OBJ\\-> DROP { } DUP DUP DUP DUP 0 0 \\-> m I J \\Gb.lc N.lc v.lc \\<-l.v \\<-l.c \\<-choi.c \\<-ok
\\<< 2 J 1 -
FOR j 0 \\-> count.s
\\<< 2 I 1 -
FOR i m { I j } GET DUP 0 ==
IF
THEN DROP I 'i' STO
ELSE m { i j } GET * 0 <
IF
THEN 1 'count.s' STO I 'i' STO
END
END
NEXT count.s 0 >
IF
THEN m { 1 j } GET \\-> m1j
\\<< m1j
CASE m1j \\->STR 2 2 SUB \"\\Gb\" SAME
THEN j 1 - R\\->I DUP '\\Gb.lc' STO+ \\->TAG '\\<-\\Gb.l' STO+
END m1j \\->STR 2 2 SUB \"N\" SAME
THEN j 1 - R\\->I DUP 'N.lc' STO+ \\->TAG '\\<-N.l' STO+
END m { I j } GET 0 >
IF
THEN j 1 - R\\->I DUP 'v.lc' STO+ \\->TAG '\\<-v.l' STO+
ELSE DROP
END
END
\\>>
END
\\>>
NEXT \\Gb.lc REVLIST '\\Gb.lc' STO \\<-\\Gb.l REVLIST '\\<-\\Gb.l' STO N.lc REVLIST 'N.lc' STO \\<-N.l REVLIST '\\<-N.l' STO \\<-v.l REVLIST '\\<-v.l' STO v.lc REVLIST 'v.lc' STO
CASE \\<-\\Gb.l SIZE 1 >
THEN \\<-\\Gb.l \\Gb.lc
END \\<-N.l SIZE 1 >
THEN \\<-N.l N.lc
END \\<-v.l v.lc
END '\\<-l.c' STO '\\<-l.v' STO \\<-l.c DUP SIZE 0 ==
IF
THEN DROP m \\->SOL
END 1 GET '\\<-choi.c' STO TEST.col SWAP DROP m SWAP \\<-\\Gb.l SIZE 1 > \\<-N.l SIZE 1 > OR
IF
THEN 'F'
END
\\>>
\\>>" "

" "'TEST.col'" "
" "\\<< \"\" 0 \\-> ok
\\<<
DO DROP \\<-l.v \\<-l.c 1 GET \"Edit Sugg Col#\" \\->TAG TEST.auto '\\<-choi.c' STO \\<-l.c DUP SIZE \\-> l s
\\<< 1 s
FOR i l i GET \\<-choi.c ==
IF
THEN 1 'ok' STO s 'i' STO
END
NEXT
\\>>
UNTIL ok 1 ==
END \\<-choi.c
\\>>
\\>>" "

" "'C\\->L'" "
" "\\<< ROT DUPDUP SIZE OBJ\\-> DROP \\oo NEG 0 \\-> l F m mn I J minmax k
\\<< 1 'l' STO+ m { I l } GET DUP SIGN F 1 ==
IF
THEN \"(to elimin \" m { 1 l } GET + \")\" + 2
ELSE 1
END \"Ratios w/ C\" l 1 - R\\->I + SWAP \\->LIST \\-> z zs l.q
\\<< 2 I 1 -
FOR i m { i l } GET DUP z * 0 <
IF
THEN m { i J } GET SWAP / EVAL DUP i 1 - R\\->I \"L\" SWAP + \\->TAG 'l.q' STO+ zs * DUP minmax >
IF
THEN i 'k' STO 'minmax' STO
ELSE DROP
END
ELSE DROP
END
NEXT m l.q REVLIST \"L\" k 1 - R\\->I + OBJ\\-> zs 0 < \"Min\" \"Max\" IFTE \\->TAG + TEST.auto m k l
\\>>
\\>>
\\>>" "

" "'DISPLAY'" "
" "\\<< EVAL DUP \\-> s
\\<< TYPE 9 ==
IF
THEN s DUP ROUND\\1669&0 2 \\->ARRY
ELSE s ROUND\\1669&0
END
\\>>
\\>>" "

" "'\\->SLACK.\\Gb'" "
" "\\<< 1 FS?
IF
THEN \\<-J 1 - R\\->I DUP \"Part1\\166added x\" SWAP + \"=\" + \"\\Gb\" ROT + \"+\" + + \\<-minCi NEG DUP FP 0 ==
IF
THEN R\\->I
END SWAP \\->TAG 1 \\->LIST 'SLACK.\\Gb' STO 4 \\<-J 1 +
FOR j SOL j GET DUP OBJ\\-> DUP \"=\" + SWAP \"x\" \"\\Gb\" SREPL DROP + SWAP DUP TYPE 29 ==
IF
THEN 1 GET
END 0 \\>=
IF
THEN \"+\"
ELSE \"-\"
END + SWAP DTAG DUP TYPE 29 ==
IF
THEN 1 GET
END ABS SWAP j 4 ==
IF
THEN \"Part2\\166with \" SWAP +
END \\->TAG SLACK.\\Gb SWAP + 'SLACK.\\Gb' STO
NEXT
END
\\>>" "

" "'SOL\\Gbi\\->VECT\\Gbi'" "
" "\\<< 4 \\<-J 1 +
FOR j SOL j GET DTAG DUP TYPE 29 ==
IF
THEN 1 GET
END
NEXT 1 \\<-J 1 - \\->ARRY '\\<-VECT\\Gbi' STO
\\>>" "

" "'\\->M\\166FOR.2ndMAIN'" "
" "\\<< \\<-m00 \\<-Zrow \\<-I 1 + ROW+ \\<-J 1 - COL- DROP '\\<-m0' STO \\<-m0 1 \\<-I 1 +
FOR i i ROW- DUP \\<-VECT\\Gbi DOT \\<-J 1 - SWAP PUT i ROW+
NEXT \\<-J 2 - IDN \\<-VECT\\Gbi \\<-J 1 - COL- DROP \\<-J 1 - ROW+ TRN 1 ROW+
\\>>" "

" "'\\->SOL'" "
" "\\<< DUP SIZE OBJ\\-> 0 0 \\-> m I J lf xi p
\\<< { } 1 I 1 -
FOR i m { i 1 } GET +
NEXT 'lf' STO m { } m { I J } GET \\<-MiMa.s * DISPLAY 1 FC?
IF
THEN DUP DUP TYPE 29 ==
IF
THEN 1 GET
END '\\<-Z' STO CHECK.lin.comb2
END \\<-MiMa.s 1 ==
IF
THEN \"

Z-Max\"
ELSE \"

Z-Min\"
END \\->TAG + 1 \\<-l.xi SIZE
FOR i lf \\<-l.xi i GET DUP UNROT POS 'p' STO 'xi' STO 1 FS?
IF
THEN p 0 ==
IF
THEN 0
ELSE m { p J } GET
END
ELSE xi \"\" + DUP SIZE DUP2 \\-> x xs
\\<< DUP SUB \"a\" SAME
IF
THEN p 0 ==
IF
THEN 0
ELSE m { p J } GET \\<-l.xi.s i GET *
END 1 'i' STO+ lf \\<-l.xi i GET POS 'p' STO p 0 ==
IF
THEN 0
ELSE m { p J } GET \\<-l.xi.s i GET *
END - x 1 xs 1 - SUB OBJ\\-> 'xi' STO
ELSE lf \\<-l.xi i GET DUP UNROT POS 'p' STO 'xi' STO p 0 ==
IF
THEN 0
ELSE m { p J } GET \\<-l.xi.s i GET *
END
END
\\>>
END DISPLAY 1 FC?
IF
THEN DUP xi\\->V
END xi \\->TAG +
NEXT 0 SWAP + \"Var\\|>\" \\<-Jor 2 - R\\->I + \"\\166\" + \"Steps\\|>\" + 1 FS?
IF
THEN m 1 GET DUP '\\<-step0' STO +
ELSE m 1 GET \\<-step0 0 > \\<-step0 0 IFTE + +
END OBJ\\-> SWAP + \"Sol\" \\->TAG 2 FS?
IF
THEN SWAP \"Final Step\" \\->TAG SWAP DUP \\<-STACK.full 0 ==
IF
THEN 6 ROLLD 4 ROLL 4 ROLL DROP2 3
ELSE m 1 GET 1 + 2 * 1 + DUP \\-> s2
\\<< ROLL DROP s2 ROLL DROP s2 ROLL DROP s2 ROLLD s2 1 -
\\>>
END SWAP DROP 1 - \\->LIST DUP 1 GET DTAG \"Step-0 (total: \" m 1 GET R\\->I 1 FS?
IF
THEN DUP '\\<-step0' STO
END + \")\" + \\->TAG 1 SWAP PUT \\<-step0 0 > 1 FC? AND
IF
THEN SLACK.\\Gb TAIL SWAP + SLACK.\\Gb HEAD :as in transf. '\\<=': some.Ci \\<-minCi \"<0 Ci min\" \\->TAG 2 \\->LIST + \\<-STEPS.x\\Gb + { \\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173​\\173\\173\\173\\173\\173\\173 } + SWAP +
END 'STEPS' STO
END 2 \"\" PUT DUP DUP 'SOL' STO \\->STR 1 FC?
IF
THEN DROP2 m CHECK.UNBOUND CHECK.INEQ SOL 2 \"Time\\|>\" TICKS \\<-time - B\\->R 8192 / 0 RND R\\->I + \"\\166s\" + OBJ\\-> PUT DUP DUP 'SOL' STO \\->STR
CASE d\\Gm 0 \\=/
THEN DROP2 SOL d\\Gm \"

Above Sol 1+\\Gm\" xP 1 ==
IF
THEN \"[\\>=0]\"
ELSE free
END + \"*d,d\" + \\->TAG + DUP DUP 'SOL' STO \\->STR
END m CHECK.2SOL 2 FC?
THEN 3 DROPN 'For\\1662nd.Main.Sol' \"Additional Step\" \\->TAG SWAP 1 \\->LIST + \\<-STEPS1 SWAP + 'STEPS' STO \\<-RESULT1.ROW RESULT.ROW 4 COL+ 'RESULT.ROW' STO DROP2 \"inCol\\166\" \\<-jj 1 - R\\->I + \"\\166addit.STEPS\" + OBJ\\-> \"
Main Sol 2,as Zrow=0\" \\->TAG SOL + \\<-SOL1 SWAP + DUP 'SOL' STO DUP \\->STR
END \\<-\\ooSOL 0 \\=/
THEN DROP2 \"\\ooUnbound.Sol\\->\\oo\" \\<-MiMa.s 1 == \"Max\" \"Min\" IFTE + OBJ\\-> \"'Sol' is no \" \\<-MiMa.s 1 == \"Max\" \"Min\" IFTE + \"!\" + \\->TAG SOL + \"in.Col\\166\" \\<-\\ooSOL R\\->I + \"\\166final.STEPS\" + OBJ\\-> \"
as only positive Val\" \\->TAG + DUP DUP 'SOL' STO \\->STR
END
END row.prob 1 ==
IF
THEN DROP \\180Sol\\180\\166VIOLATES.input \"
Attention ! Found\" \\->TAG + \\<-row.prob.l \"Inequal (Ci) at\" \\->TAG + DUP DUP 'SOL' STO \\->STR
END DROP \\<-xab 1 ==
IF
THEN :NB xi Free \\->xia-xib=: xi '\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\173\\17​3\\173\\173\\173\\173\\173\\173' STEPS + + 'STEPS' STO
END \\<-xab 1 ==
IF
THEN :xia-xib=: xi\\166for\\183xi\\166Free 1 \\->LIST SLACK.\\Gb DUP TYPE 5 ==
IF
THEN +
ELSE DROP
END 'SLACK.\\Gb' STO
END S.lin 0 \\=/
IF
THEN DROP SOL S.lin \"
Or not? SIMPLEX Sol 2\" \\->TAG + d\\Gm 0 \\=/
IF
THEN d\\Gm \" + \\Gm\" xP 1 ==
IF
THEN \"[\\>=0]\"
ELSE free
END + \"*d, d\" + \\->TAG +
END d\\Gm 0 \\=/
IF
THEN Plus \"
\\->Mixed Solution
a(Sol 1) +
b(not? SIMPLEX Sol 2)
|a-b|=1\" \\->TAG + d\\Gm \" \\Gm\" xP 1 ==
IF
THEN \"[\\>=0]\"
ELSE free
END + \"*d, d\" + \\->TAG +
END DUP 'SOL' STO
END S.1\\173N OBJ\\-> \\<-Jor 2 - / 1 >
IF
THEN \\<-Jor 2 - \\->ARRY \\<-Jor 1 - ROLLD \\<-Jor 2 - \\->ARRY SWAP 2 \\->LIST S.lin 0 \\=/
IF
THEN S.lin +
END EXPAND SAME.Sol
ELSE \\<-Jor 2 - \\->ARRY S.lin 0 \\=/
IF
THEN S.lin DUP TYPE 5 \\=/
IF
THEN 1 \\->LIST
END + EXPAND SAME.Sol
END
END DUP DUP TYPE 5 ==
IF
THEN SIZE 1 ==
IF
THEN 1 GET
ELSE
END
ELSE DROP
END 'S.1\\173N' STO \\<-fg STOF row.prob 1 == \\<-\\ooSOL 0 \\=/ OR d\\Gm 0 \\=/ S.lin 0 \\=/ OR OR \\<-SOL1 0 \\=/ OR
IF
THEN \"Attention !

Read carefully:
special
result\" DOERR
ELSE KILL
END
END
\\>>
\\>>" "

" "'CHECK.lin.comb2'" "
" "\\<< Mult.Lin.D 1 ==
IF
THEN \\<-INPUTmod :: \\->Q MAP DUP SIZE OBJ\\-> DROP 1 - 0 0 \\-> m I J L.Comb L.s
\\<< m J COL- DROP I J * \\<-Z PUT J COL- NEG J COL+ 'm' STO -1 'J' STO+ { } I J MIN 1 J
FOR j j
NEXT J \\->LIST Comb DUP 'L.Comb' STO SIZE 'L.s' STO 1 L.s
FOR i L.Comb i GET \\-> l0
\\<< { I 1 } 0 CON 2 I J MIN
FOR i m l0 i GET COL- SWAP DROP i COL+
NEXT 1 COL- DROP m l0 1 GET COL- SWAP DROP 1 COL+ m J 1 + COL- SWAP DROP I J MIN 1 + COL+ RREF \\-> r
\\<< 1 1 I
FOR i
CASE r i ROW- SWAP DROP DUP DOT 0 ==
THEN 1
END r i ROW- I J MIN 1 + COL- DROP SWAP DROP DUP DOT 1 ==
THEN 0 1 I J MIN
FOR j r { i j } GET ABS +
NEXT 1 == 1 0 IFTE
END 0
END *
NEXT xP 1 ==
IF
THEN 1 I
FOR i r i I J MIN 1 + 2 \\->LIST GET 0 >
IF
THEN I 'i' STO 0 *
END
NEXT
END 0 \\=/
IF
THEN r I J MIN 1 + COL- SWAP DROP 1 J
FOR j l0 j POS 0 ==
IF
THEN 0 j COL+
END
NEXT NEG I J >
IF
THEN J 1 + I
START J 1 + COL- DROP
NEXT
END +
END
\\>>
\\>>
NEXT DUP SIZE 0 >
IF
THEN EXPAND SAME.Sol DUP SIZE 1 ==
IF
THEN 1 GET
END 'S.lin' STO
ELSE DROP
END
\\>>
END
\\>>" "

" "'S.lin'" "
" "0" "

" "'CHECK.UNBOUND'" "
" "\\<< DUP SIZE OBJ\\-> DROP UNROT ROW- SWAP DROP \\-> J r
\\<< 2 J 1 -
FOR j r j GET 0 >
IF
THEN j 1 - '\\<-\\ooSOL' STO J 1 - 'j' STO
END
NEXT
\\>>
\\>>" "

" "'CHECK.INEQ'" "
" "\\<< \\->Ci.sol ROW.CHECK
\\>>" "

" "'ROW.CHECK'" "
" "\\<< 1 \\<-I.INP 1 -
FOR i \\<-Ci.sol i GET ROUND\\1669&0 -105 FS?
IF
THEN \\->NUM
ELSE \\->Q
END \\<-INPUTmod { i \\<-Jor } GET \\<-INPUTmod i \\<-Jor 1 - 2 \\->LIST GET \\-> Cs Ci in
\\<< Cs in \"E\" +
CASE in 'G' SAME
THEN Cs Ci \\>=
IF
THEN \"\"
ELSE \"not\\|>\"
END
END in 'L' SAME
THEN Cs Ci \\<=
IF
THEN \"\"
ELSE \"not\\|>\"
END
END in 'E' SAME
THEN DROP \"E\" Cs Ci ==
IF
THEN \"\"
ELSE \"not\\|>\"
END
END DROP \"L\\166G\" \"\"
END DUP \"not\\|>\" SAME
IF
THEN 1 'row.prob' STO \\<-row.prob.l i R\\->I \"row\" \\->TAG + '\\<-row.prob.l' STO
END SWAP + OBJ\\-> Ci
\\>>
NEXT \\<-I.INP 1 - 3 2 \\->LIST \\->ARRY 'RESULT.ROW' STO
\\>>" "

" "'\\->Ci.sol'" "
" "\\<< \\<-INP.cut 4 \\<-Jor 1 +
FOR i SOL i GET DTAG DUP TYPE 29 ==
IF
THEN 1 GET
END
NEXT \\<-Jor 2 - 1 2 \\->LIST \\->ARRY * '\\<-Ci.sol' STO
\\>>" "

" "'row.prob'" "
" "0" "

" "'RESULT.ROW'" "
" "[[ 50 'LE' 50 20 'LE' 50 ]
[ 100 'LE' 100 100 'LE' 100 ]
[ 75 'LE' 90 60 'LE' 90 ]]" "

" "'CHECK.2SOL'" "
" "\\<< 2 FS? d\\Gm 0 == AND
IF
THEN DUP DUP SIZE OBJ\\-> DROP UNROT DUP UNROT ROW- SWAP DROP \\oo NEG 0 1 \\-> m J I r max.i ii s2
\\<< 2 J 1 -
FOR j r j GET 0 >
IF
THEN 0 's2' STO
END
NEXT s2 1 ==
IF
THEN J 1 - 2
FOR j r j GET 0 ==
IF
THEN 2 I 1 -
FOR i m { i j } GET DUP 0 <
IF
THEN \\<-STACK.full 0 ==
IF
THEN \"Dum\" DUP 5 ROLLD 5 ROLLD
END 2 CF m { i J } GET SWAP / DUP max.i >
IF
THEN 'max.i' STO i 'ii' STO j '\\<-jj' STO I 1 - 'i' STO 0 'j' STO
ELSE DROP
END
ELSE DROP
END
NEXT
END -1
STEP \\<-jj 0 >
IF
THEN 2 CF m ii \\<-jj \\->PIVOT\\166&COL.ROW SLACK.\\Gb '\\<-SLACK1.\\Gb' STO RESULT.ROW '\\<-RESULT1.ROW' STO STEPS '\\<-STEPS1' STO \"in.Col\\166\" \\<-jj 1 - R\\->I + \"\\166final.STEPS\" + OBJ\\-> \"
Main Sol 1,as Zrow=0\" \\->TAG SOL + '\\Gl\\184GE\\1660\\183and\\183\\Gl\\184LE\\1661' \"\\GlSol 1+(1-\\Gl)Sol 2\" \\->TAG SWAP + '\\<-SOL1' STO \\->SOL
END
END
\\>>
END
\\>>" "

" "'xi\\->V'" "
" "\\<< DUP TYPE 29 ==
IF
THEN 1 GET
END S.1\\173N SWAP + 'S.1\\173N' STO
\\>>" "

" "'\\->PIVOT\\166&COL.ROW'" "
" "\\<< DUP2 \\-> k l
\\<< 1 - SWAP 1 - SWAP Mkl\\->N UNROT DROP2 DUP 1 GET 1 + 1 R\\->I SWAP PUT DUPDUP { k 1 } GET SWAP { 1 l } GET ROT { k 1 } ROT PUT { 1 l } ROT PUT DUP { k 1 } GET \\->STR 2 2 SUB \"\\Gb\" SAME
IF
THEN k ROW- DROP
END
\\>>
\\>>" "

" "'Mkl\\->N'" "
" "\\<< \"Used in Prog, but can
be used alone \\-> 3 Arg:
- Mat
. without labels
. or w/ 1 label line
& w/ 1 label col
- Pivot line k(without
counting label line)
- Pivot col l (without
counting label col)
3 Outputs:
- Orig Mat
- {k l}
- Simplex transf Mat\" DROP ROT DUP DUP SIZE OBJ\\-> DROP 1 \\-> k l m mn I J lab
\\<< m { I 1 } GET TYPE 6 \\=/
IF
THEN 0 'lab' STO m { 1 J } 0 CON 1 ROW+ I 1 + 1 2 \\->LIST 0 CON 1 COL+ DUP 'm' STO 'mn' STO 1 'I' STO+ 1 'J' STO+
END 1 'k' STO+ 1 'l' STO+ 2 I
FOR i 2 J
FOR j i k \\=/ j l \\=/ *
IF
THEN m { i j } GET m { i l } GET m { k j } GET * m { k l } GET / - EVAL mn { i j } ROT PUT 'mn' STO
ELSE
END
NEXT
NEXT 2 I
FOR i i k \\=/
IF
THEN m { i l } GET m { k l } GET / EVAL mn { i l } ROT PUT 'mn' STO
END
NEXT 2 J
FOR j j l \\=/
IF
THEN m { k j } GET m { k l } GET / NEG EVAL mn { k j } ROT PUT 'mn' STO
END
NEXT m { k l } GET INV EVAL mn { k l } ROT PUT lab 0 ==
IF
THEN 1 ROW- DROP 1 COL- DROP m 1 ROW- DROP 1 COL- DROP :: EVAL MAP 'm' STO
END m \"L\" k 1 - + OBJ\\-> \"C\" l 1 - + OBJ\\-> 2 \\->LIST ROT
\\>>
\\>>" "

" "'ROUND\\1669&0'" "
" "\\<< \"Input: any Number
(fractions allowed)\" DROP \"999999\" \"Modify above previous
string for rounding.

If that string has:

\\oo\\oo \\-> no rounding
(twice infinity sign!)

999999 \\-> round. when
occurr 6 9s or 6 0s
Ex Inp. (-)2.39999993
\\-> Output: (-)2.4
Ex Inp. (-)5.70000008
\\-> Output: (-)5.7

99999 \\-> round. when
occurr 5 9s or 5 0s
etc
\" DROP SWAP STD EVAL DUP DUP FP 0 \\=/
IF
THEN SIGN EVAL SWAP ABS EVAL DUP IP SWAP FP \\->STR 0 5 ROLL DUP SIZE \"\" 1 ROT
START \"0\" +
NEXT \\-> s i f p nine zero
\\<< nine \"\\oo\\oo\" SAME
IF
THEN nine 'zero' STO
END
CASE f nine POS 'p' STO p 3 >
THEN f 1 p 1 - SUB \".\" 1 p 3 -
START 0 +
NEXT 1 +
END f nine POS 'p' STO p 3 ==
THEN f 1 p 1 - SUB \".1\"
END f nine POS 'p' STO p 2 ==
THEN \"0\" \"1\"
END f zero POS 'p' STO p 2 >
THEN f 1 p 1 - SUB \"0\"
END f zero POS 'p' STO p 2 ==
THEN \"0\" DUP
END f \"0\"
END OBJ\\-> SWAP OBJ\\-> + i + s * DUP FP 0 ==
IF
THEN R\\->I
END
\\>>
ELSE ROT DROP2 R\\->I
END
\\>>" "

" "'NOTE'" "
" "\\<< CLLCD \"\\|> \\->PIVOT or Mkl\\->N may
be used outside the
Prog to 'pivot' MATR
\\183with col/line labels
\\183or without labels
\\|> For Roundings like
\\1832.37999999 \\->2.38
\\1834.230000001 \\->4.23
\\-> See ROUND\\1669&0\" 1 DISP 7 FREEZE
\\>>" "

" "'VERS'" "
" "\\<< CLLCD \"VER 8e
2023.01.02
Max/Min SIMPLEX

campart@hotmail.com

(according to
'Lineare Algebra',1980
by Kirchgraber/Marti)
\" 1 DISP 7 FREEZE
\\>>" "

" "'DATA'" "
" "DIR
SPECIAL
DIR

\\->GO
\\<< UPDIR UPDIR \\->GO
\\>>

SPEED.RDOM
\\<< \"Test Fictive Ineq \\<=
2 Arg:
\\183n for #Ineq
\\183z for RDZ\" DROP RDZ \\-> n
\\<< 1 n SQ
START RAND 10 * 1 + IP R\\->I RAND .5 \\>=
IF
THEN NEG
END
NEXT { n n } \\->ARRY -1 * 1 n
START RAND 10 * 1 + IP R\\->I
NEXT { 1 n } \\->ARRY n 1 + ROW+ 1 n 1 +
START RAND 100 * 1 + IP R\\->I
NEXT n 1 + 1 \\->LIST \\->ARRY n 1 + COL+ 1 n
START 'L'
NEXT 0 n 1 + 1 2 \\->LIST \\->ARRY n 1 + COL+ \\->GO
\\>>
\\>>


UNBO1
[[ 2 -3 'L' 4 ]
[ 5 -3 'G' 100 ]
[ 1 1 0 'Max' ]]

UNBO2
\\<< Confused1: { 32 -20 } :Other: { { 2000 -1332 } { 10000 -3332 } }
[[ 2 3 'L' 4 ]
[ 5 3 'G' 100 ]
[ 0 1 'L' 0 ]
[ 1 -1 0 'Max' ]]
\\>>


UNBO3
[[ 2 3 'L' 4 ]
[ 5 3 'G' 10 ]
[ 0 1 'L' 0 ]
[ 1 -1 0 'Max' ]]


\\GlS\\GlS1
[[ 8 6 1 'L' 48 ]
[ 4 2 1.5 'L' 20 ]
[ 2 1.5 .5 'L' 8 ]
[ 0 1 0 'L' 5 ]
[ 60 35 20 0 'Max' ]]


\\GlS\\GlS2
[[ 6 9 'L' 100 ]
[ 2 1 'L' 20 ]
[ 2000 3000 0 'Max' ]]


\\GlS\\GlS3
[[ 2 1 'L' 50 ]
[ 2 5 'L' 100 ]
[ 2 3 'L' 90 ]
[ 4 10 0 'Max' ]]


\\GlS\\GlS4
[[ 2 1 'L' 80 ]
[ 2 3 'L' 120 ]
[ 20 30 0 'Max' ]]


\\GlS\\GlS5
[[ 1 2 'L' 5 ]
[ 1 1 'L' 4 ]
[ 2 4 0 'Max' ]]

\\GlS\\GlS6
[[ 2 1 3 'L' 10 ]
[ 1 1 0 'L' 5 ]
[ 0 1 0 'L' 1 ]
[ 2 1 3 0 'Max' ]]


S&\\Gl1
[[ 1 0 0 '1/4' -8 -1 9 'E' 0 ]
[ 0 1 0 '1/2' -12 '-1/2' 3 'E' 7 ]
[ 0 0 1 0 0 1 0 'E' 1 ]
[ 0 0 0 '3/4' 20 '-1/6' 6 0 'Min' ]]


S&\\Gl2
[[ 1 -1 1 -1 0 'E' 2 ]
[ 2 -2 -1 0 1 'E' 0 ]
[ 1 -1 3 0 0 0 'Min' ]]
CYCLE
\\<< \"\\oo Loops/steps
& same table \\-> no Sol\" 1 DISP 7 FREEZE
[[ 9 -9 -2 1 'L' 0 ]
[ -2 1 '1/3' '-1/3' 'L' 0 ]
[ -12 3 2 -1 'L' 2 ]
[ -12 3 2 -1 0 'Max' ]]


\\>>
SPEC.SPEC
\\<< \"S=\\Glx1+(1-\\Gl)x2 0\\<=\\Gl\\<=1
+\\Gm1d1+\\Gm2d2 \\Gmi\\>=0
\\->Incorrect! Correct
is S=ax1+bx2 |a-b|=1
+\\Gm1d1+\\Gm2d2 \\Gmi\\>=0
x1:[0 2 2 0 5 0 17]
x2:[5 2 11/3 0 0 0 121/3]
d1:[0 1 0 0 1 1 4]
d2:[1 1 1/3 0 0 1 26/3]
https://ieeexplore.ieee.org/stamp/stamp....er=6075407\" 1 DISP 7 FREEZE
[[ 1 -1 0 0 1 0 0 'E' 3 ]
[ -3 2 9 2 0 -2 0 'E' 22 ]
[ 0 1 0 0 0 -1 0 'E' 2 ]
[ 4 3 5 0 1 0 -1 'E' 4 ]
[ -1 0 3 -1 0 0 0 0 'Max' ]]
\\>>
END

\\->GO
\\<< UPDIR \\->GO
\\>>


M0
[[ 2 1 'L' 50 ]
[ 2 5 'L' 100 ]
[ 2 3 'L' 90 ]
[ 4 10 0 'Max' ]]


M44
[[ 1 2 'L' 110 ]
[ 1 4 'L' 160 ]
[ 1 1 'L' 100 ]
[ 1 4 'G' 130 ]
[ 1 -3 0 'Max' ]]


M44b
[[ 2 1 'L' 110 ]
[ 4 1 'L' 160 ]
[ 1 1 'L' 100 ]
[ 4 1 'G' 130 ]
[ -3 1 0 'Max' ]]


M44FU
[[ 1 0 0 0 'F' 0 ]
[ 0 1 0 0 'F' 0 ]
[ 0 0 1 0 'F' 0 ]
[ 0 0 0 1 'F' 0 ]
[ 4 4 3 7 'L' 90 ]
[ 6 3 5 4 'L' 120 ]
[ 5 2 3 3 'L' 60 ]
[ 6 5 1 2 'L' 100 ]
[ 75 65 80 75 0 'Max' ]]


M3V
[[ 1 -1 1 'E' 0 ]
[ 0 -1 4 'E' 1 ]
[ -1 -4 -2 0 'Max' ]]


M4Va
[[ 4 4 3 7 'L' 90 ]
[ 6 3 5 4 'L' 120 ]
[ 5 2 3 3 'L' 60 ]
[ 0 1 0 0 'L' 15 ]
[ 1 0 0 0 'L' 10 ]
[ 6 5 1 2 'L' 100 ]
[ 75 65 80 75 0 'Max' ]]


M4Vb
[[ 0 0 1 0 'F' 0 ]
[ 0 0 0 1 'F' 0 ]
[ 4 4 3 7 'L' 90 ]
[ 6 3 5 4 'L' 120 ]
[ 5 2 3 3 'L' 60 ]
[ 0 1 0 0 'L' 15 ]
[ 1 0 0 0 'L' 10 ]
[ 6 5 1 2 'L' 100 ]
[ 75 65 80 75 0 'Max' ]]


MMIN
[[ 2.5 2 'G' 15 ]
[ 1 2.5 'G' 25 ]
[ 1 0 'G' 12 ]
[ 100 120 0 'Min' ]]
END" "

SLACK.ß
"No transf/slack ß"

MAIN
LABEL "\\<< \\->LABEL STEP0 DUP DUP DUP SIZE OBJ\\-> DROP 3 DROPN LOOP
\\>>"
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP49G-50G Version 8f Simplex Max Min Pivot Algorithm, multiple/unbounded solutions - Gil - 01-03-2023 04:33 PM



User(s) browsing this thread: 1 Guest(s)