1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
int chercherNoeud(int nbreNoeudsTrouve, double **distanceEntreVertices, GestionNoeuds *pGestionNoeuds, Circuit *pCircuit, int noeudDebut)
{
int i,j;
int trouve;
int noeudProche = 0;
double distanceMin =1000;
int chargeProduit1 =0;
int chargeProduit2 =0;
int capaciteRestante = capaciteMax;
for(i=0;i<nbreNoeuds;i++)
{
trouve =0;//trouve est faux
j=0;
while(trouve==0&&j<taille)
{
if(i==pCircuit->tableau[j])
{
trouve = 1;
}
else
{
j++;
}
}
if(trouve==0 && distanceMin>distanceEntreVertices[noeudDebut][i])
{
chargeProduit1 += pGestionNoeuds->tableau[i].demandProduit1;
printf("\nchargeP1 %d\n",chargeProduit1);
chargeProduit2+= pGestionNoeuds->tableau[i].demandProduit2;
printf("\nchargeP2 %d\n",chargeProduit2);
capaciteRestante-=pGestionNoeuds->tableau[i].demandProduit1 + pGestionNoeuds->tableau[i].demandProduit2;
printf("\ncapaciteRes %d\n",capaciteRestante);distanceMin = distanceEntreVertices[noeudDebut][i];
if(chargeProduit1>=0&&chargeProduit2>=0&&capaciteRestante>=0)
{
noeudProche = i;
printf("noeudProche: %d\n",noeudProche);
}
}
}
return noeudProche;
}
] |
Partager