<<

LP algorithmis: History Primal- Examples

Linear and Integer Programming, and examples

Algorithmics GEI-FIB UPC

Spring 2018

A-GEI Linear and Integer Programming, duality and examples LP algorithmis: History Primal-Dual Integer Linear programming Examples LP People

Kantorovich (1912-1986) Dantzig (1914-2005)

von Neumman (1903-1957) Khachiyan (1952-2005)

Karmarkar (1957)

A-GEI Linear and Integer Programming, duality and examples LP algorithmis: History Primal-Dual Integer Linear programming Examples History

1939, Leonid Kantorovich (1939): for use during World War II to plan expenditures and returns to reduce costs to the army and increase losses to the enemy 1947 (secret until), George B. Dantzig: simplex method John von Neumann: the theory of duality as a linear optimization solution 1979, Leonid Khachiyan: LP was shown to be solvable in polynomial time 1984, Narendra Karmarkar: new -point method for solving LP problems First example (Dantzig’s): Find the best assignment of 70 people to 70 job

A-GEI Linear and Integer Programming, duality and examples LP algorithmis: History Primal-Dual Integer Linear programming Examples History: Simplex algorithm

Klee and Minty 1972: The simplex algorithm takes exponential time in the worst case Spielman and Teng 2001: when the inputs to the simplex algorithm are slightly randomly perturbed, the expected running time of the simplex algorithm is polynomial for any inputs. Kelner and Spielman 2006: A polynomial time randomized simplex algorithm that works on any inputs.

A-GEI Linear and Integer Programming, duality and examples The best lower bound, for any x?

max bT y s.t. AT y = c y ≥ 0

∗ T if x opt, y Ax is a general But as we are maximizing linear combination of equa- this is equivalent to tions, if we can select y so that max bT y T ∗ T ∗ y Ax = c x , s.t. AT y ≤ c DUAL cT x∗ ≥ y T b y ≥ 0

LP algorithmis: History Primal-Dual Integer Linear programming Examples Searching for a lower bound: The best one?

LP (PRIMAL)

min cT x s.t. Ax ≥ b x ≥ 0

A-GEI Linear and Integer Programming, duality and examples The best lower bound, for any x?

max bT y s.t. AT y = c y ≥ 0

But as we are maximizing this is equivalent to

max bT y s.t. AT y ≤ c DUAL y ≥ 0

LP algorithmis: History Primal-Dual Integer Linear programming Examples Searching for a lower bound: The best one?

LP (PRIMAL)

min cT x s.t. Ax ≥ b x ≥ 0

if x∗ opt, y T Ax is a general linear combination of equa- tions, if we can select y so that y T Ax∗ = cT x∗, cT x∗ ≥ y T b

A-GEI Linear and Integer Programming, duality and examples max bT y s.t. AT y = c y ≥ 0

But as we are maximizing this is equivalent to

max bT y s.t. AT y ≤ c DUAL y ≥ 0

LP algorithmis: History Primal-Dual Integer Linear programming Examples Searching for a lower bound: The best one?

The best lower bound, for LP (PRIMAL) any x? min cT x s.t. Ax ≥ b x ≥ 0

if x∗ opt, y T Ax is a general linear combination of equa- tions, if we can select y so that y T Ax∗ = cT x∗, cT x∗ ≥ y T b

A-GEI Linear and Integer Programming, duality and examples But as we are maximizing this is equivalent to

max bT y s.t. AT y ≤ c DUAL y ≥ 0

LP algorithmis: History Primal-Dual Integer Linear programming Examples Searching for a lower bound: The best one?

The best lower bound, for LP (PRIMAL) any x?

T min c x max bT y s.t. Ax ≥ b s.t. AT y = c x ≥ 0 y ≥ 0 if x∗ opt, y T Ax is a general linear combination of equa- tions, if we can select y so that y T Ax∗ = cT x∗, cT x∗ ≥ y T b

A-GEI Linear and Integer Programming, duality and examples max bT y s.t. AT y ≤ c DUAL y ≥ 0

LP algorithmis: History Primal-Dual Integer Linear programming Examples Searching for a lower bound: The best one?

The best lower bound, for LP (PRIMAL) any x?

T min c x max bT y s.t. Ax ≥ b s.t. AT y = c x ≥ 0 y ≥ 0

∗ T if x opt, y Ax is a general But as we are maximizing linear combination of equa- this is equivalent to tions, if we can select y so that y T Ax∗ = cT x∗, cT x∗ ≥ y T b

A-GEI Linear and Integer Programming, duality and examples LP algorithmis: History Primal-Dual Integer Linear programming Examples Searching for a lower bound: The best one?

The best lower bound, for LP (PRIMAL) any x?

T min c x max bT y s.t. Ax ≥ b s.t. AT y = c x ≥ 0 y ≥ 0

∗ T if x opt, y Ax is a general But as we are maximizing linear combination of equa- this is equivalent to tions, if we can select y so that max bT y T ∗ T ∗ y Ax = c x , s.t. AT y ≤ c DUAL cT x∗ ≥ y T b y ≥ 0

A-GEI Linear and Integer Programming, duality and examples Theorem (Strong duality) If the primal has an optimal solution x∗ then the dual has an optimal solution y ∗ such that cT x∗ = bT y ∗

There are additional conditions for a pair (x, y) of primal-dual feasible solutions allowing improvements on the cost of the objective . Those ideas lead to the family of primal-dual algorithms. Jack R. Edmonds gave the first (sophisticated) application of the primal-dual paradigm in his work on maximum weight matchings in arbitrary graphs (1965).

