Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Diff of /trunk/gadget/hooke.cc
[mareframe] / trunk / gadget / hooke.cc Repository:
ViewVC logotype

Diff of /trunk/gadget/hooke.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 13, Wed Jul 29 17:33:41 2015 UTC revision 14, Thu Jul 30 12:36:46 2015 UTC
# Line 156  Line 156 
156    DoubleVector z(point);    DoubleVector z(point);
157    
158    minf = prevbest;    minf = prevbest;
 //  for (int k=0;k<point.Size(); k++)  
 //        cout << z[k] ;  
 //  cout << endl;  
159    for (i = 0; i < point.Size(); i++) {    for (i = 0; i < point.Size(); i++) {
   
 //        for (int k=0;k<point.Size(); k++)  
 //                cout << z[k] << " " ;  
 //cout << endl;  
160      z[param[i]] = point[param[i]] + delta[param[i]];      z[param[i]] = point[param[i]] + delta[param[i]];
161      ftmp = EcoSystem->SimulateAndUpdate(z);      ftmp = EcoSystem->SimulateAndUpdate(z);
 //    cout << i <<"-z["<< param[i]<<"]:" <<z[param[i]] << " - " << ftmp << endl;  
162      if (ftmp < minf) {      if (ftmp < minf) {
163        minf = ftmp;        minf = ftmp;
164      } else {      } else {
# Line 178  Line 170 
170        else        else
171          z[param[i]] = point[param[i]];          z[param[i]] = point[param[i]];
172      }      }
 //    cout << i <<"-z["<< param[i]<<"]:" <<z[param[i]] << " - " << ftmp  <<" - " << prevbest << endl;  
173    }    }
174    
175    for (i = 0; i < point.Size(); i++)    for (i = 0; i < point.Size(); i++)
# Line 222  Line 213 
213            if ((i + paral_tokens -1) >= nvars)            if ((i + paral_tokens -1) >= nvars)
214                    paral_tokens = nvars - i;                    paral_tokens = nvars - i;
215            omp_set_dynamic(0);            omp_set_dynamic(0);
216            omp_set_nested(1);            omp_set_nested(1); //permit the nested parallelization
217  #pragma omp parallel for num_threads(paral_tokens) private(k)  #pragma omp parallel for num_threads(paral_tokens) private(k) //parallelize the parameters (numThr/2)
218            for (j = 0; j < paral_tokens; ++j) {            for (j = 0; j < paral_tokens; ++j) {
219                    storage[j].z = z;                    storage[j].z = z;
220                    storage[j].delta = delta;                    storage[j].delta = delta;
# Line 233  Line 224 
224                    v1[k] +=  delta[k];                    v1[k] +=  delta[k];
225                    v2[k] -=  delta[k];                    v2[k] -=  delta[k];
226    
227  #pragma omp parallel sections num_threads(2)  #pragma omp parallel sections num_threads(2) //parrallelize the +/- delta simulation for each parameter
228                    {                    {
229          #pragma omp section          #pragma omp section
230                            {                            {
# Line 300  Line 291 
291    EcoSystem->scaleVariables();    EcoSystem->scaleVariables();
292  #ifndef NO_OPENMP  #ifndef NO_OPENMP
293    int numThr = omp_get_max_threads ( );    int numThr = omp_get_max_threads ( );
294    for (i = 0; i < numThr; i++)    for (i = 0; i < numThr; i++) // scale the variables for the ecosystem of every thread
295            EcoSystems[i]->scaleVariables();            EcoSystems[i]->scaleVariables();
296  #endif  #endif
297    EcoSystem->getOptScaledValues(x);    EcoSystem->getOptScaledValues(x);
# Line 644  Line 635 
635             IntVector trapped(nvars, 0);             IntVector trapped(nvars, 0);
636    
637             EcoSystem->scaleVariables();             EcoSystem->scaleVariables();
          #ifndef NO_OPENMP  
638             int numThr = omp_get_max_threads ( );             int numThr = omp_get_max_threads ( );
639             for (i = 0; i < numThr; i++)             for (i = 0; i < numThr; i++) // scale the variables for the ecosystem of every thread
640                    EcoSystems[i]->scaleVariables();                    EcoSystems[i]->scaleVariables();
          #endif  
641             EcoSystem->getOptScaledValues(x);             EcoSystem->getOptScaledValues(x);
642             EcoSystem->getOptLowerBounds(lowerb);             EcoSystem->getOptLowerBounds(lowerb);
643             EcoSystem->getOptUpperBounds(upperb);             EcoSystem->getOptUpperBounds(upperb);

Legend:
Removed from v.13  
changed lines
  Added in v.14

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge