diff --git a/Travail_de_session/AbsenceSchedules/AbsencesVector.java b/Travail_de_session/AbsenceSchedules/AbsencesVector.java index 7e6f8a8..e285198 100644 --- a/Travail_de_session/AbsenceSchedules/AbsencesVector.java +++ b/Travail_de_session/AbsenceSchedules/AbsencesVector.java @@ -6,7 +6,7 @@ import jdistlib.rng.RandomEngine; public class AbsencesVector { private int[] AbsencesVector; private double probAbsence = 0.02; - private double probReturn = 0.50; + private double probReturn = 0.80; public AbsencesVector(int length, RandomEngine r) { diff --git a/Travail_de_session/InitialSchedules/ModelInitialSchedules.java b/Travail_de_session/InitialSchedules/ModelInitialSchedules.java index 3db4564..f899b7f 100644 --- a/Travail_de_session/InitialSchedules/ModelInitialSchedules.java +++ b/Travail_de_session/InitialSchedules/ModelInitialSchedules.java @@ -192,14 +192,14 @@ public class ModelInitialSchedules { // Contrainte de bris de symétrie: // chaque horaire d'employé est léxicographiquement inférieure à la suivante, par type d'employé // Ne fonctionne pas avec l'heuristique par défaut - /*for (int employee = 0; employee < (this.maxPartTimeEmployee-1); employee++){ - chocoModelInitialSchedules.lexLessEq(this.workPeriodsSchedulesOfPartTimeEmployees[employee], - this.workPeriodsSchedulesOfPartTimeEmployees[employee+1]).post(); - } +// for (int employee = 0; employee < (this.maxPartTimeEmployee-1); employee++){ +// chocoModelInitialSchedules.lexLessEq(this.workPeriodsSchedulesOfPartTimeEmployees[employee], +// this.workPeriodsSchedulesOfPartTimeEmployees[employee+1]).post(); +// } for (int employee = 0; employee < (this.maxFullTimeEmployee-1); employee++){ chocoModelInitialSchedules.lexLessEq(this.workPeriodsSchedulesOfFullTimeEmployees[employee], this.workPeriodsSchedulesOfFullTimeEmployees[employee+1]).post(); - }*/ + } } diff --git a/Travail_de_session/MainClass.java b/Travail_de_session/MainClass.java index d7248c5..53ef6db 100644 --- a/Travail_de_session/MainClass.java +++ b/Travail_de_session/MainClass.java @@ -7,6 +7,7 @@ import org.chocosolver.solver.Solver; import org.chocosolver.solver.exception.ContradictionException; import ScheduleUtil.SchedulesArray; import AbsenceSchedules.AbsenceSchedulesArray; +import SchedulesRecovery.RecoveredSchedulesArray; import java.util.ArrayList; import java.util.List; @@ -19,15 +20,16 @@ public class MainClass { public static void main(String[] args) { // Le main ne devrait contenir que les 5 fonctions correspondantes aux etapes du pipeline - List initialSchedulesArrayList = generateInitialSchedule(); + List initialSchedulesArrayList = generateInitialSchedules(); - GenerateAbsencesSchedule(initialSchedulesArrayList); - // Creer les simulation avec une autre classe. Faire un nouveau package de fonctions. + List absenceSchedulesArrayList = GenerateAbsencesSchedules(initialSchedulesArrayList); + + List recoveredSchedulesArrayList = GenerateRecoveredSchedules(absenceSchedulesArrayList); // Algo de recouvrement d'absences. Faire un nouveau package de fonctions. // Trouver meilleure solution et l'afficher. } - private static List generateInitialSchedule() { + private static List generateInitialSchedules() { List initialSchedulesArrayList = new ArrayList<>(); @@ -51,7 +53,7 @@ public class MainClass { solverInitialSchedules.showDashboard(); /*solverInitialSchedules.setSearch(Search.domOverWDegSearch(myModelInitialSchedules.allWorkPeriods));*/ // solverInitialSchedules.setRestartOnSolutions(); /*Sans restart, toutes les horaires sont identiques*/ - solverInitialSchedules.limitSolution(2); + solverInitialSchedules.limitSolution(5); //solverInitialSchedules.limitTime(10000); List myInitialSchedulesSolutions; // myInitialSchedulesSolutions = solverInitialSchedules.findAllOptimalSolutions @@ -73,18 +75,32 @@ public class MainClass { } - private static void GenerateAbsencesSchedule(List initialSchedulesArrayList) { + private static List GenerateAbsencesSchedules(List initialSchedulesArrayList) { RandomEngine r = new MersenneTwister(123456789); List absenceSchedulesArrayList = new ArrayList<>(); for (SchedulesArray initialSchedule : initialSchedulesArrayList) { - -// SchedulesArray copyInitialSchedule = initialSchedule.clone(); AbsenceSchedulesArray absenceSchedule = new AbsenceSchedulesArray(initialSchedule); absenceSchedule.generateAbsences(r); absenceSchedulesArrayList.add(absenceSchedule); } // Pour afficher les horaires avec absence SchedulesWindows.ShowSchedulesFrame absenceSchedulesViewer = new SchedulesWindows.ShowSchedulesFrame(absenceSchedulesArrayList, "Absence Schedules"); + + return absenceSchedulesArrayList; + } + + private static List GenerateRecoveredSchedules(List absenceSchedulesArrayList) { + + List recoveredSchedulesArrayList = new ArrayList<>(); + for (SchedulesArray absenceSchedule : absenceSchedulesArrayList) { + RecoveredSchedulesArray recoveredSchedule = new RecoveredSchedulesArray(absenceSchedule); + recoveredSchedule.recoverAbsenceScheduleOptimally(); + recoveredSchedulesArrayList.add(recoveredSchedule); + } + // Pour afficher les horaires avec absence + SchedulesWindows.ShowSchedulesFrame recoveredSchedulesViewer = new SchedulesWindows.ShowSchedulesFrame(recoveredSchedulesArrayList, "Recovered Schedules"); + + return recoveredSchedulesArrayList; } } diff --git a/Travail_de_session/SchedulesRecovery/RecoveredSchedulesArray.java b/Travail_de_session/SchedulesRecovery/RecoveredSchedulesArray.java new file mode 100644 index 0000000..916137d --- /dev/null +++ b/Travail_de_session/SchedulesRecovery/RecoveredSchedulesArray.java @@ -0,0 +1,24 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package SchedulesRecovery; + +import AbsenceSchedules.AbsenceSchedulesArray; +import ScheduleUtil.SchedulesArray; + +/** + * + * @author frabe + */ +public class RecoveredSchedulesArray extends AbsenceSchedulesArray{ + + public RecoveredSchedulesArray(SchedulesArray myScheduleArray){ + super(myScheduleArray); + } + + public void recoverAbsenceScheduleOptimally() { + + } +}