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

condition de retour du tableau auxiliaire à revoir

parent 6478954a
No related branches found
No related tags found
No related merge requests found
......@@ -83,10 +83,9 @@ public class Main {
int phase = spx.which_phase();
if (phase != -1) {
spx.tabAux(phase);
spx.printSimplex(spx.getTabAux(), "Tableau Auxiliaire", 3);
} else {
spx.pivot();
spx.printSimplex(spx.getMatEcart(),"pivot", 3);
spx.printSimplex(spx.getMatEcart(), "pivot", 3);
System.out.println("Nombre de pivot: " + spx.getNbPivot());
}
......
......@@ -11,9 +11,11 @@ public class Simplex {
public Matrix getTabAux() {
return tabAux;
}
public Matrix getMatEcart() {
return matEcart;
}
public int getNbPivot() {
return nbPivot;
}
......@@ -79,14 +81,31 @@ public class Simplex {
for (int j = 0; j < this.tabAux.getY(); j++) {
if (i < this.matEcart.getX() && j < this.matEcart.getY())
this.tabAux.setData(i, j, this.matEcart.getData(i, j));
else if(i == this.tabAux.getX() - 1)
else if (i == this.tabAux.getX() - 1)
this.tabAux.setData(i, j, tabRes[j]);
else
this.tabAux.setData(i, j, this.matEcart.getData(i, j-5));
this.tabAux.setData(i, j, this.matEcart.getData(i, j - this.matEcart.getX()));
}
}
if(signe(this.tabAux.getData(this.tabAux.getX(), this.tabAux.getY()))) {
this.tabAux.matrixPrint("Tableau auxiliaire ", 2);
double valLastCase = this.tabAux.getData(this.tabAux.getX() - 1, this.tabAux.getY() - 1);
// si la dernière case est négative, il faut envoyer le tableau "basique" dans la méthode du pivot
if (valLastCase < 0) {
Matrix newMatEcart = this.matEcart;
newMatEcart.matrixFill(this.matEcart.getX(), this.matEcart.getY(), this.tabAux.getDatas());
newMatEcart.matrixPrint("Nouvelle matrice ", 2);
this.matEcart = newMatEcart;
//this.matEcart = this.tabAux;
pivot();
printSimplex(getMatEcart(), "pivot", 3);
System.out.println("Nombre de pivot: " + getNbPivot());
} else if (valLastCase > 0) {
// si elle est positive , il n'y a pas de solutions admissibles
System.out.println("Il n'y a pas de solutions admissibles pour ce problème");
} else // = 0
{
System.out.println("Le min/max est 0");
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment