| 17 | for (int j = 0; j < n; j++) { N[j] = j; D[m][j] = -c[j]; } |
| 18 | N[n] = -1; D[m + 1][n] = 1; } |
| 19 | void Pivot(int r, int s) { |
| 20 | double inv = 1.0 / D[r][s]; |
| 21 | for (int i = 0; i < m + 2; i++) if (i != r) |
| 22 | for (int j = 0; j < n + 2; j++) if (j != s) |
| 23 | D[i][j] -= D[r][j] * D[i][s] * inv; |
| 24 | for (int j = 0; j < n + 2; j++) if (j != s) D[r][j] *= inv; |
| 25 | for (int i = 0; i < m + 2; i++) if (i != r) D[i][s] *= -inv; |
| 26 | D[r][s] = inv; |
| 27 | swap(B[r], N[s]); } |
| 28 | bool Simplex(int phase) { |
| 29 | int x = phase == 1 ? m + 1 : m; |
| 30 | while (true) { |
nothing calls this directly
no outgoing calls
no test coverage detected