SolverInput.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Type used to communicate the problem to be optimized to the serveur
  2. export type Skill = {
  3. id: number;
  4. name: string;
  5. isTeachable: boolean;
  6. isPreference: boolean;
  7. };
  8. export type AssignementPair = {
  9. slotId: string;
  10. volonteerId: number;
  11. isFixed?: boolean;
  12. };
  13. export type TimeslotRaw = {
  14. id: string;
  15. startTime: string;
  16. endTime: string;
  17. skillsId: Array<number>;
  18. minAttendee: number;
  19. maxAttendee: number;
  20. };
  21. export type VolonteerRaw = {
  22. id: number;
  23. skillsId: Array<number>;
  24. };
  25. export type MealSlot = {
  26. id: string;
  27. startTime: string;
  28. endTime: string;
  29. maxAttendee: number;
  30. };
  31. export type SolverInput = {
  32. constraints: Array<Skill>;
  33. mealAssignements: Array<AssignementPair>;
  34. volonteerList: Array<VolonteerRaw>;
  35. mealSlots: Array<MealSlot>;
  36. timeslots: Array<TimeslotRaw>;
  37. assignements: Array<AssignementPair>;
  38. };
  39. export type SolverOutput = {
  40. assignements: Array<AssignementPair>;
  41. message: string;
  42. score: string;
  43. explanation: string;
  44. };
  45. export type JustificationObject = {
  46. type: "Assignement" | "MealAssignement" | "MealSlot";
  47. slotId: string;
  48. volonteerId: number;
  49. };
  50. export type HardConstraint =
  51. | "Meal not initialized"
  52. | "Timeslot not initialized"
  53. | "Volonteer conflict"
  54. | "Volonteer Meal conflict"
  55. | "Competence conflict"
  56. | "Meal max attendee";
  57. export type ScoreExplanation = {
  58. [constraintName in HardConstraint]: Array<Array<string | JustificationObject>>;
  59. };