minizinc 4.4.6-edge.8 → 4.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.
- package/README.md +13 -14
- package/dist/minizinc-worker.js +1 -1
- package/dist/minizinc.cjs +1 -1
- package/dist/minizinc.data +0 -0
- package/dist/minizinc.js +1 -1
- package/dist/minizinc.mjs +1 -1
- package/dist/minizinc.wasm +0 -0
- package/package.json +9 -6
- package/types/index.d.ts +34 -34
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
JavaScript interface for MiniZinc
|
|
2
|
-
=================================
|
|
1
|
+
# JavaScript interface for MiniZinc
|
|
3
2
|
|
|
4
3
|
[](https://js.minizinc.dev/docs/stable)
|
|
5
4
|
[](https://www.npmjs.com/package/minizinc)
|
|
@@ -26,8 +25,8 @@ Using ECMAScript modules:
|
|
|
26
25
|
const solve = model.solve({
|
|
27
26
|
options: {
|
|
28
27
|
solver: 'gecode',
|
|
29
|
-
'all-solutions': true
|
|
30
|
-
}
|
|
28
|
+
'all-solutions': true,
|
|
29
|
+
},
|
|
31
30
|
});
|
|
32
31
|
solve.on('solution', solution => {
|
|
33
32
|
console.log(solution.output.json);
|
|
@@ -48,8 +47,8 @@ Using a traditional script:
|
|
|
48
47
|
const solve = model.solve({
|
|
49
48
|
options: {
|
|
50
49
|
solver: 'gecode',
|
|
51
|
-
'all-solutions': true
|
|
52
|
-
}
|
|
50
|
+
'all-solutions': true,
|
|
51
|
+
},
|
|
53
52
|
});
|
|
54
53
|
solve.on('solution', solution => {
|
|
55
54
|
console.log(solution.output.json);
|
|
@@ -122,7 +121,7 @@ MiniZinc.init({
|
|
|
122
121
|
workerURL: 'http://localhost:3000/path/to/my-own-worker.js',
|
|
123
122
|
// If these are omitted, searches next to the worker script
|
|
124
123
|
wasmURL: 'http://localhost:3000/path/to/minizinc.wasm',
|
|
125
|
-
dataURL: 'http://localhost:3000/path/to/minizinc.data'
|
|
124
|
+
dataURL: 'http://localhost:3000/path/to/minizinc.data',
|
|
126
125
|
}).then(() => {
|
|
127
126
|
console.log('Ready');
|
|
128
127
|
});
|
|
@@ -135,7 +134,7 @@ MiniZinc.init({
|
|
|
135
134
|
// Executable name
|
|
136
135
|
minizinc: 'minizinc',
|
|
137
136
|
// Search paths (can omit to use PATH)
|
|
138
|
-
minizincPaths: ['/home/me/.local/bin', '/usr/local/bin']
|
|
137
|
+
minizincPaths: ['/home/me/.local/bin', '/usr/local/bin'],
|
|
139
138
|
});
|
|
140
139
|
```
|
|
141
140
|
|
|
@@ -157,7 +156,7 @@ model.addString('int: z;');
|
|
|
157
156
|
// Add data in DZN format
|
|
158
157
|
model.addDznString('y = 1;');
|
|
159
158
|
// Add data from a JSON object
|
|
160
|
-
model.addJson({z: 2});
|
|
159
|
+
model.addJson({ z: 2 });
|
|
161
160
|
```
|
|
162
161
|
|
|
163
162
|
### Solving
|
|
@@ -171,8 +170,8 @@ const solve = model.solve({
|
|
|
171
170
|
options: {
|
|
172
171
|
solver: 'gecode',
|
|
173
172
|
'time-limit': 10000,
|
|
174
|
-
statistics: true
|
|
175
|
-
}
|
|
173
|
+
statistics: true,
|
|
174
|
+
},
|
|
176
175
|
});
|
|
177
176
|
// You can listen for events
|
|
178
177
|
solve.on('solution', solution => console.log(solution.output.json));
|
|
@@ -190,7 +189,7 @@ During solving, MiniZinc emits events which can be subscribed to/unsubscribed fr
|
|
|
190
189
|
methods. The events are those which appear in
|
|
191
190
|
[Machine-readable JSON output format](https://minizinc.dev/doc-latest/en/json-stream.html),
|
|
192
191
|
with the addition of the [`exit`](https://js.minizinc.dev/docs/stable/interfaces/ExitMessage.html)
|
|
193
|
-
event, which can be used to detect when solving finishes (if you do not wish to await the
|
|
192
|
+
event, which can be used to detect when solving finishes (if you do not wish to await the
|
|
194
193
|
[`SolveProgress`](https://js.minizinc.dev/docs/stable/interfaces/SolveProgress.html) object).
|
|
195
194
|
|
|
196
195
|
By default, `--output-mode json` is used, allowing you to retrieve the model variable values
|
|
@@ -200,12 +199,12 @@ directly from the solution objects. Use
|
|
|
200
199
|
|
|
201
200
|
## Documentation
|
|
202
201
|
|
|
203
|
-
For more detailed documentation of all available options and functionality, visit the
|
|
202
|
+
For more detailed documentation of all available options and functionality, visit the
|
|
204
203
|
[API documentation](https://js.minizinc.dev/docs/stable/).
|
|
205
204
|
|
|
206
205
|
## Building
|
|
207
206
|
|
|
208
|
-
### Compiling MiniZinc for WebAssembly
|
|
207
|
+
### Compiling MiniZinc for WebAssembly
|
|
209
208
|
|
|
210
209
|
The WebAssembly build of MiniZinc requires [Emscripten](https://emscripten.org/).
|
|
211
210
|
|