small fix

This commit is contained in:
alexandre 2024-04-19 12:06:11 +02:00
parent 3f0cce69ad
commit fe916af1a5
2 changed files with 12 additions and 4 deletions

View File

@ -768,6 +768,13 @@ bool is_overlap_creneau(creneau* edt, int len_edt, int id, int grp) { // detect
}
k++;
}
k = 1;
while(id-k >= 0 && is_equal_date(edt[id].date, edt[id-k].date)) {
if(edt[id+k].group == grp) {
return true;
}
k++;
}
return false;
}
@ -819,7 +826,7 @@ void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleu
weeklen = weeks_len[week];
// update what colles to add
if(math == 0) {
math = 3;
math = 2;
} else {
remaining_to_add++;
math--;
@ -870,7 +877,7 @@ 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++;
@ -949,6 +956,7 @@ void add_colles_for_group_MP2I(int* weeks_len, creneau* edt, int len_edt, colleu
if(dudes[perm[dude]].mat == rotation) {
add_colle(edt, dudes, grp, k+r%weeklen, perm[dude]);
if(math_dude > free_math_space(edt, len_edt, k+r%weeklen) || is_overlap(edt, len_edt, k+r%weeklen)) {
//if(math_dude > free_math_space(edt, len_edt, k+r%weeklen)) {
remove_colle(edt, k+r%weeklen);
} else {
found = true;
@ -1096,7 +1104,7 @@ void aux_2(creneau* edt, int len_edt, colleur* chads, int len_chads, int n_group
//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, i%6, &skipped);
add_colles_for_group_MP2I(weeks_len, edt, len_edt, chads, len_chads, n_weeks, i+1, (topic)(2+i%2), i%4, -20, &skipped);
add_colles_for_group_MP2I(weeks_len, edt, len_edt, chads, len_chads, n_weeks, i+1, (topic)(2+i%2), i%3, -20, &skipped);
}
for(int i = 0; i < n_groups; i++) {
//printf("Score for group %d : %d\n", i+1, score(edt, len_edt, i+1));

View File

@ -112,7 +112,7 @@ int main(int argc, char **argv) {
//colleur* dudes = import_colleurs("some_data.txt", 13, len_creneau);
colleur* dudes = import_colleurs_oneweek(path_colleurs, n_colleurs, n_weeks, n_creneaux);
aux_2(edt, len_edt, dudes, n_colleurs, n_groups, n_weeks, 5000, path_output);
aux_2(edt, len_edt, dudes, n_colleurs, n_groups, n_weeks, 2500, path_output);
for(int i = 0; i < len_edt; i++) {
free(edt[i].name);