LP algorithmis: History Primal-Dual Integer Linear programming Examples Strong duality theorem

Working from the dual trying to get the best lower bound we come back to the primal.

A-GEI Linear and Integer Programming, duality and examples LP algorithmis: History Primal-Dual Integer Linear programming Examples Strong duality theorem

Working from the dual trying to get the best lower bound we come back to the primal. Theorem (Strong duality) If the primal has an optimal solution x∗ then the dual has an optimal solution y ∗ such that cT x∗ = bT y ∗

There are additional conditions for a pair (x, y) of primal-dual feasible solutions allowing improvements on the cost of the objective function. Those ideas lead to the family of primal-dual algorithms. Jack R. Edmonds gave the first (sophisticated) application of the primal-dual paradigm in his work on maximum weight matchings in arbitrary graphs (1965). A-GEI Linear and Integer Programming, duality and examples LP algorithmis: History Primal-Dual Integer Linear programming Examples Integer Linear Programming

The ILP problem is defined: Given matrix A (n × m) together with vectors b and c, solve

min cT x subject to Ax ≥ b x ∈ Z

Big difference between LP and ILP: LP has polynomial time algorithms but ILP is NP-hard.

A-GEI Linear and Integer Programming, duality and examples There are a myriad of solvers packages: GLPK: https://www.gnu.org/software/glpk/ LP-SOLVE: http://www3.cs.stonybrook.edu/ CPLEX: http://ampl.com/products/solvers/solvers-we-sell/cplex/ GUROBI Optimizer: http://www.gurobi.com/products/gurobi-optimizer

LP algorithmis: History Primal-Dual Integer Linear programming Examples Solvers for LP

Due to the importance of LP and ILP as models to solve optimization problem, there is a very active research going on to design new algorithms and heuristics to improve the running time for solving LP (algorithms) IPL (heuristics or approximation algorithms).

A-GEI Linear and Integer Programming, duality and examples LP algorithmis: History Primal-Dual Integer Linear programming Examples Solvers for LP

Due to the importance of LP and ILP as models to solve optimization problem, there is a very active research going on to design new algorithms and heuristics to improve the running time for solving LP (algorithms) IPL (heuristics or approximation algorithms). There are a myriad of solvers packages: GLPK: https://www.gnu.org/software/glpk/ LP-SOLVE: http://www3.cs.stonybrook.edu/ CPLEX: http://ampl.com/products/solvers/solvers-we-sell/cplex/ GUROBI Optimizer: http://www.gurobi.com/products/gurobi-optimizer

A-GEI Linear and Integer Programming, duality and examples The problem is NP-hard. Can we formulate VC as an ILP problem?

Variables: x1 ... xn, xi = 1 if i ∈ S, 0 otherwise. Pn Objective function: i=1 xi . Restrictions: for every edge( i, j) ∈ E, xi + xj ≥ 1

xi ∈ {0, 1} The ILP formulation can be computed in polytime.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 ILP for cover

vc Given a graph G = (V , E), we want to find a set S, with minimum number of vertices, so that every edge in G has at least one end point in S.

A-GEI Linear and Integer Programming, duality and examples Can we formulate VC as an ILP problem?

Variables: x1 ... xn, xi = 1 if i ∈ S, 0 otherwise. Pn Objective function: i=1 xi . Restrictions: for every edge( i, j) ∈ E, xi + xj ≥ 1

xi ∈ {0, 1} The ILP formulation can be computed in polytime.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 ILP for vertex cover

vc Given a graph G = (V , E), we want to find a set S, with minimum number of vertices, so that every edge in G has at least one end point in S. The problem is NP-hard.

A-GEI Linear and Integer Programming, duality and examples Variables: x1 ... xn, xi = 1 if i ∈ S, 0 otherwise. Pn Objective function: i=1 xi . Restrictions: for every edge( i, j) ∈ E, xi + xj ≥ 1

xi ∈ {0, 1} The ILP formulation can be computed in polytime.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 ILP for vertex cover

vc Given a graph G = (V , E), we want to find a set S, with minimum number of vertices, so that every edge in G has at least one end point in S. The problem is NP-hard. Can we formulate VC as an ILP problem?

A-GEI Linear and Integer Programming, duality and examples Pn Objective function: i=1 xi . Restrictions: for every edge( i, j) ∈ E, xi + xj ≥ 1

xi ∈ {0, 1} The ILP formulation can be computed in polytime.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 ILP for vertex cover

vc Given a graph G = (V , E), we want to find a set S, with minimum number of vertices, so that every edge in G has at least one end point in S. The problem is NP-hard. Can we formulate VC as an ILP problem?

Variables: x1 ... xn, xi = 1 if i ∈ S, 0 otherwise.

A-GEI Linear and Integer Programming, duality and examples Restrictions: for every edge( i, j) ∈ E, xi + xj ≥ 1

xi ∈ {0, 1} The ILP formulation can be computed in polytime.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 ILP for vertex cover

vc Given a graph G = (V , E), we want to find a set S, with minimum number of vertices, so that every edge in G has at least one end point in S. The problem is NP-hard. Can we formulate VC as an ILP problem?

Variables: x1 ... xn, xi = 1 if i ∈ S, 0 otherwise. Pn Objective function: i=1 xi .

A-GEI Linear and Integer Programming, duality and examples xi ∈ {0, 1} The ILP formulation can be computed in polytime.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 ILP for vertex cover

vc Given a graph G = (V , E), we want to find a set S, with minimum number of vertices, so that every edge in G has at least one end point in S. The problem is NP-hard. Can we formulate VC as an ILP problem?

