or-tools-wasm 0.5.0 → 0.7.1

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.
Files changed (52) hide show
  1. package/README.md +206 -54
  2. package/build/javascript/browser/cp_sat_module_loader.js +53 -0
  3. package/build/javascript/browser/cpsat_worker.js +135 -0
  4. package/build/javascript/browser/cpsat_worker_types.js +0 -0
  5. package/build/javascript/browser/index.js +5910 -0
  6. package/build/javascript/lib/assets/cp_sat_runtime-BcQ-oG9G.js +2568 -0
  7. package/build/javascript/lib/assets/cp_sat_runtime-BcQ-oG9G.js.map +1 -0
  8. package/build/javascript/lib/assets/{cp_sat_runtime-BUuF8d7w.wasm → cp_sat_runtime.wasm} +0 -0
  9. package/build/javascript/lib/assets/cp_sat_runtime.wasm.map +1 -0
  10. package/build/javascript/lib/assets/cp_sat_runtime_asyncify-CebveWgj.js +2642 -0
  11. package/build/javascript/lib/assets/cp_sat_runtime_asyncify-CebveWgj.js.map +1 -0
  12. package/build/javascript/lib/assets/{cp_sat_runtime_asyncify-CjMVqM1A.wasm → cp_sat_runtime_asyncify.wasm} +0 -0
  13. package/build/javascript/lib/assets/cp_sat_runtime_asyncify.wasm.map +1 -0
  14. package/build/javascript/lib/assets/cpsat_worker-CxyMtsph.js +145 -0
  15. package/build/javascript/lib/assets/cpsat_worker-CxyMtsph.js.map +1 -0
  16. package/build/javascript/lib/chunks/cp_sat_runtime-D-Bi0Puh.js +2568 -0
  17. package/build/javascript/lib/chunks/cp_sat_runtime-D-Bi0Puh.js.map +1 -0
  18. package/build/javascript/lib/chunks/cp_sat_runtime_asyncify-pyd1qgFK.js +2642 -0
  19. package/build/javascript/lib/chunks/cp_sat_runtime_asyncify-pyd1qgFK.js.map +1 -0
  20. package/build/javascript/lib/cp_sat_api.d.ts +277 -98
  21. package/build/javascript/lib/cp_sat_api.js +3364 -219
  22. package/build/javascript/lib/cp_sat_api.js.map +1 -1
  23. package/build/javascript/wasm/cp_sat_runtime.d.ts +51 -0
  24. package/build/javascript/wasm/cp_sat_runtime.js +10 -0
  25. package/build/javascript/wasm/cp_sat_runtime.wasm +0 -0
  26. package/build/javascript/wasm/cp_sat_runtime.wasm.map +1 -0
  27. package/build/javascript/wasm/cp_sat_runtime_asyncify.js +10 -0
  28. package/build/javascript/wasm/cp_sat_runtime_asyncify.wasm +0 -0
  29. package/build/javascript/wasm/cp_sat_runtime_asyncify.wasm.map +1 -0
  30. package/javascript/lib/cp_sat_api.ts +475 -0
  31. package/javascript/lib/cp_sat_module_loader.bundled.ts +58 -0
  32. package/javascript/lib/cp_sat_module_loader.ts +57 -0
  33. package/javascript/lib/cpsat_worker.ts +160 -0
  34. package/javascript/lib/cpsat_worker_types.ts +32 -0
  35. package/javascript/lib/generated/sat_parameters.ts +2760 -0
  36. package/javascript/lib/index.ts +8 -0
  37. package/javascript/lib/internal_wasm_asyncify.d.ts +15 -0
  38. package/javascript/lib/vite-shims.d.ts +25 -0
  39. package/javascript/lib/webassembly_promising.d.ts +7 -0
  40. package/package.json +46 -7
  41. package/build/javascript/lib/assets/cp_sat_runtime-N6mpxHFm.js +0 -2565
  42. package/build/javascript/lib/assets/cp_sat_runtime-N6mpxHFm.js.map +0 -1
  43. package/build/javascript/lib/assets/cp_sat_runtime_asyncify-DAFhCUmM.js +0 -2639
  44. package/build/javascript/lib/assets/cp_sat_runtime_asyncify-DAFhCUmM.js.map +0 -1
  45. package/build/javascript/lib/assets/cpsat_worker-Bc6EW-gj.js +0 -139
  46. package/build/javascript/lib/assets/cpsat_worker-Bc6EW-gj.js.map +0 -1
  47. package/build/javascript/lib/chunks/cp_sat_runtime-B9zhYjnh.js +0 -2565
  48. package/build/javascript/lib/chunks/cp_sat_runtime-B9zhYjnh.js.map +0 -1
  49. package/build/javascript/lib/chunks/cp_sat_runtime_asyncify-BaxdGqjW.js +0 -2639
  50. package/build/javascript/lib/chunks/cp_sat_runtime_asyncify-BaxdGqjW.js.map +0 -1
  51. package/build/javascript/lib/chunks/index-Cq3lJx2c.js +0 -3815
  52. package/build/javascript/lib/chunks/index-Cq3lJx2c.js.map +0 -1
