linny-r 1.1.7 → 1.1.9

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
@@ -5,7 +5,8 @@
5
5
  <a href="https://en.wikipedia.org/wiki/Unit_commitment_problem_in_electrical_power_production" target="_blank">unit commitment problems</a> (UCP) and
6
6
  <a href="https://en.wikipedia.org/wiki/Generation_expansion_planning" target="_blank">generation expansion planning</a> (GEP).</p>
7
7
 
8
- The graphical language and WYSIWYG model editor are developed by **Pieter Bots** at Delft University of Technology.
8
+ The graphical language and WYSIWYG model editor are developed by **Pieter Bots** at
9
+ <a href="https://tudelft.nl" target="_blank">Delft University of Technology</a>.
9
10
 
10
11
  Originally implemented in Delphi Pascal, Linny-R is now developed in HTML+CSS+JavaScript
11
12
  so as to be platform-independent and 100% transparent open source (under the MIT license).
@@ -13,21 +14,21 @@ The software comprises a server that runs on Node.js, and a graphical user inter
13
14
 
14
15
  You can play with the most recent release of Linny-R on
15
16
  <a href="https://sysmod.tbm.tudelft.nl/linny-r" target="_blank">this server hosted at TU Delft</a>.
16
- Note that this server imposes restrictions on solver time and the total number of blocks it will solve per run.
17
+ Note that this server imposes restrictions on solver time and the total number of blocks it will solve per run.
17
18
  If you install Linny-R on your own machine, no such restrictions apply.
18
19
 
19
20
  Documentation for Linny-R is still scant, but it is growing. You can contribute yourself (in "wiki fashion")
20
- via the official documentation site https://linny-r.info.
21
+ via the official documentation site <a href="https://linny-r.info" target="_blank">https://linny-r.info</a>.
21
22
 
22
23
  ### Installing Node.js
23
24
 
24
25
  Linny-R is developed as a JavaScript package, and requires that **Node.js** is installed on your computer.
25
- Node.js can be downloaded from https://nodejs.org.
26
+ This software can be downloaded from <a href="https://nodejs.org" target="_blank">https://nodejs.org</a>.
26
27
  Make sure that you choose the correct installer for your computer.
27
- Linny-R is developed using the *current* release. Presently (October 2022) this is 18.10.0.
28
+ Linny-R is developed using the _current_ release. Presently (October 2022) this is 18.10.0.
28
29
 
29
30
  Run the installer and accept the default settings.
30
- There is **no** need to install the optional Tools for Native Modules.
31
+ There is **no** need to install the optional _Tools for Native Modules_.
31
32
 
32
33
  Open the Command Line Interface (CLI) of your computer.
33
34
  On macOS, this will be `Terminal`, on Windows `Command Prompt`.
@@ -101,13 +102,13 @@ and the sub-directory `static`. This `static` directory should contain three HTM
101
102
 
102
103
  It should also contain the style sheet `linny-r.css` required by the GUI.
103
104
 
104
- The subdirectories of `static` contain files that are served to the browser by the script
105
+ The sub-directories of `static` contain files that are served to the browser by the script
105
106
  `server.js` when it is running in Node.js.
106
107
 
107
108
  ### Configuring the MILP solver
108
109
 
109
110
  Linny-R presently supports two MILP solvers: Gurobi and LP_solve.
110
- Gurobi is *considerably* more powerful than the open source LP_solve solver that has powered Linny-R since 2009,
111
+ Gurobi is _considerably_ more powerful than the open source LP_solve solver that has powered Linny-R since 2009,
111
112
  but it requires a license.
112
113
  Academic licenses can be obtained by students and staff of eligible institutions.
113
114
 
