Example:
W | Z | x1 | x2 | x- | s1 | s2 | a1 | RHS --------------------------------------------------- -1 0 0 0 0 0 0 1 0 <= phase 1 objective 0 1 -15 -10 0 0 0 0 0 <= phase 2 objective 0 0 1 0 0 1 0 0 2 <= constraint 1 0 0 0 1 0 0 1 0 3 <= constraint 2 0 0 1 1 0 0 0 1 4 <= constraint 3W: Phase 1 objective function Z: Phase 2 objective function x1 & x2: Decision variables x-: Extra decision variable to allow for negative values s1 & s2: Slack/Surplus variables a1: Artificial variable RHS: Right hand side
| Modifier and Type | Field and Description |
|---|---|
| private int[] | basicRows
Maps rows to their corresponding basic variables. |
| private int[] | basicVariables
Maps basic variables to row they are basic in. |
| private final List | columnLabels
The variables each column represents |
| private final List | constraints
Linear constraints. |
| private final double | epsilon
Amount of error to accept when checking for optimality. |
| private final LinearObjectiveFunction | f
Linear objective function. |
| private final int | maxUlps
Amount of error to accept in floating point comparisons. |
| private static final String | NEGATIVE_VAR_COLUMN_LABEL
Column label for negative vars. |
| private int | numArtificialVariables
Number of artificial variables. |
| private final int | numDecisionVariables
Number of decision variables. |
| private final int | numSlackVariables
Number of slack variables. |
| private final boolean | restrictToNonNegative
Whether to restrict the variables to non-negative values. |
| private static final long | serialVersionUID
Serializable version identifier. |
| private transient Array2DRowRealMatrix | tableau
Simple tableau. |
| Access | Constructor and Description |
|---|---|
| pack-priv | SimplexTableau(final LinearObjectiveFunction
Linear objective function. f, final Collection<LinearConstraint> Linear constraints. constraints, final GoalType Optimization goal: either goalType, final boolean GoalType#MAXIMIZE
or GoalType#MINIMIZE.Whether to restrict the variables to non-negative values. restrictToNonNegative, final double Amount of error to accept when checking for optimality. epsilon)Builds a tableau for a linear problem. |
| pack-priv | SimplexTableau(final LinearObjectiveFunction
linear objective function f, final Collection<LinearConstraint> linear constraints constraints, final GoalType type of optimization goal: either goalType, final boolean GoalType#MAXIMIZE or GoalType#MINIMIZEwhether to restrict the variables to non-negative values restrictToNonNegative, final double amount of error to accept when checking for optimality epsilon, final int amount of error to accept in floating point comparisons maxUlps)Build a tableau for a linear problem. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| protected Array2DRowRealMatrix | Returns: created tableauif true, goal is to maximize the objective function maximize)Create the tableau by itself. |
| protected void | divideRow(final int
index of the row dividendRowIndex, final double value of the divisor divisor)Divides one row by a given divisor. |
| protected void | dropPhase1Objective()
Removes the phase 1 objective function, positive cost non-artificial variables, and the non-basic artificial variables from this tableau. |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Indicates whether some other object is "equal to" this one. |
| private Integer | Returns: the row that the variable is basic in, ornull if the variable is not basic.index of the column col)Returns the row in which the given column is basic. |
| protected final int | Returns: offset of the first artificial variableGet the offset of the first artificial variable. |
| protected Integer | Returns: the row that the variable is basic in. null if the column is not basicindex of the column to check col)Checks whether the given column is basic. |
| protected int | Returns: the variable that is basic for this row.the index of the row to check row)Returns the variable that is basic in this row. |
| private int | Returns: number of constraint with the specified relationshiprelationship to count relationship)Get a count of constraints corresponding to a specified relationship. |
| protected final double[][] | |
| protected final double | Returns: entry at (row, column)row index row, final int column index column)Get an entry of the tableau. |
| protected final int | |
| protected static double | Returns: the -1 times the sum of all coefficients in the given array.coefficients to sum coefficients)Get the -1 times the sum of all coefficients in the given array. |
| protected final int | Returns: number of artificial variablesGet the number of artificial variables. |
| protected final int | |
| protected final int | Returns: 2 for Phase 1. 1 for Phase 2.Get the number of objective functions in this tableau. |
| protected final int | |
| protected final int | Returns: original number of decision variablesGet the original number of decision variables. |
| protected final int | |
| protected final double[] | Returns: the reference to the underlying row datathe row index row)Get the row from the tableau. |
| protected final int | Returns: offset of the first slack variableGet the offset of the first slack variable. |
| protected PointValuePair | |
| protected final int | |
| public int | |
| private void | initializeBasicVariables(final int
the column to start startColumn)Initializes the basic variable / row mapping. |
| protected void | |
| pack-priv boolean | Returns: whether the model has been solvedReturns whether the problem is at an optimal state. |
| private LinearConstraint | Returns: new equationreference constraint constraint)Get a new equation equivalent to this one with a positive right hand side. |
| public List | Returns: new versions of the constraintsoriginal (not normalized) constraints originalConstraints)Get new versions of the constraints which have positive right hand sides. |
| protected void | performRowOperations(int
the pivot column pivotCol, int the pivot row pivotRow)Perform the row operations of the simplex algorithm with the selected pivot column and row. |
| private void | readObject(ObjectInputStream
stream from which the object should be read ois)Deserialize the instance. |
| protected final void | setEntry(final int
row index row, final int column index column, final double for the entry value)Set an entry of the tableau. |
| protected void | subtractRow(final int
row index minuendRowIndex, final int row index subtrahendRowIndex, final double multiplication factor multiplier)Subtracts a multiple of one row from another. |
| private void |
| basicRows | back to summary |
|---|---|
| private int[] basicRows Maps rows to their corresponding basic variables. | |
| basicVariables | back to summary |
|---|---|
| private int[] basicVariables Maps basic variables to row they are basic in. | |
| columnLabels | back to summary |
|---|---|
| private final List<String> columnLabels The variables each column represents | |
| constraints | back to summary |
|---|---|
| private final List<LinearConstraint> constraints Linear constraints. | |
| epsilon | back to summary |
|---|---|
| private final double epsilon Amount of error to accept when checking for optimality. | |
| f | back to summary |
|---|---|
| private final LinearObjectiveFunction f Linear objective function. | |
| maxUlps | back to summary |
|---|---|
| private final int maxUlps Amount of error to accept in floating point comparisons. | |
| NEGATIVE_VAR_COLUMN_LABEL | back to summary |
|---|---|
| private static final String NEGATIVE_VAR_COLUMN_LABEL Column label for negative vars. | |
| numArtificialVariables | back to summary |
|---|---|
| private int numArtificialVariables Number of artificial variables. | |
| numDecisionVariables | back to summary |
|---|---|
| private final int numDecisionVariables Number of decision variables. | |
| numSlackVariables | back to summary |
|---|---|
| private final int numSlackVariables Number of slack variables. | |
| restrictToNonNegative | back to summary |
|---|---|
| private final boolean restrictToNonNegative Whether to restrict the variables to non-negative values. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serializable version identifier. | |
| tableau | back to summary |
|---|---|
| private transient Array2DRowRealMatrix tableau Simple tableau. | |
| SimplexTableau | back to summary |
|---|---|
| pack-priv SimplexTableau(final LinearObjectiveFunction f, final Collection<LinearConstraint> constraints, final GoalType goalType, final boolean restrictToNonNegative, final double epsilon) Builds a tableau for a linear problem.
| |
| SimplexTableau | back to summary |
|---|---|
| pack-priv SimplexTableau(final LinearObjectiveFunction f, final Collection<LinearConstraint> constraints, final GoalType goalType, final boolean restrictToNonNegative, final double epsilon, final int maxUlps) Build a tableau for a linear problem.
| |
| copyArray | back to summary |
|---|---|
private void copyArray(final double[] src, final double[] dest)
| |
| createTableau | back to summary |
|---|---|
| protected Array2DRowRealMatrix createTableau(final boolean maximize) Create the tableau by itself.
| |
| divideRow | back to summary |
|---|---|
| protected void divideRow(final int dividendRowIndex, final double divisor) Divides one row by a given divisor. After application of this operation, the following will hold: dividendRow = dividendRow / divisor
| |
| dropPhase1Objective | back to summary |
|---|---|
| protected void dropPhase1Objective() Removes the phase 1 objective function, positive cost non-artificial variables, and the non-basic artificial variables from this tableau. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| findBasicRow | back to summary |
|---|---|
| private Integer findBasicRow(final int col) Returns the row in which the given column is basic.
| |
| getArtificialVariableOffset | back to summary |
|---|---|
| protected final int getArtificialVariableOffset() Get the offset of the first artificial variable.
| |
| getBasicRow | back to summary |
|---|---|
| protected Integer getBasicRow(final int col) Checks whether the given column is basic.
| |
| getBasicVariable | back to summary |
|---|---|
| protected int getBasicVariable(final int row) Returns the variable that is basic in this row.
| |
| getConstraintTypeCounts | back to summary |
|---|---|
| private int getConstraintTypeCounts(final Relationship relationship) Get a count of constraints corresponding to a specified relationship.
| |
| getData | back to summary |
|---|---|
| protected final double[][] getData() Get the tableau data.
| |
| getEntry | back to summary |
|---|---|
| protected final double getEntry(final int row, final int column) Get an entry of the tableau.
| |
| getHeight | back to summary |
|---|---|
| protected final int getHeight() Get the height of the tableau.
| |
| getInvertedCoefficientSum | back to summary |
|---|---|
| protected static double getInvertedCoefficientSum(final RealVector coefficients) Get the -1 times the sum of all coefficients in the given array.
| |
| getNumArtificialVariables | back to summary |
|---|---|
| protected final int getNumArtificialVariables() Get the number of artificial variables.
| |
| getNumDecisionVariables | back to summary |
|---|---|
| protected final int getNumDecisionVariables() Get the number of decision variables. If variables are not restricted to positive values, this will include 1 extra decision variable to represent the absolute value of the most negative variable.
| |
| getNumObjectiveFunctions | back to summary |
|---|---|
| protected final int getNumObjectiveFunctions() Get the number of objective functions in this tableau.
| |
| getNumSlackVariables | back to summary |
|---|---|
| protected final int getNumSlackVariables() Get the number of slack variables.
| |
| getOriginalNumDecisionVariables | back to summary |
|---|---|
| protected final int getOriginalNumDecisionVariables() Get the original number of decision variables.
| |
| getRhsOffset | back to summary |
|---|---|
| protected final int getRhsOffset() Get the offset of the right hand side.
| |
| getRow | back to summary |
|---|---|
| protected final double[] getRow(int row) Get the row from the tableau.
| |
| getSlackVariableOffset | back to summary |
|---|---|
| protected final int getSlackVariableOffset() Get the offset of the first slack variable.
| |
| getSolution | back to summary |
|---|---|
| protected PointValuePair getSolution() Get the current solution.
| |
| getWidth | back to summary |
|---|---|
| protected final int getWidth() Get the width of the tableau.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| initializeBasicVariables | back to summary |
|---|---|
| private void initializeBasicVariables(final int startColumn) Initializes the basic variable / row mapping.
| |
| initializeColumnLabels | back to summary |
|---|---|
| protected void initializeColumnLabels() Initialize the labels for the columns. | |
| isOptimal | back to summary |
|---|---|
| pack-priv boolean isOptimal() Returns whether the problem is at an optimal state.
| |
| normalize | back to summary |
|---|---|
| private LinearConstraint normalize(final LinearConstraint constraint) Get a new equation equivalent to this one with a positive right hand side.
| |
| normalizeConstraints | back to summary |
|---|---|
| public List Get new versions of the constraints which have positive right hand sides.
| |
| performRowOperations | back to summary |
|---|---|
| protected void performRowOperations(int pivotCol, int pivotRow) Perform the row operations of the simplex algorithm with the selected pivot column and row.
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException Deserialize the instance.
| |
| setEntry | back to summary |
|---|---|
| protected final void setEntry(final int row, final int column, final double value) Set an entry of the tableau.
| |
| subtractRow | back to summary |
|---|---|
| protected void subtractRow(final int minuendRowIndex, final int subtrahendRowIndex, final double multiplier) Subtracts a multiple of one row from another. After application of this operation, the following will hold: minuendRow = minuendRow - multiple * subtrahendRow
| |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream oos) throws IOException Serialize the instance.
| |