 
 
 
 
 
 
Re: simplex tableau help wanted
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg931] Re: [mg820] simplex tableau help wanted
- From: hay at haystack.demon.co.uk
- Date: Wed, 3 May 1995 00:10:16 -0400
Doug Gwyn  <gwyn at arl.mil>;[mg820] simplex tableau help wanted
writes
> I'm a newcomer to Mathematica (Windows) and would appreciate some
> assistance in a project I'm working on, to teach linear
> programming. What I want is to show each tableau in an example
of> Danzig's simplex algorithm, preferably with pivot flagged (*)
etc., > certainly with variable labels along the top and side of
the> matrix.  Could some experienced Mathematica programmer suggest
the > general structures to use for this?  If there is a sample
package
> that does something very similar, I'd appreciate finding it.
> Thanks for any and all help!
The following shows some of the things that I have have found
useful in writing this kind of code.
Block is used to keep m the same after the display.
I have set the horizontal alignment to Right for integer entries.
"a\n " is a trick to raise the top headings.
In[1]:=
	m = Table[Random[Integer,{-9,9}],{3},{5}];
In[4]:=
	Block[{mm = m},
		mm[[2,3]] = StringForm["[``]",m[[2,3]]];
		TableForm[
			mm,
			TableHeadings ->
			{{"a","b","c"},{"a\n ","b","c","d","e"}},
			TableAlignments -> {Automatic, Right}
		]
	]
Out[4]//TableForm=
	    a   b   c      d   e
	a   8   2     -7   7   -4
	b   3   7   [-4]   6    8
	c   2   6      2   7   -5
	
We should be able to get a lot better layout with the next version  
of Mma.
You may find something of interest in my package
Strang`LinearAlgebra` (on MathSource).
I can send you a package for Floyd's method for least weight routes  
that may be a bit more relevant.
Allan Hayes
hay at haystack.demon.co.uk

