ElfPSP_AntColony
Protein Structure Prediction using Ant Colony Optimization
|
Holds data needed by each CUDA thread to execute its work. More...
Public Member Functions | |
__device__ void | solution_from_directions (int3 *solution, char *directions) |
Given a vector of relative directions, returns a vector of coordinates generated by these directions. More... | |
__device__ void | local_search (int &solContact, int lsFreq) |
Performs local search in the thread's own solution, replacing mySolution if a better solution is found. More... | |
__device__ double & | pheromone (int i, int d) |
Getter for individual pheromones. More... | |
__device__ int | calculate_contacts (int3 *solution) |
Counts contacts within the given solution. More... | |
__device__ void | get_heuristics (int curSize, int3 *solution, double *heurs, int3 *possiblePos) |
Calculates the heuristic value for the step being decided. More... | |
__device__ void | get_probabilities (int movIndex, double *probs, double *heurs) |
Calculates probability of following each of the 5 directions. More... | |
__device__ void | develop_solution (int3 *solution, char *directions) |
Simulates the behavior of an ant walking through the pheromone matrix, developing a solution. More... | |
Static Public Member Functions | |
static __device__ int3 | DIRECTION_VECTOR (int3 prevDir, char dir) |
Returns the vector obtained by following the vector 'prevDir' and turning to direction 'dir'. More... | |
Public Attributes | |
int | tid |
Unique identifier for the thread within all blocks (the grid). More... | |
int | randNumber |
Random number that also serves as the seed for generation. More... | |
int3 * | mySolution |
Memory region containing coordinates of the solution this thread is developing. More... | |
int3 * | myOtherSolution |
Memory region that the thread uses for performing local seach (small perturbation) on mySolution. More... | |
char * | myDirections |
Memory containing relative directions for mySolution. More... | |
char * | myOtherDirections |
Memory containing relative directions for myOtherSolution. More... | |
double * | pheromones |
Pointer to the pheromone matrix (shared by all threads). More... | |
char * | hpChain |
hpChain of the protein being predicted (shared by all threads). More... | |
int | nCoords |
Number of coordinates of the protein. More... | |
int | nMovElems |
Number of directions of the protein. More... | |
double | dAlpha |
Alpha parameter of the ACO algorithm. More... | |
double | dBeta |
Beta parameter of the ACO algorithm. More... | |
Holds data needed by each CUDA thread to execute its work.
We associate device functions with this structure, which makes access to this struct's data by a thread much easier.
__device__ int CUDAThread::calculate_contacts | ( | int3 * | solution | ) |
Counts contacts within the given solution.
__device__ void CUDAThread::develop_solution | ( | int3 * | solution, |
char * | directions | ||
) |
Simulates the behavior of an ant walking through the pheromone matrix, developing a solution.
[out] | solution | Output memory region in which to store the solution coordinates. |
[out] | directions | Output memory region in which to store the solution directions. |
|
static |
Returns the vector obtained by following the vector 'prevDir' and turning to direction 'dir'.
__device__ void CUDAThread::get_heuristics | ( | int | curSize, |
int3 * | solution, | ||
double * | heurs, | ||
int3 * | possiblePos | ||
) |
Calculates the heuristic value for the step being decided.
curSize | Number of coordinates that have already been decided. should correspond to the number of valid coordinates in the given solution . | |
solution | Memory region containing the coordinates being decided. | |
[out] | heurs | Output array of 5 doubles where we store heuristic values for each direction. |
possiblePos | Array of the 5 possible positions that result by following each of the 5 directions in the current solution . |
__device__ void CUDAThread::get_probabilities | ( | int | movIndex, |
double * | probs, | ||
double * | heurs | ||
) |
Calculates probability of following each of the 5 directions.
movIndex | Index of the direction being decided. | |
[out] | probs | Output array with 5 doubles where we store the probability of following each of the 5 directions. |
heurs | Array with the 5 heuristic values of each possible direction. |
__device__ void CUDAThread::local_search | ( | int & | solContact, |
int | lsFreq | ||
) |
Performs local search in the thread's own solution, replacing mySolution
if a better solution is found.
[out] | solContact | Output argument where we store the highest number of contacts found. |
lsFreq | Local search frequency, which defines the number of perturbations to generate. |
__device__ double & CUDAThread::pheromone | ( | int | i, |
int | d | ||
) |
Getter for individual pheromones.
i | The index of relative direction that is currently being decided. |
d | The relative direction in [0-4] that is being considered. |
__device__ void CUDAThread::solution_from_directions | ( | int3 * | solution, |
char * | directions | ||
) |
Given a vector of relative directions, returns a vector of coordinates generated by these directions.
solution | Memory region where we should store the resulting solution. |
directions | Memory region containing the directions. |
double CUDAThread::dAlpha |
Alpha parameter of the ACO algorithm.
double CUDAThread::dBeta |
Beta parameter of the ACO algorithm.
char* CUDAThread::hpChain |
hpChain of the protein being predicted (shared by all threads).
char* CUDAThread::myDirections |
Memory containing relative directions for mySolution.
char* CUDAThread::myOtherDirections |
Memory containing relative directions for myOtherSolution.
int3* CUDAThread::myOtherSolution |
Memory region that the thread uses for performing local seach (small perturbation) on mySolution.
int3* CUDAThread::mySolution |
Memory region containing coordinates of the solution this thread is developing.
int CUDAThread::nCoords |
Number of coordinates of the protein.
int CUDAThread::nMovElems |
Number of directions of the protein.
double* CUDAThread::pheromones |
Pointer to the pheromone matrix (shared by all threads).
int CUDAThread::randNumber |
Random number that also serves as the seed for generation.
int CUDAThread::tid |
Unique identifier for the thread within all blocks (the grid).