@@ -167,7 +168,7 @@ Open the Command Line Interface (CLI) of your computer, change to your `WORKING_
167
168
  This response should be something similar to:
168
169
 
169
170
  <pre>
170
- Node.js server for Linny-R version 1.0
171
+ Node.js server for Linny-R version 1.1.9
171
172
  Node.js version: v18.10.0
172
173
  ... etc.
173
174
  </pre>
@@ -191,7 +192,7 @@ stating the name of the solver.
191
192
  You can then test the GUI by creating a simple model.
192
193
  Make one that has at least one process that outputs a product,
193
194
  and this product must have a price or a set lower bound, otherwise the model will have no objective function.
194
- Then click on the *Solve* button at the bottom of the left-hand tool bar.
195
+ Then click on the _Solve_ button at the bottom of the left-hand tool bar.
195
196
  The Linny-R icon in the upper left corner should start rotating, while the status bar at the bottom should display:
196
197
 
197
198
  <pre>
@@ -211,14 +212,18 @@ Solve block 1 a
211
212
  The user workspace is created when the server is run for the first time.
212
213
  The sub-directories of this directory `user` are used by Linny-R to store files.
213
214
 
214
- * `channel` and `callback` will be used to interact with Linny-R via its *Receiver*
215
+ * `autosave` will contain models that have been _auto-saved_
216
+ * `channel` and `callback` will be used to interact with Linny-R via its _Receiver_
215
217
  * `diagrams` will be used to render Scalable Vector Graphics (SVG) files as
216
218
  Portable Network Graphics (PNG) using Inkscape (if installed)
217
- * `modules` will contain models stored in the `local host` *repository*
219
+ * `modules` will contain models stored in the `local host` _repository_
218
220
  * `solver` will contain the files that are exchanged with the Mixed Integer Linear Programming (MILP) solver
219
221
  (the names of the files that will appear in this directory may vary, depending on the MILP-solver you use)
220
222
 
221
-
223
+ By default, the `user` directory is created in your `WORKING_DIRECTORY`.
224
+ You can overrule this by specifying the path to another directory when you start the server.
225
+ Note that doing this will create a new, empty workspace (the directories listed above)
226
+ in the specified path. It will **not** affect or duplicate information from existing workspaces.
222
227
 
223
228
  #### Command line options
224
229
 
@@ -239,7 +244,7 @@ When you download a diagram, it will be saved as a .svg file.
239
244
  These files can be viewed and edited using Inkscape, an open source vector graphics editor.
240
245
 
241
246
  As it may be tedious to first save a diagram as SVG and then render it manually as a bitmap image,
242
- Linny-R features a *Render diagram as bitmap* button on the top toolbar, and on the bottom toolbar of the *Chart manager*.
247
+ Linny-R features a *Render diagram as bitmap* button on the top toolbar, and on the bottom toolbar of the _Chart manager_.
243
248
  When you click it, Linny-R will send the image as SVG to the server.
244
249
  The server script will save the SVG in the `user/diagrams` sub-directory,
245
250
  and then try to execute an Inkscape command that will convert this SVG to a PNG image file in the same directory.
@@ -261,8 +266,8 @@ so you need to do this yourself.
261
266
  To facilitate start-up, you can create a shortcut icon on your desktop.
262
267
 
263
268
  On a Windows machine, change to your Linny-R folder, right-click on the batch file `linny-r.bat`,
264
- and select the *Create shortcut* option.
265
- Then right-click on the shortcut file to edit its properties, and click the *Change Icon* button.
269
+ and select the _Create shortcut_ option.
270
+ Then right-click on the shortcut file to edit its properties, and click the _Change Icon_ button.
266
271
  The dialog that then appears will allow you to go to the sub-folder `node_modules\linny-r\static\images`,
267
272
  where you should select the file `linny-r.ico`.
268
273
  Finally, rename the shortcut to `Linny-R` and move or copy it to your desktop.
@@ -281,8 +286,7 @@ and from there drag/drop the file `linny-r.icns` on the icon shown in the top le
281
286
 
282
287
  If you have not configured a "click-start" icon as described above,
283
288
  you must start a modeling session with Linny-R by opening a CLI box,
284
- then change to the Linny-R directory, type `node server`,
285
- open your browser, and then navigate to http://127.0.0.1:5050
289
+ then change to the Linny-R directory and type `linny-r`.
286
290
 
287
291
  To shut down the server, click on the local host icon in the upper right corner of the Linny-R GUI in your browser.
288
292
  Alternatively, you can stop the server by repeatedly pressing ``Ctrl+C`` in the CLI box.
@@ -306,7 +310,8 @@ you will see the command line options that allow you to run models in various wa
306
310
  ### Troubleshooting problems
307
311
 
308
312
  If during any of the steps above you encounter problems, please try to diagnose them and resolve them yourself.
309
- You can find a lot of useful information on the Linny-R documentatio website: https://linny-r.info
313
+ You can find a lot of useful information on the Linny-R documentatio website:
314
+ <a href="https://linny-r.info" target="_blank">https://linny-r.info</a>.
310
315
 
311
316
  To diagnose a problem, always look in the CLI box where Node.js is running,
312
317
  as informative server-side error messages will appear there.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linny-r",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Executable graphical language with WYSIWYG editor for MILP models",
5
5
  "main": "server.js",
6
6
  "scripts": {
package/post-install.js CHANGED
@@ -52,21 +52,24 @@ const
52
52
  path = require('path'),
53
53
  os = require('os'),
54
54
  PLATFORM = os.platform(),
55
- WORKING_DIRECTORY = process.cwd(),
55
+ mod_dir = path.join('node_modules', 'linny-r'),
56
+ // NOTE: working directory for this script is the *module* directory,
57
+ // which is two levels deeper than the actual working directory
58
+ WORKING_DIRECTORY = process.cwd().replace(path.sep + mod_dir, ''),
56
59
  lines = [
57
60
  '# The first line (without the comment symbol #) should be like this:',
58
61
  '# cd ',
59
62
  '',
60
63
  '# Then this command to launch the Linny-R server should work:',
61
- 'node ' + path.join('node_modules', 'linny-r', 'server') + ' launch'
64
+ `node ${mod_dir}${path.sep}server launch`
62
65
  ];
63
66
  let sp;
64
67
  if(PLATFORM.startsWith('win')) {
65
68
  sp = path.join(WORKING_DIRECTORY, 'linny-r.bat');
66
- lines[1] += 'C:\\path\\to\\main\\Linny-R\\directory';
69
+ lines[1] += 'C:\\path\\to\\\\your\\Linny-R\\directory';
67
70
  } else {
68
71
  sp = path.join(WORKING_DIRECTORY, 'linny-r.command');
69
- lines[1] += '/path/to/main/Linny-R/directory';
72
+ lines[1] += '/path/to/your/Linny-R/directory';
70
73
  }
71
74
  lines[2] = 'cd ' + WORKING_DIRECTORY;
72
75
  try {
package/server.js CHANGED
@@ -197,24 +197,30 @@ const SHUTDOWN_MESSAGE = `<!DOCTYPE html>
197
197
  font-family: sans-serif;