@@ -0,0 +1,2760 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ /*
3
+ * AUTO-GENERATED FILE.
4
+ *
5
+ * Source: ortools/sat/sat_parameters.proto
6
+ * Generator: scripts/generate_sat_parameters_types.mjs
7
+ */
8
+
9
+ /**
10
+ * ==========================================================================
11
+ * Branching and polarity
12
+ * ==========================================================================
13
+ * Variables without activity (i.e. at the beginning of the search) will be
14
+ * tried in this preferred order.
15
+ */
16
+ export enum SatParameters_VariableOrder {
17
+ IN_ORDER = 0,
18
+ /**
19
+ * As specified by the problem.
20
+ */
21
+ IN_REVERSE_ORDER = 1,
22
+ IN_RANDOM_ORDER = 2,
23
+ }
24
+ export type SatParameters_VariableOrder_Name = 'IN_ORDER' | 'IN_REVERSE_ORDER' | 'IN_RANDOM_ORDER';
25
+
26
+ /**
27
+ * Specifies the initial polarity (true/false) when the solver branches on a
28
+ * variable. This can be modified later by the user, or the phase saving
29
+ * heuristic.
30
+ * Note(user): POLARITY_FALSE is usually a good choice because of the
31
+ * "natural" way to express a linear boolean problem.
32
+ */
33
+ export enum SatParameters_Polarity {
34
+ POLARITY_TRUE = 0,
35
+ POLARITY_FALSE = 1,
36
+ POLARITY_RANDOM = 2,
37
+ }
38
+ export type SatParameters_Polarity_Name = 'POLARITY_TRUE' | 'POLARITY_FALSE' | 'POLARITY_RANDOM';
39
+
40
+ /**
41
+ * ==========================================================================
42
+ * Conflict analysis
43
+ * ==========================================================================
44
+ * Do we try to minimize conflicts (greedily) when creating them.
45
+ */
46
+ export enum SatParameters_ConflictMinimizationAlgorithm {
47
+ NONE = 0,
48
+ SIMPLE = 1,
49
+ RECURSIVE = 2,
50
+ }
51
+ export type SatParameters_ConflictMinimizationAlgorithm_Name = 'NONE' | 'SIMPLE' | 'RECURSIVE';
52
+
53
+ /**
54
+ * Whether to expoit the binary clause to minimize learned clauses further.
55
+ */
56
+ export enum SatParameters_BinaryMinizationAlgorithm {
57
+ NO_BINARY_MINIMIZATION = 0,
58
+ BINARY_MINIMIZATION_FROM_UIP = 1,
59
+ BINARY_MINIMIZATION_FROM_UIP_AND_DECISIONS = 5,
60
+ }
61
+ export type SatParameters_BinaryMinizationAlgorithm_Name = 'NO_BINARY_MINIMIZATION' | 'BINARY_MINIMIZATION_FROM_UIP' | 'BINARY_MINIMIZATION_FROM_UIP_AND_DECISIONS';
62
+
63
+ /**
64
+ * The clauses that will be kept during a cleanup are the ones that come
65
+ * first under this order. We always keep or exclude ties together.
66
+ */
67
+ export enum SatParameters_ClauseOrdering {
68
+ /**
69
+ * Order clause by decreasing activity, then by increasing LBD.
70
+ */
71
+ CLAUSE_ACTIVITY = 0,
72
+ /**
73
+ * Order clause by increasing LBD, then by decreasing activity.
74
+ */
75
+ CLAUSE_LBD = 1,
76
+ }
77
+ export type SatParameters_ClauseOrdering_Name = 'CLAUSE_ACTIVITY' | 'CLAUSE_LBD';
78
+
79
+ /**
80
+ * ==========================================================================
81
+ * Restart
82
+ * ==========================================================================
83
+ * Restart algorithms.
84
+ * A reference for the more advanced ones is:
85
+ * Gilles Audemard, Laurent Simon, "Refining Restarts Strategies for SAT
86
+ * and UNSAT", Principles and Practice of Constraint Programming Lecture
87
+ * Notes in Computer Science 2012, pp 118-126
88
+ */
89
+ export enum SatParameters_RestartAlgorithm {
90
+ NO_RESTART = 0,
91
+ /**
92
+ * Just follow a Luby sequence times restart_period.
93
+ */
94
+ LUBY_RESTART = 1,
95
+ /**
96
+ * Moving average restart based on the decision level of conflicts.
97
+ */
98
+ DL_MOVING_AVERAGE_RESTART = 2,
99
+ /**
100
+ * Moving average restart based on the LBD of conflicts.
101
+ */
102
+ LBD_MOVING_AVERAGE_RESTART = 3,
103
+ /**
104
+ * Fixed period restart every restart period.
105
+ */
106
+ FIXED_RESTART = 4,
107
+ }
108
+ export type SatParameters_RestartAlgorithm_Name = 'NO_RESTART' | 'LUBY_RESTART' | 'DL_MOVING_AVERAGE_RESTART' | 'LBD_MOVING_AVERAGE_RESTART' | 'FIXED_RESTART';
109
+
110
+ /**
111
+ * In what order do we add the assumptions in a core-based max-sat algorithm
112
+ */
113
+ export enum SatParameters_MaxSatAssumptionOrder {
114
+ DEFAULT_ASSUMPTION_ORDER = 0,
115
+ ORDER_ASSUMPTION_BY_DEPTH = 1,
116
+ ORDER_ASSUMPTION_BY_WEIGHT = 2,
117
+ }
118
+ export type SatParameters_MaxSatAssumptionOrder_Name = 'DEFAULT_ASSUMPTION_ORDER' | 'ORDER_ASSUMPTION_BY_DEPTH' | 'ORDER_ASSUMPTION_BY_WEIGHT';
119
+
120
+ /**
121
+ * What stratification algorithm we use in the presence of weight.
122
+ */
123
+ export enum SatParameters_MaxSatStratificationAlgorithm {
124
+ /**
125
+ * No stratification of the problem.
126
+ */
127
+ STRATIFICATION_NONE = 0,
128
+ /**
129
+ * Start with literals with the highest weight, and when SAT, add the
130
+ * literals with the next highest weight and so on.
131
+ */
132
+ STRATIFICATION_DESCENT = 1,
133
+ /**
134
+ * Start with all literals. Each time a core is found with a given minimum
135
+ * weight, do not consider literals with a lower weight for the next core
136
+ * computation. If the subproblem is SAT, do like in STRATIFICATION_DESCENT
137
+ * and just add the literals with the next highest weight.
138
+ */
139
+ STRATIFICATION_ASCENT = 2,
140
+ }
141
+ export type SatParameters_MaxSatStratificationAlgorithm_Name = 'STRATIFICATION_NONE' | 'STRATIFICATION_DESCENT' | 'STRATIFICATION_ASCENT';
142
+
143
+ /**
144
+ * The search branching will be used to decide how to branch on unfixed nodes.
145
+ */
146
+ export enum SatParameters_SearchBranching {
147
+ /**
148
+ * Try to fix all literals using the underlying SAT solver's heuristics,
149
+ * then generate and fix literals until integer variables are fixed. New
150
+ * literals on integer variables are generated using the fixed search
151
+ * specified by the user or our default one.
152
+ */
153
+ AUTOMATIC_SEARCH = 0,
154
+ /**
155
+ * If used then all decisions taken by the solver are made using a fixed
156
+ * order as specified in the API or in the CpModelProto search_strategy
157
+ * field.
158
+ */
159
+ FIXED_SEARCH = 1,
160
+ /**
161
+ * Simple portfolio search used by LNS workers.
162
+ */
163
+ PORTFOLIO_SEARCH = 2,
164
+ /**
165
+ * If used, the solver will use heuristics from the LP relaxation. This
166
+ * exploit the reduced costs of the variables in the relaxation.
167
+ */
168
+ LP_SEARCH = 3,
169
+ /**
170
+ * If used, the solver uses the pseudo costs for branching. Pseudo costs
171
+ * are computed using the historical change in objective bounds when some
172
+ * decision are taken. Note that this works whether we use an LP or not.
173
+ */
174
+ PSEUDO_COST_SEARCH = 4,
175
+ /**
176
+ * Mainly exposed here for testing. This quickly tries a lot of randomized
177
+ * heuristics with a low conflict limit. It usually provides a good first
178
+ * solution.
179
+ */
180
+ PORTFOLIO_WITH_QUICK_RESTART_SEARCH = 5,
181
+ /**
182
+ * Mainly used internally. This is like FIXED_SEARCH, except we follow the
183
+ * solution_hint field of the CpModelProto rather than using the information
184
+ * provided in the search_strategy.
185
+ */
186
+ HINT_SEARCH = 6,
187
+ /**
188
+ * Similar to FIXED_SEARCH, but differ in how the variable not listed into
189
+ * the fixed search heuristics are branched on. This will always start the
190
+ * search tree according to the specified fixed search strategy, but will
191
+ * complete it using the default automatic search.
192
+ */
193
+ PARTIAL_FIXED_SEARCH = 7,
194
+ /**
195
+ * Randomized search. Used to increase entropy in the search.
196
+ */
197
+ RANDOMIZED_SEARCH = 8,
198
+ }
199
+ export type SatParameters_SearchBranching_Name = 'AUTOMATIC_SEARCH' | 'FIXED_SEARCH' | 'PORTFOLIO_SEARCH' | 'LP_SEARCH' | 'PSEUDO_COST_SEARCH' | 'PORTFOLIO_WITH_QUICK_RESTART_SEARCH' | 'HINT_SEARCH' | 'PARTIAL_FIXED_SEARCH' | 'RANDOMIZED_SEARCH';
200
+
201
+ export enum SatParameters_SharedTreeSplitStrategy {
202
+ /**
203
+ * Uses the default strategy, currently equivalent to
204
+ * SPLIT_STRATEGY_DISCREPANCY.
205
+ */
206
+ SPLIT_STRATEGY_AUTO = 0,
207
+ /**
208
+ * Only accept splits if the node to be split's depth+discrepancy is minimal
209
+ * for the desired number of leaves.
210
+ * The preferred child for discrepancy calculation is the one with the
211
+ * lowest objective lower bound or the original branch direction if the
212
+ * bounds are equal. This rule allows twice as many workers to work in the
213
+ * preferred subtree as non-preferred.
214
+ */
215
+ SPLIT_STRATEGY_DISCREPANCY = 1,
216
+ /**
217
+ * Only split nodes with an objective lb equal to the global lb. If there is
218
+ * no objective, this is equivalent to SPLIT_STRATEGY_FIRST_PROPOSAL.
219
+ */
220
+ SPLIT_STRATEGY_OBJECTIVE_LB = 2,
221
+ /**
222
+ * Attempt to keep the shared tree balanced.
223
+ */
224
+ SPLIT_STRATEGY_BALANCED_TREE = 3,
225
+ /**
226
+ * Workers race to split their subtree, the winner's proposal is accepted.
227
+ */
228
+ SPLIT_STRATEGY_FIRST_PROPOSAL = 4,
229
+ }
230
+ export type SatParameters_SharedTreeSplitStrategy_Name = 'SPLIT_STRATEGY_AUTO' | 'SPLIT_STRATEGY_DISCREPANCY' | 'SPLIT_STRATEGY_OBJECTIVE_LB' | 'SPLIT_STRATEGY_BALANCED_TREE' | 'SPLIT_STRATEGY_FIRST_PROPOSAL';
231
+
232
+ /**
233
+ * Rounding method to use for feasibility pump.
234
+ */
235
+ export enum SatParameters_FPRoundingMethod {
236
+ /**
237
+ * Rounds to the nearest integer value.
238
+ */
239
+ NEAREST_INTEGER = 0,
240
+ /**
241
+ * Counts the number of linear constraints restricting the variable in the
242
+ * increasing values (up locks) and decreasing values (down locks). Rounds
243
+ * the variable in the direction of lesser locks.
244
+ */
245
+ LOCK_BASED = 1,
246
+ /**
247
+ * Similar to lock based rounding except this only considers locks of active
248
+ * constraints from the last lp solve.
249
+ */
250
+ ACTIVE_LOCK_BASED = 3,
251
+ /**
252
+ * This is expensive rounding algorithm. We round variables one by one and
253
+ * propagate the bounds in between. If none of the rounded values fall in
254
+ * the continuous domain specified by lower and upper bound, we use the
255
+ * current lower/upper bound (whichever one is closest) instead of rounding
256
+ * the fractional lp solution value. If both the rounded values are in the
257
+ * domain, we round to nearest integer.
258
+ */
259
+ PROPAGATION_ASSISTED = 2,
260
+ }
261
+ export type SatParameters_FPRoundingMethod_Name = 'NEAREST_INTEGER' | 'LOCK_BASED' | 'ACTIVE_LOCK_BASED' | 'PROPAGATION_ASSISTED';
262
+
263
+ /**
264
+ * Contains the definitions for all the sat algorithm parameters and their
265
+ * default values.
266
+ * NEXT TAG: 356
267
+ */
268
+ export type SatParameters = {
269
+ /**
270
+ * In some context, like in a portfolio of search, it makes sense to name a
271
+ * given parameters set for logging purpose.
272
+ *
273
+ * @default ""
274
+ */
275
+ name?: string;
276
+ /**
277
+ * @default IN_ORDER
278
+ */
279
+ preferredVariableOrder?: SatParameters_VariableOrder | SatParameters_VariableOrder_Name;
280
+ /**
281
+ * @default POLARITY_FALSE
282
+ */
283
+ initialPolarity?: SatParameters_Polarity | SatParameters_Polarity_Name;
284
+ /**
285
+ * If this is true, then the polarity of a variable will be the last value it
286
+ * was assigned to, or its default polarity if it was never assigned since the
287
+ * call to ResetDecisionHeuristic().
288
+ * Actually, we use a newer version where we follow the last value in the
289
+ * longest non-conflicting partial assignment in the current phase.
290
+ * This is called 'literal phase saving'. For details see 'A Lightweight
291
+ * Component Caching Scheme for Satisfiability Solvers' K. Pipatsrisawat and
292
+ * A.Darwiche, In 10th International Conference on Theory and Applications of
293
+ * Satisfiability Testing, 2007.
294
+ *
295
+ * @default true
296
+ */
297
+ usePhaseSaving?: boolean;
298
+ /**
299
+ * If non-zero, then we change the polarity heuristic after that many number
300
+ * of conflicts in an arithmetically increasing fashion. So x the first time,
301
+ * 2 * x the second time, etc...
302
+ *
303
+ * @default 1000
304
+ */
305
+ polarityRephaseIncrement?: number;
306
+ /**
307
+ * If true and we have first solution LS workers, tries in some phase to
308
+ * follow a LS solutions that violates has litle constraints as possible.
309
+ *
310
+ * @default false
311
+ */
312
+ polarityExploitLsHints?: boolean;
313
+ /**
314
+ * The proportion of polarity chosen at random. Note that this take
315
+ * precedence over the phase saving heuristic. This is different from
316
+ * initial_polarity:POLARITY_RANDOM because it will select a new random
317
+ * polarity each time the variable is branched upon instead of selecting one
318
+ * initially and then always taking this choice.
319
+ *
320
+ * @default 0
321
+ */
322
+ randomPolarityRatio?: number;
323
+ /**
324
+ * A number between 0 and 1 that indicates the proportion of branching
325
+ * variables that are selected randomly instead of choosing the first variable
326
+ * from the given variable_ordering strategy.
327
+ *
328
+ * @default 0
329
+ */
330
+ randomBranchesRatio?: number;
331
+ /**
332
+ * Whether we use the ERWA (Exponential Recency Weighted Average) heuristic as
333
+ * described in "Learning Rate Based Branching Heuristic for SAT solvers",
334
+ * J.H.Liang, V. Ganesh, P. Poupart, K.Czarnecki, SAT 2016.
335
+ *
336
+ * @default false
337
+ */
338
+ useErwaHeuristic?: boolean;
339
+ /**
340
+ * The initial value of the variables activity. A non-zero value only make
341
+ * sense when use_erwa_heuristic is true. Experiments with a value of 1e-2
342
+ * together with the ERWA heuristic showed slighthly better result than simply
343
+ * using zero. The idea is that when the "learning rate" of a variable becomes
344
+ * lower than this value, then we prefer to branch on never explored before
345
+ * variables. This is not in the ERWA paper.
346
+ *
347
+ * @default 0
348
+ */
349
+ initialVariablesActivity?: number;
350
+ /**
351
+ * When this is true, then the variables that appear in any of the reason of
352
+ * the variables in a conflict have their activity bumped. This is addition to
353
+ * the variables in the conflict, and the one that were used during conflict
354
+ * resolution.
355
+ *
356
+ * @default false
357
+ */
358
+ alsoBumpVariablesInConflictReasons?: boolean;
359
+ /**
360
+ * @default RECURSIVE
361
+ */
362
+ minimizationAlgorithm?: SatParameters_ConflictMinimizationAlgorithm | SatParameters_ConflictMinimizationAlgorithm_Name;
363
+ /**
364
+ * @default BINARY_MINIMIZATION_FROM_UIP_AND_DECISIONS
365
+ */
366
+ binaryMinimizationAlgorithm?: SatParameters_BinaryMinizationAlgorithm | SatParameters_BinaryMinizationAlgorithm_Name;
367
+ /**
368
+ * At a really low cost, during the 1-UIP conflict computation, it is easy to
369
+ * detect if some of the involved reasons are subsumed by the current
370
+ * conflict. When this is true, such clauses are detached and later removed
371
+ * from the problem.
372
+ *
373
+ * @default true
374
+ */
375
+ subsumptionDuringConflictAnalysis?: boolean;
376
+ /**
377
+ * It is possible that "intermediate" clauses during conflict resolution
378
+ * subsumes some of the clauses that propagated. This is quite cheap to detect
379
+ * and result in more subsumption/strengthening of clauses.
380
+ *
381
+ * @default true
382
+ */
383
+ extraSubsumptionDuringConflictAnalysis?: boolean;
384
+ /**
385
+ * Try even more subsumption options during conflict analysis.
386
+ *
387
+ * @default true
388
+ */
389
+ decisionSubsumptionDuringConflictAnalysis?: boolean;
390
+ /**
391
+ * If >=0, each time we have a conflict, we try to subsume the last n learned
392
+ * clause with it.
393
+ *
394
+ * @default 4
395
+ */
396
+ eagerlySubsumeLastNConflicts?: number;
397
+ /**
398
+ * If we remove clause that we now are "implied" by others. Note that this
399
+ * might not always be good as we might loose some propagation power.
400
+ *
401
+ * @default true
402
+ */
403
+ subsumeDuringVivification?: boolean;
404
+ /**
405
+ * If true, try to backtrack as little as possible on conflict and re-imply
406
+ * the clauses later.
407
+ * This means we discard less propagation than traditional backjumping, but
408
+ * requites additional bookkeeping to handle reimplication.
409
+ * See: https://doi.org/10.1007/978-3-319-94144-8_7
410
+ *
411
+ * @default false
412
+ */
413
+ useChronologicalBacktracking?: boolean;
414
+ /**
415
+ * If chronological backtracking is enabled, this is the maximum number of
416
+ * levels we will backjump over, otherwise we will backtrack.
417
+ *
418
+ * @default 50
419
+ */
420
+ maxBackjumpLevels?: number;
421
+ /**
422
+ * If chronological backtracking is enabled, this is the minimum number of
423
+ * conflicts before we will consider backjumping.
424
+ *
425
+ * @default 1000
426
+ */
427
+ chronologicalBacktrackMinConflicts?: number;
428
+ /**
429
+ * ==========================================================================
430
+ * Clause database management
431
+ * ==========================================================================
432
+ * Trigger a cleanup when this number of "deletable" clauses is learned.
433
+ *
434
+ * @default 10000
435
+ */
436
+ clauseCleanupPeriod?: number;
437
+ /**
438
+ * Increase clause_cleanup_period by this amount after each cleanup.
439
+ *
440
+ * @default 0
441
+ */
442
+ clauseCleanupPeriodIncrement?: number;
443
+ /**
444
+ * During a cleanup, we will always keep that number of "deletable" clauses.
445
+ * Note that this doesn't include the "protected" clauses.
446
+ *
447
+ * @default 0
448
+ */
449
+ clauseCleanupTarget?: number;
450
+ /**
451
+ * During a cleanup, if clause_cleanup_target is 0, we will delete the
452
+ * clause_cleanup_ratio of "deletable" clauses instead of aiming for a fixed
453
+ * target of clauses to keep.
454
+ *
455
+ * @default 0
456
+ */
457
+ clauseCleanupRatio?: number;
458
+ /**
459
+ * All the clauses with a LBD (literal blocks distance) lower or equal to this
460
+ * parameters will always be kept.
461
+ * Note that the LBD of a clause that just propagated is 1 + number of
462
+ * different decision levels of its literals. So that the "classic" LBD of a
463
+ * learned conflict is the same as its LBD when we backjump and then propagate
464
+ * it.
465
+ *
466
+ * @default 5
467
+ */
468
+ clauseCleanupLbdBound?: number;
469
+ /**
470
+ * All the clause with a LBD lower or equal to this will be kept except if
471
+ * its activity hasn't been bumped in the last 32 cleanup phase. Note that
472
+ * this has no effect if it is <= clause_cleanup_lbd_bound.
473
+ *
474
+ * @default 0
475
+ */
476
+ clauseCleanupLbdTier1?: number;
477
+ /**
478
+ * All the clause with a LBD lower or equal to this will be kept except if its
479
+ * activity hasn't been bumped since the previous cleanup phase. Note that
480
+ * this has no effect if it is <= clause_cleanup_lbd_bound or <=
481
+ * clause_cleanup_lbd_tier1.
482
+ *
483
+ * @default 0
484
+ */
485
+ clauseCleanupLbdTier2?: number;
486
+ /**
487
+ * @default CLAUSE_ACTIVITY
488
+ */
489
+ clauseCleanupOrdering?: SatParameters_ClauseOrdering | SatParameters_ClauseOrdering_Name;
490
+ /**
491
+ * Same as for the clauses, but for the learned pseudo-Boolean constraints.
492
+ *
493
+ * @default 200
494
+ */
495
+ pbCleanupIncrement?: number;
496
+ /**
497
+ * @default 0
498
+ */
499
+ pbCleanupRatio?: number;
500
+ /**
501
+ * ==========================================================================
502
+ * Variable and clause activities
503
+ * ==========================================================================
504
+ * Each time a conflict is found, the activities of some variables are
505
+ * increased by one. Then, the activity of all variables are multiplied by
506
+ * variable_activity_decay.
507
+ * To implement this efficiently, the activity of all the variables is not
508
+ * decayed at each conflict. Instead, the activity increment is multiplied by
509
+ * 1 / decay. When an activity reach max_variable_activity_value, all the
510
+ * activity are multiplied by 1 / max_variable_activity_value.
511
+ *
512
+ * @default 0
513
+ */
514
+ variableActivityDecay?: number;
515
+ /**
516
+ * @default 1
517
+ */
518
+ maxVariableActivityValue?: number;
519
+ /**
520
+ * The activity starts at 0.8 and increment by 0.01 every 5000 conflicts until
521
+ * 0.95. This "hack" seems to work well and comes from:
522
+ * Glucose 2.3 in the SAT 2013 Competition - SAT Competition 2013
523
+ * http://edacc4.informatik.uni-ulm.de/SC13/solver-description-download/136
524
+ *
525
+ * @default 0
526
+ */
527
+ glucoseMaxDecay?: number;
528
+ /**
529
+ * @default 0
530
+ */
531
+ glucoseDecayIncrement?: number;
532
+ /**
533
+ * @default 5000
534
+ */
535
+ glucoseDecayIncrementPeriod?: number;
536
+ /**
537
+ * Clause activity parameters (same effect as the one on the variables).
538
+ *
539
+ * @default 0
540
+ */
541
+ clauseActivityDecay?: number;
542
+ /**
543
+ * @default 1
544
+ */
545
+ maxClauseActivityValue?: number;
546
+ /**
547
+ * The restart strategies will change each time the strategy_counter is
548
+ * increased. The current strategy will simply be the one at index
549
+ * strategy_counter modulo the number of strategy. Note that if this list
550
+ * includes a NO_RESTART, nothing will change when it is reached because the
551
+ * strategy_counter will only increment after a restart.
552
+ * The idea of switching of search strategy tailored for SAT/UNSAT comes from
553
+ * Chanseok Oh with his COMiniSatPS solver, see http://cs.nyu.edu/~chanseok/.
554
+ * But more generally, it seems REALLY beneficial to try different strategy.
555
+ */
556
+ restartAlgorithms?: Array<SatParameters_RestartAlgorithm | SatParameters_RestartAlgorithm_Name>;
557
+ /**
558
+ * @default "LUBY_RESTART,LBD_MOVING_AVERAGE_RESTART,DL_MOVING_AVERAGE_RESTART"
559
+ */
560
+ defaultRestartAlgorithms?: string;
561
+ /**
562
+ * Restart period for the FIXED_RESTART strategy. This is also the multiplier
563
+ * used by the LUBY_RESTART strategy.
564
+ *
565
+ * @default 50
566
+ */
567
+ restartPeriod?: number;
568
+ /**
569
+ * Size of the window for the moving average restarts.
570
+ *
571
+ * @default 50
572
+ */
573
+ restartRunningWindowSize?: number;
574
+ /**
575
+ * In the moving average restart algorithms, a restart is triggered if the
576
+ * window average times this ratio is greater that the global average.
577
+ *
578
+ * @default 1
579
+ */
580
+ restartDlAverageRatio?: number;
581
+ /**
582
+ * @default 1
583
+ */
584
+ restartLbdAverageRatio?: number;
585
+ /**
586
+ * Block a moving restart algorithm if the trail size of the current conflict
587
+ * is greater than the multiplier times the moving average of the trail size
588
+ * at the previous conflicts.
589
+ *
590
+ * @default false
591
+ */
592
+ useBlockingRestart?: boolean;
593
+ /**
594
+ * @default 5000
595
+ */
596
+ blockingRestartWindowSize?: number;
597
+ /**
598
+ * @default 1
599
+ */
600
+ blockingRestartMultiplier?: number;
601
+ /**
602
+ * After each restart, if the number of conflict since the last strategy
603
+ * change is greater that this, then we increment a "strategy_counter" that
604
+ * can be use to change the search strategy used by the following restarts.
605
+ *
606
+ * @default 0
607
+ */
608
+ numConflictsBeforeStrategyChanges?: number;
609
+ /**
610
+ * The parameter num_conflicts_before_strategy_changes is increased by that
611
+ * much after each strategy change.
612
+ *
613
+ * @default 0
614
+ */
615
+ strategyChangeIncreaseRatio?: number;
616
+ /**
617
+ * ==========================================================================
618
+ * Limits
619
+ * ==========================================================================
620
+ * Maximum time allowed in seconds to solve a problem.
621
+ * The counter will starts at the beginning of the Solve() call.
622
+ *
623
+ * @default inf
624
+ */
625
+ maxTimeInSeconds?: number;
626
+ /**
627
+ * Maximum time allowed in deterministic time to solve a problem.
628
+ * The deterministic time should be correlated with the real time used by the
629
+ * solver, the time unit being as close as possible to a second.
630
+ *
631
+ * @default inf
632
+ */
633
+ maxDeterministicTime?: number;
634
+ /**
635
+ * Stops after that number of batches has been scheduled. This only make sense
636
+ * when interleave_search is true.
637
+ *
638
+ * @default 0
639
+ */
640
+ maxNumDeterministicBatches?: number;
641
+ /**
642
+ * Maximum number of conflicts allowed to solve a problem.
643
+ * TODO(user): Maybe change the way the conflict limit is enforced?
644
+ * currently it is enforced on each independent internal SAT solve, rather
645
+ * than on the overall number of conflicts across all solves. So in the
646
+ * context of an optimization problem, this is not really usable directly by a
647
+ * client.
648
+ *
649
+ * @default 0
650
+ */
651
+ maxNumberOfConflicts?: number;
652
+ /**
653
+ * kint64max
654
+ * Maximum memory allowed for the whole thread containing the solver. The
655
+ * solver will abort as soon as it detects that this limit is crossed. As a
656
+ * result, this limit is approximative, but usually the solver will not go too
657
+ * much over.
658
+ * TODO(user): This is only used by the pure SAT solver, generalize to CP-SAT.
659
+ *
660
+ * @default 10000
661
+ */
662
+ maxMemoryInMb?: number;
663
+ /**
664
+ * Stop the search when the gap between the best feasible objective (O) and
665
+ * our best objective bound (B) is smaller than a limit.
666
+ * The exact definition is:
667
+ * - Absolute: abs(O - B)
668
+ * - Relative: abs(O - B) / max(1, abs(O)).
669
+ * Important: The relative gap depends on the objective offset! If you
670
+ * artificially shift the objective, you will get widely different value of
671
+ * the relative gap.
672
+ * Note that if the gap is reached, the search status will be OPTIMAL. But
673
+ * one can check the best objective bound to see the actual gap.
674
+ * If the objective is integer, then any absolute gap < 1 will lead to a true
675
+ * optimal. If the objective is floating point, a gap of zero make little
676
+ * sense so is is why we use a non-zero default value. At the end of the
677
+ * search, we will display a warning if OPTIMAL is reported yet the gap is
678
+ * greater than this absolute gap.
679
+ *
680
+ * @default 1
681
+ */
682
+ absoluteGapLimit?: number;
683
+ /**
684
+ * @default 0
685
+ */
686
+ relativeGapLimit?: number;
687
+ /**
688
+ * ==========================================================================
689
+ * Other parameters
690
+ * ==========================================================================
691
+ * At the beginning of each solve, the random number generator used in some
692
+ * part of the solver is reinitialized to this seed. If you change the random
693
+ * seed, the solver may make different choices during the solving process.
694
+ * For some problems, the running time may vary a lot depending on small
695
+ * change in the solving algorithm. Running the solver with different seeds
696
+ * enables to have more robust benchmarks when evaluating new features.
697
+ *
698
+ * @default 1
699
+ */
700
+ randomSeed?: number;
701
+ /**
702
+ * This is mainly here to test the solver variability. Note that in tests, if
703
+ * not explicitly set to false, all 3 options will be set to true so that
704
+ * clients do not rely on the solver returning a specific solution if they are
705
+ * many equivalent optimal solutions.
706
+ *
707
+ * @default false
708
+ */
709
+ permuteVariableRandomly?: boolean;
710
+ /**
711
+ * @default false
712
+ */
713
+ permutePresolveConstraintOrder?: boolean;
714
+ /**
715
+ * @default false
716
+ */
717
+ useAbslRandom?: boolean;
718
+ /**
719
+ * Whether the solver should log the search progress. This is the maing
720
+ * logging parameter and if this is false, none of the logging (callbacks,
721
+ * log_to_stdout, log_to_response, ...) will do anything.
722
+ *
723
+ * @default false
724
+ */
725
+ logSearchProgress?: boolean;
726
+ /**
727
+ * Whether the solver should display per sub-solver search statistics.
728
+ * This is only useful is log_search_progress is set to true, and if the
729
+ * number of search workers is > 1. Note that in all case we display a bit
730
+ * of stats with one line per subsolver.
731
+ *
732
+ * @default false
733
+ */
734
+ logSubsolverStatistics?: boolean;
735
+ /**
736
+ * Add a prefix to all logs.
737
+ *
738
+ * @default ""
739
+ */
740
+ logPrefix?: string;
741
+ /**
742
+ * Log to stdout.
743
+ *
744
+ * @default true
745
+ */
746
+ logToStdout?: boolean;
747
+ /**
748
+ * Log to response proto.
749
+ *
750
+ * @default false
751
+ */
752
+ logToResponse?: boolean;
753
+ /**
754
+ * Experimental.
755
+ * This is an old experiment, it might cause crashes in multi-thread and you
756
+ * should double check the solver result. It can still be used if you only
757
+ * care about feasible solutions (these are checked) and it gives good result
758
+ * on your problem. We might revive it at some point.
759
+ * Whether to use pseudo-Boolean resolution to analyze a conflict. Note that
760
+ * this option only make sense if your problem is modelized using
761
+ * pseudo-Boolean constraints. If you only have clauses, this shouldn't change
762
+ * anything (except slow the solver down).
763
+ *
764
+ * @default false
765
+ */
766
+ usePbResolution?: boolean;
767
+ /**
768
+ * A different algorithm during PB resolution. It minimizes the number of
769
+ * calls to ReduceCoefficients() which can be time consuming. However, the
770
+ * search space will be different and if the coefficients are large, this may
771
+ * lead to integer overflows that could otherwise be prevented.
772
+ *
773
+ * @default false
774
+ */
775
+ minimizeReductionDuringPbResolution?: boolean;
776
+ /**
777
+ * Whether or not the assumption levels are taken into account during the LBD
778
+ * computation. According to the reference below, not counting them improves
779
+ * the solver in some situation. Note that this only impact solves under
780
+ * assumptions.
781
+ * Gilles Audemard, Jean-Marie Lagniez, Laurent Simon, "Improving Glucose for
782
+ * Incremental SAT Solving with Assumptions: Application to MUS Extraction"
783
+ * Theory and Applications of Satisfiability Testing - SAT 2013, Lecture Notes
784
+ * in Computer Science Volume 7962, 2013, pp 309-317.
785
+ *
786
+ * @default true
787
+ */
788
+ countAssumptionLevelsInLbd?: boolean;
789
+ /**
790
+ * ==========================================================================
791
+ * Presolve
792
+ * ==========================================================================
793
+ * During presolve, only try to perform the bounded variable elimination (BVE)
794
+ * of a variable x if the number of occurrences of x times the number of
795
+ * occurrences of not(x) is not greater than this parameter.
796
+ *
797
+ * @default 500
798
+ */
799
+ presolveBveThreshold?: number;
800
+ /**
801
+ * Internal parameter. During BVE, if we eliminate a variable x, by default we
802
+ * will push all clauses containing x and all clauses containing not(x) to the
803
+ * postsolve. However, it is possible to write the postsolve code so that only
804
+ * one such set is needed. The idea is that, if we push the set containing a
805
+ * literal l, is to set l to false except if it is needed to satisfy one of
806
+ * the clause in the set. This is always beneficial, but for historical
807
+ * reason, not all our postsolve algorithm support this.
808
+ *
809
+ * @default false
810
+ */
811
+ filterSatPostsolveClauses?: boolean;
812
+ /**
813
+ * During presolve, we apply BVE only if this weight times the number of
814
+ * clauses plus the number of clause literals is not increased.
815
+ *
816
+ * @default 3
817
+ */
818
+ presolveBveClauseWeight?: number;
819
+ /**
820
+ * The maximum "deterministic" time limit to spend in probing. A value of
821
+ * zero will disable the probing.
822
+ * TODO(user): Clean up. The first one is used in CP-SAT, the other in pure
823
+ * SAT presolve.
824
+ *
825
+ * @default 1
826
+ */
827
+ probingDeterministicTimeLimit?: number;
828
+ /**
829
+ * @default 30
830
+ */
831
+ presolveProbingDeterministicTimeLimit?: number;
832
+ /**
833
+ * Whether we use an heuristic to detect some basic case of blocked clause
834
+ * in the SAT presolve.
835
+ *
836
+ * @default true
837
+ */
838
+ presolveBlockedClause?: boolean;
839
+ /**
840
+ * Whether or not we use Bounded Variable Addition (BVA) in the presolve.
841
+ *
842
+ * @default true
843
+ */
844
+ presolveUseBva?: boolean;
845
+ /**
846
+ * Apply Bounded Variable Addition (BVA) if the number of clauses is reduced
847
+ * by stricly more than this threshold. The algorithm described in the paper
848
+ * uses 0, but quick experiments showed that 1 is a good value. It may not be
849
+ * worth it to add a new variable just to remove one clause.
850
+ *
851
+ * @default 1
852
+ */
853
+ presolveBvaThreshold?: number;
854
+ /**
855
+ * In case of large reduction in a presolve iteration, we perform multiple
856
+ * presolve iterations. This parameter controls the maximum number of such
857
+ * presolve iterations.
858
+ *
859
+ * @default 3
860
+ */
861
+ maxPresolveIterations?: number;
862
+ /**
863
+ * Whether we presolve the cp_model before solving it.
864
+ *
865
+ * @default true
866
+ */
867
+ cpModelPresolve?: boolean;
868
+ /**
869
+ * How much effort do we spend on probing. 0 disables it completely.
870
+ *
871
+ * @default 2
872
+ */
873
+ cpModelProbingLevel?: number;
874
+ /**
875
+ * Whether we also use the sat presolve when cp_model_presolve is true.
876
+ *
877
+ * @default true
878
+ */
879
+ cpModelUseSatPresolve?: boolean;
880
+ /**
881
+ * If we try to load at most ones and exactly ones constraints when running
882
+ * the pure SAT presolve. Or if we just ignore them.
883
+ * If one detects at_most_one via merge_at_most_one_work_limit or exactly one
884
+ * with find_clauses_that_are_exactly_one, it might be good to also set this
885
+ * to true.
886
+ *
887
+ * @default false
888
+ */
889
+ loadAtMostOnesInSatPresolve?: boolean;
890
+ /**
891
+ * If cp_model_presolve is true and there is a large proportion of fixed
892
+ * variable after the first model copy, remap all the model to a dense set of
893
+ * variable before the full presolve even starts. This should help for LNS on
894
+ * large models.
895
+ *
896
+ * @default true
897
+ */
898
+ removeFixedVariablesEarly?: boolean;
899
+ /**
900
+ * If true, we detect variable that are unique to a table constraint and only
901
+ * there to encode a cost on each tuple. This is usually the case when a WCSP
902
+ * (weighted constraint program) is encoded into CP-SAT format.
903
+ * This can lead to a dramatic speed-up for such problems but is still
904
+ * experimental at this point.
905
+ *
906
+ * @default false
907
+ */
908
+ detectTableWithCost?: boolean;
909
+ /**
910
+ * How much we try to "compress" a table constraint. Compressing more leads to
911
+ * less Booleans and faster propagation but can reduced the quality of the lp
912
+ * relaxation. Values goes from 0 to 3 where we always try to fully compress a
913
+ * table. At 2, we try to automatically decide if it is worth it.
914
+ *
915
+ * @default 2
916
+ */
917
+ tableCompressionLevel?: number;
918
+ /**
919
+ * If true, expand all_different constraints that are not permutations.
920
+ * Permutations (#Variables = #Values) are always expanded.
921
+ *
922
+ * @default false
923
+ */
924
+ expandAlldiffConstraints?: boolean;
925
+ /**
926
+ * Max domain size for all_different constraints to be expanded.
927
+ *
928
+ * @default 256
929
+ */
930
+ maxAlldiffDomainSize?: number;
931
+ /**
932
+ * If true, expand the reservoir constraints by creating booleans for all
933
+ * possible precedences between event and encoding the constraint.
934
+ *
935
+ * @default true
936
+ */
937
+ expandReservoirConstraints?: boolean;
938
+ /**
939
+ * Max domain size for expanding linear2 constraints (ax + by ==/!= c).
940
+ *
941
+ * @default 8
942
+ */
943
+ maxDomainSizeForLinear2Expansion?: number;
944
+ /**
945
+ * Mainly useful for testing.
946
+ * If this and expand_reservoir_constraints is true, we use a different
947
+ * encoding of the reservoir constraint using circuit instead of precedences.
948
+ * Note that this is usually slower, but can exercise different part of the
949
+ * solver. Note that contrary to the precedence encoding, this easily support
950
+ * variable demands.
951
+ * WARNING: with this encoding, the constraint takes a slightly different
952
+ * meaning. There must exist a permutation of the events occurring at the same
953
+ * time such that the level is within the reservoir after each of these events
954
+ * (in this permuted order). So we cannot have +100 and -100 at the same time
955
+ * if the level must be between 0 and 10 (as authorized by the reservoir
956
+ * constraint).
957
+ *
958
+ * @default false
959
+ */
960
+ expandReservoirUsingCircuit?: boolean;
961
+ /**
962
+ * Encore cumulative with fixed demands and capacity as a reservoir
963
+ * constraint. The only reason you might want to do that is to test the
964
+ * reservoir propagation code!
965
+ *
966
+ * @default false
967
+ */
968
+ encodeCumulativeAsReservoir?: boolean;
969
+ /**
970
+ * If the number of expressions in the lin_max is less that the max size
971
+ * parameter, model expansion replaces target = max(xi) by linear constraint
972
+ * with the introduction of new booleans bi such that bi => target == xi.
973
+ * This is mainly for experimenting compared to a custom lin_max propagator.
974
+ *
975
+ * @default 0
976
+ */
977
+ maxLinMaxSizeForExpansion?: number;
978
+ /**
979
+ * If true, it disable all constraint expansion.
980
+ * This should only be used to test the presolve of expanded constraints.
981
+ *
982
+ * @default false
983
+ */
984
+ disableConstraintExpansion?: boolean;
985
+ /**
986
+ * Linear constraint with a complex right hand side (more than a single
987
+ * interval) need to be expanded, there is a couple of way to do that.
988
+ *
989
+ * @default false
990
+ */
991
+ encodeComplexLinearConstraintWithInteger?: boolean;
992
+ /**
993
+ * During presolve, we use a maximum clique heuristic to merge together
994
+ * no-overlap constraints or at most one constraints. This code can be slow,
995
+ * so we have a limit in place on the number of explored nodes in the
996
+ * underlying graph. The internal limit is an int64, but we use double here to
997
+ * simplify manual input.
998
+ *
999
+ * @default 1
1000
+ */
1001
+ mergeNoOverlapWorkLimit?: number;
1002
+ /**
1003
+ * @default 1
1004
+ */
1005
+ mergeAtMostOneWorkLimit?: number;
1006
+ /**
1007
+ * How much substitution (also called free variable aggregation in MIP
1008
+ * litterature) should we perform at presolve. This currently only concerns
1009
+ * variable appearing only in linear constraints. For now the value 0 turns it
1010
+ * off and any positive value performs substitution.
1011
+ *
1012
+ * @default 1
1013
+ */
1014
+ presolveSubstitutionLevel?: number;
1015
+ /**
1016
+ * If true, we will extract from linear constraints, enforcement literals of
1017
+ * the form "integer variable at bound => simplified constraint". This should
1018
+ * always be beneficial except that we don't always handle them as efficiently
1019
+ * as we could for now. This causes problem on manna81.mps (LP relaxation not
1020
+ * as tight it seems) and on neos-3354841-apure.mps.gz (too many literals
1021
+ * created this way).
1022
+ *
1023
+ * @default false
1024
+ */
1025
+ presolveExtractIntegerEnforcement?: boolean;
1026
+ /**
1027
+ * A few presolve operations involve detecting constraints included in other
1028
+ * constraint. Since there can be a quadratic number of such pairs, and
1029
+ * processing them usually involve scanning them, the complexity of these
1030
+ * operations can be big. This enforce a local deterministic limit on the
1031
+ * number of entries scanned. Default is 1e8.
1032
+ * A value of zero will disable these presolve rules completely.
1033
+ *
1034
+ * @default 100000000
1035
+ */
1036
+ presolveInclusionWorkLimit?: number;
1037
+ /**
1038
+ * If true, we don't keep names in our internal copy of the user given model.
1039
+ *
1040
+ * @default true
1041
+ */
1042
+ ignoreNames?: boolean;
1043
+ /**
1044
+ * Run a max-clique code amongst all the x != y we can find and try to infer
1045
+ * set of variables that are all different. This allows to close neos16.mps
1046
+ * for instance. Note that we only run this code if there is no all_diff
1047
+ * already in the model so that if a user want to add some all_diff, we assume
1048
+ * it is well done and do not try to add more.
1049
+ * This will also detect and add no_overlap constraints, if all the relations
1050
+ * x != y have "offsets" between them. I.e. x > y + offset.
1051
+ *
1052
+ * @default true
1053
+ */
1054
+ inferAllDiffs?: boolean;
1055
+ /**
1056
+ * Try to find large "rectangle" in the linear constraint matrix with
1057
+ * identical lines. If such rectangle is big enough, we can introduce a new
1058
+ * integer variable corresponding to the common expression and greatly reduce
1059
+ * the number of non-zero.
1060
+ *
1061
+ * @default true
1062
+ */
1063
+ findBigLinearOverlap?: boolean;
1064
+ /**
1065
+ * By propagating (or just using binary clauses), one can detect that all
1066
+ * literal of a clause are actually in at most one relationship. Thus this
1067
+ * constraint can be promoted to an exactly one constraints. This should help
1068
+ * as it convey more structure. Note that this is expensive, so we have a
1069
+ * deterministic limit in place.
1070
+ *
1071
+ * @default true
1072
+ */
1073
+ findClausesThatAreExactlyOne?: boolean;
1074
+ /**
1075
+ * ==========================================================================
1076
+ * Inprocessing
1077
+ * ==========================================================================
1078
+ * Enable or disable "inprocessing" which is some SAT presolving done at
1079
+ * each restart to the root level.
1080
+ *
1081
+ * @default true
1082
+ */
1083
+ useSatInprocessing?: boolean;
1084
+ /**
1085
+ * Proportion of deterministic time we should spend on inprocessing.
1086
+ * At each "restart", if the proportion is below this ratio, we will do some
1087
+ * inprocessing, otherwise, we skip it for this restart.
1088
+ *
1089
+ * @default 0
1090
+ */
1091
+ inprocessingDtimeRatio?: number;
1092
+ /**
1093
+ * The amount of dtime we should spend on probing for each inprocessing round.
1094
+ *
1095
+ * @default 1
1096
+ */
1097
+ inprocessingProbingDtime?: number;
1098
+ /**
1099
+ * Parameters for an heuristic similar to the one described in "An effective
1100
+ * learnt clause minimization approach for CDCL Sat Solvers",
1101
+ * https://www.ijcai.org/proceedings/2017/0098.pdf
1102
+ * This is the amount of dtime we should spend on this technique during each
1103
+ * inprocessing phase.
1104
+ * The minimization technique is the same as the one used to minimize core in
1105
+ * max-sat. We also minimize problem clauses and not just the learned clause
1106
+ * that we keep forever like in the paper.
1107
+ *
1108
+ * @default 1
1109
+ */
1110
+ inprocessingMinimizationDtime?: number;
1111
+ /**
1112
+ * @default true
1113
+ */
1114
+ inprocessingMinimizationUseConflictAnalysis?: boolean;
1115
+ /**
1116
+ * @default false
1117
+ */
1118
+ inprocessingMinimizationUseAllOrderings?: boolean;
1119
+ /**
1120
+ * Whether we use the algorithm described in "Clausal Congruence closure",
1121
+ * Armin Biere, Katalin Fazekas, Mathias Fleury, Nils Froleyks, 2024.
1122
+ * Note that we only have a basic version currently.
1123
+ *
1124
+ * @default true
1125
+ */
1126
+ inprocessingUseCongruenceClosure?: boolean;
1127
+ /**
1128
+ * Whether we use the SAT sweeping algorithm described in "Clausal Equivalence
1129
+ * Sweeping", Armin Biere, Katalin Fazekas, Mathias Fleury, Nils Froleyks,
1130
+ * 2025.
1131
+ *
1132
+ * @default false
1133
+ */
1134
+ inprocessingUseSatSweeping?: boolean;
1135
+ /**
1136
+ * ==========================================================================
1137
+ * Multithread
1138
+ * ==========================================================================
1139
+ * Specify the number of parallel workers (i.e. threads) to use during search.
1140
+ * This should usually be lower than your number of available cpus +
1141
+ * hyperthread in your machine.
1142
+ * A value of 0 means the solver will try to use all cores on the machine.
1143
+ * A number of 1 means no parallelism.
1144
+ * Note that 'num_workers' is the preferred name, but if it is set to zero,
1145
+ * we will still read the deprecated 'num_search_workers'.
1146
+ * As of 2020-04-10, if you're using SAT via MPSolver (to solve integer
1147
+ * programs) this field is overridden with a value of 8, if the field is not
1148
+ * set *explicitly*. Thus, always set this field explicitly or via
1149
+ * MPSolver::SetNumThreads().
1150
+ *
1151
+ * @default 0
1152
+ */
1153
+ numWorkers?: number;
1154
+ /**
1155
+ * @default 0
1156
+ */
1157
+ numSearchWorkers?: number;
1158
+ /**
1159
+ * We distinguish subsolvers that consume a full thread, and the ones that are
1160
+ * always interleaved. If left at zero, we will fix this with a default
1161
+ * formula that depends on num_workers. But if you start modifying what runs,
1162
+ * you might want to fix that to a given value depending on the num_workers
1163
+ * you use.
1164
+ *
1165
+ * @default 0
1166
+ */
1167
+ numFullSubsolvers?: number;
1168
+ /**
1169
+ * In multi-thread, the solver can be mainly seen as a portfolio of solvers
1170
+ * with different parameters. This field indicates the names of the parameters
1171
+ * that are used in multithread. This only applies to "full" subsolvers.
1172
+ * See cp_model_search.cc to see a list of the names and the default value (if
1173
+ * left empty) that looks like:
1174
+ * - default_lp (linearization_level:1)
1175
+ * - fixed (only if fixed search specified or scheduling)
1176
+ * - no_lp (linearization_level:0)
1177
+ * - max_lp (linearization_level:2)
1178
+ * - pseudo_costs (only if objective, change search heuristic)
1179
+ * - reduced_costs (only if objective, change search heuristic)
1180
+ * - quick_restart (kind of probing)
1181
+ * - quick_restart_no_lp (kind of probing with linearization_level:0)
1182
+ * - lb_tree_search (to improve lower bound, MIP like tree search)
1183
+ * - probing (continuous probing and shaving)
1184
+ * Also, note that some set of parameters will be ignored if they do not make
1185
+ * sense. For instance if there is no objective, pseudo_cost or reduced_cost
1186
+ * search will be ignored. Core based search will only work if the objective
1187
+ * has many terms. If there is no fixed strategy fixed will be ignored. And so
1188
+ * on.
1189
+ * The order is important, as only the first num_full_subsolvers will be
1190
+ * scheduled. You can see in the log which one are selected for a given run.
1191
+ */
1192
+ subsolvers?: Array<string>;
1193
+ /**
1194
+ * A convenient way to add more workers types.
1195
+ * These will be added at the beginning of the list.
1196
+ */
1197
+ extraSubsolvers?: Array<string>;
1198
+ /**
1199
+ * Rather than fully specifying subsolvers, it is often convenient to just
1200
+ * remove the ones that are not useful on a given problem or only keep
1201
+ * specific ones for testing. Each string is interpreted as a "glob", so we
1202
+ * support '*' and '?'.
1203
+ * The way this work is that we will only accept a name that match a filter
1204
+ * pattern (if non-empty) and do not match an ignore pattern. Note also that
1205
+ * these fields work on LNS or LS names even if these are currently not
1206
+ * specified via the subsolvers field.
1207
+ */
1208
+ ignoreSubsolvers?: Array<string>;
1209
+ filterSubsolvers?: Array<string>;
1210
+ /**
1211
+ * It is possible to specify additional subsolver configuration. These can be
1212
+ * referred by their params.name() in the fields above. Note that only the
1213
+ * specified field will "overwrite" the ones of the base parameter. If a
1214
+ * subsolver_params has the name of an existing subsolver configuration, the
1215
+ * named parameters will be merged into the subsolver configuration.
1216
+ */
1217
+ subsolverParams?: Array<SatParameters>;
1218
+ /**
1219
+ * Experimental. If this is true, then we interleave all our major search
1220
+ * strategy and distribute the work amongst num_workers.
1221
+ * The search is deterministic (independently of num_workers!), and we
1222
+ * schedule and wait for interleave_batch_size task to be completed before
1223
+ * synchronizing and scheduling the next batch of tasks.
1224
+ *
1225
+ * @default false
1226
+ */
1227
+ interleaveSearch?: boolean;
1228
+ /**
1229
+ * @default 0
1230
+ */
1231
+ interleaveBatchSize?: number;
1232
+ /**
1233
+ * Allows objective sharing between workers.
1234
+ *
1235
+ * @default true
1236
+ */
1237
+ shareObjectiveBounds?: boolean;
1238
+ /**
1239
+ * Allows sharing of the bounds of modified variables at level 0.
1240
+ *
1241
+ * @default true
1242
+ */
1243
+ shareLevelZeroBounds?: boolean;
1244
+ /**
1245
+ * Allows sharing of the bounds on linear2 discovered at level 0. This is
1246
+ * mainly interesting on scheduling type of problems when we branch on
1247
+ * precedences.
1248
+ * Warning: This currently non-deterministic.
1249
+ *
1250
+ * @default false
1251
+ */
1252
+ shareLinear2Bounds?: boolean;
1253
+ /**
1254
+ * Allows sharing of new learned binary clause between workers.
1255
+ *
1256
+ * @default true
1257
+ */
1258
+ shareBinaryClauses?: boolean;
1259
+ /**
1260
+ * Allows sharing of short glue clauses between workers.
1261
+ * Implicitly disabled if share_binary_clauses is false.
1262
+ *
1263
+ * @default true
1264
+ */
1265
+ shareGlueClauses?: boolean;
1266
+ /**
1267
+ * Minimize and detect subsumption of shared clauses immediately after they
1268
+ * are imported.
1269
+ *
1270
+ * @default true
1271
+ */
1272
+ minimizeSharedClauses?: boolean;
1273
+ /**
1274
+ * The amount of dtime between each export of shared glue clauses.
1275
+ *
1276
+ * @default 1
1277
+ */
1278
+ shareGlueClausesDtime?: number;
1279
+ /**
1280
+ * ==========================================================================
1281
+ * Proofs
1282
+ * ==========================================================================
1283
+ * If true, inferred clauses are checked with an LRAT checker as they are
1284
+ * learned, in presolve (reduced to trivial simplifications if
1285
+ * cp_model_presolve is false), and in each worker. As of December 2025, this
1286
+ * only works with pure SAT problems, with
1287
+ * - cp_model_presolve = false,
1288
+ * - linearization_level <= 1,
1289
+ * - symmetry_level <= 1.
1290
+ *
1291
+ * @default false
1292
+ */
1293
+ checkLratProof?: boolean;
1294
+ /**
1295
+ * If true, and if output_lrat_proof is true and the problem is UNSAT, check
1296
+ * that the merged proof file is valid, i.e., that clause sharing between
1297
+ * workers is correct. This checks each inferred clause, so you might want to
1298
+ * disable check_lrat_proof to avoid redundant work. As of November 2025, this
1299
+ * only works for pure SAT problems, with num_workers = 1.
1300
+ *
1301
+ * @default false
1302
+ */
1303
+ checkMergedLratProof?: boolean;
1304
+ /**
1305
+ * If true, an LRAT proof that all the clauses inferred by the solver are
1306
+ * valid is output to several files (one for presolve -- reduced to trivial
1307
+ * simplifications if cp_model_presolve is false, one per worker, and one for
1308
+ * the merged proof). As of December 2025, this only works for pure SAT
1309
+ * problems, with
1310
+ * - cp_model_presolve = false,
1311
+ * - linearization_level <= 1,
1312
+ * - symmetry_level <= 1.
1313
+ *
1314
+ * @default false
1315
+ */
1316
+ outputLratProof?: boolean;
1317
+ /**
1318
+ * If true, and if the problem is UNSAT, a DRAT proof of this UNSAT property
1319
+ * is checked after the solver has finished. As of November 2025, this only
1320
+ * works for pure SAT problems, with
1321
+ * - num_workers = 1,
1322
+ * - cp_model_presolve = false,
1323
+ * - linearization_level <= 1,
1324
+ * - symmetry_level <= 1.
1325
+ *
1326
+ * @default false
1327
+ */
1328
+ checkDratProof?: boolean;
1329
+ /**
1330
+ * If true, a DRAT proof that all the clauses inferred by the solver are valid
1331
+ * is output to a file. As of December 2025, this only works for pure SAT
1332
+ * problems, with
1333
+ * - num_workers = 1,
1334
+ * - cp_model_presolve = false,
1335
+ * - linearization_level <= 1,
1336
+ * - symmetry_level <= 1.
1337
+ *
1338
+ * @default false
1339
+ */
1340
+ outputDratProof?: boolean;
1341
+ /**
1342
+ * The maximum time allowed to check the DRAT proof (this can take more time
1343
+ * than the solve itself). Only used if check_drat_proof is true.
1344
+ *
1345
+ * @default inf
1346
+ */
1347
+ maxDratTimeInSeconds?: number;
1348
+ /**
1349
+ * ==========================================================================
1350
+ * Debugging parameters
1351
+ * ==========================================================================
1352
+ * We have two different postsolve code. The default one should be better and
1353
+ * it allows for a more powerful presolve, but it can be useful to postsolve
1354
+ * using the full solver instead.
1355
+ *
1356
+ * @default false
1357
+ */
1358
+ debugPostsolveWithFullSolver?: boolean;
1359
+ /**
1360
+ * If positive, try to stop just after that many presolve rules have been
1361
+ * applied. This is mainly useful for debugging presolve.
1362
+ *
1363
+ * @default 0
1364
+ */
1365
+ debugMaxNumPresolveOperations?: number;
1366
+ /**
1367
+ * Crash if we do not manage to complete the hint into a full solution.
1368
+ *
1369
+ * @default false
1370
+ */
1371
+ debugCrashOnBadHint?: boolean;
1372
+ /**
1373
+ * Crash if presolve breaks a feasible hint.
1374
+ *
1375
+ * @default false
1376
+ */
1377
+ debugCrashIfPresolveBreaksHint?: boolean;
1378
+ /**
1379
+ * Crash if the LRAT UNSAT proof is invalid.
1380
+ *
1381
+ * @default false
1382
+ */
1383
+ debugCrashIfLratCheckFails?: boolean;
1384
+ /**
1385
+ * ==========================================================================
1386
+ * Max-sat parameters
1387
+ * ==========================================================================
1388
+ * For an optimization problem, whether we follow some hints in order to find
1389
+ * a better first solution. For a variable with hint, the solver will always
1390
+ * try to follow the hint. It will revert to the variable_branching default
1391
+ * otherwise.
1392
+ *
1393
+ * @default true
1394
+ */
1395
+ useOptimizationHints?: boolean;
1396
+ /**
1397
+ * If positive, we spend some effort on each core:
1398
+ * - At level 1, we use a simple heuristic to try to minimize an UNSAT core.
1399
+ * - At level 2, we use propagation to minimize the core but also identify
1400
+ * literal in at most one relationship in this core.
1401
+ *
1402
+ * @default 2
1403
+ */
1404
+ coreMinimizationLevel?: number;
1405
+ /**
1406
+ * Whether we try to find more independent cores for a given set of
1407
+ * assumptions in the core based max-SAT algorithms.
1408
+ *
1409
+ * @default true
1410
+ */
1411
+ findMultipleCores?: boolean;
1412
+ /**
1413
+ * If true, when the max-sat algo find a core, we compute the minimal number
1414
+ * of literals in the core that needs to be true to have a feasible solution.
1415
+ * This is also called core exhaustion in more recent max-SAT papers.
1416
+ *
1417
+ * @default true
1418
+ */
1419
+ coverOptimization?: boolean;
1420
+ /**
1421
+ * @default DEFAULT_ASSUMPTION_ORDER
1422
+ */
1423
+ maxSatAssumptionOrder?: SatParameters_MaxSatAssumptionOrder | SatParameters_MaxSatAssumptionOrder_Name;
1424
+ /**
1425
+ * If true, adds the assumption in the reverse order of the one defined by
1426
+ * max_sat_assumption_order.
1427
+ *
1428
+ * @default false
1429
+ */
1430
+ maxSatReverseAssumptionOrder?: boolean;
1431
+ /**
1432
+ * @default STRATIFICATION_DESCENT
1433
+ */
1434
+ maxSatStratification?: SatParameters_MaxSatStratificationAlgorithm | SatParameters_MaxSatStratificationAlgorithm_Name;
1435
+ /**
1436
+ * ==========================================================================
1437
+ * Constraint programming parameters
1438
+ * ==========================================================================
1439
+ * Some search decisions might cause a really large number of propagations to
1440
+ * happen when integer variables with large domains are only reduced by 1 at
1441
+ * each step. If we propagate more than the number of variable times this
1442
+ * parameters we try to take counter-measure. Setting this to 0.0 disable this
1443
+ * feature.
1444
+ * TODO(user): Setting this to something like 10 helps in most cases, but the
1445
+ * code is currently buggy and can cause the solve to enter a bad state where
1446
+ * no progress is made.
1447
+ *
1448
+ * @default 10
1449
+ */
1450
+ propagationLoopDetectionFactor?: number;
1451
+ /**
1452
+ * When this is true, then a disjunctive constraint will try to use the
1453
+ * precedence relations between time intervals to propagate their bounds
1454
+ * further. For instance if task A and B are both before C and task A and B
1455
+ * are in disjunction, then we can deduce that task C must start after
1456
+ * duration(A) + duration(B) instead of simply max(duration(A), duration(B)),
1457
+ * provided that the start time for all task was currently zero.
1458
+ * This always result in better propagation, but it is usually slow, so
1459
+ * depending on the problem, turning this off may lead to a faster solution.
1460
+ *
1461
+ * @default true
1462
+ */
1463
+ usePrecedencesInDisjunctiveConstraint?: boolean;
1464
+ /**
1465
+ * At root level, we might compute the transitive closure of "precedences"
1466
+ * relations so that we can exploit that in scheduling problems. Setting this
1467
+ * to zero disable the feature.
1468
+ *
1469
+ * @default 1000000
1470
+ */
1471
+ transitivePrecedencesWorkLimit?: number;
1472
+ /**
1473
+ * Create one literal for each disjunction of two pairs of tasks. This slows
1474
+ * down the solve time, but improves the lower bound of the objective in the
1475
+ * makespan case. This will be triggered if the number of intervals is less or
1476
+ * equal than the parameter and if use_strong_propagation_in_disjunctive is
1477
+ * true.
1478
+ *
1479
+ * @default 60
1480
+ */
1481
+ maxSizeToCreatePrecedenceLiteralsInDisjunctive?: number;
1482
+ /**
1483
+ * Enable stronger and more expensive propagation on no_overlap constraint.
1484
+ *
1485
+ * @default false
1486
+ */
1487
+ useStrongPropagationInDisjunctive?: boolean;
1488
+ /**
1489
+ * Whether we try to branch on decision "interval A before interval B" rather
1490
+ * than on intervals bounds. This usually works better, but slow down a bit
1491
+ * the time to find the first solution.
1492
+ * These parameters are still EXPERIMENTAL, the result should be correct, but
1493
+ * it some corner cases, they can cause some failing CHECK in the solver.
1494
+ *
1495
+ * @default false
1496
+ */
1497
+ useDynamicPrecedenceInDisjunctive?: boolean;
1498
+ /**
1499
+ * @default false
1500
+ */
1501
+ useDynamicPrecedenceInCumulative?: boolean;
1502
+ /**
1503
+ * When this is true, the cumulative constraint is reinforced with overload
1504
+ * checking, i.e., an additional level of reasoning based on energy. This
1505
+ * additional level supplements the default level of reasoning as well as
1506
+ * timetable edge finding.
1507
+ * This always result in better propagation, but it is usually slow, so
1508
+ * depending on the problem, turning this off may lead to a faster solution.
1509
+ *
1510
+ * @default false
1511
+ */
1512
+ useOverloadCheckerInCumulative?: boolean;
1513
+ /**
1514
+ * Enable a heuristic to solve cumulative constraints using a modified energy
1515
+ * constraint. We modify the usual energy definition by applying a
1516
+ * super-additive function (also called "conservative scale" or "dual-feasible
1517
+ * function") to the demand and the durations of the tasks.
1518
+ * This heuristic is fast but for most problems it does not help much to find
1519
+ * a solution.
1520
+ *
1521
+ * @default false
1522
+ */
1523
+ useConservativeScaleOverloadChecker?: boolean;
1524
+ /**
1525
+ * When this is true, the cumulative constraint is reinforced with timetable
1526
+ * edge finding, i.e., an additional level of reasoning based on the
1527
+ * conjunction of energy and mandatory parts. This additional level
1528
+ * supplements the default level of reasoning as well as overload_checker.
1529
+ * This always result in better propagation, but it is usually slow, so
1530
+ * depending on the problem, turning this off may lead to a faster solution.
1531
+ *
1532
+ * @default false
1533
+ */
1534
+ useTimetableEdgeFindingInCumulative?: boolean;
1535
+ /**
1536
+ * Max number of intervals for the timetable_edge_finding algorithm to
1537
+ * propagate. A value of 0 disables the constraint.
1538
+ *
1539
+ * @default 100
1540
+ */
1541
+ maxNumIntervalsForTimetableEdgeFinding?: number;
1542
+ /**
1543
+ * If true, detect and create constraint for integer variable that are "after"
1544
+ * a set of intervals in the same cumulative constraint.
1545
+ * Experimental: by default we just use "direct" precedences. If
1546
+ * exploit_all_precedences is true, we explore the full precedence graph. This
1547
+ * assumes we have a DAG otherwise it fails.
1548
+ *
1549
+ * @default false
1550
+ */
1551
+ useHardPrecedencesInCumulative?: boolean;
1552
+ /**
1553
+ * @default false
1554
+ */
1555
+ exploitAllPrecedences?: boolean;
1556
+ /**
1557
+ * When this is true, the cumulative constraint is reinforced with propagators
1558
+ * from the disjunctive constraint to improve the inference on a set of tasks
1559
+ * that are disjunctive at the root of the problem. This additional level
1560
+ * supplements the default level of reasoning.
1561
+ * Propagators of the cumulative constraint will not be used at all if all the
1562
+ * tasks are disjunctive at root node.
1563
+ * This always result in better propagation, but it is usually slow, so
1564
+ * depending on the problem, turning this off may lead to a faster solution.
1565
+ *
1566
+ * @default true
1567
+ */
1568
+ useDisjunctiveConstraintInCumulative?: boolean;
1569
+ /**
1570
+ * If less than this number of boxes are present in a no-overlap 2d, we
1571
+ * create 4 Booleans per pair of boxes:
1572
+ * - Box 2 is after Box 1 on x.
1573
+ * - Box 1 is after Box 2 on x.
1574
+ * - Box 2 is after Box 1 on y.
1575
+ * - Box 1 is after Box 2 on y.
1576
+ * Note that at least one of them must be true, and at most one on x and one
1577
+ * on y can be true.
1578
+ * This can significantly help in closing small problem. The SAT reasoning
1579
+ * can be a lot more powerful when we take decision on such positional
1580
+ * relations.
1581
+ *
1582
+ * @default 10
1583
+ */
1584
+ noOverlap2dBooleanRelationsLimit?: number;
1585
+ /**
1586
+ * When this is true, the no_overlap_2d constraint is reinforced with
1587
+ * propagators from the cumulative constraints. It consists of ignoring the
1588
+ * position of rectangles in one position and projecting the no_overlap_2d on
1589
+ * the other dimension to create a cumulative constraint. This is done on both
1590
+ * axis. This additional level supplements the default level of reasoning.
1591
+ *
1592
+ * @default false
1593
+ */
1594
+ useTimetablingInNoOverlap2d?: boolean;
1595
+ /**
1596
+ * When this is true, the no_overlap_2d constraint is reinforced with
1597
+ * energetic reasoning. This additional level supplements the default level of
1598
+ * reasoning.
1599
+ *
1600
+ * @default false
1601
+ */
1602
+ useEnergeticReasoningInNoOverlap2d?: boolean;
1603
+ /**
1604
+ * When this is true, the no_overlap_2d constraint is reinforced with
1605
+ * an energetic reasoning that uses an area-based energy. This can be combined
1606
+ * with the two other overlap heuristics above.
1607
+ *
1608
+ * @default false
1609
+ */
1610
+ useAreaEnergeticReasoningInNoOverlap2d?: boolean;
1611
+ /**
1612
+ * @default false
1613
+ */
1614
+ useTryEdgeReasoningInNoOverlap2d?: boolean;
1615
+ /**
1616
+ * If the number of pairs to look is below this threshold, do an extra step of
1617
+ * propagation in the no_overlap_2d constraint by looking at all pairs of
1618
+ * intervals.
1619
+ *
1620
+ * @default 1250
1621
+ */
1622
+ maxPairsPairwiseReasoningInNoOverlap2d?: number;
1623
+ /**
1624
+ * Detects when the space where items of a no_overlap_2d constraint can placed
1625
+ * is disjoint (ie., fixed boxes split the domain). When it is the case, we
1626
+ * can introduce a boolean for each pair <item, component> encoding whether
1627
+ * the item is in the component or not. Then we replace the original
1628
+ * no_overlap_2d constraint by one no_overlap_2d constraint for each
1629
+ * component, with the new booleans as the enforcement_literal of the
1630
+ * intervals. This is equivalent to expanding the original no_overlap_2d
1631
+ * constraint into a bin packing problem with each connected component being a
1632
+ * bin. This heuristic is only done when the number of regions to split
1633
+ * is less than this parameter and <= 1 disables it.
1634
+ *
1635
+ * @default 0
1636
+ */
1637
+ maximumRegionsToSplitInDisconnectedNoOverlap2d?: number;
1638
+ /**
1639
+ * When set, this activates a propagator for the no_overlap_2d constraint that
1640
+ * uses any eventual linear constraints of the model in the form
1641
+ * `{start interval 1} - {end interval 2} + c*w <= ub` to detect that two
1642
+ * intervals must overlap in one dimension for some values of `w`. This is
1643
+ * particularly useful for problems where the distance between two boxes is
1644
+ * part of the model.
1645
+ *
1646
+ * @default true
1647
+ */
1648
+ useLinear3ForNoOverlap2dPrecedences?: boolean;
1649
+ /**
1650
+ * When set, it activates a few scheduling parameters to improve the lower
1651
+ * bound of scheduling problems. This is only effective with multiple workers
1652
+ * as it modifies the reduced_cost, lb_tree_search, and probing workers.
1653
+ *
1654
+ * @default true
1655
+ */
1656
+ useDualSchedulingHeuristics?: boolean;
1657
+ /**
1658
+ * Turn on extra propagation for the circuit constraint.
1659
+ * This can be quite slow.
1660
+ *
1661
+ * @default false
1662
+ */
1663
+ useAllDifferentForCircuit?: boolean;
1664
+ /**
1665
+ * If the size of a subset of nodes of a RoutesConstraint is less than this
1666
+ * value, use linear constraints of size 1 and 2 (such as capacity and time
1667
+ * window constraints) enforced by the arc literals to compute cuts for this
1668
+ * subset (unless the subset size is less than
1669
+ * routing_cut_subset_size_for_tight_binary_relation_bound, in which case the
1670
+ * corresponding algorithm is used instead). The algorithm for these cuts has
1671
+ * a O(n^3) complexity, where n is the subset size. Hence the value of this
1672
+ * parameter should not be too large (e.g. 10 or 20).
1673
+ *
1674
+ * @default 0
1675
+ */
1676
+ routingCutSubsetSizeForBinaryRelationBound?: number;
1677
+ /**
1678
+ * Similar to above, but with a different algorithm producing better cuts, at
1679
+ * the price of a higher O(2^n) complexity, where n is the subset size. Hence
1680
+ * the value of this parameter should be small (e.g. less than 10).
1681
+ *
1682
+ * @default 0
1683
+ */
1684
+ routingCutSubsetSizeForTightBinaryRelationBound?: number;
1685
+ /**
1686
+ * Similar to above, but with an even stronger algorithm in O(n!). We try to
1687
+ * be defensive and abort early or not run that often. Still the value of
1688
+ * that parameter shouldn't really be much more than 10.
1689
+ *
1690
+ * @default 8
1691
+ */
1692
+ routingCutSubsetSizeForExactBinaryRelationBound?: number;
1693
+ /**
1694
+ * Similar to routing_cut_subset_size_for_exact_binary_relation_bound but
1695
+ * use a bound based on shortest path distances (which respect triangular
1696
+ * inequality). This allows to derive bounds that are valid for any superset
1697
+ * of a given subset. This is slow, so it shouldn't really be larger than 10.
1698
+ *
1699
+ * @default 8
1700
+ */
1701
+ routingCutSubsetSizeForShortestPathsBound?: number;
1702
+ /**
1703
+ * The amount of "effort" to spend in dynamic programming for computing
1704
+ * routing cuts. This is in term of basic operations needed by the algorithm
1705
+ * in the worst case, so a value like 1e8 should take less than a second to
1706
+ * compute.
1707
+ *
1708
+ * @default 1
1709
+ */
1710
+ routingCutDpEffort?: number;
1711
+ /**
1712
+ * If the length of an infeasible path is less than this value, a cut will be
1713
+ * added to exclude it.
1714
+ *
1715
+ * @default 6
1716
+ */
1717
+ routingCutMaxInfeasiblePathLength?: number;
1718
+ /**
1719
+ * @default AUTOMATIC_SEARCH
1720
+ */
1721
+ searchBranching?: SatParameters_SearchBranching | SatParameters_SearchBranching_Name;
1722
+ /**
1723
+ * Conflict limit used in the phase that exploit the solution hint.
1724
+ *
1725
+ * @default 10
1726
+ */
1727
+ hintConflictLimit?: number;
1728
+ /**
1729
+ * If true, the solver tries to repair the solution given in the hint. This
1730
+ * search terminates after the 'hint_conflict_limit' is reached and the solver
1731
+ * switches to regular search. If false, then we do a FIXED_SEARCH using the
1732
+ * hint until the hint_conflict_limit is reached.
1733
+ *
1734
+ * @default false
1735
+ */
1736
+ repairHint?: boolean;
1737
+ /**
1738
+ * If true, variables appearing in the solution hints will be fixed to their
1739
+ * hinted value.
1740
+ *
1741
+ * @default false
1742
+ */
1743
+ fixVariablesToTheirHintedValue?: boolean;
1744
+ /**
1745
+ * If true, search will continuously probe Boolean variables, and integer
1746
+ * variable bounds. This parameter is set to true in parallel on the probing
1747
+ * worker.
1748
+ *
1749
+ * @default false
1750
+ */
1751
+ useProbingSearch?: boolean;
1752
+ /**
1753
+ * Use extended probing (probe bool_or, at_most_one, exactly_one).
1754
+ *
1755
+ * @default true
1756
+ */
1757
+ useExtendedProbing?: boolean;
1758
+ /**
1759
+ * How many combinations of pairs or triplets of variables we want to scan.
1760
+ *
1761
+ * @default 20000
1762
+ */
1763
+ probingNumCombinationsLimit?: number;
1764
+ /**
1765
+ * Add a shaving phase (where the solver tries to prove that the lower or
1766
+ * upper bound of a variable are infeasible) to the probing search. (<= 0
1767
+ * disables it).
1768
+ *
1769
+ * @default 0
1770
+ */
1771
+ shavingDeterministicTimeInProbingSearch?: number;
1772
+ /**
1773
+ * Specifies the amount of deterministic time spent of each try at shaving a
1774
+ * bound in the shaving search.
1775
+ *
1776
+ * @default 0
1777
+ */
1778
+ shavingSearchDeterministicTime?: number;
1779
+ /**
1780
+ * Specifies the threshold between two modes in the shaving procedure.
1781
+ * If the range of the variable/objective is less than this threshold, then
1782
+ * the shaving procedure will try to remove values one by one. Otherwise, it
1783
+ * will try to remove one range at a time.
1784
+ *
1785
+ * @default 64
1786
+ */
1787
+ shavingSearchThreshold?: number;
1788
+ /**
1789
+ * If true, search will search in ascending max objective value (when
1790
+ * minimizing) starting from the lower bound of the objective.
1791
+ *
1792
+ * @default false
1793
+ */
1794
+ useObjectiveLbSearch?: boolean;
1795
+ /**
1796
+ * This search differs from the previous search as it will not use assumptions
1797
+ * to bound the objective, and it will recreate a full model with the
1798
+ * hardcoded objective value.
1799
+ *
1800
+ * @default false
1801
+ */
1802
+ useObjectiveShavingSearch?: boolean;
1803
+ /**
1804
+ * This search takes all Boolean or integer variables, and maximize or
1805
+ * minimize them in order to reduce their domain. -1 is automatic, otherwise
1806
+ * value 0 disables it, and 1, 2, or 3 changes something.
1807
+ *
1808
+ * @default -1
1809
+ */
1810
+ variablesShavingLevel?: number;
1811
+ /**
1812
+ * The solver ignores the pseudo costs of variables with number of recordings
1813
+ * less than this threshold.
1814
+ *
1815
+ * @default 100
1816
+ */
1817
+ pseudoCostReliabilityThreshold?: number;
1818
+ /**
1819
+ * The default optimization method is a simple "linear scan", each time trying
1820
+ * to find a better solution than the previous one. If this is true, then we
1821
+ * use a core-based approach (like in max-SAT) when we try to increase the
1822
+ * lower bound instead.
1823
+ *
1824
+ * @default false
1825
+ */
1826
+ optimizeWithCore?: boolean;
1827
+ /**
1828
+ * Do a more conventional tree search (by opposition to SAT based one) where
1829
+ * we keep all the explored node in a tree. This is meant to be used in a
1830
+ * portfolio and focus on improving the objective lower bound. Keeping the
1831
+ * whole tree allow us to report a better objective lower bound coming from
1832
+ * the worst open node in the tree.
1833
+ *
1834
+ * @default false
1835
+ */
1836
+ optimizeWithLbTreeSearch?: boolean;
1837
+ /**
1838
+ * Experimental. Save the current LP basis at each node of the search tree so
1839
+ * that when we jump around, we can load it and reduce the number of LP
1840
+ * iterations needed.
1841
+ * It currently works okay if we do not change the lp with cuts or
1842
+ * simplification... More work is needed to make it robust in all cases.
1843
+ *
1844
+ * @default false
1845
+ */
1846
+ saveLpBasisInLbTreeSearch?: boolean;
1847
+ /**
1848
+ * If non-negative, perform a binary search on the objective variable in order
1849
+ * to find an [min, max] interval outside of which the solver proved unsat/sat
1850
+ * under this amount of conflict. This can quickly reduce the objective domain
1851
+ * on some problems.
1852
+ *
1853
+ * @default -1
1854
+ */
1855
+ binarySearchNumConflicts?: number;
1856
+ /**
1857
+ * This has no effect if optimize_with_core is false. If true, use a different
1858
+ * core-based algorithm similar to the max-HS algo for max-SAT. This is a
1859
+ * hybrid MIP/CP approach and it uses a MIP solver in addition to the CP/SAT
1860
+ * one. This is also related to the PhD work of tobyodavies@
1861
+ * "Automatic Logic-Based Benders Decomposition with MiniZinc"
1862
+ * http://aaai.org/ocs/index.php/AAAI/AAAI17/paper/view/14489
1863
+ *
1864
+ * @default false
1865
+ */
1866
+ optimizeWithMaxHs?: boolean;
1867
+ /**
1868
+ * Parameters for an heuristic similar to the one described in the paper:
1869
+ * "Feasibility Jump: an LP-free Lagrangian MIP heuristic", Bjørnar
1870
+ * Luteberget, Giorgio Sartor, 2023, Mathematical Programming Computation.
1871
+ *
1872
+ * @default true
1873
+ */
1874
+ useFeasibilityJump?: boolean;
1875
+ /**
1876
+ * Disable every other type of subsolver, setting this turns CP-SAT into a
1877
+ * pure local-search solver.
1878
+ *
1879
+ * @default false
1880
+ */
1881
+ useLsOnly?: boolean;
1882
+ /**
1883
+ * On each restart, we randomly choose if we use decay (with this parameter)
1884
+ * or no decay.
1885
+ *
1886
+ * @default 0
1887
+ */
1888
+ feasibilityJumpDecay?: number;
1889
+ /**
1890
+ * How much do we linearize the problem in the local search code.
1891
+ *
1892
+ * @default 2
1893
+ */
1894
+ feasibilityJumpLinearizationLevel?: number;
1895
+ /**
1896
+ * This is a factor that directly influence the work before each restart.
1897
+ * Increasing it leads to longer restart.
1898
+ *
1899
+ * @default 1
1900
+ */
1901
+ feasibilityJumpRestartFactor?: number;
1902
+ /**
1903
+ * How much dtime for each LS batch.
1904
+ *
1905
+ * @default 0
1906
+ */
1907
+ feasibilityJumpBatchDtime?: number;
1908
+ /**
1909
+ * Probability for a variable to have a non default value upon restarts or
1910
+ * perturbations.
1911
+ *
1912
+ * @default 0
1913
+ */
1914
+ feasibilityJumpVarRandomizationProbability?: number;
1915
+ /**
1916
+ * Max distance between the default value and the pertubated value relative to
1917
+ * the range of the domain of the variable.
1918
+ *
1919
+ * @default 0
1920
+ */
1921
+ feasibilityJumpVarPerburbationRangeRatio?: number;
1922
+ /**
1923
+ * When stagnating, feasibility jump will either restart from a default
1924
+ * solution (with some possible randomization), or randomly pertubate the
1925
+ * current solution. This parameter selects the first option.
1926
+ *
1927
+ * @default true
1928
+ */
1929
+ feasibilityJumpEnableRestarts?: boolean;
1930
+ /**
1931
+ * Maximum size of no_overlap or no_overlap_2d constraint for a quadratic
1932
+ * expansion. This might look a lot, but by expanding such constraint, we get
1933
+ * a linear time evaluation per single variable moves instead of a slow O(n
1934
+ * log n) one.
1935
+ *
1936
+ * @default 500
1937
+ */
1938
+ feasibilityJumpMaxExpandedConstraintSize?: number;
1939
+ /**
1940
+ * This will create incomplete subsolvers (that are not LNS subsolvers)
1941
+ * that use the feasibility jump code to find improving solution, treating
1942
+ * the objective improvement as a hard constraint.
1943
+ *
1944
+ * @default 0
1945
+ */
1946
+ numViolationLs?: number;
1947
+ /**
1948
+ * How long violation_ls should wait before perturbating a solution.
1949
+ *
1950
+ * @default 100
1951
+ */
1952
+ violationLsPerturbationPeriod?: number;
1953
+ /**
1954
+ * Probability of using compound move search each restart.
1955
+ * TODO(user): Add reference to paper when published.
1956
+ *
1957
+ * @default 0
1958
+ */
1959
+ violationLsCompoundMoveProbability?: number;
1960
+ /**
1961
+ * Enables shared tree search.
1962
+ * If positive, start this many complete worker threads to explore a shared
1963
+ * search tree. These workers communicate objective bounds and simple decision
1964
+ * nogoods relating to the shared prefix of the tree, and will avoid exploring
1965
+ * the same subtrees as one another.
1966
+ * Specifying a negative number uses a heuristic to select an appropriate
1967
+ * number of shared tree workeres based on the total number of workers.
1968
+ *
1969
+ * @default -1
1970
+ */
1971
+ sharedTreeNumWorkers?: number;
1972
+ /**
1973
+ * Set on shared subtree workers. Users should not set this directly.
1974
+ *
1975
+ * @default false
1976
+ */
1977
+ useSharedTreeSearch?: boolean;
1978
+ /**
1979
+ * Minimum restarts before a worker will replace a subtree
1980
+ * that looks "bad" based on the average LBD of learned clauses.
1981
+ *
1982
+ * @default 1
1983
+ */
1984
+ sharedTreeWorkerMinRestartsPerSubtree?: number;
1985
+ /**
1986
+ * If true, workers share more of the information from their local trail.
1987
+ * Specifically, literals implied by the shared tree decisions.
1988
+ *
1989
+ * @default true
1990
+ */
1991
+ sharedTreeWorkerEnableTrailSharing?: boolean;
1992
+ /**
1993
+ * If true, shared tree workers share their target phase when returning an
1994
+ * assigned subtree for the next worker to use.
1995
+ *
1996
+ * @default true
1997
+ */
1998
+ sharedTreeWorkerEnablePhaseSharing?: boolean;
1999
+ /**
2000
+ * How many open leaf nodes should the shared tree maintain per worker.
2001
+ *
2002
+ * @default 2
2003
+ */
2004
+ sharedTreeOpenLeavesPerWorker?: number;
2005
+ /**
2006
+ * In order to limit total shared memory and communication overhead, limit the
2007
+ * total number of nodes that may be generated in the shared tree. If the
2008
+ * shared tree runs out of unassigned leaves, workers act as portfolio
2009
+ * workers. Note: this limit includes interior nodes, not just leaves.
2010
+ *
2011
+ * @default 10000
2012
+ */
2013
+ sharedTreeMaxNodesPerWorker?: number;
2014
+ /**
2015
+ * @default SPLIT_STRATEGY_AUTO
2016
+ */
2017
+ sharedTreeSplitStrategy?: SatParameters_SharedTreeSplitStrategy | SatParameters_SharedTreeSplitStrategy_Name;
2018
+ /**
2019
+ * How much deeper compared to the ideal max depth of the tree is considered
2020
+ * "balanced" enough to still accept a split. Without such a tolerance,
2021
+ * sometimes the tree can only be split by a single worker, and they may not
2022
+ * generate a split for some time. In contrast, with a tolerance of 1, at
2023
+ * least half of all workers should be able to split the tree as soon as a
2024
+ * split becomes required. This only has an effect on
2025
+ * SPLIT_STRATEGY_BALANCED_TREE and SPLIT_STRATEGY_DISCREPANCY.
2026
+ *
2027
+ * @default 1
2028
+ */
2029
+ sharedTreeBalanceTolerance?: number;
2030
+ /**
2031
+ * How much dtime a worker will wait between proposing splits.
2032
+ * This limits the contention in splitting the shared tree, and also reduces
2033
+ * the number of too-easy subtrees that are generates.
2034
+ *
2035
+ * @default 0
2036
+ */
2037
+ sharedTreeSplitMinDtime?: number;
2038
+ /**
2039
+ * Whether we enumerate all solutions of a problem without objective.
2040
+ * WARNING:
2041
+ * - This can be used with num_workers > 1 but then each solutions can be
2042
+ * found more than once, so it is up to the client to deduplicate them.
2043
+ * - If keep_all_feasible_solutions_in_presolve is unset, we will set it to
2044
+ * true as otherwise, many feasible solution can just be removed by the
2045
+ * presolve. It is still possible to manually set this to false if one only
2046
+ * wants to enumerate all solutions of the presolved model.
2047
+ *
2048
+ * @default false
2049
+ */
2050
+ enumerateAllSolutions?: boolean;
2051
+ /**
2052
+ * If true, we disable the presolve reductions that remove feasible solutions
2053
+ * from the search space. Such solution are usually dominated by a "better"
2054
+ * solution that is kept, but depending on the situation, we might want to
2055
+ * keep all solutions.
2056
+ * A trivial example is when a variable is unused. If this is true, then the
2057
+ * presolve will not fix it to an arbitrary value and it will stay in the
2058
+ * search space.
2059
+ *
2060
+ * @default false
2061
+ */
2062
+ keepAllFeasibleSolutionsInPresolve?: boolean;
2063
+ /**
2064
+ * If true, add information about the derived variable domains to the
2065
+ * CpSolverResponse. It is an option because it makes the response slighly
2066
+ * bigger and there is a bit more work involved during the postsolve to
2067
+ * construct it, but it should still have a low overhead. See the
2068
+ * tightened_variables field in CpSolverResponse for more details.
2069
+ *
2070
+ * @default false
2071
+ */
2072
+ fillTightenedDomainsInResponse?: boolean;
2073
+ /**
2074
+ * If true, the final response addition_solutions field will be filled with
2075
+ * all solutions from our solutions pool.
2076
+ * Note that if both this field and enumerate_all_solutions is true, we will
2077
+ * copy to the pool all of the solution found. So if solution_pool_size is big
2078
+ * enough, you can get all solutions this way instead of using the solution
2079
+ * callback.
2080
+ * Note that this only affect the "final" solution, not the one passed to the
2081
+ * solution callbacks.
2082
+ *
2083
+ * @default false
2084
+ */
2085
+ fillAdditionalSolutionsInResponse?: boolean;
2086
+ /**
2087
+ * If true, the solver will add a default integer branching strategy to the
2088
+ * already defined search strategy. If not, some variable might still not be
2089
+ * fixed at the end of the search. For now we assume these variable can just
2090
+ * be set to their lower bound.
2091
+ *
2092
+ * @default true
2093
+ */
2094
+ instantiateAllVariables?: boolean;
2095
+ /**
2096
+ * If true, then the precedences propagator try to detect for each variable if
2097
+ * it has a set of "optional incoming arc" for which at least one of them is
2098
+ * present. This is usually useful to have but can be slow on model with a lot
2099
+ * of precedence.
2100
+ *
2101
+ * @default true
2102
+ */
2103
+ autoDetectGreaterThanAtLeastOneOf?: boolean;
2104
+ /**
2105
+ * For an optimization problem, stop the solver as soon as we have a solution.
2106
+ *
2107
+ * @default false
2108
+ */
2109
+ stopAfterFirstSolution?: boolean;
2110
+ /**
2111
+ * Mainly used when improving the presolver. When true, stops the solver after
2112
+ * the presolve is complete (or after loading and root level propagation).
2113
+ *
2114
+ * @default false
2115
+ */
2116
+ stopAfterPresolve?: boolean;
2117
+ /**
2118
+ * @default false
2119
+ */
2120
+ stopAfterRootPropagation?: boolean;
2121
+ /**
2122
+ * LNS parameters.
2123
+ * Initial parameters for neighborhood generation.
2124
+ *
2125
+ * @default 0
2126
+ */
2127
+ lnsInitialDifficulty?: number;
2128
+ /**
2129
+ * @default 0
2130
+ */
2131
+ lnsInitialDeterministicLimit?: number;
2132
+ /**
2133
+ * Testing parameters used to disable all lns workers.
2134
+ *
2135
+ * @default true
2136
+ */
2137
+ useLns?: boolean;
2138
+ /**
2139
+ * Experimental parameters to disable everything but lns.
2140
+ *
2141
+ * @default false
2142
+ */
2143
+ useLnsOnly?: boolean;
2144
+ /**
2145
+ * Size of the top-n different solutions kept by the solver.
2146
+ * This parameter must be > 0. Currently, having this larger than one mainly
2147
+ * impact the "base" solution chosen for a LNS/LS fragment.
2148
+ *
2149
+ * @default 3
2150
+ */
2151
+ solutionPoolSize?: number;
2152
+ /**
2153
+ * If solution_pool_size is <= this, we will use DP to keep a "diverse" set
2154
+ * of solutions (the one further apart via hamming distance) in the pool.
2155
+ * Setting this to large value might be slow, especially if your solution are
2156
+ * large.
2157
+ *
2158
+ * @default 10
2159
+ */
2160
+ solutionPoolDiversityLimit?: number;
2161
+ /**
2162
+ * In order to not get stuck in local optima, when this is non-zero, we try to
2163
+ * also work on "older" solutions with a worse objective value so we get a
2164
+ * chance to follow a different LS/LNS trajectory.
2165
+ *
2166
+ * @default 1
2167
+ */
2168
+ alternativePoolSize?: number;
2169
+ /**
2170
+ * Turns on relaxation induced neighborhood generator.
2171
+ *
2172
+ * @default true
2173
+ */
2174
+ useRinsLns?: boolean;
2175
+ /**
2176
+ * Adds a feasibility pump subsolver along with lns subsolvers.
2177
+ *
2178
+ * @default true
2179
+ */
2180
+ useFeasibilityPump?: boolean;
2181
+ /**
2182
+ * Turns on neighborhood generator based on local branching LP. Based on Huang
2183
+ * et al., "Local Branching Relaxation Heuristics for Integer Linear
2184
+ * Programs", 2023.
2185
+ *
2186
+ * @default true
2187
+ */
2188
+ useLbRelaxLns?: boolean;
2189
+ /**
2190
+ * Only use lb-relax if we have at least that many workers.
2191
+ *
2192
+ * @default 16
2193
+ */
2194
+ lbRelaxNumWorkersThreshold?: number;
2195
+ /**
2196
+ * @default PROPAGATION_ASSISTED
2197
+ */
2198
+ fpRounding?: SatParameters_FPRoundingMethod | SatParameters_FPRoundingMethod_Name;
2199
+ /**
2200
+ * If true, registers more lns subsolvers with different parameters.
2201
+ *
2202
+ * @default false
2203
+ */
2204
+ diversifyLnsParams?: boolean;
2205
+ /**
2206
+ * Randomize fixed search.
2207
+ *
2208
+ * @default false
2209
+ */
2210
+ randomizeSearch?: boolean;
2211
+ /**
2212
+ * Search randomization will collect the top
2213
+ * 'search_random_variable_pool_size' valued variables, and pick one randomly.
2214
+ * The value of the variable is specific to each strategy.
2215
+ *
2216
+ * @default 0
2217
+ */
2218
+ searchRandomVariablePoolSize?: number;
2219
+ /**
2220
+ * Experimental code: specify if the objective pushes all tasks toward the
2221
+ * start of the schedule.
2222
+ *
2223
+ * @default false
2224
+ */
2225
+ pushAllTasksTowardStart?: boolean;
2226
+ /**
2227
+ * If true, we automatically detect variables whose constraint are always
2228
+ * enforced by the same literal and we mark them as optional. This allows
2229
+ * to propagate them as if they were present in some situation.
2230
+ * TODO(user): This is experimental and seems to lead to wrong optimal in
2231
+ * some situation. It should however gives correct solutions. Fix.
2232
+ *
2233
+ * @default false
2234
+ */
2235
+ useOptionalVariables?: boolean;
2236
+ /**
2237
+ * The solver usually exploit the LP relaxation of a model. If this option is
2238
+ * true, then whatever is infered by the LP will be used like an heuristic to
2239
+ * compute EXACT propagation on the IP. So with this option, there is no
2240
+ * numerical imprecision issues.
2241
+ *
2242
+ * @default true
2243
+ */
2244
+ useExactLpReason?: boolean;
2245
+ /**
2246
+ * This can be beneficial if there is a lot of no-overlap constraints but a
2247
+ * relatively low number of different intervals in the problem. Like 1000
2248
+ * intervals, but 1M intervals in the no-overlap constraints covering them.
2249
+ *
2250
+ * @default false
2251
+ */
2252
+ useCombinedNoOverlap?: boolean;
2253
+ /**
2254
+ * All at_most_one constraints with a size <= param will be replaced by a
2255
+ * quadratic number of binary implications.
2256
+ *
2257
+ * @default 3
2258
+ */
2259
+ atMostOneMaxExpansionSize?: number;
2260
+ /**
2261
+ * Indicates if the CP-SAT layer should catch Control-C (SIGINT) signals
2262
+ * when calling solve. If set, catching the SIGINT signal will terminate the
2263
+ * search gracefully, as if a time limit was reached.
2264
+ *
2265
+ * @default true
2266
+ */
2267
+ catchSigintSignal?: boolean;
2268
+ /**
2269
+ * Stores and exploits "implied-bounds" in the solver. That is, relations of
2270
+ * the form literal => (var >= bound). This is currently used to derive
2271
+ * stronger cuts.
2272
+ *
2273
+ * @default true
2274
+ */
2275
+ useImpliedBounds?: boolean;
2276
+ /**
2277
+ * Whether we try to do a few degenerate iteration at the end of an LP solve
2278
+ * to minimize the fractionality of the integer variable in the basis. This
2279
+ * helps on some problems, but not so much on others. It also cost of bit of
2280
+ * time to do such polish step.
2281
+ *
2282
+ * @default false
2283
+ */
2284
+ polishLpSolution?: boolean;
2285
+ /**
2286
+ * The internal LP tolerances used by CP-SAT. These applies to the internal
2287
+ * and scaled problem. If the domains of your variables are large it might be
2288
+ * good to use lower tolerances. If your problem is binary with low
2289
+ * coefficients, it might be good to use higher ones to speed-up the lp
2290
+ * solves.
2291
+ *
2292
+ * @default 1
2293
+ */
2294
+ lpPrimalTolerance?: number;
2295
+ /**
2296
+ * @default 1
2297
+ */
2298
+ lpDualTolerance?: number;
2299
+ /**
2300
+ * Temporary flag util the feature is more mature. This convert intervals to
2301
+ * the newer proto format that support affine start/var/end instead of just
2302
+ * variables.
2303
+ *
2304
+ * @default true
2305
+ */
2306
+ convertIntervals?: boolean;
2307
+ /**
2308
+ * Whether we try to automatically detect the symmetries in a model and
2309
+ * exploit them. Currently, at level 1 we detect them in presolve and try
2310
+ * to fix Booleans. At level 2, we also do some form of dynamic symmetry
2311
+ * breaking during search. At level 3, we also detect symmetries for very
2312
+ * large models, which can be slow. At level 4, we try to break as much
2313
+ * symmetry as possible in presolve.
2314
+ *
2315
+ * @default 2
2316
+ */
2317
+ symmetryLevel?: number;
2318
+ /**
2319
+ * When we have symmetry, it is possible to "fold" all variables from the same
2320
+ * orbit into a single variable, while having the same power of LP relaxation.
2321
+ * This can help significantly on symmetric problem. However there is
2322
+ * currently a bit of overhead as the rest of the solver need to do some
2323
+ * translation between the folded LP and the rest of the problem.
2324
+ *
2325
+ * @default false
2326
+ */
2327
+ useSymmetryInLp?: boolean;
2328
+ /**
2329
+ * Experimental. This will compute the symmetry of the problem once and for
2330
+ * all. All presolve operations we do should keep the symmetry group intact
2331
+ * or modify it properly. For now we have really little support for this. We
2332
+ * will disable a bunch of presolve operations that could be supported.
2333
+ *
2334
+ * @default false
2335
+ */
2336
+ keepSymmetryInPresolve?: boolean;
2337
+ /**
2338
+ * Deterministic time limit for symmetry detection.
2339
+ *
2340
+ * @default 1
2341
+ */
2342
+ symmetryDetectionDeterministicTimeLimit?: number;
2343
+ /**
2344
+ * The new linear propagation code treat all constraints at once and use
2345
+ * an adaptation of Bellman-Ford-Tarjan to propagate constraint in a smarter
2346
+ * order and potentially detect propagation cycle earlier.
2347
+ *
2348
+ * @default true
2349
+ */
2350
+ newLinearPropagation?: boolean;
2351
+ /**
2352
+ * Linear constraints that are not pseudo-Boolean and that are longer than
2353
+ * this size will be split into sqrt(size) intermediate sums in order to have
2354
+ * faster propation in the CP engine.
2355
+ *
2356
+ * @default 100
2357
+ */
2358
+ linearSplitSize?: number;
2359
+ /**
2360
+ * ==========================================================================
2361
+ * Linear programming relaxation
2362
+ * ==========================================================================
2363
+ * A non-negative level indicating the type of constraints we consider in the
2364
+ * LP relaxation. At level zero, no LP relaxation is used. At level 1, only
2365
+ * the linear constraint and full encoding are added. At level 2, we also add
2366
+ * all the Boolean constraints.
2367
+ *
2368
+ * @default 1
2369
+ */
2370
+ linearizationLevel?: number;
2371
+ /**
2372
+ * A non-negative level indicating how much we should try to fully encode
2373
+ * Integer variables as Boolean.
2374
+ *
2375
+ * @default 1
2376
+ */
2377
+ booleanEncodingLevel?: number;
2378
+ /**
2379
+ * When loading a*x + b*y ==/!= c when x and y are both fully encoded.
2380
+ * The solver may decide to replace the linear equation by a set of clauses.
2381
+ * This is triggered if the sizes of the domains of x and y are below the
2382
+ * threshold.
2383
+ *
2384
+ * @default 16
2385
+ */
2386
+ maxDomainSizeWhenEncodingEqNeqConstraints?: number;
2387
+ /**
2388
+ * The limit on the number of cuts in our cut pool. When this is reached we do
2389
+ * not generate cuts anymore.
2390
+ * TODO(user): We should probably remove this parameters, and just always
2391
+ * generate cuts but only keep the best n or something.
2392
+ *
2393
+ * @default 10000
2394
+ */
2395
+ maxNumCuts?: number;
2396
+ /**
2397
+ * Control the global cut effort. Zero will turn off all cut. For now we just
2398
+ * have one level. Note also that most cuts are only used at linearization
2399
+ * level >= 2.
2400
+ *
2401
+ * @default 1
2402
+ */
2403
+ cutLevel?: number;
2404
+ /**
2405
+ * For the cut that can be generated at any level, this control if we only
2406
+ * try to generate them at the root node.
2407
+ *
2408
+ * @default false
2409
+ */
2410
+ onlyAddCutsAtLevelZero?: boolean;
2411
+ /**
2412
+ * When the LP objective is fractional, do we add the cut that forces the
2413
+ * linear objective expression to be greater or equal to this fractional value
2414
+ * rounded up? We can always do that since our objective is integer, and
2415
+ * combined with MIR heuristic to reduce the coefficient of such cut, it can
2416
+ * help.
2417
+ *
2418
+ * @default false
2419
+ */
2420
+ addObjectiveCut?: boolean;
2421
+ /**
2422
+ * Whether we generate and add Chvatal-Gomory cuts to the LP at root node.
2423
+ * Note that for now, this is not heavily tuned.
2424
+ *
2425
+ * @default true
2426
+ */
2427
+ addCgCuts?: boolean;
2428
+ /**
2429
+ * Whether we generate MIR cuts at root node.
2430
+ * Note that for now, this is not heavily tuned.
2431
+ *
2432
+ * @default true
2433
+ */
2434
+ addMirCuts?: boolean;
2435
+ /**
2436
+ * Whether we generate Zero-Half cuts at root node.
2437
+ * Note that for now, this is not heavily tuned.
2438
+ *
2439
+ * @default true
2440
+ */
2441
+ addZeroHalfCuts?: boolean;
2442
+ /**
2443
+ * Whether we generate clique cuts from the binary implication graph. Note
2444
+ * that as the search goes on, this graph will contains new binary clauses
2445
+ * learned by the SAT engine.
2446
+ *
2447
+ * @default true
2448
+ */
2449
+ addCliqueCuts?: boolean;
2450
+ /**
2451
+ * Whether we generate RLT cuts. This is still experimental but can help on
2452
+ * binary problem with a lot of clauses of size 3.
2453
+ *
2454
+ * @default true
2455
+ */
2456
+ addRltCuts?: boolean;
2457
+ /**
2458
+ * Cut generator for all diffs can add too many cuts for large all_diff
2459
+ * constraints. This parameter restricts the large all_diff constraints to
2460
+ * have a cut generator.
2461
+ *
2462
+ * @default 64
2463
+ */
2464
+ maxAllDiffCutSize?: number;
2465
+ /**
2466
+ * For the lin max constraints, generates the cuts described in "Strong
2467
+ * mixed-integer programming formulations for trained neural networks" by Ross
2468
+ * Anderson et. (https://arxiv.org/pdf/1811.01988.pdf)
2469
+ *
2470
+ * @default true
2471
+ */
2472
+ addLinMaxCuts?: boolean;
2473
+ /**
2474
+ * In the integer rounding procedure used for MIR and Gomory cut, the maximum
2475
+ * "scaling" we use (must be positive). The lower this is, the lower the
2476
+ * integer coefficients of the cut will be. Note that cut generated by lower
2477
+ * values are not necessarily worse than cut generated by larger value. There
2478
+ * is no strict dominance relationship.
2479
+ * Setting this to 2 result in the "strong fractional rouding" of Letchford
2480
+ * and Lodi.
2481
+ *
2482
+ * @default 600
2483
+ */
2484
+ maxIntegerRoundingScaling?: number;
2485
+ /**
2486
+ * If true, we start by an empty LP, and only add constraints not satisfied
2487
+ * by the current LP solution batch by batch. A constraint that is only added
2488
+ * like this is known as a "lazy" constraint in the literature, except that we
2489
+ * currently consider all constraints as lazy here.
2490
+ *
2491
+ * @default true
2492
+ */
2493
+ addLpConstraintsLazily?: boolean;
2494
+ /**
2495
+ * Even at the root node, we do not want to spend too much time on the LP if
2496
+ * it is "difficult". So we solve it in "chunks" of that many iterations. The
2497
+ * solve will be continued down in the tree or the next time we go back to the
2498
+ * root node.
2499
+ *
2500
+ * @default 2000
2501
+ */
2502
+ rootLpIterations?: number;
2503
+ /**
2504
+ * While adding constraints, skip the constraints which have orthogonality
2505
+ * less than 'min_orthogonality_for_lp_constraints' with already added
2506
+ * constraints during current call. Orthogonality is defined as 1 -
2507
+ * cosine(vector angle between constraints). A value of zero disable this
2508
+ * feature.
2509
+ *
2510
+ * @default 0
2511
+ */
2512
+ minOrthogonalityForLpConstraints?: number;
2513
+ /**
2514
+ * Max number of time we perform cut generation and resolve the LP at level 0.
2515
+ *
2516
+ * @default 1
2517
+ */
2518
+ maxCutRoundsAtLevelZero?: number;
2519
+ /**
2520
+ * If a constraint/cut in LP is not active for that many consecutive OPTIMAL
2521
+ * solves, remove it from the LP. Note that it might be added again later if
2522
+ * it become violated by the current LP solution.
2523
+ *
2524
+ * @default 100
2525
+ */
2526
+ maxConsecutiveInactiveCount?: number;
2527
+ /**
2528
+ * These parameters are similar to sat clause management activity parameters.
2529
+ * They are effective only if the number of generated cuts exceed the storage
2530
+ * limit. Default values are based on a few experiments on miplib instances.
2531
+ *
2532
+ * @default 1
2533
+ */
2534
+ cutMaxActiveCountValue?: number;
2535
+ /**
2536
+ * @default 0
2537
+ */
2538
+ cutActiveCountDecay?: number;
2539
+ /**
2540
+ * Target number of constraints to remove during cleanup.
2541
+ *
2542
+ * @default 1000
2543
+ */
2544
+ cutCleanupTarget?: number;
2545
+ /**
2546
+ * Add that many lazy constraints (or cuts) at once in the LP. Note that at
2547
+ * the beginning of the solve, we do add more than this.
2548
+ *
2549
+ * @default 50
2550
+ */
2551
+ newConstraintsBatchSize?: number;
2552
+ /**
2553
+ * All the "exploit_*" parameters below work in the same way: when branching
2554
+ * on an IntegerVariable, these parameters affect the value the variable is
2555
+ * branched on. Currently the first heuristic that triggers win in the order
2556
+ * in which they appear below.
2557
+ * TODO(user): Maybe do like for the restart algorithm, introduce an enum
2558
+ * and a repeated field that control the order on which these are applied?
2559
+ * If true and the Lp relaxation of the problem has an integer optimal
2560
+ * solution, try to exploit it. Note that since the LP relaxation may not
2561
+ * contain all the constraints, such a solution is not necessarily a solution
2562
+ * of the full problem.
2563
+ *
2564
+ * @default true
2565
+ */
2566
+ exploitIntegerLpSolution?: boolean;
2567
+ /**
2568
+ * If true and the Lp relaxation of the problem has a solution, try to exploit
2569
+ * it. This is same as above except in this case the lp solution might not be
2570
+ * an integer solution.
2571
+ *
2572
+ * @default true
2573
+ */
2574
+ exploitAllLpSolution?: boolean;
2575
+ /**
2576
+ * When branching on a variable, follow the last best solution value.
2577
+ *
2578
+ * @default false
2579
+ */
2580
+ exploitBestSolution?: boolean;
2581
+ /**
2582
+ * When branching on a variable, follow the last best relaxation solution
2583
+ * value. We use the relaxation with the tightest bound on the objective as
2584
+ * the best relaxation solution.
2585
+ *
2586
+ * @default false
2587
+ */
2588
+ exploitRelaxationSolution?: boolean;
2589
+ /**
2590
+ * When branching an a variable that directly affect the objective,
2591
+ * branch on the value that lead to the best objective first.
2592
+ *
2593
+ * @default true
2594
+ */
2595
+ exploitObjective?: boolean;
2596
+ /**
2597
+ * Infer products of Boolean or of Boolean time IntegerVariable from the
2598
+ * linear constrainst in the problem. This can be used in some cuts, altough
2599
+ * for now we don't really exploit it.
2600
+ *
2601
+ * @default false
2602
+ */
2603
+ detectLinearizedProduct?: boolean;
2604
+ /**
2605
+ * This should be better on integer problems.
2606
+ * But it is still work in progress.
2607
+ *
2608
+ * @default false
2609
+ */
2610
+ useNewIntegerConflictResolution?: boolean;
2611
+ /**
2612
+ * If true, and during integer conflict resolution (icr) the 1-UIP is an
2613
+ * integer literal for which we do not have an associated Boolean. Create one.
2614
+ *
2615
+ * @default true
2616
+ */
2617
+ create1uipBooleanDuringIcr?: boolean;
2618
+ /**
2619
+ * ==========================================================================
2620
+ * MIP -> CP-SAT (i.e. IP with integer coeff) conversion parameters that are
2621
+ * used by our automatic "scaling" algorithm.
2622
+ * Note that it is hard to do a meaningful conversion automatically and if
2623
+ * you have a model with continuous variables, it is best if you scale the
2624
+ * domain of the variable yourself so that you have a relevant precision for
2625
+ * the application at hand. Same for the coefficients and constraint bounds.
2626
+ * ==========================================================================
2627
+ * We need to bound the maximum magnitude of the variables for CP-SAT, and
2628
+ * that is the bound we use. If the MIP model expect larger variable value in
2629
+ * the solution, then the converted model will likely not be relevant.
2630
+ *
2631
+ * @default 1
2632
+ */
2633
+ mipMaxBound?: number;
2634
+ /**
2635
+ * All continuous variable of the problem will be multiplied by this factor.
2636
+ * By default, we don't do any variable scaling and rely on the MIP model to
2637
+ * specify continuous variable domain with the wanted precision.
2638
+ *
2639
+ * @default 1
2640
+ */
2641
+ mipVarScaling?: number;
2642
+ /**
2643
+ * If this is false, then mip_var_scaling is only applied to variables with
2644
+ * "small" domain. If it is true, we scale all floating point variable
2645
+ * independenlty of their domain.
2646
+ *
2647
+ * @default false
2648
+ */
2649
+ mipScaleLargeDomain?: boolean;
2650
+ /**
2651
+ * If true, some continuous variable might be automatically scaled. For now,
2652
+ * this is only the case where we detect that a variable is actually an
2653
+ * integer multiple of a constant. For instance, variables of the form k * 0.5
2654
+ * are quite frequent, and if we detect this, we will scale such variable
2655
+ * domain by 2 to make it implied integer.
2656
+ *
2657
+ * @default true
2658
+ */
2659
+ mipAutomaticallyScaleVariables?: boolean;
2660
+ /**
2661
+ * If one try to solve a MIP model with CP-SAT, because we assume all variable
2662
+ * to be integer after scaling, we will not necessarily have the correct
2663
+ * optimal. Note however that all feasible solutions are valid since we will
2664
+ * just solve a more restricted version of the original problem.
2665
+ * This parameters is here to prevent user to think the solution is optimal
2666
+ * when it might not be. One will need to manually set this to false to solve
2667
+ * a MIP model where the optimal might be different.
2668
+ * Note that this is tested after some MIP presolve steps, so even if not
2669
+ * all original variable are integer, we might end up with a pure IP after
2670
+ * presolve and after implied integer detection.
2671
+ *
2672
+ * @default false
2673
+ */
2674
+ onlySolveIp?: boolean;
2675
+ /**
2676
+ * When scaling constraint with double coefficients to integer coefficients,
2677
+ * we will multiply by a power of 2 and round the coefficients. We will choose
2678
+ * the lowest power such that we have no potential overflow (see
2679
+ * mip_max_activity_exponent) and the worst case constraint activity error
2680
+ * does not exceed this threshold.
2681
+ * Note that we also detect constraint with rational coefficients and scale
2682
+ * them accordingly when it seems better instead of using a power of 2.
2683
+ * We also relax all constraint bounds by this absolute value. For pure
2684
+ * integer constraint, if this value if lower than one, this will not change
2685
+ * anything. However it is needed when scaling MIP problems.
2686
+ * If we manage to scale a constraint correctly, the maximum error we can make
2687
+ * will be twice this value (once for the scaling error and once for the
2688
+ * relaxed bounds). If we are not able to scale that well, we will display
2689
+ * that fact but still scale as best as we can.
2690
+ *
2691
+ * @default 1
2692
+ */
2693
+ mipWantedPrecision?: number;
2694
+ /**
2695
+ * To avoid integer overflow, we always force the maximum possible constraint
2696
+ * activity (and objective value) according to the initial variable domain to
2697
+ * be smaller than 2 to this given power. Because of this, we cannot always
2698
+ * reach the "mip_wanted_precision" parameter above.
2699
+ * This can go as high as 62, but some internal algo currently abort early if
2700
+ * they might run into integer overflow, so it is better to keep it a bit
2701
+ * lower than this.
2702
+ *
2703
+ * @default 53
2704
+ */
2705
+ mipMaxActivityExponent?: number;
2706
+ /**
2707
+ * As explained in mip_precision and mip_max_activity_exponent, we cannot
2708
+ * always reach the wanted precision during scaling. We use this threshold to
2709
+ * enphasize in the logs when the precision seems bad.
2710
+ *
2711
+ * @default 1
2712
+ */
2713
+ mipCheckPrecision?: number;
2714
+ /**
2715
+ * Even if we make big error when scaling the objective, we can always derive
2716
+ * a correct lower bound on the original objective by using the exact lower
2717
+ * bound on the scaled integer version of the objective. This should be fast,
2718
+ * but if you don't care about having a precise lower bound, you can turn it
2719
+ * off.
2720
+ *
2721
+ * @default true
2722
+ */
2723
+ mipComputeTrueObjectiveBound?: boolean;
2724
+ /**
2725
+ * Any finite values in the input MIP must be below this threshold, otherwise
2726
+ * the model will be reported invalid. This is needed to avoid floating point
2727
+ * overflow when evaluating bounds * coeff for instance. We are a bit more
2728
+ * defensive, but in practice, users shouldn't use super large values in a
2729
+ * MIP.
2730
+ *
2731
+ * @default 1
2732
+ */
2733
+ mipMaxValidMagnitude?: number;
2734
+ /**
2735
+ * By default, any variable/constraint bound with a finite value and a
2736
+ * magnitude greater than the mip_max_valid_magnitude will result with a
2737
+ * invalid model. This flags change the behavior such that such bounds are
2738
+ * silently transformed to +∞ or -∞.
2739
+ * It is recommended to keep it at false, and create valid bounds.
2740
+ *
2741
+ * @default false
2742
+ */
2743
+ mipTreatHighMagnitudeBoundsAsInfinity?: boolean;
2744
+ /**
2745
+ * Any value in the input mip with a magnitude lower than this will be set to
2746
+ * zero. This is to avoid some issue in LP presolving.
2747
+ *
2748
+ * @default 1
2749
+ */
2750
+ mipDropTolerance?: number;
2751
+ /**
2752
+ * When solving a MIP, we do some basic floating point presolving before
2753
+ * scaling the problem to integer to be handled by CP-SAT. This control how
2754
+ * much of that presolve we do. It can help to better scale floating point
2755
+ * model, but it is not always behaving nicely.
2756
+ *
2757
+ * @default 2
2758
+ */
2759
+ mipPresolveLevel?: number;
2760
+ };