a multiagent algorithm for graph partitioning

34
A multiagent algorithm for graph partitioning A multiagent algorithm for graph partitioning Francesc Comellas & Emili Sapena Applied Mathematics Univertitat Politècnica de Catalunya Barcelona, Catalonia, Spain

Upload: allegra-lawrence

Post on 03-Jan-2016

78 views

Category:

Documents


14 download

DESCRIPTION

A multiagent algorithm for graph partitioning. Francesc Comellas & Emili Sapena Applied Mathematics Univertitat Politècnica de Catalunya Barcelona, Catalonia, Spain. Índex. 1. Introducció i Objectius 2. Teoria de grafs 3. Algorisme Formigues 4. Bipartició 5. K-partició 6. Clustering - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Francesc Comellas & Emili SapenaApplied MathematicsUnivertitat Politècnica de CatalunyaBarcelona, Catalonia, Spain

Page 2: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Índex

• 1. Introducció i Objectius• 2. Teoria de grafs• 3. Algorisme Formigues• 4. Bipartició• 5. K-partició• 6. Clustering• 7. Conclusions• 8. Preguntes

Page 3: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Tipus d’algorismes

• Cerca exhaustiva

• Cerca local o aleatòria

• Algorismes heurístics

• Algorismes naturals

Page 4: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Cerca exhaustiva

• Els algorismes de cerca exhaustiva són aquells que calculen totes les solucions possibles al problema per quedar-se amb la millor.

Sempre troben la millor solució

El cost de l’execució augmenta amb el nombre de solucions possibles.

Page 5: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Cerca local o aleatòria

• Es basen en una exploració reduïda i a l'atzar de l'espai d'estats.

Són més ràpids que els exhaustius.

No garanteixen trobar la millor solució, ni tan sols una subòptima.

Page 6: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Algorismes heurístics

• Específics per resoldre un tipus de problema

Troba solucions òptimes o subòptimes en temps molt menors a la cerca exhaustiva.

Cal un estudi previ del problema molt rigorós i, moltes vegades, una idea brillant.

Solen ser poc adaptables a d’altres problemes.

Page 7: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Algorismes naturals

• Es basen en la imitació de mecanismes de la natura per a la resolució de determinats problemes.

Fàcilment adaptables a diferents tipus de problemes.

Troben solucions òptimes o subòptimes en temps molt menors a la cerca exhaustiva

Page 8: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Algorismes naturals

• Xarxes neuronals

• Algorismes genètics

• Recuïta simulada (Simulated Annealing)

• Algorisme multi-agent

Page 9: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Algorisme Formigues

• Algorisme multi-agent basat en la idea de que la cerca d’una millora local de cada agent per separat pot trobar una bona solució global.

• Igual que en un formiguer, el treball coordinat individual i senzill de cada agent pot resoldre tasques molt complicades.

Page 10: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

ANTS algorithm

• Random color the graph forming k balanced sets• Initialize the cost for each vertex• Initialize the global cost• Put N ants randomly on the graph• Do

– Repeat (for each ant)• Move the ant to the worst* neighbor vertex• Change vertex color to the best possible*• Keep balance• Update cost for the vertex and its neighbors• Update global cost

– Save partition if better

• Until stop criteria

Page 11: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• Random color the graph forming k balanced sets• Initialize the cost for each vertex• Initialize the global cost• Put N ants randomly on the graph• Do

– Repeat (for each ant)• Move the ant to the worst* neighbor vertex• Change vertex color to the best possible*• Keep balance• Update cost for the vertex and its neighbors• Update global cost

– Save partition if better

• Until stop criteria

ANTS algorithm

Page 12: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• Random color the graph forming k balanced sets• Initialize the cost for each vertex• Initialize the global cost• Put N ants randomly on the graph• Do

– Repeat (for each ant)• Move the ant to the worst* neighbor vertex• Change vertex color to the best possible*• Keep balance• Update cost for the vertex and its neighbors• Update global cost

– Save partition if better

• Until stop criteria

ANTS algorithm

Page 13: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Cost: 35• Random color the graph forming k balanced sets• Initialize the cost for each vertex• Initialize the global cost• Put N ants randomly on the graph• Do

