added data for S2 and bug fixes
This commit is contained in:
parent
3c0da02e3a
commit
1f2562109b
36
algorithm.c
36
algorithm.c
|
@ -747,7 +747,7 @@ bool is_overlap_creneau(creneau* edt, int len_edt, int id, int grp) { // detect
|
|||
return false;
|
||||
}
|
||||
|
||||
void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleur* chads, int len_chads, int n_weeks, int grp, topic start_rotation, int mth, int inf) {
|
||||
void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleur* chads, int len_chads, int n_weeks, int grp, topic start_rotation, int mth, int inf, int* skip_count) {
|
||||
topic rotation = start_rotation; // physics/english rotation
|
||||
int math = mth; // math (3/4)
|
||||
int info = inf; // info (1/6)
|
||||
|
@ -794,7 +794,7 @@ void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleu
|
|||
|
||||
info++;
|
||||
// info colle
|
||||
while(info == 5) {
|
||||
while(info >= 8) {
|
||||
if(edt[k+r%weeklen].group == 0 && edt[k+r%weeklen].length == 2) {
|
||||
// if creneau is empty
|
||||
// import all colleurs available
|
||||
|
@ -812,8 +812,8 @@ void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleu
|
|||
// - he is a INFO colleur
|
||||
// if a colle has been addded, interrupt the for and while loops
|
||||
for(int dude = 0; dude < len_perm*(1-found); dude++) {
|
||||
if(chads[perm[dude]].mat == INFO && !is_overlap_creneau(edt, len_edt, k+r%weeklen, grp)) {
|
||||
add_colle(edt, chads, grp, k+r%weeklen, perm[dude]);
|
||||
if(dudes[perm[dude]].mat == INFO && !is_overlap_creneau(edt, len_edt, k+r%weeklen, grp)) {
|
||||
add_colle(edt, dudes, grp, k+r%weeklen, perm[dude]);
|
||||
found = true;
|
||||
info = 0;
|
||||
}
|
||||
|
@ -822,7 +822,8 @@ void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleu
|
|||
}
|
||||
if(!found && halt > weeklen) {
|
||||
info = 0;
|
||||
printf("Warning : skipping info colle for week %d and group %d\n", week+1, grp);
|
||||
//printf("Warning : skipping info colle for week %d and group %d\n", week+1, grp);
|
||||
*skip_count += 1;
|
||||
}
|
||||
r++;
|
||||
halt++;
|
||||
|
@ -853,8 +854,8 @@ void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleu
|
|||
// - he does not have another colle at the same time (is_overlap)
|
||||
// if a colle has been addded, interrupt the for andwhile loops
|
||||
for(int dude = 0; dude < len_perm*(1-found); dude++) {
|
||||
if(chads[perm[dude]].mat == MATH) {
|
||||
add_colle(edt, chads, grp, k+r%weeklen, perm[dude]);
|
||||
if(dudes[perm[dude]].mat == MATH) {
|
||||
add_colle(edt, dudes, grp, k+r%weeklen, perm[dude]);
|
||||
if(is_overlap(edt, len_edt, k+r%weeklen)) {
|
||||
remove_colle(edt, k+r%weeklen);
|
||||
} else {
|
||||
|
@ -867,7 +868,8 @@ void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleu
|
|||
}
|
||||
if(!found && halt > weeklen) {
|
||||
remaining_to_add--;
|
||||
printf("Warning : skipping math colle for week %d and group %d\n", week+1, grp);
|
||||
//printf("Warning : skipping math colle for week %d and group %d\n", week+1, grp);
|
||||
*skip_count += 1;
|
||||
}
|
||||
r++;
|
||||
halt++;
|
||||
|
@ -885,8 +887,9 @@ void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleu
|
|||
if(len_dudes != 0) {
|
||||
generate_random_perm(perm, len_perm);
|
||||
for(int dude = 0; dude < len_perm*(1-found); dude++) {
|
||||
if(chads[perm[dude]].mat == rotation) {
|
||||
add_colle(edt, chads, grp, k+r%16, perm[dude]);
|
||||
//printf("%d\n", chads[perm[dude]]);
|
||||
if(dudes[perm[dude]].mat == rotation) {
|
||||
add_colle(edt, dudes, grp, k+r%16, perm[dude]);
|
||||
found = true;
|
||||
remaining_to_add--;
|
||||
}
|
||||
|
@ -895,7 +898,8 @@ void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleu
|
|||
}
|
||||
if(!found && halt > weeks_len[week]) {
|
||||
remaining_to_add--;
|
||||
printf("Warning : skipping secondary colle for week %d and group %d\n", week+1, grp);
|
||||
//printf("Warning : skipping secondary colle for week %d and group %d\n", week+1, grp);
|
||||
*skip_count += 1;
|
||||
}
|
||||
r++;
|
||||
halt++;
|
||||
|
@ -1003,11 +1007,13 @@ void aux_2(creneau* edt, int len_edt, colleur* chads, int len_chads, int n_group
|
|||
|
||||
int max_score = 0;
|
||||
int global_min = 0;
|
||||
int global_skipped = 0;
|
||||
int screwed_group = 0;
|
||||
int local_score = 0;
|
||||
int local_min = 0;
|
||||
int local_group = 0;
|
||||
int temp = 0;
|
||||
int skipped = 0;
|
||||
int a = n_sim/100;
|
||||
for(int k = 0; k < n_sim*(1 - (max_score == n_groups*100)); k++) {
|
||||
if(k >= a) {
|
||||
|
@ -1018,9 +1024,11 @@ void aux_2(creneau* edt, int len_edt, colleur* chads, int len_chads, int n_group
|
|||
}
|
||||
local_score = 0;
|
||||
local_min = 100;
|
||||
skipped = 0;
|
||||
for(int i = 0; i < n_groups; i++) {
|
||||
//for(int i = 0; i < 1; i++) {
|
||||
//rintf("Adding colles for group %d...\n", i+1);
|
||||
add_colles_for_group_MP2I(weeks_len, edt, len_edt, chads, len_chads, n_weeks, i+1, (topic)(2+i%2), i%4,1+i%4);
|
||||
add_colles_for_group_MP2I(weeks_len, edt, len_edt, chads, len_chads, n_weeks, i+1, (topic)(2+i%2), i%4,i%8, &skipped);
|
||||
}
|
||||
for(int i = 0; i < n_groups; i++) {
|
||||
//printf("Score for group %d : %d\n", i+1, score(edt, len_edt, i+1));
|
||||
|
@ -1031,10 +1039,12 @@ void aux_2(creneau* edt, int len_edt, colleur* chads, int len_chads, int n_group
|
|||
local_group = i+1;
|
||||
}
|
||||
}
|
||||
local_score -= skipped*35;
|
||||
if(local_score > max_score) {
|
||||
max_score = local_score;
|
||||
screwed_group = local_group;
|
||||
global_min = local_min;
|
||||
global_skipped = skipped;
|
||||
write_to_file("output.csv", edt, len_edt);
|
||||
}
|
||||
for(int r = 0; r < len_edt; r++) {
|
||||
|
@ -1047,7 +1057,7 @@ void aux_2(creneau* edt, int len_edt, colleur* chads, int len_chads, int n_group
|
|||
if(max_score == 100*n_groups) {
|
||||
printf("Interrupting early due to a perfect score achieved\n");
|
||||
} else {
|
||||
printf("100% Completed, best score is %d/%d\n", max_score, 100*n_groups);
|
||||
printf("100% Completed, best score is %d/%d with %d skipped colles\n", max_score, 100*n_groups, global_skipped);
|
||||
printf("Most screwed group is %d with a score of %d/100\n", screwed_group, global_min);
|
||||
}
|
||||
int end = time(NULL);
|
||||
|
|
12
display.c
12
display.c
|
@ -286,4 +286,16 @@ void print_one_week(creneau* edt, int len_creneau, date start) { /*
|
|||
}
|
||||
updateRenderer(renderer);*/
|
||||
//usleep(3000000);
|
||||
}
|
||||
|
||||
void print_all_edt(creneau* edt, int len_edt, int n_weeks, int len_oneweek) {
|
||||
for(int k = 0; k < n_weeks; k++) {
|
||||
print_one_week(edt, len_edt, edt[k*len_oneweek].date);
|
||||
}
|
||||
}
|
||||
|
||||
void print_all_colleurs(colleur* chads, int n_chads) {
|
||||
for(int c = 0; c < n_chads; c++) {
|
||||
printf("Colleur %s with %d available :\n", chads[c].name, chads[c].n_disp);
|
||||
}
|
||||
}
|
16
main.c
16
main.c
|
@ -7,20 +7,24 @@ int main() {
|
|||
srand(time(NULL));
|
||||
|
||||
//creneau* edt = import_creneaux("file.txt", 76);
|
||||
creneau* edt = import_creneaux_oneweek("file2.txt", 19, 4);
|
||||
int len_creneau = 76;
|
||||
creneau* edt = import_creneaux_oneweek("MP2I-creneaux.txt", 31, 6);
|
||||
int len_edt = 31*6;
|
||||
|
||||
//colleur* dudes = import_colleurs("some_data.txt", 13, len_creneau);
|
||||
colleur* dudes = import_colleurs_oneweek("some_file2.txt", 12, 4, 19);
|
||||
int n_colleurs = 12;
|
||||
|
||||
colleur* dudes = import_colleurs_oneweek("MP2I-colleurs.txt", 16, 6, 31);
|
||||
int n_colleurs = 16;
|
||||
|
||||
//print_all_edt(edt, len_edt, 6, 31);
|
||||
//print_all_colleurs(dudes, n_colleurs);
|
||||
|
||||
//assert(0);
|
||||
|
||||
// {char* name; int namelen; topic mat; date* disp; int n_disp;} colleur;
|
||||
|
||||
/*int* a = malloc(sizeof(int)*10);
|
||||
generate_random_perm(a, 10);
|
||||
print_arr(a, 10);*/
|
||||
aux_2(edt, len_creneau, dudes, n_colleurs, 7, 4, 3000);
|
||||
aux_2(edt, len_edt, dudes, n_colleurs, 15, 6, 5000);
|
||||
//generate_colles_v1(edt, len_creneau, dudes, n_colleurs, 9, 4);
|
||||
//generate_colles_v1(edt, len_creneau, dudes, n_colleurs, 15, 4);
|
||||
|
||||
|
|
246
output.csv
246
output.csv
|
@ -1,77 +1,187 @@
|
|||
hour,day,month,year,length,group,colleur,matiere
|
||||
12,5,2,2024,1,5,Le_Gourielec,Anglais
|
||||
13,5,2,2024,1,2,Poupy,Physique
|
||||
18,5,2,2024,1,6,Chevalier,Physique
|
||||
17,6,2,2024,1,4,Carpintero,Maths
|
||||
18,6,2,2024,1,7,Carpintero,Maths
|
||||
14,7,2,2024,1,6,Rapin,Maths
|
||||
14,7,2,2024,2,4,Jospin,Info
|
||||
12,5,2,2024,1,2,Chevalier,Physique
|
||||
12,5,2,2024,1,10,Chevalier,Physique
|
||||
13,5,2,2024,1,15,Herbaut,Anglais
|
||||
13,5,2,2024,1,3,Herbaut,Anglais
|
||||
14,6,2,2024,1,1,Belaggoune,Anglais
|
||||
14,6,2,2024,1,14,Chevalier,Physique
|
||||
14,6,2,2024,1,10,Mullaert,Maths
|
||||
17,6,2,2024,1,4,Chevalier,Physique
|
||||
17,6,2,2024,1,8,Chevalier,Physique
|
||||
18,6,2,2024,1,3,Rapin,Maths
|
||||
13,7,2,2024,1,2,Carpintero,Maths
|
||||
14,7,2,2024,1,5,Le_Gouriellec,Anglais
|
||||
14,7,2,2024,1,7,Bouverot,Maths
|
||||
14,7,2,2024,1,4,Carpintero,Maths
|
||||
14,7,2,2024,1,6,Boully,Maths
|
||||
14,7,2,2024,2,0,none,none
|
||||
14,7,2,2024,2,0,none,none
|
||||
15,7,2,2024,1,3,Carpintero,Maths
|
||||
16,7,2,2024,1,3,Belaggoune,Anglais
|
||||
17,7,2,2024,1,7,Le_Gourielec,Anglais
|
||||
15,7,2,2024,1,8,Bouverot,Maths
|
||||
15,7,2,2024,1,11,Boully,Maths
|
||||
15,7,2,2024,1,0,none,none
|
||||
16,7,2,2024,1,0,none,none
|
||||
16,7,2,2024,2,8,Colleur_Dinfo,Info
|
||||
17,7,2,2024,1,0,none,none
|
||||
17,7,2,2024,1,0,none,none
|
||||
18,7,2,2024,1,0,none,none
|
||||
14,8,2,2024,1,0,none,none
|
||||
15,8,2,2024,1,2,Mullaert,Maths
|
||||
18,8,2,2024,1,4,Poupy,Physique
|
||||
15,8,2,2024,1,0,none,none
|
||||
18,8,2,2024,1,12,Rapin,Maths
|
||||
18,8,2,2024,1,0,none,none
|
||||
16,9,2,2024,1,0,none,none
|
||||
17,9,2,2024,1,0,none,none
|
||||
18,9,2,2024,1,0,none,none
|
||||
12,12,2,2024,1,5,Chibani,Physique
|
||||
13,12,2,2024,1,6,Mann,Anglais
|
||||
18,12,2,2024,1,1,Chevalier,Physique
|
||||
17,13,2,2024,1,7,Chevalier,Physique
|
||||
18,13,2,2024,1,3,Chibani,Physique
|
||||
14,14,2,2024,1,0,none,none
|
||||
14,14,2,2024,2,3,Jospin,Info
|
||||
14,14,2,2024,2,0,none,none
|
||||
14,14,2,2024,2,7,Jospin,Info
|
||||
15,14,2,2024,1,3,Boully,Maths
|
||||
16,14,2,2024,1,4,Rapin,Maths
|
||||
17,9,2,2024,1,14,Oubaha,Maths
|
||||
18,9,2,2024,1,15,Oubaha,Maths
|
||||
12,12,2,2024,1,3,Chevalier,Physique
|
||||
12,12,2,2024,1,9,Chevalier,Physique
|
||||
13,12,2,2024,1,14,Herbaut,Anglais
|
||||
13,12,2,2024,1,2,Herbaut,Anglais
|
||||
14,13,2,2024,1,4,Belaggoune,Anglais
|
||||
14,13,2,2024,1,15,Chevalier,Physique
|
||||
14,13,2,2024,1,5,Chevalier,Physique
|
||||
17,13,2,2024,1,7,Colin,Physique
|
||||
17,13,2,2024,1,13,Colin,Physique
|
||||
18,13,2,2024,1,7,Rapin,Maths
|
||||
13,14,2,2024,1,12,Carpintero,Maths
|
||||
14,14,2,2024,1,6,Le_Gouriellec,Anglais
|
||||
14,14,2,2024,1,8,Bouverot,Maths
|
||||
14,14,2,2024,1,1,Carpintero,Maths
|
||||
14,14,2,2024,1,3,Boully,Maths
|
||||
14,14,2,2024,2,7,Colleur_Dinfo,Info
|
||||
15,14,2,2024,1,4,Boully,Maths
|
||||
15,14,2,2024,1,9,Bouverot,Maths
|
||||
15,14,2,2024,1,0,none,none
|
||||
16,14,2,2024,1,0,none,none
|
||||
16,14,2,2024,2,15,Colleur_Dinfo,Info
|
||||
17,14,2,2024,1,0,none,none
|
||||
18,14,2,2024,1,5,Boully,Maths
|
||||
14,15,2,2024,1,2,Belaggoune,Anglais
|
||||
15,15,2,2024,1,1,Boully,Maths
|
||||
18,15,2,2024,1,4,Belaggoune,Anglais
|
||||
16,16,2,2024,1,7,Carpintero,Maths
|
||||
17,16,2,2024,1,0,none,none
|
||||
18,16,2,2024,1,0,none,none
|
||||
12,19,2,2024,1,1,Belaggoune,Anglais
|
||||
13,19,2,2024,1,4,Rapin,Maths
|
||||
18,19,2,2024,1,2,Mullaert,Maths
|
||||
17,20,2,2024,1,5,Boully,Maths
|
||||
18,20,2,2024,1,6,Carpintero,Maths
|
||||
14,21,2,2024,1,7,Herbaud,Anglais
|
||||
14,21,2,2024,2,2,Jospin,Info
|
||||
14,21,2,2024,2,6,Jospin,Info
|
||||
14,21,2,2024,2,0,none,none
|
||||
15,21,2,2024,1,2,Poupy,Physique
|
||||
16,21,2,2024,1,5,Herbaud,Anglais
|
||||
17,21,2,2024,1,3,Belaggoune,Anglais
|
||||
18,21,2,2024,1,1,Rapin,Maths
|
||||
14,22,2,2024,1,6,Chibani,Physique
|
||||
17,14,2,2024,1,0,none,none
|
||||
18,14,2,2024,1,0,none,none
|
||||
14,15,2,2024,1,0,none,none
|
||||
15,15,2,2024,1,0,none,none
|
||||
18,15,2,2024,1,11,Rapin,Maths
|
||||
18,15,2,2024,1,0,none,none
|
||||
16,16,2,2024,1,0,none,none
|
||||
17,16,2,2024,1,13,Oubaha,Maths
|
||||
18,16,2,2024,1,15,Oubaha,Maths
|
||||
12,19,2,2024,1,6,Chevalier,Physique
|
||||
12,19,2,2024,1,8,Chevalier,Physique
|
||||
13,19,2,2024,1,15,Herbaut,Anglais
|
||||
13,19,2,2024,1,5,Herbaut,Anglais
|
||||
14,20,2,2024,1,1,Mullaert,Maths
|
||||
14,20,2,2024,1,10,Chevalier,Physique
|
||||
14,20,2,2024,1,12,Chevalier,Physique
|
||||
17,20,2,2024,1,14,Colin,Physique
|
||||
17,20,2,2024,1,0,none,none
|
||||
18,20,2,2024,1,5,Rapin,Maths
|
||||
13,21,2,2024,1,6,Carpintero,Maths
|
||||
14,21,2,2024,1,7,Le_Gouriellec,Anglais
|
||||
14,21,2,2024,1,1,Le_Gouriellec,Anglais
|
||||
14,21,2,2024,1,4,Carpintero,Maths
|
||||
14,21,2,2024,1,2,Boully,Maths
|
||||
14,21,2,2024,2,6,Colleur_Dinfo,Info
|
||||
15,21,2,2024,1,8,Boully,Maths
|
||||
15,21,2,2024,1,9,Bouverot,Maths
|
||||
15,21,2,2024,1,0,none,none
|
||||
16,21,2,2024,1,0,none,none
|
||||
16,21,2,2024,2,14,Colleur_Dinfo,Info
|
||||
17,21,2,2024,1,0,none,none
|
||||
17,21,2,2024,1,0,none,none
|
||||
18,21,2,2024,1,0,none,none
|
||||
14,22,2,2024,1,0,none,none
|
||||
15,22,2,2024,1,0,none,none
|
||||
18,22,2,2024,1,4,Chevalier,Physique
|
||||
18,22,2,2024,1,10,Rapin,Maths
|
||||
18,22,2,2024,1,0,none,none
|
||||
16,23,2,2024,1,0,none,none
|
||||
17,23,2,2024,1,0,none,none
|
||||
18,23,2,2024,1,0,none,none
|
||||
12,26,2,2024,1,3,Poupy,Physique
|
||||
13,26,2,2024,1,5,Chibani,Physique
|
||||
18,26,2,2024,1,7,Rapin,Maths
|
||||
17,27,2,2024,1,1,Chevalier,Physique
|
||||
18,27,2,2024,1,3,Carpintero,Maths
|
||||
14,28,2,2024,1,4,Herbaud,Anglais
|
||||
14,28,2,2024,2,1,Jospin,Info
|
||||
14,28,2,2024,2,5,Jospin,Info
|
||||
14,28,2,2024,2,0,none,none
|
||||
15,28,2,2024,1,5,Boully,Maths
|
||||
16,28,2,2024,1,6,Mullaert,Maths
|
||||
17,28,2,2024,1,7,Poupy,Physique
|
||||
18,28,2,2024,1,2,Carpintero,Maths
|
||||
14,29,2,2024,1,1,Mullaert,Maths
|
||||
15,29,2,2024,1,2,Belaggoune,Anglais
|
||||
18,29,2,2024,1,6,Herbaud,Anglais
|
||||
17,23,2,2024,1,12,Oubaha,Maths
|
||||
18,23,2,2024,1,13,Oubaha,Maths
|
||||
12,26,2,2024,1,5,Chevalier,Physique
|
||||
12,26,2,2024,1,7,Chevalier,Physique
|
||||
13,26,2,2024,1,14,Herbaut,Anglais
|
||||
13,26,2,2024,1,6,Herbaut,Anglais
|
||||
14,27,2,2024,1,1,Chevalier,Physique
|
||||
14,27,2,2024,1,15,Chevalier,Physique
|
||||
14,27,2,2024,1,4,Belaggoune,Anglais
|
||||
17,27,2,2024,1,3,Chevalier,Physique
|
||||
17,27,2,2024,1,9,Colin,Physique
|
||||
18,27,2,2024,1,3,Rapin,Maths
|
||||
13,28,2,2024,1,7,Carpintero,Maths
|
||||
14,28,2,2024,1,5,Carpintero,Maths
|
||||
14,28,2,2024,1,1,Boully,Maths
|
||||
14,28,2,2024,1,6,Bouverot,Maths
|
||||
14,28,2,2024,1,8,Le_Gouriellec,Anglais
|
||||
14,28,2,2024,2,5,Colleur_Dinfo,Info
|
||||
15,28,2,2024,1,9,Boully,Maths
|
||||
15,28,2,2024,1,10,Bouverot,Maths
|
||||
15,28,2,2024,1,0,none,none
|
||||
16,28,2,2024,1,0,none,none
|
||||
16,28,2,2024,2,13,Colleur_Dinfo,Info
|
||||
17,28,2,2024,1,0,none,none
|
||||
17,28,2,2024,1,0,none,none
|
||||
18,28,2,2024,1,0,none,none
|
||||
14,29,2,2024,1,0,none,none
|
||||
15,29,2,2024,1,0,none,none
|
||||
18,29,2,2024,1,11,Rapin,Maths
|
||||
18,29,2,2024,1,0,none,none
|
||||
16,1,3,2024,1,0,none,none
|
||||
17,1,3,2024,1,0,none,none
|
||||
18,1,3,2024,1,0,none,none
|
||||
17,1,3,2024,1,13,Oubaha,Maths
|
||||
18,1,3,2024,1,14,Oubaha,Maths
|
||||
12,4,3,2024,1,12,Chevalier,Physique
|
||||
12,4,3,2024,1,6,Chevalier,Physique
|
||||
13,4,3,2024,1,15,Herbaut,Anglais
|
||||
13,4,3,2024,1,11,Herbaut,Anglais
|
||||
14,5,3,2024,1,4,Chevalier,Physique
|
||||
14,5,3,2024,1,14,Chevalier,Physique
|
||||
14,5,3,2024,1,7,Mullaert,Maths
|
||||
17,5,3,2024,1,0,none,none
|
||||
17,5,3,2024,1,0,none,none
|
||||
18,5,3,2024,1,2,Rapin,Maths
|
||||
13,6,3,2024,1,8,Carpintero,Maths
|
||||
14,6,3,2024,1,3,Bouverot,Maths
|
||||
14,6,3,2024,1,3,Le_Gouriellec,Anglais
|
||||
14,6,3,2024,1,9,Le_Gouriellec,Anglais
|
||||
14,6,3,2024,1,6,Boully,Maths
|
||||
14,6,3,2024,2,4,Colleur_Dinfo,Info
|
||||
15,6,3,2024,1,4,Bouverot,Maths
|
||||
15,6,3,2024,1,10,Boully,Maths
|
||||
15,6,3,2024,1,0,none,none
|
||||
16,6,3,2024,1,0,none,none
|
||||
16,6,3,2024,2,12,Colleur_Dinfo,Info
|
||||
17,6,3,2024,1,0,none,none
|
||||
17,6,3,2024,1,0,none,none
|
||||
18,6,3,2024,1,0,none,none
|
||||
14,7,3,2024,1,0,none,none
|
||||
15,7,3,2024,1,0,none,none
|
||||
18,7,3,2024,1,11,Rapin,Maths
|
||||
18,7,3,2024,1,0,none,none
|
||||
16,8,3,2024,1,0,none,none
|
||||
17,8,3,2024,1,12,Oubaha,Maths
|
||||
18,8,3,2024,1,14,Oubaha,Maths
|
||||
12,11,3,2024,1,5,Chevalier,Physique
|
||||
12,11,3,2024,1,9,Chevalier,Physique
|
||||
13,11,3,2024,1,14,Herbaut,Anglais
|
||||
13,11,3,2024,1,8,Herbaut,Anglais
|
||||
14,12,3,2024,1,1,Mullaert,Maths
|
||||
14,12,3,2024,1,11,Chevalier,Physique
|
||||
14,12,3,2024,1,12,Belaggoune,Anglais
|
||||
17,12,3,2024,1,15,Colin,Physique
|
||||
17,12,3,2024,1,13,Chevalier,Physique
|
||||
18,12,3,2024,1,3,Rapin,Maths
|
||||
13,13,3,2024,1,4,Carpintero,Maths
|
||||
14,13,3,2024,1,4,Le_Gouriellec,Anglais
|
||||
14,13,3,2024,1,5,Carpintero,Maths
|
||||
14,13,3,2024,1,7,Boully,Maths
|
||||
14,13,3,2024,1,8,Bouverot,Maths
|
||||
14,13,3,2024,2,3,Colleur_Dinfo,Info
|
||||
15,13,3,2024,1,9,Bouverot,Maths
|
||||
15,13,3,2024,1,11,Boully,Maths
|
||||
15,13,3,2024,1,0,none,none
|
||||
16,13,3,2024,1,0,none,none
|
||||
16,13,3,2024,2,11,Colleur_Dinfo,Info
|
||||
17,13,3,2024,1,0,none,none
|
||||
17,13,3,2024,1,0,none,none
|
||||
18,13,3,2024,1,0,none,none
|
||||
14,14,3,2024,1,0,none,none
|
||||
15,14,3,2024,1,0,none,none
|
||||
18,14,3,2024,1,12,Rapin,Maths
|
||||
18,14,3,2024,1,0,none,none
|
||||
16,15,3,2024,1,0,none,none
|
||||
17,15,3,2024,1,13,Oubaha,Maths
|
||||
18,15,3,2024,1,15,Oubaha,Maths
|
||||
|
|
|
28
structure.c
28
structure.c
|
@ -360,26 +360,22 @@ creneau* import_creneaux_oneweek(char* filename, int len_file, int n_weeks) {
|
|||
return edt;
|
||||
}
|
||||
|
||||
void expand(colleur* guy, int id, int n_horaires, int n_weeks) {
|
||||
date* horaires = guy[id].disp;
|
||||
date* res = malloc(sizeof(date)*n_horaires*n_weeks);
|
||||
for (int i = 0; i < n_horaires; i++) {
|
||||
res[i] = horaires[i];
|
||||
void expand(colleur* guy, int id, int n_weeks) {
|
||||
int len_1st = guy[id].n_disp;
|
||||
date* new = malloc(sizeof(date)*len_1st*n_weeks);
|
||||
|
||||
for(int b = 0; b < len_1st; b++) {
|
||||
new[b] = guy[id].disp[b];
|
||||
}
|
||||
for(int k = 1; k < n_weeks; k++) {
|
||||
for(int i = 0; i < n_horaires; i++) {
|
||||
res[k*n_horaires+i] = increment_date(res[i], 7*k);
|
||||
for(int week = 1; week < n_weeks; week++) {
|
||||
for(int i = 0; i < len_1st; i++) {
|
||||
new[week*len_1st+i] = increment_date(guy[id].disp[i], 7*week);
|
||||
}
|
||||
}
|
||||
|
||||
/*for(int i = 0; i < n_horaires*n_weeks; i++) {
|
||||
printf("%d %d %d %d\n", res[i].hour, res[i].day, res[i].month, res[i].year);
|
||||
}
|
||||
printf("\n\n");*/
|
||||
|
||||
free(guy[id].disp);
|
||||
guy[id].disp = res;
|
||||
guy[id].n_disp = n_weeks*n_horaires;
|
||||
guy[id].n_disp *= n_weeks;
|
||||
guy[id].disp = new;
|
||||
}
|
||||
|
||||
colleur* import_colleurs_oneweek(char* filename, int n_colleurs, int n_weeks, int len_oneweek) {
|
||||
|
@ -464,7 +460,7 @@ colleur* import_colleurs_oneweek(char* filename, int n_colleurs, int n_weeks, in
|
|||
// {char* name; int namelen; topic mat; date* disp; int n_disp;}
|
||||
|
||||
for(int c = 0; c < n_colleurs; c++) {
|
||||
expand(res, c, len_oneweek, n_weeks);
|
||||
expand(res, c, n_weeks);
|
||||
}
|
||||
|
||||
printf("Imported colleurs with no problems\n");
|
||||
|
|
Loading…
Reference in New Issue