Skip to content
Snippets Groups Projects
Commit 6572fcc7 authored by juliano.souzaluz's avatar juliano.souzaluz
Browse files

Update Main.java

parent dd934483
No related branches found
No related tags found
No related merge requests found
...@@ -40,8 +40,11 @@ public class Main { ...@@ -40,8 +40,11 @@ public class Main {
*/ */
public static void main(String[] args) throws FileNotFoundException, RuntimeException { public static void main(String[] args) throws FileNotFoundException, RuntimeException {
long start = System.nanoTime(); long start = System.nanoTime();
Scanner readFile = new Scanner(System.in);
File f = new File("src/input.txt"); System.out.println("Entrez le nom du fichier à tester, il doit se situer dans le dossier src.");
String nameFile = readFile.nextLine();
//String nameFile = "input_test2.txt";
File f = new File("src/" + nameFile);
Scanner sc = new Scanner(f); Scanner sc = new Scanner(f);
String[] elements; String[] elements;
int sousCondition = nbSc(sc), line = 0; int sousCondition = nbSc(sc), line = 0;
...@@ -77,7 +80,7 @@ public class Main { ...@@ -77,7 +80,7 @@ public class Main {
// Tableau initial // Tableau initial
Simplex spx = new Simplex(eq.getMat().getX(), eq.getMat().getX() + eq.getMat().getY() + 1, line); Simplex spx = new Simplex(eq.getMat().getX(), eq.getMat().getX() + eq.getMat().getY() + 1, line);
spx.createSimplex(eq, contraintes); spx.createSimplex(eq, contraintes);
spx.printSimplex(spx.getMatEcart(), "Tableau", 0); spx.printSimplex(spx.getMatEcart(), "Tableau initial", 0);
// true = phase 1 membres de droite pas admissible | false = phase 2 membres de droite admissible // true = phase 1 membres de droite pas admissible | false = phase 2 membres de droite admissible
int phase = spx.which_phase(); int phase = spx.which_phase();
...@@ -85,7 +88,7 @@ public class Main { ...@@ -85,7 +88,7 @@ public class Main {
spx.tabAux(phase); spx.tabAux(phase);
} else { } else {
spx.pivot(spx.getMatEcart()); spx.pivot(spx.getMatEcart());
spx.printSimplex(spx.getMatEcart(), "pivot", 3); spx.printSimplex(spx.getMatEcart(), "Résultat", 3);
System.out.println("Nombre de pivot: " + spx.getNbPivot()); System.out.println("Nombre de pivot: " + spx.getNbPivot());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment