Essays.club - Ensayos gratis, notas de cursos, notas de libros, tareas, monografías y trabajos de investigación
Buscar

PROYECTO DE PROGRAMACIÓN AVANZADA QUE RECURRA A UN ALGORITMO GENÉTICO

Enviado por   •  14 de Julio de 2018  •  1.314 Palabras (6 Páginas)  •  291 Visitas

Página 1 de 6

...

De esta forma se muestra la representación grafica de la problemática del agente viajero.

SIMBOLOGÍA[pic 5][pic 6]

[pic 7][pic 8][pic 9][pic 10][pic 11]

[pic 12]

Inicio/Fin Entradas Decisión Salidas Líneas de Flujo

DIAGRAMA DE FLUJO

[pic 13]

[pic 14]

[pic 15][pic 16]

[pic 17]

[pic 18][pic 19]

[pic 20]

[pic 21]

[pic 22][pic 23]

[pic 24][pic 25]

[pic 26]

[pic 27][pic 28]

[pic 29][pic 30]

[pic 31]

[pic 32]

[pic 33]

[pic 34][pic 35]

[pic 36]

[pic 37][pic 38]

[pic 39]

[pic 40][pic 41]

[pic 42]

[pic 43]

[pic 44]

[pic 45]

[pic 46][pic 47]

[pic 48]

[pic 49]

[pic 50]

[pic 51]

[pic 52]

PSEUDOCODIGO[pic 53]

for ( int i=0;ifalse;

for ( int i=0;i

int icandidate;

do {

icandidate = (int) ( 0.999999* random.NextDouble() *

(double) cityList.Length );

} while ( taken[icandidate] );

cityList[i] = icandidate;

taken[icandidate] = true;

if ( i == cityList.Length-2 ) {

icandidate = 0;

while ( taken[icandidate] ) icandidate++;

cityList[i+1] = icandidate;

}

}

calculateCost(cities);

cutLength = 1;

}

public void calculateCost(SupplyPoint [] cities) {

cost=0;

for ( int i=0;i

double dist = cities[cityList[i]].proximity(cities[cityList[i+1]]);

cost += dist;

}

}

public double getCost() {

return cost;

}

public int getCity(int i) {

return cityList[i];

}

void setCities(int [] list) {

for ( int i=0;i

cityList[i] = list[i];

}

}

El curso de la búsqueda depende de 3 factores distintos, la cantidad de ciudades el total de la población a la cuales le esta asignando a cada ciudad y el porcentaje de mutación este porcentaje está sujeto a distintos cambios dependiendo de cómo el intérprete lo tome, se toma un contador que verifica que dichos valores no excedan su limite natural.

[pic 54]

void setCity(int index, int value) {

cityList[index] = value;

}

public void setCut(int cut) {

cutLength = cut;

}

public void setMutation(double prob) {

mutationPercent = prob;

}

public int mate(Chromosome father, Chromosome offspring1, Chromosome offspring2) {

int cutpoint1 = (int)(0.999999 * random.NextDouble() * (double)(cityList.Length - cutLength));

int cutpoint2 = cutpoint1 + cutLength;

bool[] taken1 = new bool[cityList.Length];

bool[] taken2 = new bool[cityList.Length];

int[] off1 = new int[cityList.Length];

int[] off2 = new int[cityList.Length];

for ( int i=0;i

taken1[i] = false;

taken2[i] = false;

}

for ( int i=0;i

if ( i= cutpoint2 ) {

off1[i] = -1;

off2[i] = -1;

} else {

int imother = cityList[i];

int ifather = father.getCity(i);

off1[i] = ifather;[pic 55]

...

Descargar como  txt (9.9 Kb)   pdf (62.1 Kb)   docx (20.7 Kb)  
Leer 5 páginas más »
Disponible sólo en Essays.club