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

network 4 fonctionnel

parent 2a9c90eb
No related branches found
No related tags found
No related merge requests found
......@@ -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());
}
......
......@@ -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++;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment