SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.optimization.constrained.linearprogramming.simplex
Class Tableau

java.lang.Object
  extended by com.numericalmethod.suanshu.optimization.constrained.linearprogramming.simplex.Tableau

public class Tableau
extends java.lang.Object

This class implements a "tableau" and its operations used in the Simplex method when solving an LP problem.


Nested Class Summary
static class Tableau.Label
           
static class Tableau.LabelType
           
 
Field Summary
 double epsilon
          a precision parameter: when a number |x| ≤ ε, it is considered 0
static Tableau.Label UNDEFINED
           
 
Constructor Summary
Tableau(Matrix T, double epsilon)
          Construct a simplex tableau, assuming the standard form.
Tableau(StandardLpProblem2 problem)
          Construct a simplex tableau from a standard problem.
Tableau(Tableau.Label[] rowLabel, Tableau.Label[] colLabel, Matrix T, double epsilon)
          Construct a simplex tableau.
Tableau(Tableau table)
          Copy ctor.
 
Method Summary
static DenseMatrix buildTable(StandardLpProblem2 problem)
          phase 1: (feasible) tableau initialization
 double get(int row, int col)
          Get the table entry at [row, col].
 double getBCol(int row)
           
 Tableau.Label getColLabel(int i)
           
 double getCostRow(int col)
           
 Tableau.Label getRowLabel(int i)
           
 boolean isFeasible()
          Check if this table is feasible.
 double min()
          Get the minimum inferred by this table.
 ImmutableVector minimizer()
          Get the minimizer inferred by this table.
 int nCols()
          Get the number of non-basic variables.
 int nRows()
          Get the number of basic variables.
 int problemSize()
          Get the number of variables in the problem, the cost/objective function.
 void swap(int r, int s)
          Perform a Jordan Exchange to swap row r with column s.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final Tableau.Label UNDEFINED

epsilon

public final double epsilon
a precision parameter: when a number |x| ≤ ε, it is considered 0

Constructor Detail

Tableau

public Tableau(Tableau.Label[] rowLabel,
               Tableau.Label[] colLabel,
               Matrix T,
               double epsilon)
Construct a simplex tableau.

Parameters:
rowLabel - the labeling of the basic variables
colLabel - the labeling of the non-basic variables
T - the table represented in matrix form
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0

Tableau

public Tableau(Matrix T,
               double epsilon)
Construct a simplex tableau, assuming the standard form.

Parameters:
T - the table represented in matrix form
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0

Tableau

public Tableau(StandardLpProblem2 problem)
Construct a simplex tableau from a standard problem.

Parameters:
problem - a standard linear programming problem

Tableau

public Tableau(Tableau table)
Copy ctor.

Parameters:
table - another Tableau
Method Detail

nRows

public int nRows()
Get the number of basic variables.

Returns:
number of basic variables

nCols

public int nCols()
Get the number of non-basic variables.

Returns:
number of non-basic variables

get

public double get(int row,
                  int col)
Get the table entry at [row, col].

Parameters:
row - the row index
col - the column index
Returns:
T[row, col]

getCostRow

public double getCostRow(int col)

getBCol

public double getBCol(int row)

getColLabel

public Tableau.Label getColLabel(int i)

getRowLabel

public Tableau.Label getRowLabel(int i)

isFeasible

public boolean isFeasible()
Check if this table is feasible.

Returns:
true iff the table is feasible

problemSize

public int problemSize()
Get the number of variables in the problem, the cost/objective function.

Returns:
the number of variables

min

public double min()
Get the minimum inferred by this table.

Returns:
the minimum

minimizer

public ImmutableVector minimizer()
Get the minimizer inferred by this table.

Returns:
the minimizer

swap

public void swap(int r,
                 int s)
Perform a Jordan Exchange to swap row r with column s.

Parameters:
r - the index to the entering variable (row)
s - the index to the leaving variable (column)

buildTable

public static DenseMatrix buildTable(StandardLpProblem2 problem)
phase 1: (feasible) tableau initialization

Parameters:
problem - a linear programming problem
Returns:
the tableau representation of a linear programming problem | A -b | T = | c' 0 |

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.