linny-r 1.1.2 → 1.1.4

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
@@ -24,7 +24,7 @@ via the official documentation site https://linny-r.info.
24
24
  Linny-R is developed as a JavaScript package, and requires that **Node.js** is installed on your computer.
25
25
  Node.js can be downloaded from https://nodejs.org.
26
26
  Make sure that you choose the correct installer for your computer.
27
- Linny-R is developed using the *current* release. Presently (September 2022) this is 18.9.0.
27
+ Linny-R is developed using the *current* release. Presently (October 2022) this is 18.10.0.
28
28
 
29
29
  Run the installer and accept the default settings.
30
30
  There is **no** need to install the optional Tools for Native Modules.
@@ -35,32 +35,55 @@ Verify the installation by typing:
35
35
 
36
36
  ``node --version``
37
37
 
38
- The response should be the version number of Node.js, for example: v18.9.0.
38
+ The response should be the version number of Node.js, for example: v18.10.0.
39
39
 
40
40
  ### Installing Linny-R
41
41
  It is advisable to install Linny-R in a directory on your computer, not in a cloud.
42
42
  In this installation guide, the path to this directory is denoted by `WORKING_DIRECTORY`,
43
- but on a Windows machine you may choose something like `C:\Users\xyz\Documents\Linny-R`,
43
+ so in all commands you should replace this with the actual directory path.
44
+ On a Windows machine you may choose something like `C:\Users\xyz\Documents\Linny-R`,
44
45
  and on a macOS machine probably `/Users/xyz/Linny-R`.
45
46
 
46
47
  To install Linny-R in this directory, type at the command line prompt:
47
48
 
48
49
  ``npm install --prefix WORKING_DIRECTORY linny-r``
49
50
 
50
- WORKING_DIRECTORY should now contain a new sub-directory `node_modules`,
51
+ `WORKING_DIRECTORY` should now contain a new sub-directory `node_modules`,
51
52
  and two JSON files `package.json` and `package-lock.json` that should **not** be removed,
52
53
  or you will have to re-install Linny-R.
53
54
 
54
- After installation has been completed, `WORKING_DIRECTORY` will also have a sub-directory `user`
55
- and a script file to facilitate (single click) launch: on a macOS machine the shell script `linny-r.command`,
56
- on a Windows machine the batch script `linny-r.bat`.
57
-
58
- When configuring Linny-R for a network environment
55
+ After installation has been completed, `WORKING_DIRECTORY` will also contain a script file
56
+ to facilitate (single click) launch: on a macOS machine the shell script `linny-r.command`,
57
+ on a Windows machine the batch script `linny-r.bat`. By default, this script file contains
58
+ two commands: change to the Linny-R directory and then tell Node.js to launch the
59
+ start the Linny-R server. When configuring Linny-R for a network environment
59
60
  where individual users each have their personal work space (e.g., a virtual drive U:),
60
- you can instruct Linny-R to create the `user` directory in this work space
61
- by adding the argument `workspace=[path]` to the `node` command that you use to start the Linny-R server.
61
+ you must edit the script file, adding the argument `workspace=path/to/workspace` to the
62
+ `node` command. This will instruct Linny-R to create the `user` directory in this workspace
63
+ directory instead of the Linny-R directory.
64
+
65
+ After installation has completed, `WORKING_DIRECTORY` should have this directory tree structure:
66
+
67
+ <pre>
68
+ WORKING_DIRECTORY
69
+ |
70
+ +-node_modules
71
+ |
72
+ +-@xmldom
73
+ |
74
+ +-linny-r
75
+ |
76
+ +-static
77
+ |
78
+ +-fonts
79
+ |
80
+ +-images
81
+ |
82
+ +-scripts
83
+ |
84
+ +-sounds
85
+ </pre>
62
86
 
63
- The `node_modules` directory should contain two sub-directories: `@xmldom` and `linny-r`.
64
87
  The `linny-r` directory should contain this file `README.md`,
65
88
  the files `server.js` and `console.js` that will be run by Node.js,
66
89
  and the sub-directory `static`.
@@ -73,35 +96,8 @@ The `static` directory should contain three HTML files:
73
96
 
74
97
  It should also contain the style sheet `linny-r.css` required by the GUI.
