-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbkg_interior.java
More file actions
49 lines (37 loc) · 1.18 KB
/
bkg_interior.java
File metadata and controls
49 lines (37 loc) · 1.18 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
46
47
48
49
import java.util.List;
/**
*
* @author narcisbustins
*/
public class Solucionador {
private List<Lloc> primaris;
private List<PuntInteres> secundaris;
private Circuit solucio;
private List<Circuit> optima;
public void solucionarInterior(int iP){
while (iP<secundaris.size()){
PuntInteres candidat = secundaris.get(iP);
if (solucio.acceptable(candidat) & solucio.potSerMillor(candidat,optima)){
solucio.afegir(candidat);
if (! solucio.completa()){
solucionar(iP+1);
}
else {
if (solucio.esMillor(optima)){
optima = solucio;
}
}
solucio.desanotar(candidat);
}
}
}
public void solucionar(){
int iCiutat=0;
while (iCiutat < primaris.size()){
Ciutat ciutatActual = (Ciutat) primaris.get(iCiutat);
secundaris = ciutatActual.obtenirPuntInteres();
int iSecundaris = 0;
solucionarInterior(iSecundaris);
}
}
}