premiere version pqrt 4

master
parent 4c0a5d4570
commit 6b18c2e25e

@ -0,0 +1,61 @@
#include "../includes/structure.h"
#define MAX_TACHES 100
void calculerDatesDebut()
{
int file[MAX_TACHES];
int dateActuelle;
int indiceSucc;
int indeTache;
int deb;
int fin;
int i;
int j;
initialiserFile(file, &deb, &fin);
for (i = 0; i < nbTaches; i++)
if (tableauTaches[i].nbPred == 0)
enfiler(file, &fin, i);
dateActuelle = 0;
while (!estVide(deb, fin))
{
indiceTache = defiler(file, &deb);
Tache *t = &tableauTaches[indiceTache];
t->dateDebut = dateActuelle;
t->traite = true;
for (j = 0; j < t->nbSucc; j++)
{
indiceSucc = t->successeurs[j];
Tache *succ = &tableauTaches[indiceSucc];
if (succ->dateDebut > dateActuelle + t->duree)
succ->dateDebut = succ->dateDebut;
else
succ->dateDebut = dateActuelle + t->duree;
succ->nbPred--;
if (succ->nbPred == 0)
enfiler(file, &fin, indiceSucc);
}
dateActuelle = INT_MAX;
for (i = 0; i < nbTaches; i++)
if (!tableauTaches[i].traite && tableauTaches[i].dateDebut < dateActuelle)
dateActuelle = tableauTaches[i].dateDebut;
}
for (i = 0; i < nbTaches; i++)
if (!tableauTaches[i].traite)
printf("Toutes les taches n'ont pas ete executees\n");
exit(1);
}
int main()
{
return (0);
}
Loading…
Cancel
Save