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

push

parent db0368c0
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ public class Main { ...@@ -44,7 +44,7 @@ public class Main {
System.out.println("Entrez le nom du fichier à tester, il doit se situer dans le dossier src."); System.out.println("Entrez le nom du fichier à tester, il doit se situer dans le dossier src.");
//String nameFile = readFile.nextLine(); //String nameFile = readFile.nextLine();
String nameFile = "network1.txt"; String nameFile = "network1.txt";
//String nameFile = "inputNonAdmissible.txt"; //String nameFile = "input.txt";
File f = new File("src/" + nameFile); File f = new File("src/" + nameFile);
Scanner sc = new Scanner(f); Scanner sc = new Scanner(f);
String[] elements; String[] elements;
......
...@@ -67,13 +67,15 @@ public class Simplex { ...@@ -67,13 +67,15 @@ public class Simplex {
} }
void tabAux(int line) { void tabAux(int line) {
System.out.println("");
double[] tabRes = new double[this.y + this.nbSousCondition + 1]; double[] tabRes = new double[this.y + this.nbSousCondition + 1];
Arrays.fill(tabRes, 1.0); Arrays.fill(tabRes, 1.0);
for (int i = 0; i < this.x; i++) { for (int i = 0; i < this.y; i++) {
for (int j = 0; j < this.y; j++) { for (int j = 0; j < this.x; j++) {
double data = this.matEcart.getData(this.x, j); if (this.matEcart.getData(j, this.y - 1) < 0) {
if (data < 0) { if (this.matEcart.getData(j, i) != 0) {
System.out.println(data); this.matEcart.setData(j, i, -this.matEcart.getData(j, i));
}
} }
} }
} }
...@@ -85,7 +87,6 @@ public class Simplex { ...@@ -85,7 +87,6 @@ public class Simplex {
tabRes[j] = tmpSum; tabRes[j] = tmpSum;
} }
// -2 car => tabRes[(tabRes.length-1) - (this.nbSousCondition - 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; tabRes[tabRes.length - this.nbSousCondition - 2] = 0;
...@@ -100,10 +101,9 @@ public class Simplex { ...@@ -100,10 +101,9 @@ public class Simplex {
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()));
} }
} }
System.out.println();
} }
this.tabAux.printTabAux("Tableau auxiliaire", this.nbContraintes, this.nbSousCondition, this.tabAux.getY() - this.matEcart.getY() - 1); this.tabAux.printTabAux("Tableau auxiliaire", this.nbContraintes, this.nbSousCondition, this.tabAux.getY() - this.matEcart.getY() - 1);
//pivot(this.tabAux); pivot(this.tabAux);
double solutionOptimale = this.tabAux.getData(this.tabAux.getX() - 1, this.tabAux.getY() - 1); double solutionOptimale = this.tabAux.getData(this.tabAux.getX() - 1, this.tabAux.getY() - 1);
if (solutionOptimale > 0 + EPSILON) { if (solutionOptimale > 0 + EPSILON) {
System.out.println("Il n'y a pas de solutions admissibles pour ce problème."); System.out.println("Il n'y a pas de solutions admissibles pour ce problème.");
...@@ -115,7 +115,7 @@ public class Simplex { ...@@ -115,7 +115,7 @@ public class Simplex {
res.matrixFill(res.getX(), res.getY(), tabAux.getDatas()); res.matrixFill(res.getX(), res.getY(), tabAux.getDatas());
res.matrixPrint("Petit tableau", 2); res.matrixPrint("Petit tableau", 2);
nbPivot = 0; nbPivot = 0;
//pivot(res); pivot(res);
res.matrixPrint("Résultat ", 3); res.matrixPrint("Résultat ", 3);
System.out.println("Nombre de pivot : " + nbPivot); System.out.println("Nombre de pivot : " + nbPivot);
} }
...@@ -161,7 +161,6 @@ public class Simplex { ...@@ -161,7 +161,6 @@ public class Simplex {
} }
// TODO : A REFAIRE POUR SWITCH DE Y AU CAS OU // 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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment