Ajout de la classe de recouvrement des horaires.
This commit is contained in:
parent
54eca9baa6
commit
fb03247b26
4 changed files with 54 additions and 14 deletions
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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();
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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<SchedulesArray> initialSchedulesArrayList = generateInitialSchedule();
|
||||
List<SchedulesArray> initialSchedulesArrayList = generateInitialSchedules();
|
||||
|
||||
GenerateAbsencesSchedule(initialSchedulesArrayList);
|
||||
// Creer les simulation avec une autre classe. Faire un nouveau package de fonctions.
|
||||
List<SchedulesArray> absenceSchedulesArrayList = GenerateAbsencesSchedules(initialSchedulesArrayList);
|
||||
|
||||
List<SchedulesArray> recoveredSchedulesArrayList = GenerateRecoveredSchedules(absenceSchedulesArrayList);
|
||||
// Algo de recouvrement d'absences. Faire un nouveau package de fonctions.
|
||||
// Trouver meilleure solution et l'afficher.
|
||||
}
|
||||
|
||||
private static List<SchedulesArray> generateInitialSchedule() {
|
||||
private static List<SchedulesArray> generateInitialSchedules() {
|
||||
|
||||
List<SchedulesArray> 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<Solution> myInitialSchedulesSolutions;
|
||||
// myInitialSchedulesSolutions = solverInitialSchedules.findAllOptimalSolutions
|
||||
|
@ -73,18 +75,32 @@ public class MainClass {
|
|||
|
||||
}
|
||||
|
||||
private static void GenerateAbsencesSchedule(List<SchedulesArray> initialSchedulesArrayList) {
|
||||
private static List<SchedulesArray> GenerateAbsencesSchedules(List<SchedulesArray> initialSchedulesArrayList) {
|
||||
|
||||
RandomEngine r = new MersenneTwister(123456789);
|
||||
List<SchedulesArray> 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<SchedulesArray> GenerateRecoveredSchedules(List<SchedulesArray> absenceSchedulesArrayList) {
|
||||
|
||||
List<SchedulesArray> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue