Amputation de code inutile

This commit is contained in:
Valentin Moguérou 2024-04-16 00:18:04 +02:00
parent be83812716
commit e29c0b21c5
3 changed files with 16 additions and 11 deletions

View File

@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include "structure.h"
#include "algorithm.h" #include "algorithm.h"
bool is_equal_date(date d1, date d2) { bool is_equal_date(date d1, date d2) {
@ -59,16 +60,19 @@ int get_fst_offset(creneau* edt, date d) {
return (date_dist(edt[0].date, d)); return (date_dist(edt[0].date, d));
} }
/* Feuille morte :
bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) { bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
bool debug = false; bool debug = false;
/* conditions (AND) : conditions (AND) :
0) Only 1 colle at a time * 0) Only 1 colle at a time
1) Alternate between physics and english * 1) Alternate between physics and english
2) Pattern for math colles is exactly 3-1-3-1-... * 2) Pattern for math colles is exactly 3-1-3-1-...
3) Between 1 and 2 colles per week and per group (exclusing special colles such as Info) * 3) Between 1 and 2 colles per week and per group (exclusing special colles such as Info)
4) Special colles (aka INFO) at least 1 every 6 weeks * 4) Special colles (aka INFO) at least 1 every 6 weeks
*/
int end_id = get_next_friday(edt, len_edt, end); // index of first date that is later than end int end_id = get_next_friday(edt, len_edt, end); // index of first date that is later than end
if(end_id == -1) { if(end_id == -1) {
@ -158,7 +162,6 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
// 2) Math colles // 2) Math colles
// version 2 // version 2
/*
int math = 0; int math = 0;
int abort_2 = 0; int abort_2 = 0;
for(int i = end_id-1; i >= 0+abort_2*(end_id); i--) { for(int i = end_id-1; i >= 0+abort_2*(end_id); i--) {
@ -185,7 +188,7 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
if(edt[i].group == grp && edt[i].mat == MATH) { if(edt[i].group == grp && edt[i].mat == MATH) {
math += 1; math += 1;
} }
}*/ }
int t = 0; int t = 0;
int math = 0; int math = 0;
@ -291,7 +294,6 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
return true; return true;
} }
/*
for(int i = end_id-1; i >= 0; i--) { for(int i = end_id-1; i >= 0; i--) {
if(i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4)) { if(i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4)) {
// Check week // Check week

View File

@ -13,7 +13,7 @@ int get_next_friday(creneau* edt, int len_creneau, date d);
int get_fst_offset(creneau* edt, date d); int get_fst_offset(creneau* edt, date d);
bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end); //bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end);
int heuristique_MP2I(creneau* edt, int len_edt, int grp, date end); int heuristique_MP2I(creneau* edt, int len_edt, int grp, date end);

View File

@ -4,9 +4,12 @@
#include <stdbool.h> #include <stdbool.h>
/* Feuilles mortes :
extern int* stats; extern int* stats;
extern int* n_colles; extern int* n_colles;
*/
typedef enum topic {NOTHING, MATH, PHYSICS, ENGLISH, FRENCH, INFO} topic; typedef enum topic {NOTHING, MATH, PHYSICS, ENGLISH, FRENCH, INFO} topic;
// colles subjects // colles subjects