-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.c
More file actions
129 lines (112 loc) · 3.08 KB
/
Copy pathutil.c
File metadata and controls
129 lines (112 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef _POP_
#define _POP_
#include "populacao.h"
#endif
#include <stdio.h>
#include <stdlib.h>
/**
Sobe os filhos na matriz
posFilho = posição do primeiro filho
posIni = índice da posição inicial de inserção
**/
void SobeFilhos(Individuo *geracao,int posIni,int qtdFilhos,int posFilho)
{
int i;
for(i=0;i<qtdFilhos;i++)
{
geracao[posIni] = geracao[posFilho];
posFilho++;
posIni++;
}
}
int partition(Individuo *geracao, int l, int r)
{
Individuo t;
int i = l-1;
int j;
float pivot = geracao[r].fitness;
for(j = l;j<=r-1;j++)
{
if(geracao[j].fitness >= pivot)
{
i++;
t = geracao[i];
geracao[i] = geracao[j];
geracao[j] = t;
}
}
t = geracao[i+1];
geracao[i+1] = geracao[r];
geracao[r] = t;
return i+1;
}
/**
Ordena com quick sort os indivíduos da população de acordo com a avaliação:
**/
void quickSort(Individuo *geracao, int l, int r)
{
int j;
if( l < r )
{
j = partition( geracao, l, r);// divide and conquer
quickSort( geracao, l, j-1);
quickSort( geracao, j+1, r);
}
}
void exibeResultado(Gene *gen,float fitnessTeste,float fitnessTreinamento,int clss,unsigned long int tempo)
{
int j;
printf("\n-----------REGRA:----------\n");
char *operador;
char operadores[4][3] = {"!=\0","=\0","< \0",">=\0"};
char atributos[34][50] = {
"erythema \0",
"scaling \0",
"definite borders \0",
"itching \0",
"koebner phenomenon \0",
"polygonal papules\0",
"follicular papules \0",
"oral mucosal involvement \0",
"knee and elbow involvement \0",
"scalp involvement \0",
"family history, (0 or 1) \0",
"melanin incontinence \0",
"eosinophils in the infiltrate \0",
"PNL infiltrate \0",
"fibrosis of the papillary dermis \0",
"exocytosis \0",
"acanthosis \0",
"hyperkeratosis \0",
"parakeratosis\0",
"clubbing of the rete ridges \0",
"elongation of the rete ridges \0",
"thinning of the suprapapillary epidermis \0",
"spongiform pustule \0",
"munro microabcess \0",
"focal hypergranulosis \0",
"disappearance of the granular layer \0",
"vacuolisation and damage of basal layer \0",
"spongiosis \0",
"saw-tooth appearance of retes \0",
"follicular horn plug \0",
"perifollicular parakeratosis \0",
"inflammatory monoluclear inflitrate \0",
"band-like infiltrate\0",
"Age\0"
};
FILE *f;
f = fopen("resultado.txt", "a");
fprintf(f,"\n--------------------\nCLASSE %d\n",clss);
for(j=0; j<TAM_INDIVIDUO; j++)
{
if(gen[j].peso > 0.7)
{
fprintf(f,"%s %s %d and\n",atributos[j],operadores[gen[j].operador],gen[j].valor);
}
}
fprintf(f,"\n[TEMPO]: %d ms\n",tempo);
fprintf(f,"[FITNESS TREINAMENTO] %f\n",fitnessTreinamento);
fprintf(f,"[FITNESS TESTE] %f",fitnessTeste);
fclose(f);
}