linny-r 1.1.19 → 1.1.21

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/README.md CHANGED
@@ -25,7 +25,7 @@ Technical documentation will be developed on GitHub: https://github.com/pwgbots/
25
25
  Linny-R is developed as a JavaScript package, and requires that **Node.js** is installed on your computer.
26
26
  This software can be downloaded from <a href="https://nodejs.org" target="_blank">https://nodejs.org</a>.
27
27
  Make sure that you choose the correct installer for your computer.
28
- Linny-R is developed using the _current_ release. Presently (October 2022) this is 19.0.0.
28
+ Linny-R is developed using the _current_ release. Presently (February 2023) this is 19.6.0.
29
29
 
30
30
  Run the installer and accept the default settings.
31
31
  There is **no** need to install the optional _Tools for Native Modules_.
@@ -36,7 +36,7 @@ Verify the installation by typing:
36
36
 
37
37
  ``node --version``
38
38
 
39
- The response should be the version number of Node.js, for example: v19.0.0.
39
+ The response should be the version number of Node.js, for example: v19.6.0.
40
40
 
41
41
  ## Installing Linny-R
42
42
  It is advisable to install Linny-R in a directory on your computer, not in a cloud.
@@ -169,8 +169,8 @@ Open the Command Line Interface (CLI) of your computer, change to your `WORKING_
169
169
  This response should be something similar to:
170
170
 
171
171
  <pre>
172
- Node.js server for Linny-R version 1.1.14
173
- Node.js version: v19.0.0
172
+ Node.js server for Linny-R version 1.1.21
173
+ Node.js version: v19.6.0
174
174
  ... etc.
175
175
  </pre>
176
176
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linny-r",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "description": "Executable graphical language with WYSIWYG editor for MILP models",
5
5
  "main": "server.js",
6
6
  "scripts": {
@@ -5825,7 +5825,7 @@ class GUIMonitor {
5825
5825
  this.equations_text.value = VM.equations[b - 1];
5826
5826
  }
5827
5827
  // Legend to variables is not block-dependent
5828
- this.variables_text.value = VM.variablesLegend;
5828
+ this.variables_text.value = VM.variablesLegend(b);
5829
5829
  // Show the text area for the selected tab
5830
5830
  if(this.tab !== tab) {
5831
5831
  let mt = 'monitor-' + this.tab;
@@ -6739,9 +6739,14 @@ NOTE: Grouping groups results in a single group, e.g., (1;2);(3;4;5) evaluates a
6739
6739
  options.push('<option selected disabled value="-1"></option>');
6740
6740
  const d = MODEL.equations_dataset;
6741
6741
  if(d) {
6742
+ const slist = [];
6742
6743
  for(let m in d.modifiers) if(d.modifiers.hasOwnProperty(m)) {
6743
- const s = d.modifiers[m].selector;
6744
- options.push(`<option value="${s}">${s}</option>`);
6744
+ slist.push(d.modifiers[m].selector);
6745
+ }
6746
+ // Sort to present equations in alphabetical order
6747
+ slist.sort();
6748
+ for(let i = 0; i < slist.length; i++) {
6749
+ options.push(`<option value="${slist[i]}">${slist[i]}</option>`);
6745
6750
  }
6746
6751
  }
6747
6752
  va.innerHTML = options.join('');
@@ -9819,6 +9824,12 @@ class GUIChartManager extends ChartManager {
9819
9824
  } else if(this.chart_index >= 0) {
9820
9825
  // Only accept when all conditions are met
9821
9826
  ev.preventDefault();
9827
+ if(obj instanceof DatasetModifier) {
9828
+ // Equations can be added directly as chart variable
9829
+ this.addVariable(obj.name);
9830
+ return;
9831
+ }
9832
+ // For other entities, the attribute must be specified
9822
9833
  this.add_variable_modal.show();
9823
9834
  const
9824
9835
  tn = VM.object_types.indexOf(obj.type),
@@ -2631,7 +2631,7 @@ class LinnyRModel {
2631
2631
  // NOTE: peak increase also applies to products
2632
2632
  p.b_peak_inc = [p.level[0]];
2633
2633
  p.la_peak_inc = [p.level[0]];
2634
-
2634
+ p.b_peak = [p.level[0]];
2635
2635
  }
2636
2636
  for(obj in this.links) if(this.links.hasOwnProperty(obj)) {
2637
2637
  l = this.links[obj];
@@ -4226,7 +4226,8 @@ class Note extends ObjectWithXYWH {
4226
4226
  if(obj instanceof DatasetModifier) {
4227
4227
  this.fields.push(new NoteField(tag, obj.expression));
4228
4228
  } else if(obj) {
4229
- const attr = (ena.length > 1 ? ena[1].trim() : '');
4229
+ // If attribute omitted, use default attribute of entity type
4230
+ const attr = (ena.length > 1 ? ena[1].trim() : obj.defaultAttribute);
4230
4231
  // Variable may specify a vector-type attribute
4231
4232
  let val = obj.attributeValue(attr);
4232
4233
  // If not, it may be a cluster unit balance
@@ -130,10 +130,12 @@ class Expression {
130
130
  this.code = null;
131
131
  const xp = new ExpressionParser(this.text, this.object, this.attribute);
132
132
  if(xp.error === '') {
133
- // NOTE: except for dataset modifiers, expressions should not be based
134
- // on levels-still-to-be-computed-by-the-solver, so caution the modeler
135
- // when this appears to be the case
136
- if(xp.is_level_based &&
133
+ // NOTE: except for dataset modifiers and note colors, expressions
134
+ // should not be based on levels-still-to-be-computed-by-the-solver,
135
+ // so caution the modeler when this appears to be the case
136
+ // NOTE: when note color expressions are edited, they are compiled
137
+ // to check their syntax; then their object is null
138
+ if(xp.is_level_based && this.object &&
137
139
  !(this.object instanceof Dataset || this.object instanceof Note)) {
138
140
  // NOTE: this should not occur, so log more details
139
141
  console.log('Level-based issue:',
@@ -1045,7 +1047,7 @@ class ExpressionParser {
1045
1047
  // NOTE: + and - operators are special case, since they may also
1046
1048
  // be part of a floating point number, hence the more elaborate check
1047
1049
  while(pl <= this.eot && (SEPARATOR_CHARS.indexOf(cpl) < 0 ||
1048
- ('+-'.indexOf(cpl) >= 0 && digs && pcpl === 'e'))) {
1050
+ ('+-'.indexOf(cpl) >= 0 && digs && pcpl.toLowerCase() === 'e'))) {
1049
1051
  digs = digs || '0123456789'.indexOf(cpl) >= 0;
1050
1052
  this.los++;
1051
1053
  pl++;
@@ -6247,6 +6249,8 @@ function VMI_set_const_bounds(args) {
6247
6249
  // if this is the first round
6248
6250
  if(VM.current_round) {
6249
6251
  l = vbl.actualLevel(VM.t);
6252
+ //PATCH!!
6253
+ if(l < 0.0005) l = 0;
6250
6254
  } else {
6251
6255
  l = 0;
6252
6256
  }