jsxgraph 1.4.5 → 1.4.6

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.
Files changed (54) hide show
  1. package/build/Readme.md +17 -0
  2. package/build/bin/jsxcompressor.js +1 -0
  3. package/build/bin/jsxgraphcore-min.js +7 -0
  4. package/build/bin/jsxgraphcore.js +83017 -0
  5. package/build/bin/jsxgraphcore.min.js +67 -0
  6. package/build/compressor.build.json +14 -0
  7. package/build/compressor.deps.js +8 -0
  8. package/build/core-amd.build.json +14 -0
  9. package/build/core-amd.deps.js +81 -0
  10. package/build/core.build.json +14 -0
  11. package/build/core.deps.js +102 -0
  12. package/build/plot.build.json +15 -0
  13. package/distrib/geogebra.min.js +1 -1
  14. package/distrib/geonext.min.js +1 -1
  15. package/distrib/index.d.ts +1 -0
  16. package/distrib/intergeo.min.js +1 -1
  17. package/distrib/jsxgraph.css +6 -0
  18. package/distrib/jsxgraphcore.js +3 -3
  19. package/distrib/jsxgraphsrc.js +3326 -1816
  20. package/distrib/sketch.min.js +1 -1
  21. package/package.json +1 -1
  22. package/src/3d/box3d.js +43 -38
  23. package/src/3d/curve3d.js +157 -53
  24. package/src/3d/element3d.js +84 -0
  25. package/src/3d/linspace3d.js +427 -146
  26. package/src/3d/point3d.js +352 -153
  27. package/src/3d/surface3d.js +140 -42
  28. package/src/3d/view3d.js +319 -164
  29. package/src/base/board.js +42 -26
  30. package/src/base/constants.js +8 -1
  31. package/src/base/curve.js +51 -9
  32. package/src/base/polygon.js +111 -69
  33. package/src/base/text.js +125 -51
  34. package/src/base/ticks.js +11 -2
  35. package/src/element/button.js +7 -3
  36. package/src/element/checkbox.js +8 -4
  37. package/src/element/composition.js +7 -1
  38. package/src/element/conic.js +2 -2
  39. package/src/element/input.js +9 -5
  40. package/src/jsxgraph.js +2 -0
  41. package/src/loadjsxgraph.js +13 -8
  42. package/src/math/clip.js +34 -134
  43. package/src/math/geometry.js +204 -3
  44. package/src/math/math.js +1 -2
  45. package/src/math/nlp.js +789 -730
  46. package/src/options.js +159 -8
  47. package/src/options3d.js +24 -7
  48. package/src/parser/jessiecode.js +8 -2
  49. package/src/renderer/abstract.js +26 -15
  50. package/src/renderer/canvas.js +2 -2
  51. package/src/renderer/svg.js +15 -2
  52. package/src/utils/env.js +29 -46
  53. package/src/utils/type.js +75 -2
  54. package/src/3d/threed.js +0 -38
