15.11.2013 Views

Esqueleto Algorítmico - ulpgc

Esqueleto Algorítmico - ulpgc

Esqueleto Algorítmico - ulpgc

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Implementación Secuencial y Paralela de Técnicas Algorítmicas:<br />

Aplicación a Problemas de Optimización Combinatoria<br />

Seminario Invitado: Dpto Métodos Cuantitativos en Economía y Gestión<br />

Introducción<br />

Interfaz de Usuario<br />

Patrones<br />

Secuenciales<br />

Patrones<br />

Paralelos<br />

Experimentos<br />

Computacionales<br />

Conclusiones<br />

Patrón B&B Paralelo<br />

Centralizado<br />

Patrón B&B Paralelo<br />

Distribuido<br />

Patrón B&B Memoria<br />

Compartida<br />

Patrón D&C Paralelo<br />

Mª Isabel Dorta González<br />

Marzo, 2007<br />

Código MPI Distribuido de MaLLBa:BnB: Esclavo<br />

14 while(!bqueue.empty()) {<br />

15 auxSp = bqueue.remove(); // pop a problem from the local queue<br />

16 high = auxSp.upper_bound(pbm,auxSol);<br />

17 if ( high > bestSol ) {<br />

18 low = auxSp.lower_bound(pbm,auxSol);<br />

19 if ( low > bestSol ) {<br />

20 bestSol = low;<br />

21 sol = auxSol;<br />

22 op.send(MASTER, SOLVE_TAG, bestSol, sol);<br />

23 }<br />

24 if ( high != low ) {<br />

25 // the number of required slaves<br />

26 rSlaves = bqueue.getNumberOfNodes();<br />

27 op.send(MASTER, BnB_TAG, high, rSlaves);<br />

28 ip.recv(MASTER, nfSlaves, bestSol, rank {1,..., nfSlaves});<br />

29 if ( nfSlaves >= 0) {<br />

30 auxSp.branch(pbm,bqueue); //branch and save in the local queue<br />

31 for i=0, nfSlaves{ // send subproblems to the assigned slaves<br />

32 auxSp = bqueue.remove();<br />

33 // send to the slave:<br />

34 op.send(rank, PBM_TAG, auxSp, bestSol, sol);<br />

35 }<br />

36 } // if nfSlaves == DONE the problem is bounded (cut)<br />

37 } }

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!