-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcamiMesCurtPassantPerLlocs.java
More file actions
45 lines (32 loc) · 1.32 KB
/
camiMesCurtPassantPerLlocs.java
File metadata and controls
45 lines (32 loc) · 1.32 KB
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
Atributs:
Cami optim;
Lloc desti;
ArrayList<Lloc> llocsIntermitjos;
ArrayList<boolean> passat; //inicialitzar amb llocsIntermitjos.size() posicions i totes a false.
public void camiMesCurtPassantPerLlocs(Cami actual, int o){
Candidats iCan=actual.inicialitzarCandidats(o);
while (! iCan.esFi()){
if (actual.potSerMillor(optim,iCan,"temps")){
actual.anotar(iCan,llocsIntermitjos,passat);
Iterator<Lloc> itr = llocsIntermitjos.iterator();
if (! iCan.esFi())
camiMesCurtPassantPerLlocs(actual,iCan.actual());
if (actual.esMillor(optim,"temps") & actual.Complet(desti, passat)){ //actual menys temps i actual conte desti i totes les posicions de passat==true
optim=actual;
}
actual.desanotar(iCan,llocsIntermitjos,passat);
}
iCan.seguent();
}
}
CalculadorRutes:
Candidats inicialitzarCandidats(actual,o);
Candidat:
boolean esFi();
void seguent();
Circuit:
boolean potSerMillor(Circuit optim,Candidat iCan,String comparacio);
boolean esMillor(Circuit optim,String comparacio);
void anotar(iCan,llocsIntermitjos, ArrayList<boolean> passat);
void desanotar(iCan, ArrayList<Lloc> llocsIntermitjos, ArrayList<boolean> passat);
boolean Complet(Lloc desti, passat);