Variables: x1 ... xn, xi = 1 if i ∈ S, 0 otherwise. Pn Objective function: i=1 xi . Restrictions: for every edge( i, j) ∈ E, xi + xj ≥ 1

A-GEI Linear and Integer Programming, duality and examples The ILP formulation can be computed in polytime.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 ILP for vertex cover

vc Given a graph G = (V , E), we want to find a set S, with minimum number of vertices, so that every edge in G has at least one end point in S. The problem is NP-hard. Can we formulate VC as an ILP problem?

Variables: x1 ... xn, xi = 1 if i ∈ S, 0 otherwise. Pn Objective function: i=1 xi . Restrictions: for every edge( i, j) ∈ E, xi + xj ≥ 1

xi ∈ {0, 1}

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 ILP for vertex cover

vc Given a graph G = (V , E), we want to find a set S, with minimum number of vertices, so that every edge in G has at least one end point in S. The problem is NP-hard. Can we formulate VC as an ILP problem?

Variables: x1 ... xn, xi = 1 if i ∈ S, 0 otherwise. Pn Objective function: i=1 xi . Restrictions: for every edge( i, j) ∈ E, xi + xj ≥ 1

xi ∈ {0, 1} The ILP formulation can be computed in polytime.

A-GEI Linear and Integer Programming, duality and examples Why can we drop xi ≤ 1? Let opt be the size of an optimal solution of the VC instance. ∗ ∗ Pn ∗ Let x be an optimal solution of the LP and s = i=1 xi . Is there any relationship between s∗ and opt? s∗ ≤ opt

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: LP relaxation

IP LP n n X X min xi min xi i=1 i=1

s.t. xi + xj ≥ 1 for all (i, j) ∈ E s.t. xi + xj ≥ 1 for all(i, j) ∈ E

xi ∈ {0, 1} for all i ∈ V xi ≥ 0 for all i ∈ V

A-GEI Linear and Integer Programming, duality and examples Let opt be the size of an optimal solution of the VC instance. ∗ ∗ Pn ∗ Let x be an optimal solution of the LP and s = i=1 xi . Is there any relationship between s∗ and opt? s∗ ≤ opt

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: LP relaxation

IP LP n n X X min xi min xi i=1 i=1

s.t. xi + xj ≥ 1 for all (i, j) ∈ E s.t. xi + xj ≥ 1 for all(i, j) ∈ E

xi ∈ {0, 1} for all i ∈ V xi ≥ 0 for all i ∈ V

Why can we drop xi ≤ 1?

A-GEI Linear and Integer Programming, duality and examples ∗ ∗ Pn ∗ Let x be an optimal solution of the LP and s = i=1 xi . Is there any relationship between s∗ and opt? s∗ ≤ opt

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: LP relaxation

IP LP n n X X min xi min xi i=1 i=1

s.t. xi + xj ≥ 1 for all (i, j) ∈ E s.t. xi + xj ≥ 1 for all(i, j) ∈ E

xi ∈ {0, 1} for all i ∈ V xi ≥ 0 for all i ∈ V

Why can we drop xi ≤ 1? Let opt be the size of an optimal solution of the VC instance.

A-GEI Linear and Integer Programming, duality and examples Is there any relationship between s∗ and opt? s∗ ≤ opt

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: LP relaxation

IP LP n n X X min xi min xi i=1 i=1

s.t. xi + xj ≥ 1 for all (i, j) ∈ E s.t. xi + xj ≥ 1 for all(i, j) ∈ E

xi ∈ {0, 1} for all i ∈ V xi ≥ 0 for all i ∈ V

Why can we drop xi ≤ 1? Let opt be the size of an optimal solution of the VC instance. ∗ ∗ Pn ∗ Let x be an optimal solution of the LP and s = i=1 xi .

A-GEI Linear and Integer Programming, duality and examples s∗ ≤ opt

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: LP relaxation

IP LP n n X X min xi min xi i=1 i=1

s.t. xi + xj ≥ 1 for all (i, j) ∈ E s.t. xi + xj ≥ 1 for all(i, j) ∈ E

xi ∈ {0, 1} for all i ∈ V xi ≥ 0 for all i ∈ V

Why can we drop xi ≤ 1? Let opt be the size of an optimal solution of the VC instance. ∗ ∗ Pn ∗ Let x be an optimal solution of the LP and s = i=1 xi . Is there any relationship between s∗ and opt?

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: LP relaxation

IP LP n n X X min xi min xi i=1 i=1

s.t. xi + xj ≥ 1 for all (i, j) ∈ E s.t. xi + xj ≥ 1 for all(i, j) ∈ E

xi ∈ {0, 1} for all i ∈ V xi ≥ 0 for all i ∈ V

Why can we drop xi ≤ 1? Let opt be the size of an optimal solution of the VC instance. ∗ ∗ Pn ∗ Let x be an optimal solution of the LP and s = i=1 xi . Is there any relationship between s∗ and opt? s∗ ≤ opt

A-GEI Linear and Integer Programming, duality and examples Start with the integer infeasible primal solution x = 0, and the dual feasible solution z = 0. Repeat while some constraint in primal is unsatisfied: Increase all (unfrozen) variables ze until some dual constraint becomes tight (say, for vertex i). Set xi = 1. Freeze all the variables ze such that i ∈ e.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

LP primal n X min xi i=1

s.t. xi + xj ≥ 1 for all(i, j) ∈ E

xi ≥ 0 for all i ∈ V

LP dual X max ze e∈E X s.t. ze ≤ 1 for all i ∈ V e={i,j}∈E

ze ≥ 0 for all e ∈ E

