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

Update Simplex.java

parent 4a51d62a
No related branches found
No related tags found
No related merge requests found
...@@ -74,17 +74,23 @@ public class Simplex { ...@@ -74,17 +74,23 @@ public class Simplex {
this.matEcart.setData(line, j, res); this.matEcart.setData(line, j, res);
} }
for (int i = 0; i < this.x; i++) for (int i = 0; i < this.x; i++)
//tabRes[j] -= Math.abs(this.matEcart.getData(i, j));
tabRes[j] -= this.matEcart.getData(i, j); tabRes[j] -= this.matEcart.getData(i, j);
tabRes[j] -= 1; tabRes[j] -= 1;
} }
// -2 car => tabRes[(tabRes.length-1) - (this.nbSousCondition - 1)];
tabRes[tabRes.length - 1] = tabRes[tabRes.length - this.nbSousCondition - 2]; tabRes[tabRes.length - 1] = tabRes[tabRes.length - this.nbSousCondition - 2];
tabRes[tabRes.length - this.nbSousCondition - 2] = 0;
for (int i = 0; i < this.tabAux.getX(); i++) { for (int i = 0; i < this.tabAux.getX(); i++) {
for (int j = 0; j < this.tabAux.getY(); j++) { for (int j = 0; j < this.tabAux.getY(); j++) {
if (i < this.matEcart.getX() && j < this.matEcart.getY()) if (i < this.matEcart.getX() && j < this.matEcart.getY())
this.tabAux.setData(i, j, this.matEcart.getData(i, j)); 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]); this.tabAux.setData(i, j, tabRes[j]);
else
else // membre de droite à la fin du tab
this.tabAux.setData(i, j, this.matEcart.getData(i, j - this.matEcart.getX())); this.tabAux.setData(i, j, this.matEcart.getData(i, j - this.matEcart.getX()));
} }
} }
...@@ -146,7 +152,7 @@ public class Simplex { ...@@ -146,7 +152,7 @@ public class Simplex {
} }
} }
} }
//mat.matrixPrint("Pivot numéro " + this.nbPivot, 2); mat.matrixPrint("Pivot numéro " + this.nbPivot, 2);
for (int j = 0; j < mat.getY(); j++) for (int j = 0; j < mat.getY(); j++)
if (signe(mat.getData(mat.getX() - 1, j))) { if (signe(mat.getData(mat.getX() - 1, j))) {
has_neg = true; has_neg = true;
...@@ -160,9 +166,10 @@ public class Simplex { ...@@ -160,9 +166,10 @@ public class Simplex {
} }
// TODO : A REFAIRE POUR SWITCH DE Y AU CAS OU
int ligneSortante(Matrix mat, int y) { int ligneSortante(Matrix mat, int y) {
int id = 0; int id = 0;
while (mat.getData(id, y) <= 0) { while (!(mat.getData(id, y) > 0)) {
id++; id++;
} }
double tmp = mat.getData(id, mat.getY() - 1) / mat.getData(id, y); double tmp = mat.getData(id, mat.getY() - 1) / mat.getData(id, y);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment