How to use the js-combinatorics.bigCombination function in js-combinatorics

To help you get started, we’ve selected a few js-combinatorics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chiefsmurph / robinhood-playground / analysis / smart-pms.js View on Github external
console.log(JSON.stringify(pmCache, null, 2));

    // for each day
    // sort list of pm's ordered
    // pmList: [

    // console.log(Object.keys(pmCache))
    const daysVals = [];

    const pms = Object.keys(pmCache);
    // console.log(pms, numChunks)
    if (Number(numChunks) > pms.length) {
        return null;
    }
    const cmb = Combinatorics.bigCombination(pms, Number(numChunks));
    while (a = cmb.next()) {
        console.log(a);
        const trends = filesOfInterest.map(day => {
            return a.map(pm => pmCache[pm][day]);
        });
        const avgTrends = trends.map(ts => avgArray(ts.filter(val => !!val)))
        const avgOfAvgs = avgArray(avgTrends.filter(val => !!val));
        daysVals.push({
            pmList: a,
            trends,
            avgTrends,
            avgOfAvgs
        });
    }

    // console.log(JSON.stringify(daysVals, null, 2));
github DefinitelyTyped / DefinitelyTyped / types / js-combinatorics / js-combinatorics-tests.ts View on Github external
const filteredPowers:string[][] = power.filter((i:string[]) => i.length > 0);
const allPowers:string[][] = power.toArray();
const powersCount = power.length;
const nthPower:string[] = power.nth(3);

const limitedCombination = Combinatorics.combination(["a", "b", "c"], 2);
const combination = Combinatorics.combination(["a", "b", "c"]);
const nextCombination:string[] = combination.next();
combination.forEach((i:string[]) => console.log(i));
const combinationsLengths:number[] = combination.map((i:string[]) => i.length);
const filteredCombinations:string[][] = combination.filter((i:string[]) => i.length > 0);
const allCombinations:string[][] = combination.toArray();
const combinationsCount = combination.length;

const limitedBigCombination = Combinatorics.bigCombination(["a", "b", "c"], 2);
const bigCombination = Combinatorics.bigCombination(["a", "b", "c"]);
const nextBigCombination:string[] = bigCombination.next();
bigCombination.forEach((i:string[]) => console.log(i));
const bigCombinationsLengths:number[] = bigCombination.map((i:string[]) => i.length);
const filteredBigCombinations:string[][] = bigCombination.filter((i:string[]) => i.length > 0);
const allBigCombinations:string[][] = bigCombination.toArray();
const bigCombinationsCount = bigCombination.length;

const limitedPermutation = Combinatorics.permutation(["a", "b", "c"], 2);
const permutation = Combinatorics.permutation(["a", "b", "c"]);
const nextPermutation:string[] = permutation.next();
permutation.forEach((i:string[]) => console.log(i));
const permutationsLengths:number[] = permutation.map((i:string[]) => i.length);
const filteredPermutations:string[][] = permutation.filter((i:string[]) => i.length > 0);
const allPermutations:string[][] = permutation.toArray();
const permutationsCount = permutation.length;
github DefinitelyTyped / DefinitelyTyped / types / js-combinatorics / js-combinatorics-tests.ts View on Github external
const powersLengths:number[] = power.map((i:string[]) => i.length);
const filteredPowers:string[][] = power.filter((i:string[]) => i.length > 0);
const allPowers:string[][] = power.toArray();
const powersCount = power.length;
const nthPower:string[] = power.nth(3);

const limitedCombination = Combinatorics.combination(["a", "b", "c"], 2);
const combination = Combinatorics.combination(["a", "b", "c"]);
const nextCombination:string[] = combination.next();
combination.forEach((i:string[]) => console.log(i));
const combinationsLengths:number[] = combination.map((i:string[]) => i.length);
const filteredCombinations:string[][] = combination.filter((i:string[]) => i.length > 0);
const allCombinations:string[][] = combination.toArray();
const combinationsCount = combination.length;

const limitedBigCombination = Combinatorics.bigCombination(["a", "b", "c"], 2);
const bigCombination = Combinatorics.bigCombination(["a", "b", "c"]);
const nextBigCombination:string[] = bigCombination.next();
bigCombination.forEach((i:string[]) => console.log(i));
const bigCombinationsLengths:number[] = bigCombination.map((i:string[]) => i.length);
const filteredBigCombinations:string[][] = bigCombination.filter((i:string[]) => i.length > 0);
const allBigCombinations:string[][] = bigCombination.toArray();
const bigCombinationsCount = bigCombination.length;

const limitedPermutation = Combinatorics.permutation(["a", "b", "c"], 2);
const permutation = Combinatorics.permutation(["a", "b", "c"]);
const nextPermutation:string[] = permutation.next();
permutation.forEach((i:string[]) => console.log(i));
const permutationsLengths:number[] = permutation.map((i:string[]) => i.length);
const filteredPermutations:string[][] = permutation.filter((i:string[]) => i.length > 0);
const allPermutations:string[][] = permutation.toArray();
const permutationsCount = permutation.length;