A-GEI Linear and Integer Programming, duality and examples Repeat while some constraint in primal is unsatisfied: Increase all (unfrozen) variables ze until some dual constraint becomes tight (say, for vertex i). Set xi = 1. Freeze all the variables ze such that i ∈ e.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

Start with the integer LP primal n infeasible primal solution X min xi x = 0, and the dual feasible i=1 solution z = 0. s.t. xi + xj ≥ 1 for all(i, j) ∈ E

xi ≥ 0 for all i ∈ V

LP dual X max ze e∈E X s.t. ze ≤ 1 for all i ∈ V e={i,j}∈E

ze ≥ 0 for all e ∈ E

A-GEI Linear and Integer Programming, duality and examples Increase all (unfrozen) variables ze until some dual constraint becomes tight (say, for vertex i). Set xi = 1. Freeze all the variables ze such that i ∈ e.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

Start with the integer LP primal n infeasible primal solution X min xi x = 0, and the dual feasible i=1 solution z = 0. s.t. xi + xj ≥ 1 for all(i, j) ∈ E Repeat while some xi ≥ 0 for all i ∈ V constraint in primal is unsatisfied:

LP dual X max ze e∈E X s.t. ze ≤ 1 for all i ∈ V e={i,j}∈E

ze ≥ 0 for all e ∈ E

A-GEI Linear and Integer Programming, duality and examples Set xi = 1. Freeze all the variables ze such that i ∈ e.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

Start with the integer LP primal n infeasible primal solution X min xi x = 0, and the dual feasible i=1 solution z = 0. s.t. xi + xj ≥ 1 for all(i, j) ∈ E Repeat while some xi ≥ 0 for all i ∈ V constraint in primal is unsatisfied: Increase all (unfrozen) LP dual variables z until some X e max ze dual constraint becomes e∈E tight (say, for vertex i). X s.t. ze ≤ 1 for all i ∈ V e={i,j}∈E

ze ≥ 0 for all e ∈ E

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

Start with the integer LP primal n infeasible primal solution X min xi x = 0, and the dual feasible i=1 solution z = 0. s.t. xi + xj ≥ 1 for all(i, j) ∈ E Repeat while some xi ≥ 0 for all i ∈ V constraint in primal is unsatisfied: Increase all (unfrozen) LP dual variables z until some X e max ze dual constraint becomes e∈E tight (say, for vertex i). X Set x = 1. Freeze all the s.t. ze ≤ 1 for all i ∈ V i e={i,j}∈E variables ze such that i ∈ e. ze ≥ 0 for all e ∈ E

A-GEI Linear and Integer Programming, duality and examples When the process stops, we have increased the variables ze suitably. Some vertices i were chosen (xi = 1) This set S of vertices is our output. Is S a vertex cover? Otherwise, we would have still an edge e with ze unfrozen. still unsatisfied. Cost of the solution computed by alg? At the end of the algorithm, if ze > 0, ze has been frozen. We do not know if for one (or both) endpoints the constraints got tight, but xi + xj ≤ 2, for e = (i, j). Therefore, we get a lower bound of 1 and an upper bound of 2. Which means that we have a 2-approximation algorithm.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

A-GEI Linear and Integer Programming, duality and examples Some vertices i were chosen (xi = 1) This set S of vertices is our output. Is S a vertex cover? Otherwise, we would have still an edge e with ze unfrozen. still unsatisfied. Cost of the solution computed by alg? At the end of the algorithm, if ze > 0, ze has been frozen. We do not know if for one (or both) endpoints the constraints got tight, but xi + xj ≤ 2, for e = (i, j). Therefore, we get a lower bound of 1 and an upper bound of 2. Which means that we have a 2-approximation algorithm.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

When the process stops, we have increased the variables ze suitably.

A-GEI Linear and Integer Programming, duality and examples This set S of vertices is our output. Is S a vertex cover? Otherwise, we would have still an edge e with ze unfrozen. still unsatisfied. Cost of the solution computed by alg? At the end of the algorithm, if ze > 0, ze has been frozen. We do not know if for one (or both) endpoints the constraints got tight, but xi + xj ≤ 2, for e = (i, j). Therefore, we get a lower bound of 1 and an upper bound of 2. Which means that we have a 2-approximation algorithm.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

When the process stops, we have increased the variables ze suitably. Some vertices i were chosen (xi = 1)

A-GEI Linear and Integer Programming, duality and examples Is S a vertex cover? Otherwise, we would have still an edge e with ze unfrozen. still unsatisfied. Cost of the solution computed by alg? At the end of the algorithm, if ze > 0, ze has been frozen. We do not know if for one (or both) endpoints the constraints got tight, but xi + xj ≤ 2, for e = (i, j). Therefore, we get a lower bound of 1 and an upper bound of 2. Which means that we have a 2-approximation algorithm.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

When the process stops, we have increased the variables ze suitably. Some vertices i were chosen (xi = 1) This set S of vertices is our output.

A-GEI Linear and Integer Programming, duality and examples Otherwise, we would have still an edge e with ze unfrozen. still unsatisfied. Cost of the solution computed by alg? At the end of the algorithm, if ze > 0, ze has been frozen. We do not know if for one (or both) endpoints the constraints got tight, but xi + xj ≤ 2, for e = (i, j). Therefore, we get a lower bound of 1 and an upper bound of 2. Which means that we have a 2-approximation algorithm.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

When the process stops, we have increased the variables ze suitably. Some vertices i were chosen (xi = 1) This set S of vertices is our output. Is S a vertex cover?

