or-tools-wasm 0.5.0

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