@areb0s/scip.js 1.0.5 → 1.0.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/dist/scip.js +15 -10
- package/dist/scip.js.map +1 -1
- package/dist/scip.min.js +15 -10
- package/dist/scip.min.js.map +1 -1
- package/dist/types.d.ts +157 -215
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -3,228 +3,170 @@
|
|
|
3
3
|
* SCIP Optimization Solver for JavaScript/WebAssembly
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export enum Status {
|
|
11
|
-
OPTIMAL = 'optimal',
|
|
12
|
-
INFEASIBLE = 'infeasible',
|
|
13
|
-
UNBOUNDED = 'unbounded',
|
|
14
|
-
TIME_LIMIT = 'timelimit',
|
|
15
|
-
UNKNOWN = 'unknown',
|
|
16
|
-
ERROR = 'error'
|
|
17
|
-
}
|
|
6
|
+
/**
|
|
7
|
+
* Solution status
|
|
8
|
+
*/
|
|
9
|
+
export type StatusType = 'optimal' | 'infeasible' | 'unbounded' | 'timelimit' | 'unknown' | 'error';
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
11
|
+
export const Status: {
|
|
12
|
+
OPTIMAL: 'optimal';
|
|
13
|
+
INFEASIBLE: 'infeasible';
|
|
14
|
+
UNBOUNDED: 'unbounded';
|
|
15
|
+
TIME_LIMIT: 'timelimit';
|
|
16
|
+
UNKNOWN: 'unknown';
|
|
17
|
+
ERROR: 'error';
|
|
18
|
+
};
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
timeLimit?: number;
|
|
37
|
-
/** Relative gap for MIP (e.g., 0.01 for 1%) */
|
|
38
|
-
gap?: number | null;
|
|
39
|
-
/** Enable verbose output */
|
|
40
|
-
verbose?: boolean;
|
|
41
|
-
/** Additional SCIP parameters */
|
|
42
|
-
parameters?: Record<string, string | number | boolean>;
|
|
43
|
-
/** Init options (for worker mode) */
|
|
44
|
-
initOptions?: InitOptions;
|
|
45
|
-
}
|
|
20
|
+
/**
|
|
21
|
+
* Initialization options
|
|
22
|
+
*/
|
|
23
|
+
export interface InitOptions {
|
|
24
|
+
/** Path to scip.wasm file (default: CDN) */
|
|
25
|
+
wasmPath?: string;
|
|
26
|
+
}
|
|
46
27
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Solver options
|
|
30
|
+
*/
|
|
31
|
+
export interface SolveOptions extends InitOptions {
|
|
32
|
+
/** Input format: 'lp', 'mps', 'zpl' (default: 'lp') */
|
|
33
|
+
format?: 'lp' | 'mps' | 'zpl';
|
|
34
|
+
/** Time limit in seconds (default: 3600) */
|
|
35
|
+
timeLimit?: number;
|
|
36
|
+
/** Relative gap for MIP (e.g., 0.01 for 1%) */
|
|
37
|
+
gap?: number | null;
|
|
38
|
+
/** Enable verbose output */
|
|
39
|
+
verbose?: boolean;
|
|
40
|
+
/** Additional SCIP parameters */
|
|
41
|
+
parameters?: Record<string, string | number | boolean>;
|
|
42
|
+
}
|
|
60
43
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
exitCode?: number;
|
|
75
|
-
/** Raw output (if verbose mode) */
|
|
76
|
-
output?: string;
|
|
77
|
-
/** Raw solution file content */
|
|
78
|
-
rawSolution?: string | null;
|
|
79
|
-
/** Error message (if status is ERROR) */
|
|
80
|
-
error?: string;
|
|
81
|
-
}
|
|
44
|
+
/**
|
|
45
|
+
* Solver statistics
|
|
46
|
+
*/
|
|
47
|
+
export interface Statistics {
|
|
48
|
+
/** Solving time in seconds */
|
|
49
|
+
solvingTime: number | null;
|
|
50
|
+
/** Number of branch-and-bound nodes */
|
|
51
|
+
nodes: number | null;
|
|
52
|
+
/** Number of LP iterations */
|
|
53
|
+
iterations: number | null;
|
|
54
|
+
/** Final optimality gap (percentage) */
|
|
55
|
+
gap: number | null;
|
|
56
|
+
}
|
|
82
57
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Maximize in a Web Worker
|
|
171
|
-
*/
|
|
172
|
-
export function maximizeInWorker(problem: string, options?: SolveOptions): Promise<Solution>;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Terminate the Web Worker
|
|
176
|
-
*/
|
|
177
|
-
export function terminateWorker(): void;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Worker solver instance
|
|
181
|
-
*/
|
|
182
|
-
export interface WorkerSolver {
|
|
183
|
-
solve(problem: string, options?: SolveOptions): Promise<Solution>;
|
|
184
|
-
minimize(problem: string, options?: SolveOptions): Promise<Solution>;
|
|
185
|
-
maximize(problem: string, options?: SolveOptions): Promise<Solution>;
|
|
186
|
-
version(): Promise<string>;
|
|
187
|
-
isReady(): Promise<boolean>;
|
|
188
|
-
terminate(): void;
|
|
189
|
-
}
|
|
58
|
+
/**
|
|
59
|
+
* Solution result
|
|
60
|
+
*/
|
|
61
|
+
export interface Solution {
|
|
62
|
+
/** Solution status */
|
|
63
|
+
status: StatusType;
|
|
64
|
+
/** Objective function value */
|
|
65
|
+
objective: number | null;
|
|
66
|
+
/** Variable values */
|
|
67
|
+
variables: Record<string, number>;
|
|
68
|
+
/** Solver statistics */
|
|
69
|
+
statistics: Statistics;
|
|
70
|
+
/** Exit code from SCIP */
|
|
71
|
+
exitCode?: number;
|
|
72
|
+
/** Raw output (if verbose mode) */
|
|
73
|
+
output?: string;
|
|
74
|
+
/** Raw solution file content */
|
|
75
|
+
rawSolution?: string | null;
|
|
76
|
+
/** Error message (if status is ERROR) */
|
|
77
|
+
error?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Initialize SCIP WASM module
|
|
82
|
+
* @param options - Initialization options
|
|
83
|
+
*/
|
|
84
|
+
export function init(options?: InitOptions): Promise<void>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Promise that resolves when SCIP is initialized
|
|
88
|
+
* Use like OpenCV's cv.ready
|
|
89
|
+
* @example
|
|
90
|
+
* await SCIP.ready;
|
|
91
|
+
* const result = await SCIP.solve(`...`);
|
|
92
|
+
*/
|
|
93
|
+
export const ready: Promise<void>;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Check if SCIP is initialized
|
|
97
|
+
*/
|
|
98
|
+
export function isReady(): boolean;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Solve an optimization problem
|
|
102
|
+
* @param problem - Problem in LP, MPS, or ZIMPL format
|
|
103
|
+
* @param options - Solver options
|
|
104
|
+
* @returns Solution object
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const result = await SCIP.solve(`
|
|
109
|
+
* Minimize obj: x + 2 y
|
|
110
|
+
* Subject To
|
|
111
|
+
* c1: x + y >= 1
|
|
112
|
+
* Bounds
|
|
113
|
+
* 0 <= x <= 10
|
|
114
|
+
* 0 <= y <= 10
|
|
115
|
+
* End
|
|
116
|
+
* `);
|
|
117
|
+
*
|
|
118
|
+
* if (result.status === 'optimal') {
|
|
119
|
+
* console.log('Optimal value:', result.objective);
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export function solve(problem: string, options?: SolveOptions): Promise<Solution>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Solve a minimization problem
|
|
127
|
+
*/
|
|
128
|
+
export function minimize(problem: string, options?: SolveOptions): Promise<Solution>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Solve a maximization problem
|
|
132
|
+
*/
|
|
133
|
+
export function maximize(problem: string, options?: SolveOptions): Promise<Solution>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Get SCIP version info
|
|
137
|
+
*/
|
|
138
|
+
export function version(): Promise<string>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get available SCIP parameters
|
|
142
|
+
*/
|
|
143
|
+
export function getParameters(): Promise<string>;
|
|
190
144
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
maximize: typeof maximize;
|
|
205
|
-
version: typeof version;
|
|
206
|
-
getParameters: typeof getParameters;
|
|
207
|
-
Status: typeof Status;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export default SCIP;
|
|
145
|
+
/**
|
|
146
|
+
* SCIP module interface
|
|
147
|
+
*/
|
|
148
|
+
export interface SCIPModule {
|
|
149
|
+
init: typeof init;
|
|
150
|
+
ready: typeof ready;
|
|
151
|
+
isReady: typeof isReady;
|
|
152
|
+
solve: typeof solve;
|
|
153
|
+
minimize: typeof minimize;
|
|
154
|
+
maximize: typeof maximize;
|
|
155
|
+
version: typeof version;
|
|
156
|
+
getParameters: typeof getParameters;
|
|
157
|
+
Status: typeof Status;
|
|
211
158
|
}
|
|
212
159
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* LP Problem builder (optional convenience API)
|
|
217
|
-
*/
|
|
218
|
-
export interface LPProblem {
|
|
219
|
-
minimize(expression: string): LPProblem;
|
|
220
|
-
maximize(expression: string): LPProblem;
|
|
221
|
-
subjectTo(name: string, constraint: string): LPProblem;
|
|
222
|
-
bounds(variable: string, lower?: number, upper?: number): LPProblem;
|
|
223
|
-
binary(...variables: string[]): LPProblem;
|
|
224
|
-
integer(...variables: string[]): LPProblem;
|
|
225
|
-
general(...variables: string[]): LPProblem;
|
|
226
|
-
toString(): string;
|
|
227
|
-
}
|
|
160
|
+
declare const SCIP: SCIPModule;
|
|
161
|
+
export default SCIP;
|
|
228
162
|
|
|
229
|
-
|
|
163
|
+
// Global declaration for CDN usage
|
|
164
|
+
declare global {
|
|
165
|
+
interface Window {
|
|
166
|
+
SCIP: SCIPModule;
|
|
167
|
+
SCIP_BASE_URL?: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var SCIP: SCIPModule;
|
|
171
|
+
var SCIP_BASE_URL: string | undefined;
|
|
230
172
|
}
|