Просмотр исходного кода

calculer_intra()

Signed-off-by: wmb <wmb@teknik.io>
master
wmb 1 год назад
Родитель
Сommit
6cd7a2bef7
  1. 12
      main.c

12
main.c

@ -28,8 +28,8 @@ int solution_voisine(solution *dest, const solution src); @@ -28,8 +28,8 @@ int solution_voisine(solution *dest, const solution src);
double fonction_objective(const solution s);
static double calculer_inter(const solution s, vector *cgs);
static double calculer_intra(const solution s, vector *cgs);
#endif /* 0 */
static double calculer_intra(const solution s, vector *cgs);
solution solution_opt;
solution new_solution;
@ -269,7 +269,6 @@ static double calculer_inter(const solution s, vector *cgs) @@ -269,7 +269,6 @@ static double calculer_inter(const solution s, vector *cgs)
static double calculer_intra(const solution s, vector *cgs)
{
const size_t n = sizeof(*s) / sizeof((*s)[0]);
double intra = 0.0;
int cluster;
@ -278,14 +277,13 @@ static double calculer_intra(const solution s, vector *cgs) @@ -278,14 +277,13 @@ static double calculer_intra(const solution s, vector *cgs)
int vectors_in_this_cluster = 0;
size_t i;
centre_gravite(cluster, s, cgs[cluster], 42);
for (i = 0; i < n; i++) {
if ((*s)[i] != cluster)
for (i = 0; i < N_VECTORS; i++) {
if (s[i] != cluster)
continue;
++vectors_in_this_cluster;
intra_for_this_cluster += distance(&cg, &benchmark_data[i]);
intra_for_this_cluster += distance((const vector *) cgs[cluster],
(const vector *) benchmark_data[i]);
}
intra += intra_for_this_cluster / (double) vectors_in_this_cluster;

Загрузка…
Отмена
Сохранить