From 6695b259a8b041d499d15c77cb581884ea63f352 Mon Sep 17 00:00:00 2001
From: "juliano.souzaluz" <juliano.souza-luz@etu.hesge.ch>
Date: Wed, 18 Jan 2023 17:40:04 +0100
Subject: [PATCH] network 4 fonctionnel

---
 src/Main.java    | 6 +++---
 src/Simplex.java | 5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/Main.java b/src/Main.java
index c6eeab0..523b0ea 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -85,13 +85,13 @@ public class Main {
             line++;
         }
         // Print
-        eq.printEq();
+        if (debugging) eq.printEq();
 
         // Tableau initial
         Simplex spx = new Simplex(eq.getMat().getLine(), eq.getMat().getLine() + eq.getMat().getCol() + 1,
                 line, contraintes, debugging);
         spx.createSimplex(eq, contraintes);
-        if(debugging) spx.printSimplex(spx.getMatEcart(), "Tableau initial");
+        if (debugging) spx.printSimplex(spx.getMatEcart(), "Tableau initial");
 
         // true = phase 1 membres de droite pas admissible | false = phase 2 membres de droite admissible
         if (spx.which_phase()) {
@@ -106,7 +106,7 @@ public class Main {
             // Juste le pivot sur la matrice d'écart
             spx.pivot(spx.getMatEcart(), false);
             // Si mode débogue, afficher chaque pivot
-            if(debugging) {
+            if (debugging) {
                 spx.printSimplex(spx.getMatEcart(), "Résultat");
                 System.out.println("Nombre de pivot: " + spx.getNbPivot());
             }
diff --git a/src/Simplex.java b/src/Simplex.java
index 4560713..acc58ec 100644
--- a/src/Simplex.java
+++ b/src/Simplex.java
@@ -8,7 +8,7 @@ public class Simplex {
     private final int ligne; // Ligne
     private final int colonne; // Colonne
     private int nbPivot;
-    private static final double EPSILON = 1E-7;
+    private static final double EPSILON = 1E-40;
     private final int nbContraintes;
 
     public Matrix getMatEcart() {
@@ -186,7 +186,6 @@ public class Simplex {
         int id = ligneSortante(mat, firstNeg, phase);
         // Selection de la valeur du pivot
         double val_pivot = mat.getData(id, firstNeg);
-
         // Application du pivot de gauss sur la ligne du pivot, pour avoir une "référence" de coefficient pour la suite
         for (int i = 0; i < mat.getCol(); i++) {
             mat.setData(id, i, mat.getData(id, i) / val_pivot);
@@ -233,7 +232,7 @@ public class Simplex {
         int id = 0;
         // La première vérification permet de s'assurer qu'on ne tombe pas sur un 0
         // La 2ᵉ vérification permet de vérifier qu'au plus profond de la matrice il s'agit bien d'un négatif
-        while (!(mat.getData(id, y) > 0) && mat.getData(id, depth) >= 0) {
+        while (!(mat.getData(id, y) > 0)) {
             id++;
         }
 
-- 
GitLab