package/src/math/nlp.js CHANGED
@@ -1,36 +1,38 @@
1
1
  /*
2
- Copyright 2008-2022
3
- Matthias Ehmann,
4
- Carsten Miller,
5
- Reinhard Oldenburg,
6
- Alfred Wassermann
2
+ Copyright 2008-2022
3
+ Matthias Ehmann,
4
+ Carsten Miller,
5
+ Reinhard Oldenburg,
6
+ Andreas Walter,
7
+ Alfred Wassermann
7
8
 
8
- This file is part of JSXGraph.
9
+ This file is part of JSXGraph.
9
10
 
10
- JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
11
+ JSXGraph is free software dual licensed under the GNU LGPL or MIT License.
11
12
 
12
- You can redistribute it and/or modify it under the terms of the
13
+ You can redistribute it and/or modify it under the terms of the
13
14
 
14
- * GNU Lesser General Public License as published by
15
- the Free Software Foundation, either version 3 of the License, or
16
- (at your option) any later version
17
- OR
18
- * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
15
+ * GNU Lesser General Public License as published by
16
+ the Free Software Foundation, either version 3 of the License, or
17
+ (at your option) any later version
18
+ OR
19
+ * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT
19
20
 
20
- JSXGraph is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU Lesser General Public License for more details.
21
+ JSXGraph is distributed in the hope that it will be useful,
22
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ GNU Lesser General Public License for more details.
24
25
 
25
- You should have received a copy of the GNU Lesser General Public License and
26
- the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
27
- and <http://opensource.org/licenses/MIT/>.
26
+ You should have received a copy of the GNU Lesser General Public License and
27
+ the MIT License along with JSXGraph. If not, see <http://www.gnu.org/licenses/>
28
+ and <http://opensource.org/licenses/MIT/>.
28
29
 
29
- This is a port of jcobyla
30
+ This is a port of jcobyla
30
31
 
31
- - to JavaScript by Reihard Oldenburg and
32
- - to JSXGraph By Alfred Wassermann
33
- */
32
+ - to JavaScript by Reihard Oldenburg and
33
+ - to JSXGraph by Alfred Wassermann
34
+ - optimized by Andreas Walter
35
+ */
34
36
  /*
35
37
  * jcobyla
36
38
  *
@@ -97,19 +99,6 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
97
99
  arr: function (n) {
98
100
  // Is 0 initialized
99
101
  return new Float64Array(n);
100
-
101
- // var a = new Array(n),
102
- // i;
103
-
104
- // if (Type.exists(a.fill)) {
105
- // a.fill(0.0, 0, n);
106
- // } else {
107
- // for (i = 0; i < n; i++) {
108
- // a[i] = 0.0;
109
- // }
110
- // }
111
-
112
- // return a;
113
102
  },
114
103
 
115
104
  arr2: function (n, m) {
@@ -325,410 +314,426 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
325
314
  // the algorithm.
326
315
  //alert("Iteration "+nfvals+" x="+x);
327
316
  L_40:
328
- do {
329
- if (nfvals >= maxfun && nfvals > 0) {
330
- status = this.MaxIterationsReached;
331
- break L_40;
332
- }
317
+ do {
318
+ if (nfvals >= maxfun && nfvals > 0) {
319
+ status = this.MaxIterationsReached;
320
+ break L_40;
321
+ }
333
322
 
334
- ++nfvals;
335
- f = calcfc(n, m, x, con);
336
- resmax = 0.0;
337
- for (k = 1; k <= m; ++k) {
338
- resmax = Math.max(resmax, -con[k]);
339
- }
340
- //alert( " f="+f+" resmax="+resmax);
323
+ ++nfvals;
324
+ f = calcfc(n, m, x, con);
325
+ resmax = 0.0;
326
+ for (k = 1; k <= m; ++k) {
327
+ resmax = Math.max(resmax, -con[k]);
328
+ }
329
+ //alert( " f="+f+" resmax="+resmax);
341
330
 
342
- if (nfvals === iprint - 1 || iprint === 3) {
343
- this.PrintIterationResult(nfvals, f, resmax, x, n, iprint);
344
- }
331
+ if (nfvals === iprint - 1 || iprint === 3) {
332
+ this.PrintIterationResult(nfvals, f, resmax, x, n, iprint);
333
+ }
345
334
 
346
- con[mp] = f;
347
- con[mpp] = resmax;
335
+ con[mp] = f;
336
+ con[mpp] = resmax;
348
337
 
349
- // Set the recently calculated function values in a column of DATMAT. This
350
- // array has a column for each vertex of the current simplex, the entries of
351
- // each column being the values of the constraint functions (if any)
352
- // followed by the objective function and the greatest constraint violation
353
- // at the vertex.
354
- skipVertexIdent = true;
355
- if (!ibrnch) {
356
- skipVertexIdent = false;
338
+ // Set the recently calculated function values in a column of DATMAT. This
339
+ // array has a column for each vertex of the current simplex, the entries of
340
+ // each column being the values of the constraint functions (if any)
341
+ // followed by the objective function and the greatest constraint violation
342
+ // at the vertex.
343
+ skipVertexIdent = true;
344
+ if (!ibrnch) {
345
+ skipVertexIdent = false;
357
346
 
358
- for (i = 1; i <= mpp; ++i) {
359
- datmat[i][jdrop] = con[i];
360
- }
347
+ for (i = 1; i <= mpp; ++i) {
348
+ datmat[i][jdrop] = con[i];
349
+ }
361
350
 
362
- if (nfvals <= np) {
363
- // Exchange the new vertex of the initial simplex with the optimal vertex if
364
- // necessary. Then, if the initial simplex is not complete, pick its next
365
- // vertex and calculate the function values there.
366
-
367
- if (jdrop <= n) {
368
- if (datmat[mp][np] <= f) {
369
- x[jdrop] = sim[jdrop][np];
370
- } else {
371
- sim[jdrop][np] = x[jdrop];
372
- for (k = 1; k <= mpp; ++k) {
373
- datmat[k][jdrop] = datmat[k][np];
374
- datmat[k][np] = con[k];
375
- }
376
- for (k = 1; k <= jdrop; ++k) {
377
- sim[jdrop][k] = -rho;
378
- temp = 0.0;
379
- for (i = k; i <= jdrop; ++i) {
380
- temp -= simi[i][k];
351
+ if (nfvals <= np) {
352
+ // Exchange the new vertex of the initial simplex with the optimal vertex if
353
+ // necessary. Then, if the initial simplex is not complete, pick its next
354
+ // vertex and calculate the function values there.
355
+
356
+ if (jdrop <= n) {
357
+ if (datmat[mp][np] <= f) {
358
+ x[jdrop] = sim[jdrop][np];
359
+ } else {
360
+ sim[jdrop][np] = x[jdrop];
361
+ for (k = 1; k <= mpp; ++k) {
362
+ datmat[k][jdrop] = datmat[k][np];
363
+ datmat[k][np] = con[k];
364
+ }
365
+ for (k = 1; k <= jdrop; ++k) {
366
+ sim[jdrop][k] = -rho;
367
+ temp = 0.0;
368
+ for (i = k; i <= jdrop; ++i) {
369
+ temp -= simi[i][k];
370
+ }
371
+ simi[jdrop][k] = temp;
381
372
  }
382
- simi[jdrop][k] = temp;
383
373
  }
384
374
  }
375
+ if (nfvals <= n) {
376
+ jdrop = nfvals;
377
+ x[jdrop] += rho;
378
+ continue L_40;
379
+ }
385
380
  }
386
- if (nfvals <= n) {
387
- jdrop = nfvals;
388
- x[jdrop] += rho;
389
- continue L_40;
390
- }
381
+ ibrnch = true;
391
382
  }
392
- ibrnch = true;
393
- }
394
383
 
395
- L_140:
396
- do {
397
- L_550:
398
- do {
399
- if (!skipVertexIdent) {
400
- // Identify the optimal vertex of the current simplex.
401
- phimin = datmat[mp][np] + parmu * datmat[mpp][np];
402
- nbest = np;
403
-
404
- for (j = 1; j <= n; ++j) {
405
- temp = datmat[mp][j] + parmu * datmat[mpp][j];
406
- if (temp < phimin) {
407
- nbest = j;
408
- phimin = temp;
409
- } else if (temp === phimin && parmu === 0.0 && datmat[mpp][j] < datmat[mpp][nbest]) {
410
- nbest = j;
411
- }
412
- }
384
+ L_140:
385
+ do {
386
+ L_550:
387
+ do {
388
+ if (!skipVertexIdent) {
389
+ // Identify the optimal vertex of the current simplex.
390
+ phimin = datmat[mp][np] + parmu * datmat[mpp][np];
391
+ nbest = np;
392
+
393
+ for (j = 1; j <= n; ++j) {
394
+ temp = datmat[mp][j] + parmu * datmat[mpp][j];
395
+ if (temp < phimin) {
396
+ nbest = j;
397
+ phimin = temp;
398
+ } else if (temp === phimin && parmu === 0.0 && datmat[mpp][j] < datmat[mpp][nbest]) {
399
+ nbest = j;
400
+ }
401
+ }
413
402
 
414
- // Switch the best vertex into pole position if it is not there already,
415
- // and also update SIM, SIMI and DATMAT.
416
- if (nbest <= n) {
417
- for (i = 1; i <= mpp; ++i) {
418
- temp = datmat[i][np];
419
- datmat[i][np] = datmat[i][nbest];
420
- datmat[i][nbest] = temp;
421
- }
422
- for (i = 1; i <= n; ++i) {
423
- temp = sim[i][nbest];
424
- sim[i][nbest] = 0.0;
425
- sim[i][np] += temp;
403
+ // Switch the best vertex into pole position if it is not there already,
404
+ // and also update SIM, SIMI and DATMAT.
405
+ if (nbest <= n) {
406
+ for (i = 1; i <= mpp; ++i) {
407
+ temp = datmat[i][np];
408
+ datmat[i][np] = datmat[i][nbest];
409
+ datmat[i][nbest] = temp;
410
+ }
411
+ for (i = 1; i <= n; ++i) {
412
+ temp = sim[i][nbest];
413
+ sim[i][nbest] = 0.0;
414
+ sim[i][np] += temp;
415
+
416
+ tempa = 0.0;
417
+ for (k = 1; k <= n; ++k) {
418
+ sim[i][k] -= temp;
419
+ tempa -= simi[k][i];
420
+ }
421
+ simi[nbest][i] = tempa;
422
+ }
423
+ }
426
424
 
427
- tempa = 0.0;
428
- for (k = 1; k <= n; ++k) {
429
- sim[i][k] -= temp;
430
- tempa -= simi[k][i];
431
- }
432
- simi[nbest][i] = tempa;
433
- }
434
- }
425
+ // Make an error return if SIGI is a poor approximation to the inverse of
426
+ // the leading N by N submatrix of SIG.
427
+ error = 0.0;
428
+ if (false) {
429
+ for (i = 1; i <= n; ++i) {
430
+ for (j = 1; j <= n; ++j) {
431
+ temp = this.DOT_PRODUCT_ROW_COL(simi, i, sim, j, 1, n) - (i === j ? 1.0 : 0.0);
432
+ // temp = this.DOT_PRODUCT(
433
+ // this.PART(this.ROW(simi, i), 1, n),
434
+ // this.PART(this.COL(sim, j), 1, n)
435
+ // ) - (i === j ? 1.0 : 0.0);
436
+
437
+ error = Math.max(error, Math.abs(temp));
438
+ }
439
+ }
440
+ }
441
+ if (error > 0.1) {
442
+ status = this.DivergingRoundingErrors;
443
+ break L_40;
444
+ }
435
445
 
436
- // Make an error return if SIGI is a poor approximation to the inverse of
437
- // the leading N by N submatrix of SIG.
438
- error = 0.0;
439
- if (false) {
440
- for (i = 1; i <= n; ++i) {
441
- for (j = 1; j <= n; ++j) {
442
- temp = this.DOT_PRODUCT_ROW_COL(simi, i, sim, j, 1, n) - (i === j ? 1.0 : 0.0);
443
- // temp = this.DOT_PRODUCT(
444
- // this.PART(this.ROW(simi, i), 1, n),
445
- // this.PART(this.COL(sim, j), 1, n)
446
- // ) - (i === j ? 1.0 : 0.0);
446
+ // Calculate the coefficients of the linear approximations to the objective
447
+ // and constraint functions, placing minus the objective function gradient
448
+ // after the constraint gradients in the array A. The vector W is used for
449
+ // working space.
450
+ for (k = 1; k <= mp; ++k) {
451
+ con[k] = -datmat[k][np];
452
+ for (j = 1; j <= n; ++j) {
453
+ w[j] = datmat[k][j] + con[k];
454
+ }
455
+
456
+ for (i = 1; i <= n; ++i) {
457
+ a[i][k] = (k === mp ? -1.0 : 1.0) *
458
+ this.DOT_PRODUCT_ROW_COL(w, -1, simi, i, 1, n);
459
+ // this.DOT_PRODUCT(this.PART(w, 1, n), this.PART(this.COL(simi, i), 1, n));
460
+ }
461
+ }
447
462
 
448
- error = Math.max(error, Math.abs(temp));
449
- }
450
- }
451
- }
452
- if (error > 0.1) {
453
- status = this.DivergingRoundingErrors;
454
- break L_40;
455
- }
463
+ // Calculate the values of sigma and eta, and set IFLAG = 0 if the current
464
+ // simplex is not acceptable.
465
+ iflag = true;
466
+ parsig = alpha * rho;
467
+ pareta = beta * rho;
468
+
469
+ for (j = 1; j <= n; ++j) {
470
+ wsig = 0.0;
471
+ weta = 0.0;
472
+ for (k = 1; k <= n; ++k) {
473
+ wsig += simi[j][k] * simi[j][k];
474
+ weta += sim[k][j] * sim[k][j];
475
+ }
476
+ vsig[j] = 1.0 / Math.sqrt(wsig);
477
+ veta[j] = Math.sqrt(weta);
478
+ if (vsig[j] < parsig || veta[j] > pareta) {
479
+ iflag = false;
480
+ }
481
+ }
456
482
 
457
- // Calculate the coefficients of the linear approximations to the objective
458
- // and constraint functions, placing minus the objective function gradient
459
- // after the constraint gradients in the array A. The vector W is used for
460
- // working space.
461
- for (k = 1; k <= mp; ++k) {
462
- con[k] = -datmat[k][np];
463
- for (j = 1; j <= n; ++j) {
464
- w[j] = datmat[k][j] + con[k];
465
- }
483
+ // If a new vertex is needed to improve acceptability, then decide which
484
+ // vertex to drop from the simplex.
485
+ if (!ibrnch && !iflag) {
486
+ jdrop = 0;
487
+ temp = pareta;
488
+ for (j = 1; j <= n; ++j) {
489
+ if (veta[j] > temp) {
490
+ jdrop = j;
491
+ temp = veta[j];
492
+ }
493
+ }
494
+ if (jdrop === 0) {
495
+ for (j = 1; j <= n; ++j) {
496
+ if (vsig[j] < temp) {
497
+ jdrop = j;
498
+ temp = vsig[j];
499
+ }
500
+ }
501
+ }
502
+
503
+ // Calculate the step to the new vertex and its sign.
504
+ temp = gamma * rho * vsig[jdrop];
505
+ for (k = 1; k <= n; ++k) {
506
+ dx[k] = temp * simi[jdrop][k];
507
+ }
508
+ cvmaxp = 0.0;
509
+ cvmaxm = 0.0;
510
+ total = 0.0;
511
+ for (k = 1; k <= mp; ++k) {
512
+ // total = this.DOT_PRODUCT(this.PART(this.COL(a, k), 1, n), this.PART(dx, 1, n));
513
+ total = this.DOT_PRODUCT_ROW_COL(dx, -1, a, k, 1, n);
514
+ if (k < mp) {
515
+ temp = datmat[k][np];
516
+ cvmaxp = Math.max(cvmaxp, -total - temp);
517
+ cvmaxm = Math.max(cvmaxm, total - temp);
518
+ }
519
+ }
520
+ dxsign = parmu * (cvmaxp - cvmaxm) > 2.0 * total ? -1.0 : 1.0;
521
+
522
+ // Update the elements of SIM and SIMI, and set the next X.
523
+ temp = 0.0;
524
+ for (i = 1; i <= n; ++i) {
525
+ dx[i] = dxsign * dx[i];
526
+ sim[i][jdrop] = dx[i];
527
+ temp += simi[jdrop][i] * dx[i];
528
+ }
529
+ for (k = 1; k <= n; ++k) {
530
+ simi[jdrop][k] /= temp;
531
+ }
532
+
533
+ for (j = 1; j <= n; ++j) {
534
+ if (j !== jdrop) {
535
+ // temp = this.DOT_PRODUCT(this.PART(this.ROW(simi, j), 1, n), this.PART(dx, 1, n));
536
+ temp = this.DOT_PRODUCT_ROW_COL(simi, j, dx, -1, 1, n);
537
+ for (k = 1; k <= n; ++k) {
538
+ simi[j][k] -= temp * simi[jdrop][k];
539
+ }
540
+ }
541
+ x[j] = sim[j][np] + dx[j];
542
+ }
543
+ continue L_40;
544
+ }
466
545
 
467
- for (i = 1; i <= n; ++i) {
468
- a[i][k] = (k === mp ? -1.0 : 1.0) *
469
- this.DOT_PRODUCT_ROW_COL(w, -1, simi, i, 1, n);
470
- // this.DOT_PRODUCT(this.PART(w, 1, n), this.PART(this.COL(simi, i), 1, n));
471
- }
472
- }
546
+ // Calculate DX = x(*)-x(0).
547
+ // Branch if the length of DX is less than 0.5*RHO.
548
+ ifull = this.trstlp(n, m, a, con, rho, dx);
549
+ if (!ifull) {
550
+ temp = 0.0;
551
+ for (k = 1; k <= n; ++k) {
552
+ temp += dx[k] * dx[k];
553
+ }
554
+ if (temp < 0.25 * rho * rho) {
555
+ ibrnch = true;
556
+ break L_550;
557
+ }
558
+ }
473
559
 
474
- // Calculate the values of sigma and eta, and set IFLAG = 0 if the current
475
- // simplex is not acceptable.
476
- iflag = true;
477
- parsig = alpha * rho;
478
- pareta = beta * rho;
560
+ // Predict the change to F and the new maximum constraint violation if the
561
+ // variables are altered from x(0) to x(0) + DX.
562
+ total = 0.0;
563
+ resnew = 0.0;
564
+ con[mp] = 0.0;
565
+ for (k = 1; k <= mp; ++k) {
566
+ //total = con[k] - this.DOT_PRODUCT(this.PART(this.COL(a, k), 1, n), this.PART(dx, 1, n));
567
+ total = con[k] - this.DOT_PRODUCT_ROW_COL(dx, -1, a, k, 1, n);
568
+ if (k < mp) {
569
+ resnew = Math.max(resnew, total);
570
+ }
571
+ }
479
572
 
480
- for (j = 1; j <= n; ++j) {
481
- wsig = 0.0;
482
- weta = 0.0;
483
- for (k = 1; k <= n; ++k) {
484
- wsig += simi[j][k] * simi[j][k];
485
- weta += sim[k][j] * sim[k][j];
486
- }
487
- vsig[j] = 1.0 / Math.sqrt(wsig);
488
- veta[j] = Math.sqrt(weta);
489
- if (vsig[j] < parsig || veta[j] > pareta) { iflag = false; }
490
- }
573
+ // Increase PARMU if necessary and branch back if this change alters the
574
+ // optimal vertex. Otherwise PREREM and PREREC will be set to the predicted
575
+ // reductions in the merit function and the maximum constraint violation
576
+ // respectively.
577
+ prerec = datmat[mpp][np] - resnew;
578
+ barmu = prerec > 0.0 ? total / prerec : 0.0;
579
+ if (parmu < 1.5 * barmu) {
580
+ parmu = 2.0 * barmu;
581
+ if (iprint >= 2) {
582
+ console.log("Increase in PARMU to " + parmu);
583
+ }
584
+ phi = datmat[mp][np] + parmu * datmat[mpp][np];
585
+ for (j = 1; j <= n; ++j) {
586
+ temp = datmat[mp][j] + parmu * datmat[mpp][j];
587
+ if (temp < phi || (temp === phi && parmu === 0.0 && datmat[mpp][j] < datmat[mpp][np])) {
588
+ continue L_140;
589
+ }
590
+ }
591
+ }
592
+ prerem = parmu * prerec - total;
491
593
 
492
- // If a new vertex is needed to improve acceptability, then decide which
493
- // vertex to drop from the simplex.
494
- if (!ibrnch && !iflag) {
495
- jdrop = 0;
496
- temp = pareta;
497
- for (j = 1; j <= n; ++j) {
498
- if (veta[j] > temp) {
499
- jdrop = j;
500
- temp = veta[j];
594
+ // Calculate the constraint and objective functions at x(*).
595
+ // Then find the actual reduction in the merit function.
596
+ for (k = 1; k <= n; ++k) {
597
+ x[k] = sim[k][np] + dx[k];
598
+ }
599
+ ibrnch = true;
600
+ continue L_40;
501
601
  }
502
- }
503
- if (jdrop === 0) {
602
+
603
+ skipVertexIdent = false;
604
+ vmold = datmat[mp][np] + parmu * datmat[mpp][np];
605
+ vmnew = f + parmu * resmax;
606
+ trured = vmold - vmnew;
607
+ if (parmu === 0.0 && f === datmat[mp][np]) {
608
+ prerem = prerec;
609
+ trured = datmat[mpp][np] - resmax;
610
+ }
611
+
612
+ // Begin the operations that decide whether x(*) should replace one of the
613
+ // vertices of the current simplex, the change being mandatory if TRURED is
614
+ // positive. Firstly, JDROP is set to the index of the vertex that is to be
615
+ // replaced.
616
+ ratio = trured <= 0.0 ? 1.0 : 0.0;
617
+ jdrop = 0;
504
618
  for (j = 1; j <= n; ++j) {
505
- if (vsig[j] < temp) {
619
+ // temp = Math.abs(this.DOT_PRODUCT(this.PART(this.ROW(simi, j), 1, n), this.PART(dx, 1, n)));
620
+ temp = Math.abs(this.DOT_PRODUCT_ROW_COL(simi, j, dx, -1, 1, n));
621
+ if (temp > ratio) {
506
622
  jdrop = j;
507
- temp = vsig[j];
623
+ ratio = temp;
508
624
  }
625
+ sigbar[j] = temp * vsig[j];
509
626
  }
510
- }
511
627
 
512
- // Calculate the step to the new vertex and its sign.
513
- temp = gamma * rho * vsig[jdrop];
514
- for (k = 1; k <= n; ++k) {
515
- dx[k] = temp * simi[jdrop][k];
516
- }
517
- cvmaxp = 0.0;
518
- cvmaxm = 0.0;
519
- total = 0.0;
520
- for (k = 1; k <= mp; ++k) {
521
- // total = this.DOT_PRODUCT(this.PART(this.COL(a, k), 1, n), this.PART(dx, 1, n));
522
- total = this.DOT_PRODUCT_ROW_COL(dx, -1, a, k, 1, n);
523
- if (k < mp) {
524
- temp = datmat[k][np];
525
- cvmaxp = Math.max(cvmaxp, -total - temp);
526
- cvmaxm = Math.max(cvmaxm, total - temp);
527
- }
528
- }
529
- dxsign = parmu * (cvmaxp - cvmaxm) > 2.0 * total ? -1.0 : 1.0;
628
+ // Calculate the value of ell.
530
629
 
531
- // Update the elements of SIM and SIMI, and set the next X.
532
- temp = 0.0;
533
- for (i = 1; i <= n; ++i) {
534
- dx[i] = dxsign * dx[i];
535
- sim[i][jdrop] = dx[i];
536
- temp += simi[jdrop][i] * dx[i];
537
- }
538
- for (k = 1; k <= n; ++k) {
539
- simi[jdrop][k] /= temp;
540
- }
541
-
542
- for (j = 1; j <= n; ++j) {
543
- if (j !== jdrop) {
544
- // temp = this.DOT_PRODUCT(this.PART(this.ROW(simi, j), 1, n), this.PART(dx, 1, n));
545
- temp = this.DOT_PRODUCT_ROW_COL(simi, j, dx, -1, 1, n);
546
- for (k = 1; k <= n; ++k) {
547
- simi[j][k] -= temp * simi[jdrop][k];
630
+ edgmax = delta * rho;
631
+ l = 0;
632
+ for (j = 1; j <= n; ++j) {
633
+ if (sigbar[j] >= parsig || sigbar[j] >= vsig[j]) {
634
+ temp = veta[j];
635
+ if (trured > 0.0) {
636
+ temp = 0.0;
637
+ for (k = 1; k <= n; ++k) {
638
+ temp += Math.pow(dx[k] - sim[k][j], 2.0);
639
+ }
640
+ temp = Math.sqrt(temp);
641
+ }
642
+ if (temp > edgmax) {
643
+ l = j;
644
+ edgmax = temp;
645
+ }
548
646
  }
549
647
  }
550
- x[j] = sim[j][np] + dx[j];
551
- }
552
- continue L_40;
553
- }
554
-
555
- // Calculate DX = x(*)-x(0).
556
- // Branch if the length of DX is less than 0.5*RHO.
557
- ifull = this.trstlp(n, m, a, con, rho, dx);
558
- if (!ifull) {
559
- temp = 0.0;
560
- for (k = 1; k <= n; ++k) {
561
- temp += dx[k] * dx[k];
562
- }
563
- if (temp < 0.25 * rho * rho) {
564
- ibrnch = true;
565
- break L_550;
566
- }
567
- }
648
+ if (l > 0) {
649
+ jdrop = l;
650
+ }
568
651
 
569
- // Predict the change to F and the new maximum constraint violation if the
570
- // variables are altered from x(0) to x(0) + DX.
571
- total = 0.0;
572
- resnew = 0.0;
573
- con[mp] = 0.0;
574
- for (k = 1; k <= mp; ++k) {
575
- //total = con[k] - this.DOT_PRODUCT(this.PART(this.COL(a, k), 1, n), this.PART(dx, 1, n));
576
- total = con[k] - this.DOT_PRODUCT_ROW_COL(dx, -1, a, k, 1, n);
577
- if (k < mp) { resnew = Math.max(resnew, total); }
578
- }
652
+ if (jdrop !== 0) {
653
+ // Revise the simplex by updating the elements of SIM, SIMI and DATMAT.
654
+ temp = 0.0;
655
+ for (i = 1; i <= n; ++i) {
656
+ sim[i][jdrop] = dx[i];
657
+ temp += simi[jdrop][i] * dx[i];
658
+ }
659
+ for (k = 1; k <= n; ++k) {
660
+ simi[jdrop][k] /= temp;
661
+ }
662
+ for (j = 1; j <= n; ++j) {
663
+ if (j !== jdrop) {
664
+ // temp = this.DOT_PRODUCT(this.PART(this.ROW(simi, j), 1, n), this.PART(dx, 1, n));
665
+ temp = this.DOT_PRODUCT_ROW_COL(simi, j, dx, -1, 1, n);
666
+ for (k = 1; k <= n; ++k) {
667
+ simi[j][k] -= temp * simi[jdrop][k];
668
+ }
669
+ }
670
+ }
671
+ for (k = 1; k <= mpp; ++k) {
672
+ datmat[k][jdrop] = con[k];
673
+ }
579
674
 
580
- // Increase PARMU if necessary and branch back if this change alters the
581
- // optimal vertex. Otherwise PREREM and PREREC will be set to the predicted
582
- // reductions in the merit function and the maximum constraint violation
583
- // respectively.
584
- prerec = datmat[mpp][np] - resnew;
585
- barmu = prerec > 0.0 ? total / prerec : 0.0;
586
- if (parmu < 1.5 * barmu) {
587
- parmu = 2.0 * barmu;
588
- if (iprint >= 2) { console.log("Increase in PARMU to " + parmu); }
589
- phi = datmat[mp][np] + parmu * datmat[mpp][np];
590
- for (j = 1; j <= n; ++j) {
591
- temp = datmat[mp][j] + parmu * datmat[mpp][j];
592
- if (temp < phi || (temp === phi && parmu === 0.0 && datmat[mpp][j] < datmat[mpp][np])) {
593
- continue L_140;
675
+ // Branch back for further iterations with the current RHO.
676
+ if (trured > 0.0 && trured >= 0.1 * prerem) {
677
+ continue L_140;
678
+ }
594
679
  }
595
- }
596
- }
597
- prerem = parmu * prerec - total;
680
+ } while (false);
598
681
 
599
- // Calculate the constraint and objective functions at x(*).
600
- // Then find the actual reduction in the merit function.
601
- for (k = 1; k <= n; ++k) {
602
- x[k] = sim[k][np] + dx[k];
682
+ if (!iflag) {
683
+ ibrnch = false;
684
+ continue L_140;
603
685
  }
604
- ibrnch = true;
605
- continue L_40;
606
- }
607
686
 
608
- skipVertexIdent = false;
609
- vmold = datmat[mp][np] + parmu * datmat[mpp][np];
610
- vmnew = f + parmu * resmax;
611
- trured = vmold - vmnew;
612
- if (parmu === 0.0 && f === datmat[mp][np]) {
613
- prerem = prerec;
614
- trured = datmat[mpp][np] - resmax;
615
- }
616
-
617
- // Begin the operations that decide whether x(*) should replace one of the
618
- // vertices of the current simplex, the change being mandatory if TRURED is
619
- // positive. Firstly, JDROP is set to the index of the vertex that is to be
620
- // replaced.
621
- ratio = trured <= 0.0 ? 1.0 : 0.0;
622
- jdrop = 0;
623
- for (j = 1; j <= n; ++j) {
624
- // temp = Math.abs(this.DOT_PRODUCT(this.PART(this.ROW(simi, j), 1, n), this.PART(dx, 1, n)));
625
- temp = Math.abs(this.DOT_PRODUCT_ROW_COL(simi, j, dx, -1, 1, n));
626
- if (temp > ratio) {
627
- jdrop = j;
628
- ratio = temp;
687
+ if (rho <= rhoend) {
688
+ status = this.Normal;
689
+ break L_40;
629
690
  }
630
- sigbar[j] = temp * vsig[j];
631
- }
632
691
 
633
- // Calculate the value of ell.
634
-
635
- edgmax = delta * rho;
636
- l = 0;
637
- for (j = 1; j <= n; ++j) {
638
- if (sigbar[j] >= parsig || sigbar[j] >= vsig[j]) {
639
- temp = veta[j];
640
- if (trured > 0.0) {
641
- temp = 0.0;
642
- for (k = 1; k <= n; ++k) {
643
- temp += Math.pow(dx[k] - sim[k][j], 2.0);
644
- }
645
- temp = Math.sqrt(temp);
646
- }
647
- if (temp > edgmax) {
648
- l = j;
649
- edgmax = temp;
650
- }
651
- }
652
- }
653
- if (l > 0) { jdrop = l; }
654
-
655
- if (jdrop !== 0) {
656
- // Revise the simplex by updating the elements of SIM, SIMI and DATMAT.
657
- temp = 0.0;
658
- for (i = 1; i <= n; ++i) {
659
- sim[i][jdrop] = dx[i];
660
- temp += simi[jdrop][i] * dx[i];
692
+ // Otherwise reduce RHO if it is not at its least value and reset PARMU.
693
+ cmin = 0.0;
694
+ cmax = 0.0;
695
+ rho *= 0.5;
696
+ if (rho <= 1.5 * rhoend) {
697
+ rho = rhoend;
661
698
  }
662
- for (k = 1; k <= n; ++k) { simi[jdrop][k] /= temp; }
663
- for (j = 1; j <= n; ++j) {
664
- if (j !== jdrop) {
665
- // temp = this.DOT_PRODUCT(this.PART(this.ROW(simi, j), 1, n), this.PART(dx, 1, n));
666
- temp = this.DOT_PRODUCT_ROW_COL(simi, j, dx, -1, 1, n);
667
- for (k = 1; k <= n; ++k) {
668
- simi[j][k] -= temp * simi[jdrop][k];
699
+ if (parmu > 0.0) {
700
+ denom = 0.0;
701
+ for (k = 1; k <= mp; ++k) {
702
+ cmin = datmat[k][np];
703
+ cmax = cmin;
704
+ for (i = 1; i <= n; ++i) {
705
+ cmin = Math.min(cmin, datmat[k][i]);
706
+ cmax = Math.max(cmax, datmat[k][i]);
707
+ }
708
+ if (k <= m && cmin < 0.5 * cmax) {
709
+ temp = Math.max(cmax, 0.0) - cmin;
710
+ denom = denom <= 0.0 ? temp : Math.min(denom, temp);
669
711
  }
670
712
  }
713
+ if (denom === 0.0) {
714
+ parmu = 0.0;
715
+ } else if (cmax - cmin < parmu * denom) {
716
+ parmu = (cmax - cmin) / denom;
717
+ }
671
718
  }
672
- for (k = 1; k <= mpp; ++k) {
673
- datmat[k][jdrop] = con[k];
674
- }
675
-
676
- // Branch back for further iterations with the current RHO.
677
- if (trured > 0.0 && trured >= 0.1 * prerem) {
678
- continue L_140;
679
- }
680
- }
681
- } while (false);
682
-
683
- if (!iflag) {
684
- ibrnch = false;
685
- continue L_140;
686
- }
687
-
688
- if (rho <= rhoend) {
689
- status = this.Normal;
690
- break L_40;
691
- }
692
-
693
- // Otherwise reduce RHO if it is not at its least value and reset PARMU.
694
- cmin = 0.0;
695
- cmax = 0.0;
696
- rho *= 0.5;
697
- if (rho <= 1.5 * rhoend) { rho = rhoend; }
698
- if (parmu > 0.0) {
699
- denom = 0.0;
700
- for (k = 1; k <= mp; ++k) {
701
- cmin = datmat[k][np];
702
- cmax = cmin;
703
- for (i = 1; i <= n; ++i) {
704
- cmin = Math.min(cmin, datmat[k][i]);
705
- cmax = Math.max(cmax, datmat[k][i]);
719
+ if (iprint >= 2) {
720
+ console.log("Reduction in RHO to " + rho + " and PARMU = " + parmu);
706
721
  }
707
- if (k <= m && cmin < 0.5 * cmax) {
708
- temp = Math.max(cmax, 0.0) - cmin;
709
- denom = denom <= 0.0 ? temp : Math.min(denom, temp);
722
+ if (iprint === 2) {
723
+ this.PrintIterationResult(nfvals, datmat[mp][np], datmat[mpp][np], this.COL(sim, np), n, iprint);
710
724
  }
711
- }
712
- if (denom === 0.0) {
713
- parmu = 0.0;
714
- } else if (cmax - cmin < parmu * denom) {
715
- parmu = (cmax - cmin) / denom;
716
- }
717
- }
718
- if (iprint >= 2) {
719
- console.log("Reduction in RHO to " + rho + " and PARMU = " + parmu);
720
- }
721
- if (iprint === 2) {
722
- this.PrintIterationResult(nfvals, datmat[mp][np], datmat[mpp][np], this.COL(sim, np), n, iprint);
723
- }
725
+ } while (true);
724
726
  } while (true);
725
- } while (true);
726
727
 
727
728
  switch (status) {
728
729
  case this.Normal:
729
- if (iprint >= 1) { console.log("%nNormal return from subroutine COBYLA%n"); }
730
+ if (iprint >= 1) {
731
+ console.log("%nNormal return from subroutine COBYLA%n");
732
+ }
730
733
  if (ifull) {
731
- if (iprint >= 1) { this.PrintIterationResult(nfvals, f, resmax, x, n, iprint); }
734
+ if (iprint >= 1) {
735
+ this.PrintIterationResult(nfvals, f, resmax, x, n, iprint);
736
+ }
732
737
  return status;
733
738
  }
734
739
  break;
@@ -744,10 +749,14 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
744
749
  break;
745
750
  }
746
751
 
747
- for (k = 1; k <= n; ++k) { x[k] = sim[k][np]; }
752
+ for (k = 1; k <= n; ++k) {
753
+ x[k] = sim[k][np];
754
+ }
748
755
  f = datmat[mp][np];
749
756
  resmax = datmat[mpp][np];
750
- if (iprint >= 1) { this.PrintIterationResult(nfvals, f, resmax, x, n, iprint); }
757
+ if (iprint >= 1) {
758
+ this.PrintIterationResult(nfvals, f, resmax, x, n, iprint);
759
+ }
751
760
 
752
761
  return status;
753
762
  },
@@ -850,380 +859,426 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
850
859
  first = true;
851
860
  do {
852
861
  L_60:
853
- do {
854
- if (!first || (first && resmax === 0.0)) {
855
- mcon = m + 1;
856
- icon = mcon;
857
- iact[mcon] = mcon;
858
- vmultc[mcon] = 0.0;
859
- }
860
- first = false;
861
-
862
- optold = 0.0;
863
- icount = 0;
864
- step = 0;
865
- stpful = 0;
866
-
867
- L_70:
868
862
  do {
869
- // optnew = (mcon === m) ? resmax : -this.DOT_PRODUCT(this.PART(dx, 1, n), this.PART(this.COL(a, mcon), 1, n));
870
- optnew = (mcon === m) ? resmax : -this.DOT_PRODUCT_ROW_COL(dx, -1, a, mcon, 1, n);
871
-
872
- if (icount === 0 || optnew < optold) {
873
- optold = optnew;
874
- nactx = nact;
875
- icount = 3;
876
- } else if (nact > nactx) {
877
- nactx = nact;
878
- icount = 3;
879
- } else {
880
- --icount;
863
+ if (!first || (first && resmax === 0.0)) {
864
+ mcon = m + 1;
865
+ icon = mcon;
866
+ iact[mcon] = mcon;
867
+ vmultc[mcon] = 0.0;
881
868
  }
882
- if (icount === 0) { break L_60; }
883
-
884
- // If ICON exceeds NACT, then we add the constraint with index IACT(ICON) to
885
- // the active set. Apply Givens rotations so that the last N-NACT-1 columns
886
- // of Z are orthogonal to the gradient of the new constraint, a scalar
887
- // product being set to zero if its nonzero value could be due to computer
888
- // rounding errors. The array DXNEW is used for working space.
889
- ratio = 0;
890
- if (icon <= nact) {
891
- if (icon < nact) {
892
- // Delete the constraint that has the index IACT(ICON) from the active set.
893
-
894
- isave = iact[icon];
895
- vsave = vmultc[icon];
896
- k = icon;
897
- do {
898
- kp = k + 1;
899
- kk = iact[kp];
900
- sp = this.DOT_PRODUCT(
901
- this.PART(this.COL(z, k), 1, n),
902
- this.PART(this.COL(a, kk), 1, n)
903
- );
904
- temp = Math.sqrt(sp * sp + zdota[kp] * zdota[kp]);
905
- alpha = zdota[kp] / temp;
906
- beta = sp / temp;
907
- zdota[kp] = alpha * zdota[k];
908
- zdota[k] = temp;
909
- for (i = 1; i <= n; ++i) {
910
- temp = alpha * z[i][kp] + beta * z[i][k];
911
- z[i][kp] = alpha * z[i][k] - beta * z[i][kp];
912
- z[i][k] = temp;
913
- }
914
- iact[k] = kk;
915
- vmultc[k] = vmultc[kp];
916
- k = kp;
917
- } while (k < nact);
918
-
919
- iact[k] = isave;
920
- vmultc[k] = vsave;
921
- }
922
- --nact;
923
-
924
- // If stage one is in progress, then set SDIRN to the direction of the next
925
- // change to the current vector of variables.
926
- if (mcon > m) {
927
- // Pick the next search direction of stage two.
928
- temp = 1.0 / zdota[nact];
929
- for (k = 1; k <= n; ++k) { sdirn[k] = temp * z[k][nact]; }
930
- } else {
931
- // temp = this.DOT_PRODUCT(this.PART(sdirn, 1, n), this.PART(this.COL(z, nact + 1), 1, n));
932
- temp = this.DOT_PRODUCT_ROW_COL(sdirn, -1, z, nact + 1, 1, n);
933
- for (k = 1; k <= n; ++k) { sdirn[k] -= temp * z[k][nact + 1]; }
934
- }
935
- } else {
936
- kk = iact[icon];
937
- for (k = 1; k <= n; ++k) { dxnew[k] = a[k][kk]; }
938
- tot = 0.0;
939
-
940
- // {
941
- k = n;
942
- while (k > nact) {
943
- sp = 0.0;
944
- spabs = 0.0;
945
- for (i = 1; i <= n; ++i) {
946
- temp = z[i][k] * dxnew[i];
947
- sp += temp;
948
- spabs += Math.abs(temp);
949
- }
950
- acca = spabs + 0.1 * Math.abs(sp);
951
- accb = spabs + 0.2 * Math.abs(sp);
952
- if (spabs >= acca || acca >= accb) { sp = 0.0; }
953
- if (tot === 0.0) {
954
- tot = sp;
869
+ first = false;
870
+
871
+ optold = 0.0;
872
+ icount = 0;
873
+ step = 0;
874
+ stpful = 0;
875
+
876
+ L_70:
877
+ do {
878
+ // optnew = (mcon === m) ? resmax : -this.DOT_PRODUCT(this.PART(dx, 1, n), this.PART(this.COL(a, mcon), 1, n));
879
+ optnew = (mcon === m) ? resmax : -this.DOT_PRODUCT_ROW_COL(dx, -1, a, mcon, 1, n);
880
+
881
+ if (icount === 0 || optnew < optold) {
882
+ optold = optnew;
883
+ nactx = nact;
884
+ icount = 3;
885
+ } else if (nact > nactx) {
886
+ nactx = nact;
887
+ icount = 3;
955
888
  } else {
956
- kp = k + 1;
957
- temp = Math.sqrt(sp * sp + tot * tot);
958
- alpha = sp / temp;
959
- beta = tot / temp;
960
- tot = temp;
961
- for (i = 1; i <= n; ++i) {
962
- temp = alpha * z[i][k] + beta * z[i][kp];
963
- z[i][kp] = alpha * z[i][kp] - beta * z[i][k];
964
- z[i][k] = temp;
965
- }
889
+ --icount;
890
+ }
891
+ if (icount === 0) {
892
+ break L_60;
966
893
  }
967
- --k;
968
- }
969
- // }
970
894
 
971
- if (tot === 0.0) {
972
- // The next instruction is reached if a deletion has to be made from the
973
- // active set in order to make room for the new active constraint, because
974
- // the new constraint gradient is a linear combination of the gradients of
975
- // the old active constraints. Set the elements of VMULTD to the multipliers
976
- // of the linear combination. Further, set IOUT to the index of the
977
- // constraint to be deleted, but branch if no suitable index can be found.
895
+ // If ICON exceeds NACT, then we add the constraint with index IACT(ICON) to
896
+ // the active set. Apply Givens rotations so that the last N-NACT-1 columns
897
+ // of Z are orthogonal to the gradient of the new constraint, a scalar
898
+ // product being set to zero if its nonzero value could be due to computer
899
+ // rounding errors. The array DXNEW is used for working space.
900
+ ratio = 0;
901
+ if (icon <= nact) {
902
+ if (icon < nact) {
903
+ // Delete the constraint that has the index IACT(ICON) from the active set.
904
+
905
+ isave = iact[icon];
906
+ vsave = vmultc[icon];
907
+ k = icon;
908
+ do {
909
+ kp = k + 1;
910
+ kk = iact[kp];
911
+ sp = this.DOT_PRODUCT(
912
+ this.PART(this.COL(z, k), 1, n),
913
+ this.PART(this.COL(a, kk), 1, n)
914
+ );
915
+ temp = Math.sqrt(sp * sp + zdota[kp] * zdota[kp]);
916
+ alpha = zdota[kp] / temp;
917
+ beta = sp / temp;
918
+ zdota[kp] = alpha * zdota[k];
919
+ zdota[k] = temp;
920
+ for (i = 1; i <= n; ++i) {
921
+ temp = alpha * z[i][kp] + beta * z[i][k];
922
+ z[i][kp] = alpha * z[i][k] - beta * z[i][kp];
923
+ z[i][k] = temp;
924
+ }
925
+ iact[k] = kk;
926
+ vmultc[k] = vmultc[kp];
927
+ k = kp;
928
+ } while (k < nact);
929
+
930
+ iact[k] = isave;
931
+ vmultc[k] = vsave;
932
+ }
933
+ --nact;
978
934
 
979
- ratio = -1.0;
980
- //{
981
- k = nact;
982
- do {
983
- zdotv = 0.0;
984
- zdvabs = 0.0;
935
+ // If stage one is in progress, then set SDIRN to the direction of the next
936
+ // change to the current vector of variables.
937
+ if (mcon > m) {
938
+ // Pick the next search direction of stage two.
939
+ temp = 1.0 / zdota[nact];
940
+ for (k = 1; k <= n; ++k) {
941
+ sdirn[k] = temp * z[k][nact];
942
+ }
943
+ } else {
944
+ // temp = this.DOT_PRODUCT(this.PART(sdirn, 1, n), this.PART(this.COL(z, nact + 1), 1, n));
945
+ temp = this.DOT_PRODUCT_ROW_COL(sdirn, -1, z, nact + 1, 1, n);
946
+ for (k = 1; k <= n; ++k) {
947
+ sdirn[k] -= temp * z[k][nact + 1];
948
+ }
949
+ }
950
+ } else {
951
+ kk = iact[icon];
952
+ for (k = 1; k <= n; ++k) {
953
+ dxnew[k] = a[k][kk];
954
+ }
955
+ tot = 0.0;
985
956
 
986
- for (i = 1; i <= n; ++i) {
987
- temp = z[i][k] * dxnew[i];
988
- zdotv += temp;
989
- zdvabs += Math.abs(temp);
957
+ // {
958
+ k = n;
959
+ while (k > nact) {
960
+ sp = 0.0;
961
+ spabs = 0.0;
962
+ for (i = 1; i <= n; ++i) {
963
+ temp = z[i][k] * dxnew[i];
964
+ sp += temp;
965
+ spabs += Math.abs(temp);
966
+ }
967
+ acca = spabs + 0.1 * Math.abs(sp);
968
+ accb = spabs + 0.2 * Math.abs(sp);
969
+ if (spabs >= acca || acca >= accb) {
970
+ sp = 0.0;
971
+ }
972
+ if (tot === 0.0) {
973
+ tot = sp;
974
+ } else {
975
+ kp = k + 1;
976
+ temp = Math.sqrt(sp * sp + tot * tot);
977
+ alpha = sp / temp;
978
+ beta = tot / temp;
979
+ tot = temp;
980
+ for (i = 1; i <= n; ++i) {
981
+ temp = alpha * z[i][k] + beta * z[i][kp];
982
+ z[i][kp] = alpha * z[i][kp] - beta * z[i][k];
983
+ z[i][k] = temp;
984
+ }
985
+ }
986
+ --k;
990
987
  }
991
- acca = zdvabs + 0.1 * Math.abs(zdotv);
992
- accb = zdvabs + 0.2 * Math.abs(zdotv);
993
- if (zdvabs < acca && acca < accb) {
994
- temp = zdotv / zdota[k];
995
- if (temp > 0.0 && iact[k] <= m) {
996
- tempa = vmultc[k] / temp;
997
- if (ratio < 0.0 || tempa < ratio) { ratio = tempa; }
988
+ // }
989
+
990
+ if (tot === 0.0) {
991
+ // The next instruction is reached if a deletion has to be made from the
992
+ // active set in order to make room for the new active constraint, because
993
+ // the new constraint gradient is a linear combination of the gradients of
994
+ // the old active constraints. Set the elements of VMULTD to the multipliers
995
+ // of the linear combination. Further, set IOUT to the index of the
996
+ // constraint to be deleted, but branch if no suitable index can be found.
997
+
998
+ ratio = -1.0;
999
+ //{
1000
+ k = nact;
1001
+ do {
1002
+ zdotv = 0.0;
1003
+ zdvabs = 0.0;
1004
+
1005
+ for (i = 1; i <= n; ++i) {
1006
+ temp = z[i][k] * dxnew[i];
1007
+ zdotv += temp;
1008
+ zdvabs += Math.abs(temp);
1009
+ }
1010
+ acca = zdvabs + 0.1 * Math.abs(zdotv);
1011
+ accb = zdvabs + 0.2 * Math.abs(zdotv);
1012
+ if (zdvabs < acca && acca < accb) {
1013
+ temp = zdotv / zdota[k];
1014
+ if (temp > 0.0 && iact[k] <= m) {
1015
+ tempa = vmultc[k] / temp;
1016
+ if (ratio < 0.0 || tempa < ratio) {
1017
+ ratio = tempa;
1018
+ }
1019
+ }
1020
+
1021
+ if (k >= 2) {
1022
+ kw = iact[k];
1023
+ for (i = 1; i <= n; ++i) {
1024
+ dxnew[i] -= temp * a[i][kw];
1025
+ }
1026
+ }
1027
+ vmultd[k] = temp;
1028
+ } else {
1029
+ vmultd[k] = 0.0;
1030
+ }
1031
+ } while (--k > 0);
1032
+ //}
1033
+ if (ratio < 0.0) {
1034
+ break L_60;
998
1035
  }
999
1036
 
1000
- if (k >= 2) {
1001
- kw = iact[k];
1002
- for (i = 1; i <= n; ++i) { dxnew[i] -= temp * a[i][kw]; }
1037
+ // Revise the Lagrange multipliers and reorder the active constraints so
1038
+ // that the one to be replaced is at the end of the list. Also calculate the
1039
+ // new value of ZDOTA(NACT) and branch if it is not acceptable.
1040
+
1041
+ for (k = 1; k <= nact; ++k) {
1042
+ vmultc[k] = Math.max(0.0, vmultc[k] - ratio * vmultd[k]);
1043
+ }
1044
+ if (icon < nact) {
1045
+ isave = iact[icon];
1046
+ vsave = vmultc[icon];
1047
+ k = icon;
1048
+ do {
1049
+ kp = k + 1;
1050
+ kw = iact[kp];
1051
+ sp = this.DOT_PRODUCT(
1052
+ this.PART(this.COL(z, k), 1, n),
1053
+ this.PART(this.COL(a, kw), 1, n)
1054
+ );
1055
+ temp = Math.sqrt(sp * sp + zdota[kp] * zdota[kp]);
1056
+ alpha = zdota[kp] / temp;
1057
+ beta = sp / temp;
1058
+ zdota[kp] = alpha * zdota[k];
1059
+ zdota[k] = temp;
1060
+ for (i = 1; i <= n; ++i) {
1061
+ temp = alpha * z[i][kp] + beta * z[i][k];
1062
+ z[i][kp] = alpha * z[i][k] - beta * z[i][kp];
1063
+ z[i][k] = temp;
1064
+ }
1065
+ iact[k] = kw;
1066
+ vmultc[k] = vmultc[kp];
1067
+ k = kp;
1068
+ } while (k < nact);
1069
+ iact[k] = isave;
1070
+ vmultc[k] = vsave;
1003
1071
  }
1004
- vmultd[k] = temp;
1072
+ temp = this.DOT_PRODUCT(
1073
+ this.PART(this.COL(z, nact), 1, n),
1074
+ this.PART(this.COL(a, kk), 1, n)
1075
+ );
1076
+ if (temp === 0.0) {
1077
+ break L_60;
1078
+ }
1079
+ zdota[nact] = temp;
1080
+ vmultc[icon] = 0.0;
1081
+ vmultc[nact] = ratio;
1005
1082
  } else {
1006
- vmultd[k] = 0.0;
1083
+ // Add the new constraint if this can be done without a deletion from the
1084
+ // active set.
1085
+
1086
+ ++nact;
1087
+ zdota[nact] = tot;
1088
+ vmultc[icon] = vmultc[nact];
1089
+ vmultc[nact] = 0.0;
1007
1090
  }
1008
- } while (--k > 0);
1009
- //}
1010
- if (ratio < 0.0) { break L_60; }
1011
1091
 
1012
- // Revise the Lagrange multipliers and reorder the active constraints so
1013
- // that the one to be replaced is at the end of the list. Also calculate the
1014
- // new value of ZDOTA(NACT) and branch if it is not acceptable.
1092
+ // Update IACT and ensure that the objective function continues to be
1093
+ // treated as the last active constraint when MCON>M.
1015
1094
 
1016
- for (k = 1; k <= nact; ++k) {
1017
- vmultc[k] = Math.max(0.0, vmultc[k] - ratio * vmultd[k]);
1018
- }
1019
- if (icon < nact) {
1020
- isave = iact[icon];
1021
- vsave = vmultc[icon];
1022
- k = icon;
1023
- do {
1024
- kp = k + 1;
1025
- kw = iact[kp];
1095
+ iact[icon] = iact[nact];
1096
+ iact[nact] = kk;
1097
+ if (mcon > m && kk !== mcon) {
1098
+ k = nact - 1;
1026
1099
  sp = this.DOT_PRODUCT(
1027
1100
  this.PART(this.COL(z, k), 1, n),
1028
- this.PART(this.COL(a, kw), 1, n)
1101
+ this.PART(this.COL(a, kk), 1, n)
1029
1102
  );
1030
- temp = Math.sqrt(sp * sp + zdota[kp] * zdota[kp]);
1031
- alpha = zdota[kp] / temp;
1103
+ temp = Math.sqrt(sp * sp + zdota[nact] * zdota[nact]);
1104
+ alpha = zdota[nact] / temp;
1032
1105
  beta = sp / temp;
1033
- zdota[kp] = alpha * zdota[k];
1106
+ zdota[nact] = alpha * zdota[k];
1034
1107
  zdota[k] = temp;
1035
1108
  for (i = 1; i <= n; ++i) {
1036
- temp = alpha * z[i][kp] + beta * z[i][k];
1037
- z[i][kp] = alpha * z[i][k] - beta * z[i][kp];
1109
+ temp = alpha * z[i][nact] + beta * z[i][k];
1110
+ z[i][nact] = alpha * z[i][k] - beta * z[i][nact];
1038
1111
  z[i][k] = temp;
1039
1112
  }
1040
- iact[k] = kw;
1041
- vmultc[k] = vmultc[kp];
1042
- k = kp;
1043
- } while (k < nact);
1044
- iact[k] = isave;
1045
- vmultc[k] = vsave;
1113
+ iact[nact] = iact[k];
1114
+ iact[k] = kk;
1115
+ temp = vmultc[k];
1116
+ vmultc[k] = vmultc[nact];
1117
+ vmultc[nact] = temp;
1118
+ }
1119
+
1120
+ // If stage one is in progress, then set SDIRN to the direction of the next
1121
+ // change to the current vector of variables.
1122
+ if (mcon > m) {
1123
+ // Pick the next search direction of stage two.
1124
+ temp = 1.0 / zdota[nact];
1125
+ for (k = 1; k <= n; ++k) {
1126
+ sdirn[k] = temp * z[k][nact];
1127
+ }
1128
+ } else {
1129
+ kk = iact[nact];
1130
+ // temp = (this.DOT_PRODUCT(this.PART(sdirn, 1, n),this.PART(this.COL(a, kk), 1, n)) - 1.0) / zdota[nact];
1131
+ temp = (this.DOT_PRODUCT_ROW_COL(sdirn, -1, a, kk, 1, n) - 1.0) / zdota[nact];
1132
+ for (k = 1; k <= n; ++k) {
1133
+ sdirn[k] -= temp * z[k][nact];
1134
+ }
1135
+ }
1046
1136
  }
1047
- temp = this.DOT_PRODUCT(
1048
- this.PART(this.COL(z, nact), 1, n),
1049
- this.PART(this.COL(a, kk), 1, n)
1050
- );
1051
- if (temp === 0.0) { break L_60; }
1052
- zdota[nact] = temp;
1053
- vmultc[icon] = 0.0;
1054
- vmultc[nact] = ratio;
1055
- } else {
1056
- // Add the new constraint if this can be done without a deletion from the
1057
- // active set.
1058
-
1059
- ++nact;
1060
- zdota[nact] = tot;
1061
- vmultc[icon] = vmultc[nact];
1062
- vmultc[nact] = 0.0;
1063
- }
1064
1137
 
1065
- // Update IACT and ensure that the objective function continues to be
1066
- // treated as the last active constraint when MCON>M.
1067
-
1068
- iact[icon] = iact[nact];
1069
- iact[nact] = kk;
1070
- if (mcon > m && kk !== mcon) {
1071
- k = nact - 1;
1072
- sp = this.DOT_PRODUCT(
1073
- this.PART(this.COL(z, k), 1, n),
1074
- this.PART(this.COL(a, kk), 1, n)
1075
- );
1076
- temp = Math.sqrt(sp * sp + zdota[nact] * zdota[nact]);
1077
- alpha = zdota[nact] / temp;
1078
- beta = sp / temp;
1079
- zdota[nact] = alpha * zdota[k];
1080
- zdota[k] = temp;
1138
+ // Calculate the step to the boundary of the trust region or take the step
1139
+ // that reduces RESMAX to zero. The two statements below that include the
1140
+ // factor 1.0E-6 prevent some harmless underflows that occurred in a test
1141
+ // calculation. Further, we skip the step if it could be zero within a
1142
+ // reasonable tolerance for computer rounding errors.
1143
+ dd = rho * rho;
1144
+ sd = 0.0;
1145
+ ss = 0.0;
1081
1146
  for (i = 1; i <= n; ++i) {
1082
- temp = alpha * z[i][nact] + beta * z[i][k];
1083
- z[i][nact] = alpha * z[i][k] - beta * z[i][nact];
1084
- z[i][k] = temp;
1147
+ if (Math.abs(dx[i]) >= 1.0E-6 * rho) {
1148
+ dd -= dx[i] * dx[i];
1149
+ }
1150
+ sd += dx[i] * sdirn[i];
1151
+ ss += sdirn[i] * sdirn[i];
1152
+ }
1153
+ if (dd <= 0.0) {
1154
+ break L_60;
1155
+ }
1156
+ temp = Math.sqrt(ss * dd);
1157
+ if (Math.abs(sd) >= 1.0E-6 * temp) {
1158
+ temp = Math.sqrt(ss * dd + sd * sd);
1159
+ }
1160
+ stpful = dd / (temp + sd);
1161
+ step = stpful;
1162
+ if (mcon === m) {
1163
+ acca = step + 0.1 * resmax;
1164
+ accb = step + 0.2 * resmax;
1165
+ if (step >= acca || acca >= accb) {
1166
+ break L_70;
1167
+ }
1168
+ step = Math.min(step, resmax);
1085
1169
  }
1086
- iact[nact] = iact[k];
1087
- iact[k] = kk;
1088
- temp = vmultc[k];
1089
- vmultc[k] = vmultc[nact];
1090
- vmultc[nact] = temp;
1091
- }
1092
1170
 
1093
- // If stage one is in progress, then set SDIRN to the direction of the next
1094
- // change to the current vector of variables.
1095
- if (mcon > m) {
1096
- // Pick the next search direction of stage two.
1097
- temp = 1.0 / zdota[nact];
1098
- for (k = 1; k <= n; ++k) { sdirn[k] = temp * z[k][nact]; }
1099
- } else {
1100
- kk = iact[nact];
1101
- // temp = (this.DOT_PRODUCT(this.PART(sdirn, 1, n),this.PART(this.COL(a, kk), 1, n)) - 1.0) / zdota[nact];
1102
- temp = (this.DOT_PRODUCT_ROW_COL(sdirn, -1, a, kk, 1, n) - 1.0) / zdota[nact];
1103
- for (k = 1; k <= n; ++k) { sdirn[k] -= temp * z[k][nact]; }
1104
- }
1105
- }
1171
+ // Set DXNEW to the new variables if STEP is the steplength, and reduce
1172
+ // RESMAX to the corresponding maximum residual if stage one is being done.
1173
+ // Because DXNEW will be changed during the calculation of some Lagrange
1174
+ // multipliers, it will be restored to the following value later.
1175
+ for (k = 1; k <= n; ++k) {
1176
+ dxnew[k] = dx[k] + step * sdirn[k];
1177
+ }
1178
+ if (mcon === m) {
1179
+ resold = resmax;
1180
+ resmax = 0.0;
1181
+ for (k = 1; k <= nact; ++k) {
1182
+ kk = iact[k];
1183
+ // temp = b[kk] - this.DOT_PRODUCT(this.PART(this.COL(a, kk), 1, n), this.PART(dxnew, 1, n));
1184
+ temp = b[kk] - this.DOT_PRODUCT_ROW_COL(dxnew, -1, a, kk, 1, n);
1185
+ resmax = Math.max(resmax, temp);
1186
+ }
1187
+ }
1106
1188
 
1107
- // Calculate the step to the boundary of the trust region or take the step
1108
- // that reduces RESMAX to zero. The two statements below that include the
1109
- // factor 1.0E-6 prevent some harmless underflows that occurred in a test
1110
- // calculation. Further, we skip the step if it could be zero within a
1111
- // reasonable tolerance for computer rounding errors.
1112
- dd = rho * rho;
1113
- sd = 0.0;
1114
- ss = 0.0;
1115
- for (i = 1; i <= n; ++i) {
1116
- if (Math.abs(dx[i]) >= 1.0E-6 * rho) { dd -= dx[i] * dx[i]; }
1117
- sd += dx[i] * sdirn[i];
1118
- ss += sdirn[i] * sdirn[i];
1119
- }
1120
- if (dd <= 0.0) { break L_60; }
1121
- temp = Math.sqrt(ss * dd);
1122
- if (Math.abs(sd) >= 1.0E-6 * temp) { temp = Math.sqrt(ss * dd + sd * sd); }
1123
- stpful = dd / (temp + sd);
1124
- step = stpful;
1125
- if (mcon === m) {
1126
- acca = step + 0.1 * resmax;
1127
- accb = step + 0.2 * resmax;
1128
- if (step >= acca || acca >= accb) { break L_70; }
1129
- step = Math.min(step, resmax);
1130
- }
1189
+ // Set VMULTD to the VMULTC vector that would occur if DX became DXNEW. A
1190
+ // device is included to force VMULTD(K) = 0.0 if deviations from this value
1191
+ // can be attributed to computer rounding errors. First calculate the new
1192
+ // Lagrange multipliers.
1193
+ //{
1194
+ k = nact;
1195
+ do {
1196
+ zdotw = 0.0;
1197
+ zdwabs = 0.0;
1198
+ for (i = 1; i <= n; ++i) {
1199
+ temp = z[i][k] * dxnew[i];
1200
+ zdotw += temp;
1201
+ zdwabs += Math.abs(temp);
1202
+ }
1203
+ acca = zdwabs + 0.1 * Math.abs(zdotw);
1204
+ accb = zdwabs + 0.2 * Math.abs(zdotw);
1205
+ if (zdwabs >= acca || acca >= accb) {
1206
+ zdotw = 0.0;
1207
+ }
1208
+ vmultd[k] = zdotw / zdota[k];
1209
+ if (k >= 2) {
1210
+ kk = iact[k];
1211
+ for (i = 1; i <= n; ++i) {
1212
+ dxnew[i] -= vmultd[k] * a[i][kk];
1213
+ }
1214
+ }
1215
+ } while (k-- >= 2);
1216
+ if (mcon > m) {
1217
+ vmultd[nact] = Math.max(0.0, vmultd[nact]);
1218
+ }
1219
+ //}
1131
1220
 
1132
- // Set DXNEW to the new variables if STEP is the steplength, and reduce
1133
- // RESMAX to the corresponding maximum residual if stage one is being done.
1134
- // Because DXNEW will be changed during the calculation of some Lagrange
1135
- // multipliers, it will be restored to the following value later.
1136
- for (k = 1; k <= n; ++k) { dxnew[k] = dx[k] + step * sdirn[k]; }
1137
- if (mcon === m) {
1138
- resold = resmax;
1139
- resmax = 0.0;
1140
- for (k = 1; k <= nact; ++k) {
1141
- kk = iact[k];
1142
- // temp = b[kk] - this.DOT_PRODUCT(this.PART(this.COL(a, kk), 1, n), this.PART(dxnew, 1, n));
1143
- temp = b[kk] - this.DOT_PRODUCT_ROW_COL(dxnew, -1, a, kk, 1, n);
1144
- resmax = Math.max(resmax, temp);
1145
- }
1146
- }
1221
+ // Complete VMULTC by finding the new constraint residuals.
1147
1222
 
1148
- // Set VMULTD to the VMULTC vector that would occur if DX became DXNEW. A
1149
- // device is included to force VMULTD(K) = 0.0 if deviations from this value
1150
- // can be attributed to computer rounding errors. First calculate the new
1151
- // Lagrange multipliers.
1152
- //{
1153
- k = nact;
1154
- do {
1155
- zdotw = 0.0;
1156
- zdwabs = 0.0;
1157
- for (i = 1; i <= n; ++i) {
1158
- temp = z[i][k] * dxnew[i];
1159
- zdotw += temp;
1160
- zdwabs += Math.abs(temp);
1161
- }
1162
- acca = zdwabs + 0.1 * Math.abs(zdotw);
1163
- accb = zdwabs + 0.2 * Math.abs(zdotw);
1164
- if (zdwabs >= acca || acca >= accb) { zdotw = 0.0; }
1165
- vmultd[k] = zdotw / zdota[k];
1166
- if (k >= 2) {
1167
- kk = iact[k];
1168
- for (i = 1; i <= n; ++i) { dxnew[i] -= vmultd[k] * a[i][kk]; }
1169
- }
1170
- } while (k-- >= 2);
1171
- if (mcon > m) { vmultd[nact] = Math.max(0.0, vmultd[nact]); }
1172
- //}
1173
-
1174
- // Complete VMULTC by finding the new constraint residuals.
1175
-
1176
- for (k = 1; k <= n; ++k) { dxnew[k] = dx[k] + step * sdirn[k]; }
1177
- if (mcon > nact) {
1178
- kl = nact + 1;
1179
- for (k = kl; k <= mcon; ++k) {
1180
- kk = iact[k];
1181
- total = resmax - b[kk];
1182
- sumabs = resmax + Math.abs(b[kk]);
1183
- for (i = 1; i <= n; ++i) {
1184
- temp = a[i][kk] * dxnew[i];
1185
- total += temp;
1186
- sumabs += Math.abs(temp);
1223
+ for (k = 1; k <= n; ++k) {
1224
+ dxnew[k] = dx[k] + step * sdirn[k];
1225
+ }
1226
+ if (mcon > nact) {
1227
+ kl = nact + 1;
1228
+ for (k = kl; k <= mcon; ++k) {
1229
+ kk = iact[k];
1230
+ total = resmax - b[kk];
1231
+ sumabs = resmax + Math.abs(b[kk]);
1232
+ for (i = 1; i <= n; ++i) {
1233
+ temp = a[i][kk] * dxnew[i];
1234
+ total += temp;
1235
+ sumabs += Math.abs(temp);
1236
+ }
1237
+ acca = sumabs + 0.1 * Math.abs(total);
1238
+ accb = sumabs + 0.2 * Math.abs(total);
1239
+ if (sumabs >= acca || acca >= accb) {
1240
+ total = 0.0;
1241
+ }
1242
+ vmultd[k] = total;
1243
+ }
1187
1244
  }
1188
- acca = sumabs + 0.1 * Math.abs(total);
1189
- accb = sumabs + 0.2 * Math.abs(total);
1190
- if (sumabs >= acca || acca >= accb) { total = 0.0; }
1191
- vmultd[k] = total;
1192
- }
1193
- }
1194
1245
 
1195
- // Calculate the fraction of the step from DX to DXNEW that will be taken.
1246
+ // Calculate the fraction of the step from DX to DXNEW that will be taken.
1196
1247
 
1197
- ratio = 1.0;
1198
- icon = 0;
1199
- for (k = 1; k <= mcon; ++k) {
1200
- if (vmultd[k] < 0.0) {
1201
- temp = vmultc[k] / (vmultc[k] - vmultd[k]);
1202
- if (temp < ratio) {
1203
- ratio = temp;
1204
- icon = k;
1248
+ ratio = 1.0;
1249
+ icon = 0;
1250
+ for (k = 1; k <= mcon; ++k) {
1251
+ if (vmultd[k] < 0.0) {
1252
+ temp = vmultc[k] / (vmultc[k] - vmultd[k]);
1253
+ if (temp < ratio) {
1254
+ ratio = temp;
1255
+ icon = k;
1256
+ }
1257
+ }
1205
1258
  }
1206
- }
1207
- }
1208
1259
 
1209
- // Update DX, VMULTC and RESMAX.
1260
+ // Update DX, VMULTC and RESMAX.
1210
1261
 
1211
- temp = 1.0 - ratio;
1212
- for (k = 1; k <= n; ++k) { dx[k] = temp * dx[k] + ratio * dxnew[k]; }
1213
- for (k = 1; k <= mcon; ++k) {
1214
- vmultc[k] = Math.max(0.0, temp * vmultc[k] + ratio * vmultd[k]);
1215
- }
1216
- if (mcon === m) { resmax = resold + ratio * (resmax - resold); }
1262
+ temp = 1.0 - ratio;
1263
+ for (k = 1; k <= n; ++k) {
1264
+ dx[k] = temp * dx[k] + ratio * dxnew[k];
1265
+ }
1266
+ for (k = 1; k <= mcon; ++k) {
1267
+ vmultc[k] = Math.max(0.0, temp * vmultc[k] + ratio * vmultd[k]);
1268
+ }
1269
+ if (mcon === m) {
1270
+ resmax = resold + ratio * (resmax - resold);
1271
+ }
1217
1272
 
1218
- // If the full step is not acceptable then begin another iteration.
1219
- // Otherwise switch to stage two or end the calculation.
1220
- } while (icon > 0);
1273
+ // If the full step is not acceptable then begin another iteration.
1274
+ // Otherwise switch to stage two or end the calculation.
1275
+ } while (icon > 0);
1221
1276
 
1222
- if (step === stpful) {
1223
- return true;
1224
- }
1277
+ if (step === stpful) {
1278
+ return true;
1279
+ }
1225
1280
 
1226
- } while (true);
1281
+ } while (true);
1227
1282
 
1228
1283
  // We employ any freedom that may be available to reduce the objective
1229
1284
  // function before returning a DX whose length is less than RHO.
@@ -1234,8 +1289,12 @@ define(['jxg', 'utils/type'], function (JXG, Type) {
1234
1289
  },
1235
1290
 
1236
1291
  PrintIterationResult: function (nfvals, f, resmax, x, n, iprint) {
1237
- if (iprint > 1) { console.log("NFVALS = " + nfvals + " F = " + f + " MAXCV = " + resmax); }
1238
- if (iprint > 1) { console.log("X = " + this.PART(x, 1, n)); }
1292
+ if (iprint > 1) {
1293
+ console.log("NFVALS = " + nfvals + " F = " + f + " MAXCV = " + resmax);
1294
+ }
1295
+ if (iprint > 1) {
1296
+ console.log("X = " + this.PART(x, 1, n));
1297
+ }
1239
1298
  },
1240
1299
 
1241
1300
  ROW: function (src, rowidx) {