Skip to content

MurilloMendonca/CUDA-TSP-GA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Traveling Sales Man

Genetic Algorithm with CUDA

In the actuall code configuration. It loads a distance matrix for asymmetric Traveling Sales Man. The matrix can be found at the mat.dat file as a binary generated by the following code:

void CriaMatrizRandom(int t)
{
float *v =  new float[t*t];
int r=0;
for(int i=0;i<t*t;i++)
{
    if(i%t ==r)
    {
        v[i] =0;
        r++;
        if(i+1<t*t)
        {
            v[i+1] = 1;
            i++;
        }
    }
    else
        v[i] = num_aleatorio(1,1000);
}

This code ensure that the main diagonal of the matrix is formed by '0' and there is by its sitde a diagonal formed by '1'. This condition was adopted for a better artifical case, just to be sure that the GA will find the best way.

To run the code you must compile the file main.cu :

nvcc -o [nomeDesejadoDoExecutavel] main.cu

Demais informações disponíveis em Apresentação

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages