Compare commits
No commits in common. "d4f0d54bc87a2e01dc3709e76b21215e5e2100f4" and "be838127168d0482a8e38f8baed9c01442209028" have entirely different histories.
d4f0d54bc8
...
be83812716
5
Makefile
5
Makefile
|
@ -5,10 +5,7 @@ LFLAGS=
|
||||||
|
|
||||||
all: bin/main
|
all: bin/main
|
||||||
|
|
||||||
test: bin/main
|
OBJECTS = obj/main.o obj/structure.o obj/display.o obj/algorithm.o
|
||||||
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
|
|
||||||
bin/main: bin $(OBJECTS)
|
bin/main: bin $(OBJECTS)
|
||||||
$(CC) -o $@ $(LFLAGS) $(FLAGS) $(OBJECTS)
|
$(CC) -o $@ $(LFLAGS) $(FLAGS) $(OBJECTS)
|
||||||
|
|
||||||
|
|
22
algorithm.c
22
algorithm.c
|
@ -2,7 +2,6 @@
|
||||||
#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) {
|
||||||
|
@ -60,19 +59,16 @@ 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) {
|
||||||
|
@ -162,6 +158,7 @@ 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--) {
|
||||||
|
@ -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) {
|
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;
|
||||||
|
@ -294,6 +291,7 @@ 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
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,9 @@
|
||||||
#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
|
||||||
|
|
Loading…
Reference in New Issue