A-GEI Linear and Integer Programming, duality and examples Cost of the solution computed by alg? At the end of the algorithm, if ze > 0, ze has been frozen. We do not know if for one (or both) endpoints the constraints got tight, but xi + xj ≤ 2, for e = (i, j). Therefore, we get a lower bound of 1 and an upper bound of 2. Which means that we have a 2-approximation algorithm.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

When the process stops, we have increased the variables ze suitably. Some vertices i were chosen (xi = 1) This set S of vertices is our output. Is S a vertex cover? Otherwise, we would have still an edge e with ze unfrozen. still unsatisfied.

A-GEI Linear and Integer Programming, duality and examples At the end of the algorithm, if ze > 0, ze has been frozen. We do not know if for one (or both) endpoints the constraints got tight, but xi + xj ≤ 2, for e = (i, j). Therefore, we get a lower bound of 1 and an upper bound of 2. Which means that we have a 2-approximation algorithm.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

When the process stops, we have increased the variables ze suitably. Some vertices i were chosen (xi = 1) This set S of vertices is our output. Is S a vertex cover? Otherwise, we would have still an edge e with ze unfrozen. still unsatisfied. Cost of the solution computed by alg?

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Primal-Dual approximation

When the process stops, we have increased the variables ze suitably. Some vertices i were chosen (xi = 1) This set S of vertices is our output. Is S a vertex cover? Otherwise, we would have still an edge e with ze unfrozen. still unsatisfied. Cost of the solution computed by alg? At the end of the algorithm, if ze > 0, ze has been frozen. We do not know if for one (or both) endpoints the constraints got tight, but xi + xj ≤ 2, for e = (i, j). Therefore, we get a lower bound of 1 and an upper bound of 2. Which means that we have a 2-approximation algorithm.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Another approximation for vertex cover (Prob 91)

VC-ILP VC-LP n n X X min ci xi min ci xi i=1 i=1

s.t. xi + xj ≥ 1 for all (i, j) ∈ E s.t. xi + xj ≥ 1 for all(i, j) ∈ E

xi ∈ {0, 1} for all i ∈ V xi ≥ 0 for all i ∈ V

A-GEI Linear and Integer Programming, duality and examples 91-a Let y be an optimal solution Set

 = minyi ∈{/ 0,1,1/2}{yi , |yi − 1/2|, 1 − yi }. Consider   yi −  0 < yi < 1/2 yi +  0 < yi < 1/2 0  00  yi = yi +  1/2 < yi < 1 yi = yi −  1/2 < yi < 1   yi otherwise yi otherwise

Then, y 0 and y 00 are optimal solutions. Furthermore, if y has some coordinate outside {0, 1/2, 1}, eithrt y 0 or y 00 has less coordinates outside {0, 1/2, 1} than y.

P P 0 P 00 yi = ( yi + yi )/2, both are feasible (easy), so optimal. One of them has more {0, 1, 1/2} coordinates than y by definition of .

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Weighted vertex cover: almost integral solutions

A-GEI Linear and Integer Programming, duality and examples Let y be an optimal solution Set

 = minyi ∈{/ 0,1,1/2}{yi , |yi − 1/2|, 1 − yi }. Consider   yi −  0 < yi < 1/2 yi +  0 < yi < 1/2 0  00  yi = yi +  1/2 < yi < 1 yi = yi −  1/2 < yi < 1   yi otherwise yi otherwise

Then, y 0 and y 00 are optimal solutions. Furthermore, if y has some coordinate outside {0, 1/2, 1}, eithrt y 0 or y 00 has less coordinates outside {0, 1/2, 1} than y.

P P 0 P 00 yi = ( yi + yi )/2, both are feasible (easy), so optimal. One of them has more {0, 1, 1/2} coordinates than y by definition of .

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Weighted vertex cover: almost integral solutions

91-a

A-GEI Linear and Integer Programming, duality and examples Set

 = minyi ∈{/ 0,1,1/2}{yi , |yi − 1/2|, 1 − yi }. Consider   yi −  0 < yi < 1/2 yi +  0 < yi < 1/2 0  00  yi = yi +  1/2 < yi < 1 yi = yi −  1/2 < yi < 1   yi otherwise yi otherwise

Then, y 0 and y 00 are optimal solutions. Furthermore, if y has some coordinate outside {0, 1/2, 1}, eithrt y 0 or y 00 has less coordinates outside {0, 1/2, 1} than y.

P P 0 P 00 yi = ( yi + yi )/2, both are feasible (easy), so optimal. One of them has more {0, 1, 1/2} coordinates than y by definition of .

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Weighted vertex cover: almost integral solutions

91-a Let y be an optimal solution

A-GEI Linear and Integer Programming, duality and examples   yi −  0 < yi < 1/2 yi +  0 < yi < 1/2 0  00  yi = yi +  1/2 < yi < 1 yi = yi −  1/2 < yi < 1   yi otherwise yi otherwise

Then, y 0 and y 00 are optimal solutions. Furthermore, if y has some coordinate outside {0, 1/2, 1}, eithrt y 0 or y 00 has less coordinates outside {0, 1/2, 1} than y.

P P 0 P 00 yi = ( yi + yi )/2, both are feasible (easy), so optimal. One of them has more {0, 1, 1/2} coordinates than y by definition of .

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Weighted vertex cover: almost integral solutions

91-a Let y be an optimal solution Set

 = minyi ∈{/ 0,1,1/2}{yi , |yi − 1/2|, 1 − yi }. Consider

A-GEI Linear and Integer Programming, duality and examples P P 0 P 00 yi = ( yi + yi )/2, both are feasible (easy), so optimal. One of them has more {0, 1, 1/2} coordinates than y by definition of .

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Weighted vertex cover: almost integral solutions

