Compile code with -D_REENTRANT, as we are using multithreading.
[PaGMO.git] / SolversThreads / SolversThreads.h
blob33f6e1bf85cac1d0b26bbefba874a5de22b1e22c
1 /*
2 * SolverThreads.h
3 * PaGMO
5 * Created by Dario Izzo on 9/21/08.
6 * Copyright 2008 __MyCompanyName__. All rights reserved.
8 */
11 #ifndef SOLVERSTHREADS_H
12 #define SOLVERSTHREADS_H
14 #include <pthread.h>
16 #include "GOproblem.h"
17 #include "population.h"
19 //Here we define the parameters needed to instanciate a thread. These contain
20 //datas that are algorithm specific, but also data that are needed for all aglorithms (LB,UB,objfun,mutex etc.)
22 struct threadParam{
23 //Thread unique ID
24 unsigned int threadID;
26 //Solvers Data
27 int NP;
28 int generations;
29 //DE
30 int strategy;
31 double F,CR;
32 //PSO
33 double omega,eta1,eta2,vcoeff;
34 int nswarms;
35 //GA
36 double M,CRsga;
37 int insert_best;
38 //SA-AN
39 double Ts,Tf;
40 //pointers giving access to global resources
41 GOProblem* problem;
43 bool *isActive;
44 pthread_mutex_t *TPmutex;
45 pthread_cond_t *exit;
46 Population *Ptr_pop;
47 std::ofstream *Ptr_log;
48 unsigned long randomSeed;
51 //Here we define the protoypes for each type of thread we may want to open
52 void *DEthread(void *data);
53 void *PSOthread(void *data);
54 void *MPSOthread(void *data);
55 void *SGAthread(void *data);
56 void *ASAthread(void *data);
57 #endif