colloscope/src/algorithm.h

82 lines
2.9 KiB
C
Executable File

/*
* Colloscope - A program that generates a colloscope for French 'classes prépas'
* Copyright (C) 2024 Alexandre Aboujaib
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef ALGORITHM_H_INCLUDED
#define ALGORITHM_H_INCLUDED
#include "structure.h"
bool is_equal_date(date d1, date d2);
int get_date_index(creneau* edt, int len_creneau, date d);
array get_all_date_index(creneau* edt, int len_edt, date d);
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);
//int heuristique_MP2I(creneau* edt, int len_edt, int grp, date end);
colleur *get_colleurs(colleur *cl, int len_cl, date d, int *how_many);
void add_colle(creneau *edt, colleur *chads, int grp, int id_edt, int id_chad);
void remove_colle(creneau *edt, int id_edt);
void move_colle(creneau* edt, int len_edt, int id_src, int id_dest);
void swap_colle(creneau* edt, int len_edt, int id_src, int id_dest);
int mem_id(creneau* edt, int len_edt, int grp, char* colleur, int offset);
bool is_overlap(creneau *edt, int len_edt, int id);
bool is_overlap_creneau(creneau* edt, int len_edt, int id, int grp);
int free_math_space(creneau *edt, int len_edt, int id);
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, int math_halt, int info_app);
void write_to_file(char *filename, creneau *edt, int len_edt);
int score(creneau *edt, int len_edt, int grp, int n_weeks);
int get_colleur_id(colleur* dudes, int n_dudes, char* target);
char* get_name_from_id(colleur* dudes, int n_dudes, int id);
topic get_mat_from_id(colleur* dudes, int n_dudes, int id);
int** generate_matrix(int lines, int columns, int def);
void destroy_matrix(int** m, int li);
bool retreive_indexes(creneau* edt, int len_edt, int* p1, int* p2, int g1, int g2, char* n1, char* n2, int n_weeks);
int** occurencies(creneau* edt, int len_edt, colleur* dudes, int n_groups, int n_colleurs, int n_weeks, bool is_debug);
void copy_matrix(int** src, int lines, int col, int** dest);
void aux_2(creneau *edt, int len_edt, colleur *chads, int len_chads, int n_groups, int n_weeks, int n_sim, char *outname, int math_halt, int info_app);
#endif