- if (this.totalCostAuxStorage[j] !== null) {
- return this.totalCostAuxStorage[j];
- }
- let rawLineCost = this.lineCost(items, 0, j, lineWidth);
- if (rawLineCost != Infinity) {
- this.totalCostAuxStorage[j] = rawLineCost ** 3.0;
- return rawLineCost ** 3.0;
- }
- else {
- var returnCost = Infinity;
- for (var k = 0; k < j; k++) {
- let tmp = this.totalCostAux(items, k, lineWidth) + this.lineCost(items, k + 1, j, lineWidth) ** 3.0;
- if (returnCost > tmp) {
- this.prevNodes[j] = k;
- returnCost = tmp;
+ return __awaiter(this, void 0, void 0, function* () {
+ if (this.totalCostAuxStorage[j] !== null) {
+ return this.totalCostAuxStorage[j];
+ }
+ let rawLineCost = yield this.lineCost(items, 0, j, lineWidth);
+ if (rawLineCost != Infinity) {
+ this.totalCostAuxStorage[j] = rawLineCost ** 3.0;
+ return rawLineCost ** 3.0;
+ }
+ else {
+ var returnCost = Infinity;
+ for (var k = 0; k < j; k++) {
+ let tmp1 = yield Promise.all([this.totalCostAux(items, k, lineWidth), this.lineCost(items, k + 1, j, lineWidth)]);
+ let tmp = tmp1[0] + tmp1[1] ** 3;
+ if (returnCost > tmp) {
+ this.prevNodes[j] = k;
+ returnCost = tmp;
+ }