소스 검색

calculer_intra()

Signed-off-by: wmb <wmb@teknik.io>
tags/v0.1.0
wmb 11 달 전
부모
커밋
6cd7a2bef7
1개의 변경된 파일5개의 추가작업 그리고 7개의 파일을 삭제
  1. 5
    7
      main.c

+ 5
- 7
main.c 파일 보기

@@ -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)

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)
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;

Loading…
취소
저장