forked from lovasoa/highs-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
379 lines (321 loc) · 7.81 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
type Highs = {
solve(problem: string, options?: HighsOptions): HighsSolution;
};
type HighsOptions = Readonly<
Partial<{
/**
* default: "choose"
*/
presolve: "off" | "choose" | "on";
/**
* default: "choose"
*/
solver: "simplex" | "choose" | "ipm";
/**
* default: "choose"
*/
parallel: "off" | "choose" | "on";
/**
* Time limit
* default: inf
*/
time_limit: number;
/**
* Compute cost, bound, RHS and basic solution ranging.
* default: "off"
*/
ranging: "off" | "on";
/**
* Limit on cost coefficient: values larger than this will be treated as infinite
* default: 1e+20
*/
infinite_cost: number;
/**
* Limit on |constraint bound|: values larger than this will be treated as infinite
* default: 1e+20
*/
infinite_bound: number;
/**
* Lower limit on |matrix entries|: values smaller than this will be treated as zero
* default: 1e-09
*/
small_matrix_value: number;
/**
* Upper limit on |matrix entries|: values larger than this will be treated as infinite
* default: 1e+15
*/
large_matrix_value: number;
/**
* Primal feasibility tolerance
* default: 1e-07
*/
primal_feasibility_tolerance: number;
/**
* Dual feasibility tolerance
* default: 1e-07
*/
dual_feasibility_tolerance: number;
/**
* IPM optimality tolerance
* default: 1e-08
*/
ipm_optimality_tolerance: number;
/**
* Objective bound for termination
* default: inf
*/
objective_bound: number;
/**
* Objective target for termination
* default: -inf
*/
objective_target: number;
/**
* random seed used in HiGHS
* default: 0
*/
random_seed: number;
/**
* number of threads used by HiGHS (0: automatic)
* default: 0
*/
threads: number;
/**
* Debugging level in HiGHS
* default: 0
*/
highs_debug_level: number;
/**
* Analysis level in HiGHS
* default: 0
*/
highs_analysis_level: number;
/**
* Strategy for simplex solver
* default: 1
*/
simplex_strategy: number;
/**
* Simplex scaling strategy: off / choose / equilibration / forced equilibration / max value 0 / max value 1 (0/1/2/3/4/5)
* default: 1
*/
simplex_scale_strategy: number;
/**
* Strategy for simplex crash: off / LTSSF / Bixby (0/1/2)
* default: 0
*/
simplex_crash_strategy: number;
/**
* Strategy for simplex dual edge weights: Choose / Dantzig / Devex / Steepest Edge (-1/0/1/2)
* default: -1
*/
simplex_dual_edge_weight_strategy: number;
/**
* Strategy for simplex primal edge weights: Choose / Dantzig / Devex (-1/0/1)
* default: -1
*/
simplex_primal_edge_weight_strategy: number;
/**
* Iteration limit for simplex solver
* default: 2147483647
*/
simplex_iteration_limit: number;
/**
* Limit on the number of simplex UPDATE operations
* default: 5000
*/
simplex_update_limit: number;
/**
* Iteration limit for IPM solver
* default: 2147483647
*/
ipm_iteration_limit: number;
/**
* Minimum level of concurrency in parallel simplex
* default: 1
*/
simplex_min_concurrency: number;
/**
* Maximum level of concurrency in parallel simplex
* default: 8
*/
simplex_max_concurrency: number;
/**
* Enables or disables solver output
* default: true
*/
output_flag: boolean;
/**
* Enables or disables console logging
* default: true
*/
log_to_console: boolean;
/**
* Solution file
* default: ""
*/
solution_file: string;
/**
* Log file
* default: "Highs.log"
*/
log_file: string;
/**
* Write the primal and dual solution to a file
* default: false
*/
write_solution_to_file: boolean;
/**
* Write the solution in style: 0=>Raw (computer-readable); 1=>Pretty (human-readable)
* default: 0
*/
write_solution_style: number;
/**
* Whether symmetry should be detected
* default: true
*/
mip_detect_symmetry: boolean;
/**
* MIP solver max number of nodes
* default: 2147483647
*/
mip_max_nodes: number;
/**
* MIP solver max number of nodes where estimate is above cutoff bound
* default: 2147483647
*/
mip_max_stall_nodes: number;
/**
* MIP solver max number of leave nodes
* default: 2147483647
*/
mip_max_leaves: number;
/**
* maximal age of dynamic LP rows before they are removed from the LP relaxation
* default: 10
*/
mip_lp_age_limit: number;
/**
* maximal age of rows in the cutpool before they are deleted
* default: 30
*/
mip_pool_age_limit: number;
/**
* soft limit on the number of rows in the cutpool for dynamic age adjustment
* default: 10000
*/
mip_pool_soft_limit: number;
/**
* minimal number of observations before pseudo costs are considered reliable
* default: 8
*/
mip_pscost_minreliable: number;
/**
* MIP solver reporting level
* default: 1
*/
mip_report_level: number;
/**
* MIP feasibility tolerance
* default: 1e-06
*/
mip_feasibility_tolerance: number;
/**
* effort spent for MIP heuristics
* default: 0.05
*/
mip_heuristic_effort: number;
}>
>;
type HighsSolution =
| GenericHighsSolution<
true,
HighsLinearSolutionColumn,
HighsLinearSolutionRow
>
| GenericHighsSolution<
false,
HighsMixedIntegerLinearSolutionColumn,
HighsMixedIntegerLinearSolutionRow
>
| GenericHighsSolution<
boolean,
HighsInfeasibleSolutionColumn,
HighsInfeasibleSolutionRow,
"Infeasible"
>;
type GenericHighsSolution<IsLinear extends boolean, ColType, RowType, Status extends HighsModelStatus = HighsModelStatus> = {
IsLinear: IsLinear,
Status: Status;
ObjectiveValue: number;
Columns: Record<string, ColType>;
Rows: RowType[];
};
type HighsModelStatus =
| "Not Set"
| "Load error"
| "Model error"
| "Presolve error"
| "Solve error"
| "Postsolve error"
| "Empty"
| "Optimal"
| "Infeasible"
| "Primal infeasible or unbounded"
| "Unbounded"
| "Bound on objective reached"
| "Target for objective reached"
| "Time limit reached"
| "Iteration limit reached"
| "Unknown";
interface HighsInfeasibleSolutionBase {
Index: number;
Lower: number | null;
Upper: number | null;
}
interface HighsInfeasibleSolutionRow extends HighsInfeasibleSolutionBase { }
interface HighsInfeasibleSolutionColumn extends HighsInfeasibleSolutionBase {
Type: "Integer" | "Continuous"
}
interface HighsSolutionBase extends HighsInfeasibleSolutionBase {
Primal: number;
}
interface HighsLinearSolutionColumn extends HighsSolutionBase {
Dual: number;
Name: string;
Status: HighsBasisStatus;
}
interface HighsMixedIntegerLinearSolutionColumn extends HighsSolutionBase {
Type: "Integer" | "Continuous";
Name: string;
}
interface HighsLinearSolutionRow extends HighsSolutionBase {
Dual: number;
Status: HighsBasisStatus;
Name: string;
}
interface HighsMixedIntegerLinearSolutionRow extends HighsSolutionBase { }
type HighsBasisStatus =
/** Fixed */
| "FX"
/** Lower Bound */
| "LB"
/** Basis */
| "BS"
/** Upper Bound */
| "UB"
/** Free */
| "FR"
/** Non-Bounded */
| "NB";
type HighsLoaderOptions = Readonly<
Partial<{
/** Should return the URL of an asset given its name. Useful for locating the wasm file */
locateFile(file: string): string;
}>
>;
/** Loads HiGHS */
export default function highsLoader(
options?: HighsLoaderOptions
): Promise<Highs>;
// export const Model: unknown