Skip to content

Commit

Permalink
fixed files form Math #28
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 8c0c9dd commit d02b406
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ private Integer getPivotRow(SimplexTableau tableau, final int col) {
// there's a degeneracy as indicated by a tie in the minimum ratio test

// 1. check if there's an artificial variable that can be forced out of the basis
if (tableau.getNumArtificialVariables() > 0) {
for (Integer row : minRatioPositions) {
for (int i = 0; i < tableau.getNumArtificialVariables(); i++) {
int column = i + tableau.getArtificialVariableOffset();
Expand All @@ -125,6 +126,7 @@ private Integer getPivotRow(SimplexTableau tableau, final int col) {
}
}
}
}

// 2. apply Bland's rule to prevent cycling:
// take the row for which the corresponding basic variable has the smallest index
Expand All @@ -135,6 +137,7 @@ private Integer getPivotRow(SimplexTableau tableau, final int col) {
// Additional heuristic: if we did not get a solution after half of maxIterations
// revert to the simple case of just returning the top-most row
// This heuristic is based on empirical data gathered while investigating MATH-828.
if (getIterations() < getMaxIterations() / 2) {
Integer minRow = null;
int minIndex = tableau.getWidth();
for (Integer row : minRatioPositions) {
Expand All @@ -149,6 +152,7 @@ private Integer getPivotRow(SimplexTableau tableau, final int col) {
}
}
return minRow;
}
}
return minRatioPositions.get(0);
}
Expand Down

0 comments on commit d02b406

Please sign in to comment.