mathematical programming modelling and applications
play

Mathematical Programming: Modelling and Applications Sonia Cafieri - PowerPoint PPT Presentation

Mathematical Programming: Modelling and Applications Sonia Cafieri LIX, cole Polytechnique cafieri@lix.polytechnique.fr October 2009 Ecole S. Cafieri (LIX) TD6 oct 2009 1 / 38 Outline Graphs - basic definitions 1 Densest subgraph


  1. Mathematical Programming: Modelling and Applications Sonia Cafieri LIX, École Polytechnique cafieri@lix.polytechnique.fr October 2009 Ecole S. Cafieri (LIX) TD6 oct 2009 1 / 38

  2. Outline Graphs - basic definitions 1 Densest subgraph problem 2 Graph partitioning problem 3 Graph partitioning problem - 2 - 4 Ecole S. Cafieri (LIX) TD6 oct 2009 2 / 38

  3. Basic definitions Definition A Graph is an ordered pair G = ( V , E ) comprising a set V of vertices or nodes together with a set E of edges or links, which are 2-element subsets of V . Undirected graph : a graph in which edges have no orientation. Directed graph or Digraph : a graph G = ( V , A ) , where A is a set of ordered pairs of vertices, even called arcs or directed edges. Weighted graph : a graph in which numbers (weights) are assigned to each edge. It can be directed and undirected . It is denoted by G = ( V , E , w ) or G = ( V , A , w ) , where w represents the weights. Ecole S. Cafieri (LIX) TD6 oct 2009 3 / 38

  4. Basic definitions Let G = ( V , A ) be a directed graph. A function µ : A − → N , that associates an integer number to each arc of G , is called arc coloring of G . Since we can associate a color to each integer number, the function µ actually asso- ciates a color to each arc of G . Subgraphs of the graph G can be located by considering all its arcs having the same color: H = ( U , B ) U ⊆ V , B ⊆ A , ∀ e , f ∈ B µ ( e ) = µ ( f ) . : Ecole S. Cafieri (LIX) TD6 oct 2009 4 / 38

  5. Densest subgraph problem Given a digraph G = ( V , A ) , an arc coloring µ of G , a color k , find the densest uniformly coloured subgraph H of G , i.e. the subgraph H = ( U , B ) of G in which the arcs have the same color k and such that | B | − | U | is maximun. Formulate a mathematical model and solve it by AMPL/CPLEX. Ecole S. Cafieri (LIX) TD6 oct 2009 5 / 38

  6. Densest subgraph problem: data 15 vertices color k : 2 Edges: (1,15) ( µ = 1), (2,15) ( µ = 1), (2,3) ( µ = 1), (2,4) ( µ = 1), (3,5) ( µ = 1), (4,5) ( µ = 1), (5,6) ( µ = 1), (5,11) ( µ = 2), (5,12) ( µ = 2), (5,13) ( µ = 2), (5,14) ( µ = 2), (6,9) ( µ = 1), (7,8) ( µ = 1), (7,11) ( µ = 2), (7,12) ( µ = 2), (7,13) ( µ = 2), (7,14) ( µ = 2), (7,15) ( µ = 1), (8,10) ( µ = 2), (8,14) ( µ = 2), (11,12) ( µ = 2), (11,13) ( µ = 2), (12,13) ( µ = 2) Ecole S. Cafieri (LIX) TD6 oct 2009 6 / 38

  7. Mathematical formulation Sets: V , set of vertices of G A , set of arcs of G Parameters: µ , arc coloring of graph G k , a prefixed arc color Variables: x v , binary, indicates if the vertex v is contained into the densest uniformly colored subgraph ( U , B ) : � 1 if v ∈ U ∀ v ∈ V x v = 0 otherwise Ecole S. Cafieri (LIX) TD6 oct 2009 7 / 38

  8. Mathematical model Objective function: The densest subgraph has the maximum number of arcs and the minimum number of vertices:    � � max x u x v − x v  v ∈ V ( u , v ) ∈ A Constraint: There cannot be arcs in the subgraph having a color different from k : ∀ ( u , v ) ∈ A x u x v ≤ min ( max ( 0 , µ ( u , v ) − k + 1 ) , max ( 0 , k − µ ( u , v ) + 1 )) Ecole S. Cafieri (LIX) TD6 oct 2009 8 / 38

  9. Product of binary variables Observation: we have a product of binary variables in the objective function. Because of the product of binary variables, this formulation is nonlinear: Mixed-Integer NonLinear problem. ⇓ Use a suitable reformulation for removing the product in the objective function. Ecole S. Cafieri (LIX) TD6 oct 2009 9 / 38

  10. Mathematical model: product of binary variables A new variable: y uv ∈ [ 0 , 1 ] , represents the product between x u and x v . Objective function updated: We substitute x u x v with y uv :    � y uv − � x v max  v ∈ V ( u , v ) ∈ A Ecole S. Cafieri (LIX) TD6 oct 2009 10 / 38

  11. Mathematical model: product of binary variables Constraint updated: We substitute x u x v with y uv : ∀ ( u , v ) ∈ A y uv ≤ min ( max ( 0 , µ ( u , v ) − k + 1 ) , max ( 0 , k − µ ( u , v ) + 1 )) New Linearization Constraints: ∀ ( u , v ) ∈ A y uv ≤ x u ∀ ( u , v ) ∈ A y uv ≤ x v ∀ ( u , v ) ∈ A y uv ≥ x u + x v − 1 Ecole S. Cafieri (LIX) TD6 oct 2009 11 / 38

  12. Densest Subgraph problem: AMPL model param n >= 1, integer; set V := 1..n; set E within {V,V}; # arc colours param kmax default 10; # max number of colours param k <= kmax, >= 0, integer, default 1; param mu{E} >=0, integer, <= kmax; # variables var x{V} binary; var y{(u,v) in E} >= 0, <= min(max(0, mu[u,v]-k+1), max(0,k-mu[u,v]+1)); # model maximize densesubgraph : sum{(u,v) in E} y[u,v] - sum{v in V} x[v]; # linearization constraints subject to lin1 {(u,v) in E} : y[u,v] <= x[u]; subject to lin2 {(u,v) in E} : y[u,v] <= x[v]; subject to lin3 {(u,v) in E} : y[u,v] >= x[u] + x[v] - 1; Ecole S. Cafieri (LIX) TD6 oct 2009 12 / 38

  13. Densest Subgraph problem: AMPL data param n := 15; # number of vertices param k := 2; # color param : E : mu := 1 15 1 2 15 1 2 3 1 2 4 1 3 5 1 4 5 1 5 6 1 5 11 2 5 12 2 5 13 2 5 14 2 6 9 1 7 8 1 7 11 2 7 12 2 7 13 2 7 14 2 7 15 1 8 10 1 8 14 2 11 12 2 11 13 2 12 13 2 Ecole ; S. Cafieri (LIX) TD6 oct 2009 13 / 38

  14. Densest Subgraph problem: AMPL run model densest_subgraph.mod; data densest_subgraph.dat; option solver cplex; solve; display x; Ecole S. Cafieri (LIX) TD6 oct 2009 14 / 38

  15. Densest Subgraph problem: Solution ILOG AMPL 10.100, licensed to "ecolepolytechnique-palaiseau". AMPL Version 20060626 (Linux 2.6.9-5.ELsmp) ILOG CPLEX 10.100, licensed to "ecolepolytechnique-palaiseau", options: e m b q use=8 CPLEX 10.1.0: optimal integer solution; objective 5 12 MIP simplex iterations 0 branch-and-bound nodes x [*] := 1 0 2 0 3 0 4 0 5 1 6 0 7 1 8 0 9 0 10 0 11 1 12 1 13 1 14 1 15 0 ; Ecole S. Cafieri (LIX) TD6 oct 2009 15 / 38

  16. Graph partitioning Definition Graph partitioning is the problem of finding a suitable partition of a set of data represented through a graph G . Graph partitioning is a clustering problem. Each cluster is a subgraph of the graph G . Intuitively, the best partition is the one that separates sparsely connected dense subgraphs from each other. sparsely connected: the number of edges between vertices belonging to different clusters is minimal. dense: the number of edges between vertices belonging to the same cluster is maximum. Ecole S. Cafieri (LIX) TD6 oct 2009 16 / 38

  17. Graph partitioning: example 37 38 9 8 18 7 10 36 30 20 22 6 39 35 5 23 21 4 1 17 19 33 13 3 16 34 73 24 2 54 15 44 55 32 12 52 14 48 27 25 50 11 28 53 47 75 31 51 57 74 49 59 46 41 56 77 29 26 65 45 40 62 72 70 61 63 71 64 69 58 43 60 67 68 66 42 76 Ecole S. Cafieri (LIX) TD6 oct 2009 17 / 38

  18. Graph partitioning problem Given a weighted undirected graph G = ( V , E , c ) , where V is the set of vertices of G , E is the set of edges of G , c is the set of weights eventually assigned to the edges, and an integer K ≤ | V | , find a partition of k ≤ K subsets (clusters) of V minimizing the total weights of edges between different clusters. Write the mathematical formulation and solve the problem using AMPL. Ecole S. Cafieri (LIX) TD6 oct 2009 18 / 38

  19. Graph partitioning problem: data 16 vertices maximum number of clusters: 4 Edges: (1,15) (2,15) (2,3) (2,4) (3,5) (4,5) (5,6) (5,16) (6,9) (7,8) (7,16) (8,10) (8,16) (11,16) (12,16) (13,16) (14,16) Edge Weights: 1 for each edge Ecole S. Cafieri (LIX) TD6 oct 2009 19 / 38

  20. Mathematical formulation Sets: V , set of vertices of G E , set of edges of G Parameters: c , weights of G K , maximum number of clusters in the partition Variables: ∀ u ∈ V , k ≤ K , x uk , binary, indicates if the vertex u is contained into the cluster k : � 1 if u ∈ k th cluster x uk = 0 otherwise Ecole S. Cafieri (LIX) TD6 oct 2009 20 / 38

  21. Mathematical formulation Objective function: what do we need to minimize? we want to minimize the total weights of the edges between different clusters: 1 � � c uv x uk x vl min 2 x k � = l ≤ K ( u , v ) ∈ E Ecole S. Cafieri (LIX) TD6 oct 2009 21 / 38

  22. Mathematical formulation Constraints: - each vertex must be assigned to only one cluster: ∀ u ∈ V � x uk = 1 k ≤ K - the trivial solution (all the vertices into one cluster) must be excluded: ∀ k ∈ K � x uk ≥ 1 u ∈ V Ecole S. Cafieri (LIX) TD6 oct 2009 22 / 38

  23. Some observations The objective function contains a product of binary terms. We introduce a new variable w ukvl representing the product of the two binary variables. We substitute the products with the new variable w ukvl everywhere, as for example in the objective function: min 1 � � c uv w ukvl 2 k � = l ≤ K ( u , v ) ∈ E We add linearization constraints: ∀ u ∈ V , v ∈ V , l ∈ K , k ∈ K : ( u , v ) ∈ E or ( v , u ) ∈ E w ukvl ≤ x uk w ukvl ≤ x vl w ukvl ≥ x uk + x vl − 1 Ecole S. Cafieri (LIX) TD6 oct 2009 23 / 38

Recommend


More recommend