91-a Let y be an optimal solution Set

 = minyi ∈{/ 0,1,1/2}{yi , |yi − 1/2|, 1 − yi }. Consider   yi −  0 < yi < 1/2 yi +  0 < yi < 1/2 0  00  yi = yi +  1/2 < yi < 1 yi = yi −  1/2 < yi < 1   yi otherwise yi otherwise

Then, y 0 and y 00 are optimal solutions. Furthermore, if y has some coordinate outside {0, 1/2, 1}, eithrt y 0 or y 00 has less coordinates outside {0, 1/2, 1} than y.

A-GEI Linear and Integer Programming, duality and examples One of them has more {0, 1, 1/2} coordinates than y by definition of .

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Weighted vertex cover: almost integral solutions

91-a Let y be an optimal solution Set

 = minyi ∈{/ 0,1,1/2}{yi , |yi − 1/2|, 1 − yi }. Consider   yi −  0 < yi < 1/2 yi +  0 < yi < 1/2 0  00  yi = yi +  1/2 < yi < 1 yi = yi −  1/2 < yi < 1   yi otherwise yi otherwise

Then, y 0 and y 00 are optimal solutions. Furthermore, if y has some coordinate outside {0, 1/2, 1}, eithrt y 0 or y 00 has less coordinates outside {0, 1/2, 1} than y.

P P 0 P 00 yi = ( yi + yi )/2, both are feasible (easy), so optimal.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Weighted vertex cover: almost integral solutions

91-a Let y be an optimal solution Set

 = minyi ∈{/ 0,1,1/2}{yi , |yi − 1/2|, 1 − yi }. Consider   yi −  0 < yi < 1/2 yi +  0 < yi < 1/2 0  00  yi = yi +  1/2 < yi < 1 yi = yi −  1/2 < yi < 1   yi otherwise yi otherwise

Then, y 0 and y 00 are optimal solutions. Furthermore, if y has some coordinate outside {0, 1/2, 1}, eithrt y 0 or y 00 has less coordinates outside {0, 1/2, 1} than y.

P P 0 P 00 yi = ( yi + yi )/2, both are feasible (easy), so optimal. One of them has more {0, 1, 1/2} coordinates than y by definition of .

A-GEI Linear and Integer Programming, duality and examples 0 Let x defined as xi = 0 if yi = 0, xi = 1 otherwise. return (x) Relax+Round VC runs in polynomial time x defines a vertex cover Pn Pn 0 i=1 xi ≤ 2 i=1 yi ≤ 2opt is a 2-approximation for VC.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Relax + Round

function Relax+Round VC(G) Construct the LP-VC associated G Let y be an optimal relaxed solution (of the LP instance) Using the previous result, construct an optimal relaxed 0 0 solution y such that yi ∈ {0, 1, 1/2}

A-GEI Linear and Integer Programming, duality and examples Relax+Round VC runs in polynomial time x defines a vertex cover Pn Pn 0 i=1 xi ≤ 2 i=1 yi ≤ 2opt is a 2-approximation for VC.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Relax + Round

function Relax+Round VC(G) Construct the LP-VC associated G Let y be an optimal relaxed solution (of the LP instance) Using the previous result, construct an optimal relaxed 0 0 solution y such that yi ∈ {0, 1, 1/2} 0 Let x defined as xi = 0 if yi = 0, xi = 1 otherwise. return (x)

A-GEI Linear and Integer Programming, duality and examples runs in polynomial time x defines a vertex cover Pn Pn 0 i=1 xi ≤ 2 i=1 yi ≤ 2opt is a 2-approximation for VC.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Relax + Round

function Relax+Round VC(G) Construct the LP-VC associated G Let y be an optimal relaxed solution (of the LP instance) Using the previous result, construct an optimal relaxed 0 0 solution y such that yi ∈ {0, 1, 1/2} 0 Let x defined as xi = 0 if yi = 0, xi = 1 otherwise. return (x) Relax+Round VC

A-GEI Linear and Integer Programming, duality and examples x defines a vertex cover Pn Pn 0 i=1 xi ≤ 2 i=1 yi ≤ 2opt is a 2-approximation for VC.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Relax + Round

function Relax+Round VC(G) Construct the LP-VC associated G Let y be an optimal relaxed solution (of the LP instance) Using the previous result, construct an optimal relaxed 0 0 solution y such that yi ∈ {0, 1, 1/2} 0 Let x defined as xi = 0 if yi = 0, xi = 1 otherwise. return (x) Relax+Round VC runs in polynomial time

A-GEI Linear and Integer Programming, duality and examples Pn Pn 0 i=1 xi ≤ 2 i=1 yi ≤ 2opt is a 2-approximation for VC.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Relax + Round

function Relax+Round VC(G) Construct the LP-VC associated G Let y be an optimal relaxed solution (of the LP instance) Using the previous result, construct an optimal relaxed 0 0 solution y such that yi ∈ {0, 1, 1/2} 0 Let x defined as xi = 0 if yi = 0, xi = 1 otherwise. return (x) Relax+Round VC runs in polynomial time x defines a vertex cover

A-GEI Linear and Integer Programming, duality and examples is a 2-approximation for VC.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Relax + Round

function Relax+Round VC(G) Construct the LP-VC associated G Let y be an optimal relaxed solution (of the LP instance) Using the previous result, construct an optimal relaxed 0 0 solution y such that yi ∈ {0, 1, 1/2} 0 Let x defined as xi = 0 if yi = 0, xi = 1 otherwise. return (x) Relax+Round VC runs in polynomial time x defines a vertex cover Pn Pn 0 i=1 xi ≤ 2 i=1 yi ≤ 2opt

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Vertex cover: Relax + Round

