custom-permutation 1.0.7 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,166 +1,128 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CustomPermutationGenerator = void 0;
4
- var PermutationGeneratorForSet_1 = require("./PermutationGeneratorForSet");
5
- var CustomPermutationGenerator = /** @class */ (function () {
6
- // choicesByIndex: wisheds, unChoicesByIndex: unwisheds type is not but like SlotForPerson[], since it is a object instead of array
7
- function CustomPermutationGenerator(elementList, choicesByIndex, // ChoicesByIndex is relative to sub-sch so we need elementsIndexRel, a index list of sub-sch
8
- nonChoicesByIndex, // nonChoices is also relative
9
- elementsOrderAbs, // Actual orders in final schdule
10
- elementsIndexRel, // Actual relative orders in sub-schedule
11
- passFunction, randomizechoices) {
12
- if (choicesByIndex === void 0) { choicesByIndex = {}; }
13
- if (nonChoicesByIndex === void 0) { nonChoicesByIndex = {}; }
14
- if (elementsIndexRel === void 0) { elementsIndexRel = []; }
4
+ const PermutationGeneratorForSet_1 = require("./PermutationGeneratorForSet");
5
+ class CustomPermutationGenerator {
6
+ constructor(elementList, choicesByIndex, nonChoicesByIndex, elementsOrderAbsolute, passFunction) {
15
7
  this.elementList = elementList;
16
8
  this.choicesByIndex = choicesByIndex;
17
9
  this.nonChoicesByIndex = nonChoicesByIndex;
18
- this.elementsOrderAbs = elementsOrderAbs;
19
- this.elementsIndexRel = elementsIndexRel;
10
+ this.elementsOrderAbsolute = elementsOrderAbsolute;
20
11
  this.passFunction = passFunction;
21
- this.randomizechoices = randomizechoices;
22
12
  this.nextIndexList = [];
23
- this.choicesByIndexInSet = {}; // index of each choices in set
24
- this.history = []; // Permutation history
25
- this.historyHashes = []; // Permutation hashes, being used to distinguish new perm from olds
26
- this.current = []; // keeps the current perm of set
13
+ this.finalChoicesByIndexInSet = {};
14
+ this.history = [];
15
+ this.historyHashes = [];
16
+ this.current = [];
27
17
  this.cursor = 0;
28
- var indexList = Array(elementList.length).fill(0).map(function (el, ind) { return ind; });
29
- this.set = elementList.reduce(function (init, el, i) { return elementList.indexOf(el) == i ? init.concat(el) : init; }, []);
30
- this.setAsStr = this.set.map(function (x) { return String(x); });
31
- this.init();
32
- // debugger
33
- // Optimization: Take same element indexes and when removeing one remove all
34
- var indexesOfSameElements = {};
35
- elementList.forEach(function (element, i) {
18
+ const indexList = Array(elementList.length)
19
+ .fill(0)
20
+ .map((_, ind) => ind);
21
+ this.set = Array.from(new Set(elementList));
22
+ const indexesOfSameElements = {};
23
+ elementList.forEach((element, i) => {
36
24
  indexesOfSameElements[i] = [];
37
- // Zero means noone
38
- // if (element == 0) {
39
- // // indexesOfSameElements[i] = [i]; // To make an illusion such that zero is different than zero, to make it possible to be consecutive
40
- // return;
41
- // }
42
- elementList.forEach(function (innerElement, j) {
43
- if (element == innerElement) {
25
+ elementList.forEach((el, j) => {
26
+ if (element === el) {
44
27
  indexesOfSameElements[i].push(j);
45
28
  }
46
29
  });
47
30
  });
48
- // Can be uncomment, since it will increase the permutation number but it should be remain for exact results
49
31
  this.extendIndexesOfSameElements(this.choicesByIndex, indexesOfSameElements);
50
- // not make for choicesByIndex list so that options be little
51
32
  this.extendIndexesOfSameElements(this.nonChoicesByIndex, indexesOfSameElements);
52
- // let choicesByIndexInSetFiltered = Object.keys(this.choicesByIndexInSet).filter(x => elementsIndexRel.indexOf(Number(x)) >= 0)
53
- // .map(x => this.choicesByIndexInSet[x]);
54
- // Same like above
55
- // for(let i = 0; i < this.elementsIndexRel.length; i++) {
56
- // choicesByIndexInSetFiltered[i] = this.choicesByIndexInSet[elementsIndexRel[i]]
57
- // }
58
- this.permutationGenOfSet = new PermutationGeneratorForSet_1.PermutationGeneratorForSet(elementList, indexList, this.choicesByIndexInSet, indexesOfSameElements, elementsOrderAbs, passFunction, randomizechoices);
59
- }
60
- // collect indexes of same elements into nonChoicesByIndex array, eg, slot1 should be placed by person 1 whose indexes are 3,4,5
61
- CustomPermutationGenerator.prototype.extendIndexesOfSameElements = function (choicesByIndex, indexesOfSameElements) {
62
- if (!choicesByIndex) {
63
- return;
64
- }
65
- var choicesIndexKeys = Object.keys(choicesByIndex);
66
- for (var i = 0; i < choicesIndexKeys.length; i++) {
67
- var key = choicesIndexKeys[i];
68
- if (choicesByIndex[key]) {
69
- for (var j = 0; j < choicesByIndex[key].length; j++) {
70
- var ar = choicesByIndex[key].slice();
71
- // debugger
72
- if ((indexesOfSameElements[choicesByIndex[key][j]] || []).indexOf(choicesByIndex[key][j]) >= 0) {
73
- ar = ar.concat(indexesOfSameElements[choicesByIndex[key][j]]);
74
- }
75
- }
76
- choicesByIndex[key] = ar ? ar.filter(function (el, i) { return ar.indexOf(el) == i; }) : [];
77
- }
78
- }
79
- };
80
- // ? Need indexes to make a set, since element list may not be distinct
81
- CustomPermutationGenerator.prototype.init = function () {
82
33
  if (this.nonChoicesByIndex) {
83
- this.removeNonChoicesIndexes(); // Since set is changed to indexes, choices should be converted also to indexes
34
+ this.removeNonChoicesIndexes();
84
35
  }
85
36
  if (this.choicesByIndex) {
86
- this.setChoicesIndexesInSet(); // Since set is changed to indexes, choices should be converted also to indexes
87
- }
88
- this.completeMissingChoicesIndexes();
89
- };
90
- CustomPermutationGenerator.prototype.completeMissingChoicesIndexes = function () {
91
- var allIndexes = Array(this.elementList.length).fill(0).map(function (x, i) { return i; });
92
- for (var i = 0; i < this.elementList.length; i++) {
93
- if (!this.choicesByIndexInSet[i]) {
94
- this.choicesByIndexInSet[i] = allIndexes.slice();
95
- }
37
+ this.setChoicesIndexesInSet();
96
38
  }
97
- };
98
- // Index of choices in set
99
- CustomPermutationGenerator.prototype.setChoicesIndexesInSet = function () {
100
- var _this = this;
101
- Object.keys(this.choicesByIndex).forEach(function (key) {
102
- if (!_this.choicesByIndex[key])
103
- return; //?? bu gives error
104
- var indexesInList = [];
105
- for (var j = 0; j < _this.choicesByIndex[key].length; j++) {
106
- indexesInList = indexesInList.concat(_this.getAllIndexesOfElementInList(String(_this.choicesByIndex[key][j]), _this.elementList));
39
+ this.completeRestOfIndexes();
40
+ this.permutationGenOfSet = new PermutationGeneratorForSet_1.PermutationGeneratorForSet(elementList, indexList, this.finalChoicesByIndexInSet, indexesOfSameElements, this.elementsOrderAbsolute, passFunction);
41
+ }
42
+ removeNonChoicesIndexes() {
43
+ const allIndexes = Array(this.elementList.length)
44
+ .fill(0)
45
+ .map((x, i) => i);
46
+ Object.keys(this.nonChoicesByIndex).forEach((key) => {
47
+ let indexes = allIndexes.slice();
48
+ for (const el of this.nonChoicesByIndex[+key]) {
49
+ const indexesToRemove = this.getAllIndexesOfElementInList(el, this.elementList);
50
+ indexes = indexes.filter((x) => indexesToRemove.indexOf(x) < 0);
107
51
  }
108
- _this.choicesByIndexInSet[key] = indexesInList;
52
+ this.finalChoicesByIndexInSet[key] = indexes;
109
53
  });
110
- };
111
- CustomPermutationGenerator.prototype.removeNonChoicesIndexes = function () {
112
- var _this = this;
113
- var allIndexes = Array(this.elementList.length).fill(0).map(function (x, i) { return i; });
114
- Object.keys(this.nonChoicesByIndex).forEach(function (key) {
115
- var indexes = allIndexes.slice();
116
- for (var j = 0; j < _this.nonChoicesByIndex[key].length; j++) {
117
- var indexesToRemove = _this.getAllIndexesOfElementInList(_this.nonChoicesByIndex[key][j], _this.elementList);
118
- indexes = indexes.filter(function (x) { return indexesToRemove.indexOf(x) < 0; });
54
+ }
55
+ setChoicesIndexesInSet() {
56
+ for (const key in this.choicesByIndex) {
57
+ if (!this.choicesByIndex[+key]) {
58
+ continue;
119
59
  }
120
- _this.choicesByIndexInSet[key] = indexes;
121
- });
122
- };
123
- CustomPermutationGenerator.prototype.getAllIndexesOfElementInList = function (el, list) {
124
- var indexes = [];
125
- for (var i = 0; i < list.length; i++) {
126
- if (String(el) == String(list[i])) {
60
+ let indexesInList = [];
61
+ for (const el of this.choicesByIndex[+key]) {
62
+ indexesInList = indexesInList.concat(this.getAllIndexesOfElementInList(el, this.elementList));
63
+ }
64
+ this.finalChoicesByIndexInSet[key] = indexesInList;
65
+ }
66
+ }
67
+ getAllIndexesOfElementInList(el, list) {
68
+ const indexes = [];
69
+ for (let i = 0; i < list.length; i++) {
70
+ if (String(el) === String(list[i])) {
127
71
  indexes.push(i);
128
72
  }
129
73
  }
130
74
  return indexes;
131
- };
132
- CustomPermutationGenerator.prototype.prev = function () {
133
- if (this.cursor > 1) { // cursor-1 is current, cursor-2 is prev
134
- return this.history[--this.cursor - 1];
75
+ }
76
+ completeRestOfIndexes() {
77
+ const allIndexes = Array(this.elementList.length)
78
+ .fill(0)
79
+ .map((x, i) => i);
80
+ for (let i = 0; i < this.elementList.length; i++) {
81
+ if (!this.finalChoicesByIndexInSet[i]) {
82
+ this.finalChoicesByIndexInSet[i] = allIndexes.slice();
83
+ }
135
84
  }
136
- };
137
- CustomPermutationGenerator.prototype.next = function () {
138
- var nextDistinct;
139
- while (true) {
140
- nextDistinct = this.nextDistinct();
141
- if (nextDistinct && !nextDistinct.done) {
142
- if (nextDistinct.value) {
143
- return nextDistinct.value;
144
- }
145
- else {
146
- return [];
85
+ }
86
+ extendIndexesOfSameElements(choicesByIndex, indexesOfSameElements) {
87
+ if (!choicesByIndex) {
88
+ return;
89
+ }
90
+ for (const key in choicesByIndex) {
91
+ if (choicesByIndex[key]) {
92
+ let clone;
93
+ for (const anotherKey of choicesByIndex[key]) {
94
+ clone = choicesByIndex[key].slice();
95
+ if ((indexesOfSameElements[anotherKey] || []).indexOf(anotherKey) >= 0) {
96
+ clone = clone.concat(indexesOfSameElements[anotherKey]);
97
+ }
147
98
  }
99
+ choicesByIndex[key] = clone ? clone.filter((el, idx) => clone.indexOf(el) === idx) : [];
148
100
  }
149
- else if (nextDistinct && nextDistinct.done) {
150
- return null; // PermResultTypeEnum.ENDOFPERMUTATION;
151
- }
152
101
  }
153
- };
154
- CustomPermutationGenerator.prototype.nextDistinct = function () {
102
+ }
103
+ prev() {
104
+ if (this.cursor > 1) {
105
+ // cursor-1 is current, cursor-2 is prev
106
+ return this.history[--this.cursor - 1];
107
+ }
108
+ return undefined;
109
+ }
110
+ next() {
111
+ var _a;
112
+ const nextDistinctPerm = this.nextDistinct();
113
+ return !nextDistinctPerm.done ? ((_a = nextDistinctPerm.value) !== null && _a !== void 0 ? _a : null) : null;
114
+ }
115
+ nextDistinct() {
116
+ var _a;
155
117
  if (this.cursor < this.history.length) {
156
118
  return { value: this.history[this.cursor++], done: false };
157
119
  }
158
- var nextPerm = this.permutationGenOfSet.next();
159
- this.nextIndexList = nextPerm.value;
160
- var elList;
120
+ const nextPerm = this.permutationGenOfSet.next();
121
+ this.nextIndexList = (_a = nextPerm.value) !== null && _a !== void 0 ? _a : [];
122
+ let elList;
161
123
  if (this.nextIndexList && this.nextIndexList.length > 0) {
162
124
  elList = this.getElementListByInitialListIndexes(nextPerm.value);
163
- var hash = this.getHash(elList);
125
+ const hash = this.getHash(elList);
164
126
  if (this.historyHashes.indexOf(hash) < 0 && (!this.passFunction || this.passFunction(elList))) {
165
127
  this.current = elList;
166
128
  this.history.push(elList);
@@ -168,70 +130,51 @@ var CustomPermutationGenerator = /** @class */ (function () {
168
130
  this.cursor++;
169
131
  }
170
132
  else {
171
- return false;
133
+ return this.nextDistinct();
172
134
  }
173
135
  }
174
136
  return { done: nextPerm.done, value: elList };
175
- };
176
- CustomPermutationGenerator.prototype.saveCurrentToHistory = function () {
137
+ }
138
+ saveCurrentToHistory() {
177
139
  this.history.push(this.current);
178
- var hash = this.getHash(this.current);
140
+ const hash = this.getHash(this.current);
179
141
  this.historyHashes.push(hash);
180
142
  this.cursor++;
181
- };
182
- CustomPermutationGenerator.prototype.getHash = function (elList) {
183
- var hash = '';
184
- for (var i = 0; i < elList.length; i++) {
185
- for (var j = 0; j < i + 1; j++) {
186
- hash += String(elList[i]);
187
- }
188
- }
189
- return hash;
190
- };
191
- CustomPermutationGenerator.prototype.getElementListByInitialListIndexes = function (indexes) {
192
- var _this = this;
143
+ }
144
+ getHash(elList) {
145
+ return JSON.stringify(elList);
146
+ }
147
+ getElementListByInitialListIndexes(indexes) {
193
148
  if (!indexes || !indexes.length) {
194
149
  return [];
195
150
  }
196
- var elList = [];
197
- indexes.forEach(function (index) {
198
- // if(this.elementList[index]) // Can be added, but costly
199
- {
200
- elList.push(_this.elementList[index]);
201
- }
151
+ const elList = [];
152
+ indexes.forEach((index) => {
153
+ elList.push(this.elementList[index]);
202
154
  });
203
155
  return elList;
204
- };
205
- CustomPermutationGenerator.prototype.consecutiveDifferent = function (list) {
206
- for (var i = 1; i < list.length; i++) {
207
- if (list[i] == list[i - 1]) {
208
- return false;
209
- }
210
- }
211
- return true;
212
- };
213
- CustomPermutationGenerator.prototype.reset = function () {
156
+ }
157
+ reset() {
214
158
  this.cursor = 0;
215
- };
216
- CustomPermutationGenerator.prototype.getSet = function () {
159
+ }
160
+ getSet() {
217
161
  return this.set || [];
218
- };
219
- CustomPermutationGenerator.prototype.isEmpty = function () {
162
+ }
163
+ isEmpty() {
220
164
  return !this.set || this.set.length === 0;
221
- };
222
- CustomPermutationGenerator.prototype.getCurrent = function () {
165
+ }
166
+ getCurrent() {
223
167
  if (this.cursor < this.history.length && this.cursor >= 0) {
224
168
  return this.history[this.cursor];
225
169
  }
226
170
  else {
227
171
  return null;
228
172
  }
229
- };
230
- CustomPermutationGenerator.prototype.last = function () {
173
+ }
174
+ last() {
231
175
  this.cursor = this.history.length - 1;
232
176
  return this.history[this.cursor];
233
- };
234
- return CustomPermutationGenerator;
235
- }());
177
+ }
178
+ }
236
179
  exports.CustomPermutationGenerator = CustomPermutationGenerator;
237
180
  //# sourceMappingURL=CustomPermutationGenerator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomPermutationGenerator.js","sourceRoot":"","sources":["../src/CustomPermutationGenerator.ts"],"names":[],"mappings":";;;AAAA,2EAA0E;AAG1E;IAYE,mIAAmI;IACnI,oCAAoB,WAAkB,EAC5B,cAA2B,EAAE,6FAA6F;IAC1H,iBAA8B,EAAE,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,EAAE,CAAC;YAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,IAAI;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF;AA3ND,gEA2NC"}
@@ -1,42 +1,37 @@
1
+ type ChoiceEntry = {
2
+ index: number;
3
+ length: number;
4
+ };
1
5
  export declare class PermutationGeneratorForSet {
2
6
  private elementList;
3
- private set;
7
+ private indexList;
4
8
  private choicesByIndex?;
5
9
  private indexesOfSameElements?;
6
10
  private actualOrderOfElements?;
7
11
  private passFunction?;
8
- private randomizeChoices?;
9
- choicesArraysInitial: any[];
10
- choicesArrays: any[];
11
- numOfEl: number;
12
- currentIndsOfChoices: any[];
12
+ choicesArraysInitial: number[][];
13
+ choicesArrays: number[][];
14
+ size: number;
15
+ currentIndsOfChoices: number[];
13
16
  currentElInd: number;
14
- newPerm: any[];
15
- initialSet: any[];
16
- listIndexesAfterArrangement: any[];
17
- indexesAndChoicesArrayLengthsSortedByLength: any;
18
- indexesAndChoicesArrayLengths: any[];
19
- actualAndPrevIndexesInPermAfterSortedByChoicesLength: {};
20
- elIsUsedDict: {};
21
- constructor(elementList: any[], set: any[], // set of index
22
- choicesByIndex?: object, indexesOfSameElements?: any, actualOrderOfElements?: any[], passFunction?: Function, randomizeChoices?: boolean);
23
- initPrevIndexes(): void;
24
- isNewPermWithNewElementConsecutivelyDifferent(currentEl: any, elIndInChoices: any, elIndInPerm: any): any;
25
- isNewPermWithNewElementConsecutivelyDifferent_(currentEl: any, elIndInChoices: any, elIndInPerm: any): any;
26
- isPreviousElementDifferentOrCanSkipThisFn(currentEl: any, elIndInChoices: any, elIndInPerm: any): boolean;
17
+ newPerm: (number | null)[];
18
+ initialIndexList: number[];
19
+ indexesAndChoicesCountsSortedByLength: ChoiceEntry[];
20
+ indexesAndChoicesCounts: ChoiceEntry[];
21
+ visitedDict: Record<number, boolean>;
22
+ constructor(elementList: any[], indexList: number[], choicesByIndex?: Record<string, number[]> | undefined, indexesOfSameElements?: Record<number, number[]> | undefined, actualOrderOfElements?: number[] | undefined, passFunction?: ((items: any[]) => boolean) | undefined);
23
+ isNewPermutationPassingFunction(currentEl: number, elIndInPerm: number): boolean;
27
24
  reorderListAndChoicesAccordingToChoicesCount(): void;
28
- revertResultPermToInitialOrder(newPerm: any): any[];
29
25
  initChoicesArray(): void;
30
26
  init(): void;
31
27
  next(): {
32
28
  done: boolean;
33
- value?: undefined;
34
- } | {
35
- done: boolean;
36
- value: any[];
29
+ value?: number[];
37
30
  };
38
- getNextPerm(): any[];
39
- goBack(newPerm: any, choicesArrays: any, currentIndsInChoices: any, elInd: any): any;
40
- getAndSetPossibleNextElementForNewPerm(newPerm: any, choices: any, currentIndsInChoices: any, elInd: any): any;
41
- validateParameters(elementSet: any, choicesByIndex: any): boolean;
31
+ getNextPerm(): (number | null)[] | undefined;
32
+ goBack(newPerm: (number | null)[], choicesArrayWithIndexes: number[][], selectedIndexesForPerm: number[], elInd: number): boolean;
33
+ getAndSetPossibleNextElementForNewPerm(newPerm: (number | null)[], choices: number[], currentIndsInChoices: number[], elInd: number): number | undefined;
34
+ validateParameters(elementSet: number[], choicesByIndex?: object): boolean;
35
+ revertResultPermToInitialOrder(newPerm: (number | null)[]): (number | null)[];
42
36
  }
37
+ export {};