Class SimplexTable
- java.lang.Object
-
- dev.nm.misc.datastructure.FlexibleTable
-
- dev.nm.solver.multivariate.constrained.convex.sdp.socp.qp.lp.simplex.SimplexTable
-
- All Implemented Interfaces:
MatrixAccess,MatrixTable,Table,MinimizationSolution<ImmutableVector>
public class SimplexTable extends FlexibleTable implements MinimizationSolution<ImmutableVector>
This is a simplex table used to solve a linear programming problem using a simplex method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSimplexTable.Labelstatic classSimplexTable.LabelType
-
Field Summary
Fields Modifier and Type Field Description static SimplexTable.LabelARTIFICIALstatic SimplexTable.LabelARTIFICIAL_COSTstatic SimplexTable.LabelBstatic SimplexTable.LabelCOSTstatic SimplexTable.LabelUNDEFINED
-
Constructor Summary
Constructors Constructor Description SimplexTable(LPCanonicalProblem1 problem)Construct a simplex table from a canonical linear programming problem.SimplexTable(LPCanonicalProblem1 problem, double epsilon)Construct a simplex table from a canonical linear programming problem.SimplexTable(LPProblem problem)Construct a simplex table from a general linear programming problem.SimplexTable(LPProblem problem, double epsilon)Construct a simplex table from a general linear programming problem.SimplexTable(SimplexTable table)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetBCol(int i)Get the table entry at [i, B].SimplexTable.LabelgetColLabel(int i)Gets the label for column i.doublegetCostRow(int j)Get the table entry at [COST, j].intgetProblemSize()Get the number of variables in the problem or the cost/objective function.SimplexTable.LabelgetRowLabel(int i)Gets the label for row i.booleanisFeasible()Check if this table is feasible.ImmutableVectorminimizer()Get the minimizer (solution) to the minimization problem.doubleminimum()Get the (approximate) minimum found.SimplexTableswap(int r, int s)Perform a Jordan Exchange to swap rowrwith columns.
-
-
-
Field Detail
-
COST
public static final SimplexTable.Label COST
-
B
public static final SimplexTable.Label B
-
ARTIFICIAL_COST
public static final SimplexTable.Label ARTIFICIAL_COST
-
ARTIFICIAL
public static final SimplexTable.Label ARTIFICIAL
-
UNDEFINED
public static final SimplexTable.Label UNDEFINED
-
-
Constructor Detail
-
SimplexTable
public SimplexTable(LPCanonicalProblem1 problem, double epsilon)
Construct a simplex table from a canonical linear programming problem.- Parameters:
problem- a canonical linear programming problemepsilon- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
SimplexTable
public SimplexTable(LPCanonicalProblem1 problem)
Construct a simplex table from a canonical linear programming problem.- Parameters:
problem- a canonical linear programming problem
-
SimplexTable
public SimplexTable(LPProblem problem, double epsilon)
Construct a simplex table from a general linear programming problem.- Parameters:
problem- a general linear programming problemepsilon- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
SimplexTable
public SimplexTable(LPProblem problem)
Construct a simplex table from a general linear programming problem.- Parameters:
problem- a general linear programming problem
-
SimplexTable
public SimplexTable(SimplexTable table)
Copy constructor.- Parameters:
table- a simplex table
-
-
Method Detail
-
getColLabel
public SimplexTable.Label getColLabel(int i)
Description copied from class:FlexibleTableGets the label for column i.- Overrides:
getColLabelin classFlexibleTable- Parameters:
i- a column index, counting from 1- Returns:
- the label for column i
-
getRowLabel
public SimplexTable.Label getRowLabel(int i)
Description copied from class:FlexibleTableGets the label for row i.- Overrides:
getRowLabelin classFlexibleTable- Parameters:
i- a row index, counting from 1- Returns:
- the label for row i
-
getCostRow
public double getCostRow(int j)
Get the table entry at [COST, j].- Parameters:
j- a column index, counting from 1- Returns:
- T[COST, j]
-
getBCol
public double getBCol(int i)
Get the table entry at [i, B].- Parameters:
i- a row index, counting from 1- Returns:
- T[i, B]
-
getProblemSize
public int getProblemSize()
Get the number of variables in the problem or the cost/objective function.- Returns:
- the number of variables
-
swap
public SimplexTable swap(int r, int s)
Perform a Jordan Exchange to swap rowrwith columns.- Parameters:
r- the index to a entering variable (row)s- the index to a leaving variable (column)- Returns:
- a swapped simplex table
-
isFeasible
public boolean isFeasible()
Check if this table is feasible.- Returns:
trueif the table is feasible
-
minimum
public double minimum()
Description copied from interface:MinimizationSolutionGet the (approximate) minimum found.- Specified by:
minimumin interfaceMinimizationSolution<ImmutableVector>- Returns:
- the (approximate) minimum found
-
minimizer
public ImmutableVector minimizer()
Description copied from interface:MinimizationSolutionGet the minimizer (solution) to the minimization problem.- Specified by:
minimizerin interfaceMinimizationSolution<ImmutableVector>- Returns:
- the minimizer
-
-