Compare commits

..

No commits in common. "d4f0d54bc87a2e01dc3709e76b21215e5e2100f4" and "be838127168d0482a8e38f8baed9c01442209028" have entirely different histories.

4 changed files with 12 additions and 20 deletions

View File

@ -5,10 +5,7 @@ LFLAGS=
all: bin/main
test: bin/main
bin/main MP2I-creneaux.txt 33 MP2I-colleurs.txt 16 6 15 output.csv
OBJECTS = obj/structure.o obj/algorithm.o obj/display.o obj/main.o
OBJECTS = obj/main.o obj/structure.o obj/display.o obj/algorithm.o
bin/main: bin $(OBJECTS)
$(CC) -o $@ $(LFLAGS) $(FLAGS) $(OBJECTS)

View File

@ -2,7 +2,6 @@
#include <stdlib.h>
#include <time.h>
#include "structure.h"
#include "algorithm.h"
bool is_equal_date(date d1, date d2) {
@ -60,19 +59,16 @@ int get_fst_offset(creneau* edt, 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 debug = false;
conditions (AND) :
* 0) Only 1 colle at a time
* 1) Alternate between physics and english
* 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)
* 4) Special colles (aka INFO) at least 1 every 6 weeks
/* conditions (AND) :
0) Only 1 colle at a time
1) Alternate between physics and english
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)
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
if(end_id == -1) {
@ -162,6 +158,7 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
// 2) Math colles
// version 2
/*
int math = 0;
int abort_2 = 0;
for(int i = end_id-1; i >= 0+abort_2*(end_id); i--) {
@ -188,7 +185,7 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
if(edt[i].group == grp && edt[i].mat == MATH) {
math += 1;
}
}
}*/
int t = 0;
int math = 0;
@ -294,6 +291,7 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
return true;
}
/*
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)) {
// 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);
//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);

View File

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