75
98
 
76
- The subdirectories of `static` contain files that are served to the browser by the script `server.js` when it is running in Node.js.
77
-
78
- After installation has completed, `WORKING_DIRECTORY` should have this directory tree structure:
79
-
80
- <pre>
81
- WORKING_DIRECTORY
82
- |
83
- +- node_modules
84
- |
85
- +- user
86
- |
87
- +-callback
88
- |
89
- +-channel
90
- |
91
- +-diagrams
92
- |
93
- +-modules
94
- |
95
- +-solver
96
- </pre>
97
-
98
- The sub-directories of the `user` directory are used by Linny-R to store files.
99
-
100
- * `channel` and `callback` will be used to interact with Linny-R via its *Receiver*
101
- * `diagrams` will be used to render Scalable Vector Graphics (SVG) files as Portable Network Graphics (PNG) using Inkscape (if installed)
102
- * `modules` will contain models stored in the `local host` *repository*
103
- * `solver` will contain the files that are exchanged with the Mixed Integer Linear Programming (MILP) solver
104
- (the names of the files that will appear in this directory may vary, depending on the MILP-solver you use)
99
+ The subdirectories of `static` contain files that are served to the browser by the script
100
+ `server.js` when it is running in Node.js.
105
101
 
106
102
  ### Configuring the MILP solver
107
103
 
@@ -215,6 +211,20 @@ Meanwhile, in the CLI, you should see a server log message like:
215
211
  Solve block 1 a
216
212
  </pre>
217
213
 
214
+ #### User workspace
215
+
216
+ The user workspace is created when the server is run for the first time.
217
+ The sub-directories of this directory `user` are used by Linny-R to store files.
218
+
219
+ * `channel` and `callback` will be used to interact with Linny-R via its *Receiver*
220
+ * `diagrams` will be used to render Scalable Vector Graphics (SVG) files as
221
+ Portable Network Graphics (PNG) using Inkscape (if installed)
222
+ * `modules` will contain models stored in the `local host` *repository*
223
+ * `solver` will contain the files that are exchanged with the Mixed Integer Linear Programming (MILP) solver
224
+ (the names of the files that will appear in this directory may vary, depending on the MILP-solver you use)
225
+
226
+
227
+
218
228
  #### Command line options
219
229
 
220
230
  Optionally, you can add more arguments to the `node` command:
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "linny-r",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Executable graphical language with WYSIWYG editor for MILP models",
5
5
  "main": "server.js",
6
6
  "scripts": {
7
+ "post-install": "post-install.js",
7
8
  "test": "echo \"Error: no test specified\" && exit 1"
8
9
  },
9
10
  "dependencies": {
@@ -0,0 +1,83 @@
1
+ /*
2
+ Linny-R is an executable graphical specification language for (mixed integer)
3
+ linear programming (MILP) problems, especially unit commitment problems (UCP).
4
+ The Linny-R language and tool have been developed by Pieter Bots at Delft
5
+ University of Technology, starting in 2009. The project to develop a browser-
6
+ based version started in 2017. See https://linny-r.org for more information.
7
+
8
+ This NodeJS script (post-install.js) creates a launch script for Linny-R
9
+ that facilitates start-up: the user can then type `linny-r` at the command
10
+ line prompt, and also create a clickable icon as desktop shortcut.
11
+
12
+ For macOS, the script file is `linny-r.command`, for Windows `linny-r.bat`.
13
+ The script comprises two commands:
14
+
15
+ cd path/to/linny-r/directory
16
+ node node_modules/linny-r/server launch
17
+
18
+ since Windows also supports the slash as path separator. The "launch"
19
+ command tells the script `server.js` to start Linny-R in the default
20
+ web browser.
21
+
22
+ Comments are added to the script file to facilitate customization of the
23
+ scripts by the user. The README.md file explains how the script file can be
24
+ used for single-click launch of Linny-R, and how the "workspace" parameter
25
+ can be used in a multi-user network environment to provide individual
26
+ workspaces for users.
27
+ */
28
+ /*
29
+ Copyright (c) 2020-2022 Delft University of Technology
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining a copy
32
+ of this software and associated documentation files (the "Software"), to deal
33
+ in the Software without restriction, including without limitation the rights
34
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35
+ copies of the Software, and to permit persons to whom the Software is
36
+ furnished to do so, subject to the following conditions:
37
+
38
+ The above copyright notice and this permission notice shall be included in
39
+ all copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
+ SOFTWARE.
48
+ */
49
+
50
+ const
51
+ path = require('path'),
52
+ os = require('os'),
53
+ PLATFORM = os.platform(),
54
+ WORKING_DIRECTORY = process.cwd(),
55
+ lines = [
56
+ '# The first line (without the comment symbol #) should be like this:',
57
+ '# cd ',
58
+ '',
59
+ '# Then this command to launch the Linny-R server should work:',
60
+ 'node ' + path.join('node_modules', 'linny-r', 'server') + ' launch'
61
+ ];
62
+ let sp;
63
+ if(PLATFORM.startsWith('win')) {
64
+ sp = path.join(WORKING_DIRECTORY, 'linny-r.bat');
65
+ lines[1] += 'C:\\path\\to\\main\\Linny-R\\directory';
66
+ } else {
67
+ sp = path.join(WORKING_DIRECTORY, 'linny-r.command');
68
+ lines[1] += '/path/to/main/Linny-R/directory';
69
+ }
70
+ lines[2] = 'cd ' + WORKING_DIRECTORY;
71
+ try {
72
+ try {
73
+ fs.accessSync(sp);
74
+ } catch(err) {
75
+ // Only write the script content if the file it does not yet exist
76
+ console.log('Creating launch script:', sp);
77
+ let code = lines.join(os.EOL);
78
+ if(PLATFORM.startsWith('win')) code = code.replace('#', '::');
79
+ fs.writeFileSync(sp, code, 'utf8');
80
+ }
81
+ } catch(err) {
82
+ console.log('WARNING: Failed to create launch script');
83
+ }
package/server.js CHANGED
@@ -5,7 +5,7 @@ The Linny-R language and tool have been developed by Pieter Bots at Delft
5
5
  University of Technology, starting in 2009. The project to develop a browser-
6
6
  based version started in 2017. See https://linny-r.org for more information.
7
7
 
8
- This NodeJS script (linny-r-node.js) provides a minimalist local host web server
8
+ This NodeJS script (server.js) provides a minimalist local host web server
9
9
  (URL http://127.0.0.1:5050) that will serve the Linny-R GUI (HTML, CSS,
10
10
  and JavaScript files, and images), process the requests from the browser
11
11
  that pass the MILP equation model to the solver, and then return the solution
@@ -1535,7 +1535,9 @@ function createLaunchScript() {
1535
1535
  } catch(err) {
1536
1536
  // Only write the script content if the file it does not yet exist
1537
1537
  console.log('Creating launch script:', sp);
1538
- fs.writeFileSync(sp, lines.join(os.EOL), 'utf8');
1538
+ let code = lines.join(os.EOL);
1539
+ if(PLATFORM.startsWith('win')) code = code.replace('#', '::');
1540
+ fs.writeFileSync(sp, code, 'utf8');
1539
1541
  }
1540
1542
  } catch(err) {
1541
1543
  console.log('WARNING: Failed to create launch script');
package/static/index.html CHANGED
@@ -58,8 +58,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
58
58
  // NODE = false indicates that modules need not export their properties
59
59
  NODE = false,
60
60
  // Version number and release date
61
- LINNY_R_VERSION = '1.1.0',
62
- VERSION_RELEASE_DATE = '2022-09-14 17:00',
61
+ LINNY_R_VERSION = '1.1.2',
62
+ VERSION_RELEASE_DATE = '2022-10-11 10:25',
63
63
  // Linny-R server hosting public channels
64
64
  PUBLIC_LINNY_R_URL = 'https://sysmod.tbm.tudelft.nl/linny-r',
65
65
  // Create the XML parser
@@ -218,8 +218,7 @@ main {
218
218
  padding: 2px;
219
219
  font: 7px sans-serif;
220
220
  font-style: oblique;
221
- color: gray;
222
- cursor: pointer;
221
+ color: #200030;
223
222
  }
224
223
 
225
224
  #topbar {