Esqueleto Algorítmico - ulpgc
Esqueleto Algorítmico - ulpgc
Esqueleto Algorítmico - ulpgc
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
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 />
Pseudocódigo OpenMP para Solver_SM<br />
1 // shared variables {bqueue, bstemp, soltemp, data}<br />
2 // private variables {auxSol, high, low}<br />
3 // the initial subproblem is inserted in the global shared queue<br />
4 while(!bqueue.empty()) {<br />
5 nn = bqueue.getNumberOfNodes(); // the number of needed threads<br />
6 nt = (nn > maxthread)?maxthread:nn;<br />
7 data = new SubProblem[nt]; // compute the subproblem for each thread<br />
8 for (int j = 0; j < nt; j++)<br />
9 data[j] = bqueue.remove();<br />
10 set.num.threads(nt); // establish the number of threads<br />
11 parallel forall (i = 0; i < nt; i++) {<br />
12 high = data[i].upper_bound(pbm,auxSol);<br />
13 if ( high > bstemp ) {<br />
14 if ( low > bstemp ) { // critical region<br />
15 // only one thread can change the value at any time<br />
16 bstemp = low;<br />
17 soltemp = auxSol;<br />
18 }<br />
19 if ( high != low ) { // critical region<br />
20 // just one thread can insert subproblems<br />
21 // in the queue at any time<br />
22 data[i].branch(pbm,bqueue);<br />
23 } } } }<br />
24 bestSol = bstemp;<br />
25 sol = soltemp;