function Relax+Round VC(G) Construct the LP-VC associated G Let y be an optimal relaxed solution (of the LP instance) Using the previous result, construct an optimal relaxed 0 0 solution y such that yi ∈ {0, 1, 1/2} 0 Let x defined as xi = 0 if yi = 0, xi = 1 otherwise. return (x) Relax+Round VC runs in polynomial time x defines a vertex cover Pn Pn 0 i=1 xi ≤ 2 i=1 yi ≤ 2opt is a 2-approximation for VC.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 89

89 Considereu un digraf G = (V , E) en el que cada arc e ∈ E t´e + associat una capacitat ue ∈ R i un cost ce ∈ R. El cost s’interpreta com el cost de transportar una unitat al llarg de l’arc. Cada node v ∈ V t´eassociada una demanda bv ∈ R. Si bv ≥ 0, v ´esun sumider, si no ´es una font. Assumim que la suma de totes les demandes es 0. Considereu el problema de cobrir la demanda de les fonts, a partir de l’oferta dels sumiders mitjan¸cantun flux v`alidamb el m´ınimcost possible. Doneu una formalitzaci´o d’aquest problema com programaci´olineal i calculeu el seu dual.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 89: primera versi´on

X min ce xe e∈E

xe ≤ ue e ∈ E X X xe − xe0 = bv v ∈ V e=(u,v)∈E e0=(v,w)∈E

xe ≥ 0 e ∈ E

La ecuaci´oncon igualdad la sustituimos por dos desigualdades ≥ y ≤. En formato primal nos queda

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 89: primal

X min ce xe e∈E

− xe ≥ −ue e ∈ E X X xe − xe0 ≥ bv v ∈ V e=(u,v)∈E e0=(v,w)∈E X X − xe + xe0 ≥ −bv v ∈ V e=(u,v)∈E e0=(v,w)∈E

xe ≥ 0 e ∈ E

Duual, una variable por ecuaci´on: ye eqs e ∈ E y zv , wv eqs v ∈ V . P P P La funci´onobjetivo es e∈E −ue xe + v∈V bv zv − v∈V bv wv A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83

X X X 89 : dual max −ue xe + bv zv − bv wv e∈E v∈V v∈V

− ye + zv − zw − wv + wu ≤ ue e = (u, v) ∈ E

zv , wv ≥ 0 v ∈ V

ye ≥ 0 e ∈ E

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 90

90 Considereu els enunciats dels problemes 81 y 87 doneu una formalitzaci´o,com a problema de programaci´oentera del problema de decidir (si es pot) a qui convidar per tal de mantenir les restriccions establertes. Es´ a dir, el nombre d’assistents a l’activitat a ´es ≤ M(a) i ≥ m(a), per a cada grup j hi ha d’haver com a m´ınim s(j) persones assistint a cada activitat. la persona i mai es convidada a m´esde t(i) activitats. Compareu la complexitat de les dues solucions.

Asumo que una persona en una actividad solo puede representar a un grupo. A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 81

81 El Rector de la UPC de cara a fomentar la germanor entre el personal de la UPC ha decidit establir activitats mensuals per incentivar la interacci´o entre els diferents estaments de PDI i PAS. Les festes se celebraran normalment un cop al mes. Suposem que hi han k grups disjunts en el personal, C1,..., Ck . El rectorat produeix una llista L d’activitats que tindran lloc en el curs acad`emic,i per a cada activitat a ∈ L, hi ha un nombre m`axim M(a) i un nombre m´ınim m(a) de gent que pot assistir a a. A m´es,com que els grups tenen diferents nivells d’influ`encia,el rectorat estima, per a cada j, el nombre m´ınim s(j) de persones del grup Cj que s’han de convidar a cada activitat. Per una altra banda ´esben conegut que alguns membres de la UPC no poden participar sovint en activitats l´udiques.Tenint en compte aquest aspecte el rectorat ha determinat per cada membre i del personal de la UPC un valor t(i) indicant el nombre m`aximd’activitats a les qu`e i pot participar al llarg del curs.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 81

81 El problema consisteix en, en cas que sigui possible, decidir a qui convidar a cada activitat de manera que es compleixin les restriccions pr`evies,o sigui: el nombre d’assistents a l’activitat a ´es ≤ M(a) i ≥ m(a), per a cada grup j hi ha d’haver com a m´ınim s(j) persones assistint a cada activitat. la persona i mai es convidada a m´esde t(i) activitats.

En el 87, los grupos pueden tener elementos comunes, pero una persona en una actividad solo puede representar a un grupo.

A-GEI Linear and Integer Programming, duality and examples En el enunciado del 81 podemos eliminar ”una persona solo puede usar una invitaci´onde un grupo” ya que los grupos son disjuntos.

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83

Utilizo una variable xija, 1 ≤ i ≤ n, 1 ≤ j ≤ k, 1 ≤ a ≤ m, donde m = |L|, indicado que la persona i recibe una invitaci´ona la actividad a como miembro del grupo j. Las tres condiciones del enunciado, junto con la adicional de que una persona solo puede usar una invitaci´onde un grupo nos dan el siguiente programa de programaci´onentera.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83

Utilizo una variable xija, 1 ≤ i ≤ n, 1 ≤ j ≤ k, 1 ≤ a ≤ m, donde m = |L|, indicado que la persona i recibe una invitaci´ona la actividad a como miembro del grupo j. Las tres condiciones del enunciado, junto con la adicional de que una persona solo puede usar una invitaci´onde un grupo nos dan el siguiente programa de programaci´onentera. En el enunciado del 81 podemos eliminar ”una persona solo puede usar una invitaci´onde un grupo” ya que los grupos son disjuntos.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 90

X min xi,j,a i,j,a m k m k X X X X xi,j,a ≤ M(a) xi,j,a ≥ m(a) 1 ≤ a ≤ m i=1 j=1 i=1 j=1 k X xi,j,a ≥ s(j) 1 ≤ j ≤ k, 1 ≤ a ≤ m i=1 m k X X xi,j,a ≤ t(i) 1 ≤ i ≤ n a=1 j=1 k X xi,j,a = 1 1 ≤ i ≤ n, 1 ≤ a ≤ m j=1

xija ∈ {0, 1} 1 ≤ i ≤A-GEIn, 1 ≤ jLinear≤ k and, 1 Integer≤ a ≤ Programming,m duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 90

Si comparamos las soluciones del problema 90 como ILP y las de los problemas 81 y 87 como problema de circulaci´oncon cotas inferiores. Para ILP no conocemos algoritmos con coste polin´omico(es NP-hard) mientras s´ıque tenemos algoritmos con coste polin´omico para los problemas de circulaci´oncon cotas inferiores.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 83

83 En sociologia, sovint s’estudia un graf G = (V , E) en el qual els nodes representen les persones, i les arestes representen els que s´on amics entre si. Suposem que l’amistat ´essim`etrica, per la qual cosa podem considerar G com un graf no dirigit. Volem estudiar aquest graf G, per a trobar grups de persones, molt unides en el sentit de que tots s´onamics de tots. Una manera de formalitzar aquesta idea seria la seg¨uent.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 83 (2)

83 Per a un subconjunt S ⊆ V sigui e(S) el nombre d’arestes dintre d’S, ´esa dir, el nombre d’arestes que tenen tots dos extrems en S. Definim la cohesi´o d’S com e(S)/|S|. en aquest tipus de grafs, un par`ametrenatural podia ser el conjunt S ⊆ V amb cohesi´o m`axima. 1 Doneu un algorisme polin`omicque pren com a entrada G i un nombre α racional, i determina si hi ha un conjunt S amb cohesi´o > α. 2 Doneu un algoritme polin`omicper trobar un conjunt S ⊆ V amb la m`aximacohesi´o.

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 83 sol

83: network Por cada {u, v} ∈ E a˜nadimosdos arcos (u, v) y (v, u) con capacidad 1. A˜nadimosvertice s y para cada u ∈ V un arco (s, u) con capacidad d(u). A˜nadimosvertice t y para cada u ∈ V un arco (u, t) con capacidad 2α.

Analizemos la capacidad de los s − t cortes (S, T ). S = {s} ∪ A and T = {t} ∪ B.

A-GEI Linear and Integer Programming, duality and examples X X c(S, T ) = d(u) + 2α + c(A, B) u∈B v∈A = 2α|A| + 2e(B) + 2c(A, B) = 2α|A| + 2m − 2e(A) = 2(m + α|A| − e(A))

c(S, T ) > 2m iff α|A| − e(A) < 0 iff α|A| < e(A) iff e(A)/|A| > α. Hay un conjunto con cohesion > α iff min-cut < 2m

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 83 sol

Notemos que c({s}, V ∪ {t}) = 2m y c(V ∪ {s}, {t}) = 2αn. Si α < m/n, V tiene la cohesi´onrequerida En caso contrario 2m < 2αn y mincut ≤ 2m. Para un corte gen´ericola capacidad del corte es:

A-GEI Linear and Integer Programming, duality and examples c(S, T ) > 2m iff α|A| − e(A) < 0 iff α|A| < e(A) iff e(A)/|A| > α. Hay un conjunto con cohesion > α iff min-cut < 2m

Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 83 sol

Notemos que c({s}, V ∪ {t}) = 2m y c(V ∪ {s}, {t}) = 2αn. Si α < m/n, V tiene la cohesi´onrequerida En caso contrario 2m < 2αn y mincut ≤ 2m. Para un corte gen´ericola capacidad del corte es: X X c(S, T ) = d(u) + 2α + c(A, B) u∈B v∈A = 2α|A| + 2e(B) + 2c(A, B) = 2α|A| + 2m − 2e(A) = 2(m + α|A| − e(A))

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 83 sol

Notemos que c({s}, V ∪ {t}) = 2m y c(V ∪ {s}, {t}) = 2αn. Si α < m/n, V tiene la cohesi´onrequerida En caso contrario 2m < 2αn y mincut ≤ 2m. Para un corte gen´ericola capacidad del corte es: X X c(S, T ) = d(u) + 2α + c(A, B) u∈B v∈A = 2α|A| + 2e(B) + 2c(A, B) = 2α|A| + 2m − 2e(A) = 2(m + α|A| − e(A))

c(S, T ) > 2m iff α|A| − e(A) < 0 iff α|A| < e(A) iff e(A)/|A| > α. Hay un conjunto con cohesion > α iff min-cut < 2m

A-GEI Linear and Integer Programming, duality and examples Vertex Cover LP algorithmis: History Prob 91 Primal-Dual Prob 89 Integer Linear programming Prob 90 Examples Prob 83 Problema 83 sol

Ap 1: Construir red de flujo, obtener flujo con valor m´aximoy comparar si es < 2m, coste O(m2) Ap 2: α < n b´usquedadicot´omicausando apartado anterior, O(log nm2).

A-GEI Linear and Integer Programming, duality and examples