|
|
|
@ -1,35 +1,29 @@
|
|
|
|
|
#include "../includes/main.h"
|
|
|
|
|
|
|
|
|
|
ListeAttente* traiterTaches(Tache **tabTache)
|
|
|
|
|
void traiterTaches(Tache *tabTache[])
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int dateCourante;
|
|
|
|
|
Tache *tacheCourante;
|
|
|
|
|
Tache *successeur;
|
|
|
|
|
Liste successeurs;
|
|
|
|
|
ListeAttente *file = initialiserFileAttente();
|
|
|
|
|
ListeAttente file;
|
|
|
|
|
Liste succCourant;
|
|
|
|
|
file.debut = 0;
|
|
|
|
|
file.fin = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < TMAXTRAV; i++)
|
|
|
|
|
for (int i = 0; i < TMAXTRAV; i++)
|
|
|
|
|
if (tabTache[i]->nbPred == 0)
|
|
|
|
|
enfiler(file, tabTache[i]);
|
|
|
|
|
enfiler(&file, tabTache[i]);
|
|
|
|
|
|
|
|
|
|
while (!estVide(file))
|
|
|
|
|
// Etape courante (utilisation d’une boucle)
|
|
|
|
|
while (!estVide(&file))
|
|
|
|
|
{
|
|
|
|
|
tacheCourante = defiler(file);
|
|
|
|
|
dateCourante = tacheCourante->dateDebut;
|
|
|
|
|
successeurs = tacheCourante->succ;
|
|
|
|
|
|
|
|
|
|
while (successeurs)
|
|
|
|
|
Tache *tacheActuelle = defiler(&file);
|
|
|
|
|
succCourant = tacheActuelle->succ;
|
|
|
|
|
while (succCourant)
|
|
|
|
|
{
|
|
|
|
|
successeur = trouverTache(tabTache, TMAXTRAV, successeurs->tache);
|
|
|
|
|
successeur->dateDebut = max(successeur->dateDebut, dateCourante + tacheCourante->duree);
|
|
|
|
|
Tache *successeur = trouverTache(tabTache, TMAXTRAV, succCourant->tache);
|
|
|
|
|
successeur->dateDebut = max(successeur->dateDebut, tacheActuelle->dateDebut + tacheActuelle->duree);
|
|
|
|
|
successeur->nbPred--;
|
|
|
|
|
|
|
|
|
|
if (successeur->nbPred == 0)
|
|
|
|
|
enfiler(file, successeur);
|
|
|
|
|
successeurs = successeurs->nxt;
|
|
|
|
|
enfiler(&file, successeur);
|
|
|
|
|
succCourant = succCourant->nxt;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (file);
|
|
|
|
|
}
|
|
|
|
|