"Study notes" Linear Programming

Dual problem

\[ \max \{ c^\intercal x \mid A x \leq b \} = \min \{ b^\intercal y \mid A^\intercal y \geq c \} \]

To sample item:

Luo Gu P3337 [ZJOI2013] defensive front

List equation:
\ [\ the aligned the begin {} & \ mathrm Minimize {} \ \ \\ & sum_i C_i y_i ST \ \ FORALL I \ in [. 1, n-], \ \ sum_ {L_i \ Leq J \ Leq r_i } y_j \ geq d_i \\ & \
forall i \ in [1, n], \ y_i \ geq 0 \ end {aligned} \] order \ (A ^ \ intercal_ {i , j} = [j \ in [l_i , r_i]] \) , \ (B = \ {bmatrix the begin} c_1 and c_2 \\ \\ \ \\ vdots C_N \ bmatrix End {} \) , \ (C = \ {bmatrix the begin D_2 \\ \\} D_1 \ \\ vdots D_n \ bmatrix End {} \) , so as to even after:
\ [\ the aligned the begin {} & \ mathrm Maximize {} \ \ \\ & sum_i D_i x_i ST \ \ FORALL I \ in [. 1, n- ], \ \ sum_ {j}
A_ {i, j} x_j \ geq c_i \\ & \ forall i \ in [1, n], \ x_i \ geq 0 \ end {aligned} \] Meanwhile \ (A \) column in a continuous \ (1 \) appears.

I feel very good, then adding slack variables:
\ [\ A_ sum_ {J} {I, J} = y_i + x_j \ C_i]
After the difference:
\ [\ sum_ l_j = {I} x_j - \ +. 1 sum_ {r_j = i} x_j + y_i - y_
{i - 1} = c_i - c_ {i - 1} \] transpose obtained:
\ [\ sum_ {l_j = I} x_j + C_ {I -. 1} + y_i = \ sum_ {r_j + 1 = i} x_j
+ c_i + y_ {i - 1} \] the flow equation as a point of balance, so there is even such a scheme side:

  • Set Point \ (V = {S, T , 1, 2, \ cdots, n + 1} \)

  • \ (\ FORALL I \ in [. 1, n-+. 1] \) , even side \ ((S, I, C_ {I -. 1}, 0) \) (i.e., from \ (S \) to \ (I \ ) , flow rate \ (C_ {I -. 1} \) , cost \ (0 \) ) and \ ((I, T, C_i, 0) \) .
  • \ (\ FORALL I \ in [. 1, n-] \) , even side \ ((i + 1, i , \ infty, 0) \) represents a slack variable.
  • For any interval \ ([L_i, r_i] \) , even side \ ((+ r_i. 1, L_i, \ infty, D_i) \) .

So the maximum cost maximum flow to specific implementation details may be found in the code .


To be continued. . .

Guess you like

Origin www.cnblogs.com/cj-xxz/p/12210557.html