You are on page 1of 2

Table utilisateur:

CREATE TABLE "utilisateur" ("ID" INTEGER NOT NULL UNIQUE,"login" TEXT NOT NULL
UNIQUE,"password" TEXT NOT NULL,"imageProfilPath"TEXT,PRIMARY KEY("ID"
AUTOINCREMENT));

#################
Table projet:
CREATE TABLE "projet" ("ID" INTEGER NOT NULL UNIQUE,"titre" TEXT NOT NULL
UNIQUE,"note" REAL,PRIMARY KEY("ID" AUTOINCREMENT));

#################
CREATE TABLE "ressource" ("ID" INTEGER NOT NULL UNIQUE,"nom" TEXT NOT NULL
UNIQUE,"idProjet" INTEGER,PRIMARY KEY("ID" AUTOINCREMENT),FOREIGN KEY("idProjet")
REFERENCES "projet"("ID"));
################
CREATE TABLE "contribution" ("ID" INTEGER NOT NULL UNIQUE,"idUtilisateur"
INTEGER,"idProjet" INTEGER,"type" TEXT NOT NULL,PRIMARY KEY("ID"
AUTOINCREMENT),FOREIGN KEY("idProjet") REFERENCES "projet"("ID"),FOREIGN
KEY("idUtilisateur") REFERENCES "utilisateur"("ID"));
##############
CREATE TABLE "commentaire" ("ID" INTEGER NOT NULL UNIQUE,"idProjet"
INTEGER,"contenue" TEXT,PRIMARY KEY("ID" AUTOINCREMENT),FOREIGN KEY("idProjet")
REFERENCES "projet"("ID"));
pu= new double[M.size() - 1];
int [] indexes = new int[M.size() - 1];
for (int i = 1, j = 0; i < R.size(); i++, j++) {
System.out.println("d : " + R.get(i).get(a1));
System.out.println("D : " + R.get(i).get(R.get(0).size() - 1));

//test if elements of the same column as pivot are positive (non-


negativity constraint)

/** since we are searching for minimal values to be stored in the


residus array
* we can't divide by negative number (solution irrealisable :>) nor 0
of course:
* so we take 1000000 for example as value so that we can ignore this
case explained above.
*/
if(R.get(i).get(a1) <= 0) residus[j] = 1000000;
else{
residus[j] = R.get(i).get(R.get(0).size() - 1) / R.get(i).get(a1);
}
indexes[j] = i;
}

//Debug stuffs
System.out.println("Array: residus : ");
for (int i = 0; i < residus.length; i++) {
System.out.print(residus[i] + " ");
}
double minima2 = Arrays.stream(residus).min().getAsDouble();

System.out.println("*************************");

//Save the index row in b1 variable


int b1 = -1;
// A little bug solved with hard coding (binarySearch() method didn't do
its job :>)
for (int k = 0; k < residus.length; k++)
{
if(residus[k] == minima2) b1 = k;
}

//We return the pivot element besides its i,j indexes

ArrayList<Double> returned = new ArrayList<>();

returned.add(R.get(indexes[b1]).get(a1));
returned.add((double) indexes[b1]);
returned.add((double) a1);

return returned;
}

You might also like