custom-permutation 1.0.6 → 1.1.0

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