MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / LPSolver

Method LPSolver

code/other/simplex.cpp:10–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8 VI B, N;
9 VVD D;
10 LPSolver(const VVD &A, const VD &b, const VD &c) :
11 m(b.size()), n(c.size()),
12 N(n + 1), B(m), D(m + 2, VD(n + 2)) {
13 for (int i = 0; i < m; i++) for (int j = 0; j < n; j++)
14 D[i][j] = A[i][j];
15 for (int i = 0; i < m; i++) { B[i] = n + i; D[i][n] = -1;
16 D[i][n + 1] = b[i]; }
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)

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected