Definition variables PCCTest

This commit is contained in:
Marie Brunetto 2023-04-19 17:00:27 +02:00
parent 31222aaf62
commit bda717febc
2 changed files with 46 additions and 24 deletions

View file

@ -33,8 +33,6 @@ import org.insa.graphs.model.Graph;
import org.insa.graphs.model.Path;
import org.insa.graphs.model.io.BinaryGraphReader;
import org.insa.graphs.model.io.BinaryPathReader;
import org.insa.graphs.model.io.GraphReader;
import org.insa.graphs.model.io.PathReader;
import org.insa.graphs.algorithm.ArcInspector;
import org.insa.graphs.algorithm.ArcInspectorFactory;
@ -42,37 +40,63 @@ import org.insa.graphs.algorithm.shortestpath.DijkstraAlgorithm;
import org.insa.graphs.algorithm.shortestpath.ShortestPathData;
public class PCCTest{
final static ArrayList<String> mapNames = new ArrayList<>();
final static ArrayList<String> pathNames = new ArrayList<>();
final static ArrayList<Graph> graphs = new ArrayList<>();
final static ArrayList<Path> paths = new ArrayList<>();
final static ArrayList<ArcInspector> arcInspectors = new ArrayList<>();
private static ShortestPathData DataSF_INSA, DataSF_France, DataSF_HauteGaronne, DataVL_INSA, DataVL_France, DataVL_HauteGaronne, DataVT_INSA, DataVT_France, DataVT_HauteGaronne;
@BeforeClass
public static void initAll() throws Exception
{
final String nomUser = "brunetto";
// Visit these directory to see the list of available files on Commetud.
final String mapName = "/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Maps/insa.mapgr";
final String pathName = "/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Paths/path_fr31insa_rangueil_r2.path";
// Create a graph reader.
final GraphReader reader = new BinaryGraphReader(
new DataInputStream(new BufferedInputStream(new FileInputStream(mapName))));
//Récupération des cartes
mapNames.add("/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Maps/insa.mapgr");
mapNames.add("/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Maps/france.mapgr");
mapNames.add("/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Maps/haute-garonne.mapgr");
//Recupération des chemins
pathNames.add("/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Paths/path_fr31insa_rangueil_r2.path");
pathNames.add("/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Paths/path_fr_insa_tour.path");
pathNames.add("/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Paths/path_fr31_insa_aeroport_length.path");
// Read the graph.
final Graph graph = reader.read();
// Extraction des données des cartes et chemins
for(int i = 0; i<3; i++)
{
graphs.set(i,new BinaryGraphReader(new DataInputStream(new BufferedInputStream(new FileInputStream(mapNames.get(i))))).read());
paths.set(i,new BinaryPathReader(new DataInputStream(new BufferedInputStream(new FileInputStream(pathNames.get(i))))).readPath(graphs.get(i)));
}
/*
graphs.add(new BinaryGraphReader(new DataInputStream(new BufferedInputStream(new FileInputStream(mapNames.get(0))))).read());
graphs.add(new BinaryGraphReader(new DataInputStream(new BufferedInputStream(new FileInputStream(mapNames.get(1))))).read());
// Create a PathReader.
final PathReader pathReader = new BinaryPathReader(
new DataInputStream(new BufferedInputStream(new FileInputStream(pathName))));
paths.add(new BinaryPathReader(new DataInputStream(new BufferedInputStream(new FileInputStream(pathNames.get(0))))).readPath(graphs.get(0)));
paths.add(new BinaryPathReader(new DataInputStream(new BufferedInputStream(new FileInputStream(pathNames.get(1))))).readPath(graphs.get(1)));
paths.add(new BinaryPathReader(new DataInputStream(new BufferedInputStream(new FileInputStream(pathNames.get(2))))).readPath(graphs.get(2)));*/
// Creation des filtres
// Read the path.
final Path path = pathReader.readPath(graph);
arcInspectors.set(0, ArcInspectorFactory.getAllFilters().get(0)) ; //Sans Filtres
arcInspectors.set(1, ArcInspectorFactory.getAllFilters().get(1)); //Voiture, longueur
arcInspectors.set(2, ArcInspectorFactory.getAllFilters().get(2)); //Voiture, temps
final ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0) ;
//Créations des données pour les algos
ShortestPathData theData = new ShortestPathData(graph, path.getOrigin(), path.getDestination(), arcInspector);
//ArcInspectorFactory liste d'ArcInspectors avec permissions etc existants en static
DijkstraAlgorithm dji = new DijkstraAlgorithm(theData);
DataSF_INSA = new ShortestPathData(graphs.get(0), paths.get(0).getOrigin(), paths.get(0).getDestination(), arcInspectors.get(0));
DataSF_France = new ShortestPathData(graphs.get(1), paths.get(1).getOrigin(), paths.get(1).getDestination(), arcInspectors.get(0));
DataSF_HauteGaronne = new ShortestPathData(graphs.get(2), paths.get(2).getOrigin(), paths.get(2).getDestination(), arcInspectors.get(0));
DataVL_INSA = new ShortestPathData(graphs.get(0), paths.get(0).getOrigin(), paths.get(0).getDestination(), arcInspectors.get(1));
DataVL_France = new ShortestPathData(graphs.get(1), paths.get(1).getOrigin(), paths.get(1).getDestination(), arcInspectors.get(1));
DataVL_HauteGaronne = new ShortestPathData(graphs.get(2), paths.get(2).getOrigin(), paths.get(2).getDestination(), arcInspectors.get(1));
DataVT_INSA = new ShortestPathData(graphs.get(0), paths.get(0).getOrigin(), paths.get(0).getDestination(), arcInspectors.get(2));
DataVT_France = new ShortestPathData(graphs.get(1), paths.get(1).getOrigin(), paths.get(1).getDestination(), arcInspectors.get(2));
DataVT_HauteGaronne = new ShortestPathData(graphs.get(2), paths.get(2).getOrigin(), paths.get(2).getDestination(), arcInspectors.get(2));
System.out.println("");
}
}

View file

@ -20,10 +20,8 @@ import org.insa.graphs.model.io.PathReader;
import org.insa.graphs.algorithm.ArcInspector;
import org.insa.graphs.algorithm.shortestpath.DijkstraAlgorithm;
import org.insa.graphs.algorithm.shortestpath.ShortestPathData;
/*
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;*/
public class Launch {
@ -86,7 +84,7 @@ public class Launch {
//ArcInspectorFactory liste d'ArcInspectors avec permissions etc existants en static
DijkstraAlgorithm dji = new DijkstraAlgorithm(theData);
System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");*/
System.out.println("");*/
}