linny-r 1.5.6 → 1.5.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linny-r",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "Executable graphical language with WYSIWYG editor for MILP models",
5
5
  "main": "server.js",
6
6
  "scripts": {
package/static/index.html CHANGED
@@ -1933,7 +1933,9 @@ NOTE: * and ? will be interpreted as wildcards"
1933
1933
  title="Narrow chart">
1934
1934
  </div>
1935
1935
  </div>
1936
- <div id="chart-time-step">t = 0</div>
1936
+ <div id="chart-time-div">
1937
+ <div id="chart-time-step"></div>
1938
+ </div>
1937
1939
  </div>
1938
1940
  <div id="chart-resize" class="resizer"></div>
1939
1941
  </div>
@@ -2644,7 +2644,7 @@ td.equation-expression {
2644
2644
  margin: 0;
2645
2645
  width: 570px;
2646
2646
  height: 255px;
2647
- min-width: 455px;
2647
+ min-width: 520px;
2648
2648
  min-height: 180px;
2649
2649
  max-height: 99vh;
2650
2650
  max-width: 99vw;
@@ -2950,12 +2950,16 @@ img.v-disab {
2950
2950
  margin-left: 4px;
2951
2951
  }
2952
2952
 
2953
- #chart-time-step {
2953
+ #chart-time-div {
2954
2954
  position: absolute;
2955
- bottom: 3px;
2955
+ bottom: 0px;
2956
2956
  right: 3px;
2957
- width: 50px;
2958
- font-size: 11px;
2957
+ width: 55px;
2958
+ height: 22px;
2959
+ }
2960
+
2961
+ #chart-time-step {
2962
+ font-size: 10px;
2959
2963
  }
2960
2964
 
2961
2965
  #chart-toggle-chevron,
@@ -473,7 +473,16 @@ class GUIChartManager extends ChartManager {
473
473
  ox = r.left * scale,
474
474
  w = r.width * scale,
475
475
  x = e.pageX -
476
- this.svg_container.getBoundingClientRect().left + window.scrollX;
476
+ this.svg_container.getBoundingClientRect().left + window.scrollX,
477
+ y = e.pageY -
478
+ this.svg_container.getBoundingClientRect().top + window.scrollY,
479
+ yfract = (c.plot_oy - y / scale) / c.plot_height,
480
+ yres = Math.round(
481
+ Math.max(Math.abs(c.plot_min_y), Math.abs(c.plot_max_y)) / 500),
482
+ yval = c.plot_min_y + yfract * (c.plot_max_y - c.plot_min_y),
483
+ ytrunc = Math.round(yval / yres) * yres,
484
+ ylbl = (yfract < 0 || yfract > 1 || c.plot_min_y >= c.plot_max_y ?
485
+ '' : 'y = ' + VM.sig2Dig(parseFloat(ytrunc.toPrecision(2))));
477
486
  let n = '';
478
487
  if(c.histogram) {
479
488
  let vv = [];
@@ -487,17 +496,30 @@ class GUIChartManager extends ChartManager {
487
496
  v = vv[b % l],
488
497
  t = Math.floor(b / l);
489
498
  if(x > ox && b < bars) n = 'N = ' + v.bin_tallies[t];
490
- } else {
499
+ } else if(this.runs_stat) {
500
+ const
501
+ runs = EXPERIMENT_MANAGER.selectedRuns(c),
502
+ rcnt = runs.length,
503
+ ri = Math.max(0, Math.min(rcnt, Math.floor(rcnt * (x - ox) / w)));
504
+ if(x > ox && ri < rcnt) n = 'Run #' + runs[ri];
505
+ } else if(x > ox - 5) {
491
506
  const
492
507
  runs = EXPERIMENT_MANAGER.selectedRuns(c),
493
508
  p = c.total_time_steps,
494
509
  first = (runs.length > 0 ? 1 : MODEL.start_period),
495
510
  last = (runs.length > 0 ? p : MODEL.end_period),
496
511
  t = Math.round(first - 0.5 + p * (x - ox) / w);
497
- n = 't = ' + Math.max(0, Math.min(t, last));
512
+ if(t <= last) n = 't = ' + Math.max(0, t);
513
+ }
514
+ if(ylbl && n) {
515
+ n += '<br>' + ylbl;
516
+ this.time_step.style.marginTop = '-1px';
517
+ } else {
518
+ this.time_step.style.marginTop = '5px';
498
519
  }
520
+
499
521
  this.time_step.innerHTML = n;
500
- this.time_step.style.display = 'block';
522
+ this.time_step.style.display = 'inline-block';
501
523
  } else {
502
524
  this.time_step.style.display = 'none';
503
525
  }
@@ -2460,7 +2460,7 @@ class GUIController extends Controller {
2460
2460
  }
2461
2461
  x.update(xp);
2462
2462
  // NOTE: overrule `is_static` to make that IL is always evaluated for t=1
2463
- if(name === 'initial level') x.is_static = true;
2463
+ if(name === 'initial level') x.is_static = true;
2464
2464
  return true;
2465
2465
  }
2466
2466
 
@@ -3927,6 +3927,8 @@ console.log('HERE name conflicts', name_conflicts, mapping);
3927
3927
  if(!this.updateExpressionInput('link-D', 'delay', l.flow_delay)) {
3928
3928
  return false;
3929
3929
  }
3930
+ // Explicitly set delay to 0 if input is empty string.
3931
+ if(!l.flow_delay.text.trim()) l.flow_delay.text = '0';
3930
3932
  const
3931
3933
  m = parseInt(md.element('multiplier').value),
3932
3934
  redraw = m !== l.multiplier &&
@@ -125,13 +125,15 @@ class GUIMonitor {
125
125
  for(let i = 0; i < b; i++) {
126
126
  total_time += VM.solver_times[i];
127
127
  }
128
- const n = document.createElement('div');
128
+ const
129
+ n = document.createElement('div'),
130
+ ssecs = VM.solver_secs[b - 1];
129
131
  n.classList.add('progress-block');
130
132
  if(err) n.classList.add('error-pb');
131
133
  if(b % 2 == 0) n.classList.add('even-pb');
132
134
  n.setAttribute('title',
133
- `Block #${b} took ${time.toPrecision(3)} seconds
134
- (solver: ${VM.solver_secs[b - 1]} seconds)`);
135
+ `Block #${b} took ${time.toPrecision(3)} seconds` +
136
+ (ssecs ? `\n(solver: ${ssecs} seconds)` : ''));
135
137
  n.setAttribute('data-blk', b);
136
138
  n.addEventListener('click',
137
139
  (event) => {