– Repeat (for each ant)• Move the ant to the worst* neighbor vertex• Change vertex color to the best possible*• Keep balance• Update cost for the vertex and its neighbors• Update global cost

– Save partition if better

• Until stop criteria

ANTS algorithm

Page 14: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• Random color the graph forming k balanced sets• Initialize the cost for each vertex• Initialize the global cost• Put N ants randomly on the graph• Do

– Repeat (for each ant)• Move the ant to the worst* neighbor vertex• Change vertex color to the best possible*• Keep balance• Update cost for the vertex and its neighbors• Update global cost

– Save partition if better

• Until stop criteria

ANTS algorithm

Page 15: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• Random color the graph forming k balanced sets• Initialize the cost for each vertex• Initialize the global cost• Put N ants randomly on the graph• Do

– Repeat (for each ant)• Move the ant to the worst* neighbor vertex• Change vertex color to the best possible*• Keep balance• Update cost for the vertex and its neighbors• Update global cost

– Save partition if better

• Until stop criteria

ANTS algorithm

Page 16: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• Random color the graph forming k balanced sets• Initialize the cost for each vertex• Initialize the global cost• Put N ants randomly on the graph• Do

– Repeat (for each ant)• Move the ant to the worst* neighbor vertex• Change vertex color to the best possible*• Keep balance• Update cost for the vertex and its neighbors• Update global cost

– Save partition if better

• Until stop criteria

ANTS algorithm

Page 17: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• Generar acoloriment inicial aleatori del graf• Calcular el cost a cada vèrtex• Calcular el cost global• Posar N formigues aleatòriament al graf• Fer

– Repetir (per a cada formiga)• Moure la formiga al pitjor* vèrtex veí• Canviar el color del vèrtex pel millor color

possible*• Calcular cost/fitness del vèrtex i dels veïns

afectats– Final repetir– Calcular cost global– Si hi ha millora, guarda l’acoloriment

• Fins criteri d’aturada

ANTS algorithm

Page 18: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• Generar acoloriment inicial aleatori del graf• Calcular el cost a cada vèrtex• Calcular el cost global• Posar N formigues aleatòriament al graf• Fer

– Repetir (per a cada formiga)• Moure la formiga al pitjor* vèrtex veí• Canviar el color del vèrtex pel millor color

possible*• Calcular cost/fitness del vèrtex i dels veïns

afectats– Final repetir– Calcular cost global– Si hi ha millora, guarda l’acoloriment

• Fins criteri d’aturada

ANTS algorithm

Page 19: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• Generar acoloriment inicial aleatori del graf• Calcular el cost a cada vèrtex• Calcular el cost global• Posar N formigues aleatòriament al graf• Fer

– Repetir (per a cada formiga)• Moure la formiga al pitjor* vèrtex veí• Canviar el color del vèrtex pel millor color

possible*• Calcular cost/fitness del vèrtex i dels veïns

afectats– Final repetir– Calcular cost global– Si hi ha millora, guarda l’acoloriment

• Fins criteri d’aturada

Cost: 33

ANTS algorithm

Page 20: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• Generar acoloriment inicial aleatori del graf• Calcular el cost a cada vèrtex• Calcular el cost global• Posar N formigues aleatòriament al graf• Fer

– Repetir (per a cada formiga)• Moure la formiga al pitjor* vèrtex veí• Canviar el color del vèrtex pel millor color

possible*• Calcular cost/fitness del vèrtex i dels veïns

afectats– Final repetir– Calcular cost global– Si hi ha millora, guarda l’acoloriment

• Fins criteri d’aturada

Cost: 9

ANTS algorithm

Page 21: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

• L’adaptació de l’algorisme Formigues a qualsevol problema en grafs es redueix a trobar una funció objectiva adequada.

– Funció objectiva global– Funció objectiva local

ANTS algorithm

Page 22: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Probabilitat d’error

• L’error és important per no caure en mínims locals.

Page 23: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Índex

• 1. Introducció i Objectius• 2. Teoria de grafs• 3. Algorisme Formigues• 4. Bipartició• 5. K-partició• 6. Clustering• 7. Conclusions• 8. Preguntes

Page 24: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Bipartició