198
198
  font-size: 15px;
199
199
  }
200
+ code {
201
+ background-color: black;
202
+ color: white;
203
+ padding: 2px;
204
+ border-radius: 5px;
205
+ }
200
206
  </style>
201
207
  </head>
202
208
  <body>
203
209
  <h3>Linny-R server (127.0.0.1) is shutting down</h3>
204
- <p>To restart Linny-R, switch to your ${SETTINGS.cli_name} window
210
+ <p>To restart Linny-R, switch to your <em>${SETTINGS.cli_name}</em> window
205
211
  and there at the prompt` +
206
212
  (VERSION_INFO.up_to_date ? '' : `
207
213
  first type:</p>
208
- <p>&nbsp;&nbsp;<tt>npm update linny-r</tt><p>
214
+ <p><code>npm update linny-r</code><p>
209
215
  to upgrade to Linny-R version ${VERSION_INFO.latest}, and then`) +
210
216
  ` type:</p>
211
- <p>&nbsp;&nbsp;<tt>node node_modules\linny-r\server</tt></p>
217
+ <p><code>node node_modules\\linny-r\\server</code></p>
212
218
  <p>
213
- Then switch back to this window, and click
219
+ Then switch back to this window, and click this
214
220
  <button type="button"
215
221
  onclick="window.location.href = 'http://127.0.0.1:${SETTINGS.port}';">
216
222
  Restart
217
- </button>
223
+ </button> button.
218
224
  </p>
219
225
  </body>
