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 class
SimplexTable.Label
static class
SimplexTable.LabelType
-
Field Summary
Fields Modifier and Type Field Description static SimplexTable.Label
ARTIFICIAL
static SimplexTable.Label
ARTIFICIAL_COST
static SimplexTable.Label
B
static SimplexTable.Label
COST
static SimplexTable.Label
UNDEFINED
-
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 double
getBCol(int i)
Get the table entry at [i, B].SimplexTable.Label
getColLabel(int i)
Gets the label for column i.double
getCostRow(int j)
Get the table entry at [COST, j].int
getProblemSize()
Get the number of variables in the problem or the cost/objective function.SimplexTable.Label
getRowLabel(int i)
Gets the label for row i.boolean
isFeasible()
Check if this table is feasible.ImmutableVector
minimizer()
Get the minimizer (solution) to the minimization problem.double
minimum()
Get the (approximate) minimum found.SimplexTable
swap(int r, int s)
Perform a Jordan Exchange to swap rowr
with 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:FlexibleTable
Gets the label for column i.- Overrides:
getColLabel
in 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:FlexibleTable
Gets the label for row i.- Overrides:
getRowLabel
in 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 rowr
with 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:
true
if the table is feasible
-
minimum
public double minimum()
Description copied from interface:MinimizationSolution
Get the (approximate) minimum found.- Specified by:
minimum
in interfaceMinimizationSolution<ImmutableVector>
- Returns:
- the (approximate) minimum found
-
minimizer
public ImmutableVector minimizer()
Description copied from interface:MinimizationSolution
Get the minimizer (solution) to the minimization problem.- Specified by:
minimizer
in interfaceMinimizationSolution<ImmutableVector>
- Returns:
- the minimizer
-
-