• Consisteix en dividir un graf en dos parts complint les següents condicions:– Les dos parts han de tenir el mateix nombre

de vèrtexs– El nombre de branques unint vèrtexs de

diferents parts ha de ser el mínim possible

Page 25: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Bipartició

Page 26: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Bipartició

• Utilitats:– Computació en paral·lel– Disseny VLSI– Data-mining

Page 27: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Funció objectiva global

• El nombre de branques que uneixen vèrtexs de diferents particions és directament el cost d’una solució

• Com més petit sigui aquest nombre, millor serà la solució.

Page 28: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Funció objectiva local

• Es defineix una fitness per determinar l’estat d’un vèrtex tenint en compte el seu acoloriment i el dels seus veïns.

Veïns del mateix color

Total veïns del vèrtex

Fitness =

Page 29: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Funció objectiva local

Veïns del mateix color = 3

Total veïns del vèrtex = 5

Fitness = = 0.6

Page 30: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

ResultatsGraf GA SA EO Formigues-------------------------------------------------------------U500.05 2 4 2 3U500.10 26 26 26 26U500.20 178 178 178 178U500.40 412 412 412 412 U1000.05 1 3 1 3U1000.10 39 39 39 43U1000.20 222 222 222 228U1000.40 737 737 737 737G500.005 49 51 51 50G500.01 218 219 218 218G500.02 626 628 626 626G500.04 1744 1744 1744 1744G1000.0025 93 102 95 98G1000.005 445 451 447 449G1000.01 1362 1366 1362 1363G1000.02 3382 3386 3383 3383nasa1824 739 739 739nasa2146 870 870 870nasa4704 1292 1292 1334

Page 31: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Índex

• 1. Introducció i Objectius• 2. Teoria de grafs• 3. Algorisme Formigues• 4. Bipartició• 5. K-partició• 6. Clustering• 7. Conclusions• 8. Preguntes

Page 32: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

K-partició

• Es tracta l’extensió del problema de la bipartició a k particions

Page 33: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Graph vertices edges Old value New value Old method

C2000.5 2000 999836 125 923294 922706 Ch2.0

C4000.5 4000 4000268 250 3709887 3708532 Ch2.0

DSJC125.1 125 736 8 524 522 iJ

DSJC1000.1 1000 40629 63 43078 43001 Ch2.0

DSJC1000.5 1000 249826 63 229362 228995 Ch2.0

jean 80 254 5 161 161 Ch2.0

flat1000_50_0 1000 245000 63 224403 224378 Ch2.0

flat1000_60_0 1000 245830 63 225546 225183 Ch2.0

flat1000_76_0 1000 246708 63 226371 225962 Ch2.0

le450_5a 450 5714 29 4063 4038 JE

le450_5b 450 5734 29 4065 4055 iJ

le450_15a 450 8168 29 5636 5619 iJ

le450_15b 450 8169 29 5675 5641 iJ

le450_15d 450 16750 29 13556 13550 iJ

le450_25a 450 8260 29 5325 5302 J2.2

le450_25b 450 8263 29 5041 5037 JE

le450_25c 450 13343 29 13457 13456 iJ

le450_25d 450 17425 29 13584 13539 iJ

Page 34: A multiagent algorithm for graph partitioning

A multiagent algorithm for graph partitioning

Graf vèrtexs branques mida Valor actual Nou valormètode /

referencia

miles500 128 1170 8 771 770 JE

miles750 128 2113 8 1676 1673 iJ

miles1000 128 3216 8 2770 2768 iJ

miles1500 128 5198 8 4750 4750 J2.2

mulsol.i.1 197 3925 13 3275 3270 Ch2.0

mulsol.i.5 185 3946 12 3371 3365 Ch2.0

myciel4 23 71 2 64 64 J2.2

myciel5 47 236 3 205 205 J2.2

myciel7 191 2360 12 1921 1920 iJ

queen5_5 25 160 2 151 151 J2.2

queen8_8 64 728 4 632 632 Ch2.0

queen8_12 96 1368 6 1128 1128 Ch2.0

queen12_12 144 2596 9 2040 2020 iJ

queen16_16 256 6320 16 4400 4400 J2.2