[go: up one dir, main page]

Skip to content

Commit

Permalink
Clear code
Browse files Browse the repository at this point in the history
  • Loading branch information
Goneiross committed Nov 12, 2018
1 parent 7d1b4a1 commit 3b210a6
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/positiveLinearCombination.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function linearCombination(X) {
for (let i = 0; i < X.columns - 1; i++) {
tmp = vecVal - X.get(0, i);
if (tmp >= 0 && X.get(0, i) > 0) {
console.table(solutions);
solutions.set(0, i, solutions.get(0, i) + 1);
vecVal = tmp;
notTheEnd = true;
Expand Down Expand Up @@ -64,29 +63,14 @@ export function positiveLinearCombination(base, vector, options = {}) {

let nA = new NNMF(A, 1, { maxIterations: NNMFmaxIterations, version: NNMFversion });

console.table(nA.X);

for (let i = 0; i < m; i++) {
if ((nA.X.get(m - 1, 0) / delta) > nA.X.get(i, 0)) {
nA.X.set(i, 0, 0);
}
}

console.table(nA.X);

solutions = linearCombination(nA.X, nA.X.min() + Number.EPSILON);
return (solutions);
}
}
let base = new Matrix([
[0, 20, 100, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 30, 100, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 100, 5, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 100, 15, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 10, 100, 10, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 100, 10],
]);
let vector = new Matrix([[0, 20, 100, 20, 0, 0, 0, 0, 0, 5, 100, 5, 0, 0, 0, 20, 200, 20]]);
let solutions = Matrix.zeros(1, base.columns);

solutions = positiveLinearCombination(base, vector);

0 comments on commit 3b210a6

Please sign in to comment.