220
226
  </html>`;
@@ -1389,6 +1395,7 @@ function createWorkspace() {
1389
1395
  }
1390
1396
  // Define the sub-directory paths
1391
1397
  const ws = {
1398
+ autosave: path.join(SETTINGS.user_dir, 'autosave'),
1392
1399
  channel: path.join(SETTINGS.user_dir, 'channel'),
1393
1400
  callback: path.join(SETTINGS.user_dir, 'callback'),
1394
1401
  diagrams: path.join(SETTINGS.user_dir, 'diagrams'),
package/static/index.html CHANGED
@@ -58,9 +58,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
58
58
  var
59
59
  // NODE = false indicates that modules need not export their properties
60
60
  NODE = false,
61
- // Version number and release date
61
+ // Version number
62
62
  LINNY_R_VERSION = '0',
63
- VERSION_RELEASE_DATE = 0,
63
+ // GitHub repository
64
+ GITHUB_REPOSITORY = 'https://github.com/pwgbots/linny-r',
64
65
  // Linny-R server hosting public channels
65
66
  PUBLIC_LINNY_R_URL = 'https://sysmod.tbm.tudelft.nl/linny-r',
66
67
  // Create the XML parser
@@ -151,16 +152,28 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
151
152
  const info = data.split('|');
152
153
  if(info.length > 1) {
153
154
  LINNY_R_VERSION = info[0];
155
+ const v = 'Version ' + LINNY_R_VERSION;
156
+ // Update the "home page" of the documentation manager
157
+ DOCUMENTATION_MANAGER.about_linny_r =
158
+ DOCUMENTATION_MANAGER.about_linny_r.replace(
159
+ '[LINNY_R_VERSION]', v);
160
+ // Update the version number in the browser's upper left corner
161
+ document.getElementById('linny-r-version-number').innerHTML = v;
154
162
  if(info[1] !== 'up-to-date') {
163
+ // Inform user that newer version exists
155
164
  UI.check_update_modal.element('msg').innerHTML = [
156
- '<a href="https://sysmod.tbm.tudelft.nl/linny-r/docs/?15" ',
165
+ '<a href="', GITHUB_REPOSITORY,
166
+ '/wiki/Linny-R-version-history" ',
167
+ 'title="Click to view version release notes" ',
157
168
  'target="_blank">Version <strong>',
158
- info[1], '</strong></a> released on ', info[2],
169
+ info[1], '</strong></a> released on ',
170
+ info[2].substring(0, 21),
159
171
  ' can be installed.'].join('');
160
172
  UI.check_update_modal.show();
161
173
  UI.check_update_modal.element('buttons').style.display = 'block';
162
174
  }
163
175
  } else {
176
+ // Invalid server response (should not occur, but just in case)
164
177
  UI.warn('Version check failed: "' + data + '"');
165
178
  }
166
179
  })
@@ -4319,8 +4319,8 @@ div.call-stack-expr {
4319
4319
 
4320
4320
  /* the CHECK UPDATE modal asks for permission to update the software */
4321
4321
  #check-update-dlg {
4322
- width: 245px;
4323
- height: 150px;
4322
+ width: 500px;
4323
+ height: min-content;
4324
4324
  }
4325
4325
 
4326
4326
  #confirm-delete-from-repo-msg,
@@ -4334,20 +4334,21 @@ div.call-stack-expr {
4334
4334
  #confirm-move-buttons,
4335
4335
  #confirm-delete-from-repo-buttons,
4336
4336
  #check-update-buttons {
4337
- width: calc(100% - 8px);
4337
+ width: 100%;
4338
4338
  height: 23px;
4339
- font-size: 16px;
4339
+ padding-top: 3px;
4340
+ font-size: 14px;
4341
+ white-space: nowrap;
4340
4342
  }
4341
4343
 
4342
4344
  #confirm-move-buttons > img,
4343
4345
  #confirm-delete-from-repo-buttons > img,
4344
- #check-update-buttons > img,
4345
- #check-update-restart-btn > img,
4346
- #check-update-reload-btn > img {
4346
+ #check-update-buttons > img {
4347
4347
  float: none;
4348
4348
  height: 23px;
4349
4349
  width: 23px;
4350
4350
  vertical-align: middle;
4351
+ padding-bottom: 3px;
4351
4352
  }
4352
4353
 
4353
4354
  /* Linny-R logo icon animation in 60 frames */
@@ -12873,7 +12873,7 @@ class DocumentationManager {
12873
12873
  <img src="images/logo.png" style="height:25px; margin-right: 8px">
12874
12874
  <div style="display: inline-block; min-height: 20px;
12875
12875
  vertical-align: top; padding-top: 8px">
12876
- ${LINNY_R_VERSION}
12876
+ [LINNY_R_VERSION]
12877
12877
  </div>
12878
12878
  </div>
12879
12879
  <div style="font-family: serif; font-size: 12px">