2

我在理解如何使用我的 CP-SAT 求解器中的搜索日志通过设置子求解器、初始求解策略等来改善运行时有点挣扎。我不确定如何指定这些东西。我将搜索工作人员的数量设置为 16,但我在本地计算机上运行以获取此日志(云笔记本不会生成日志),所以我不确定这是否真的按预期工作......

这是日志:

Starting CP-SAT solver v9.2.9972
Parameters: max_time_in_seconds: 600 log_search_progress: true num_search_workers: 16
Initial optimization model '':
#Variables: 68736 (1152 in objective)
  - 3432 in [-1,1]
  - 65304 in [0,1]
#kBoolAnd: 10116 (#enforced: 10116) (#literals: 38844)
#kBoolOr: 10116 (#enforced: 10116) (#literals: 38844)
#kLinMax: 1716
#kLinear1: 67644 (#enforced: 67644)
#kLinear2: 11496 (#enforced: 1776)
#kLinear3: 15408 (#enforced: 72)
#kLinearN: 34821 (#enforced: 30396) (#terms: 3252492)
Starting presolve at 0.35s
[ExtractEncodingFromLinear] #potential_supersets=5172 #potential_subsets=1716 #at_most_one_encodings=0 #exactly_one_encodings=0 #unique_terms=0 #multiple_terms=0 #literals=0 time=0.00908219s
[Probing] deterministic_time: 1.00017 (limit: 1) wall_time: 6.15367 (Aborted 6706/73596)
[Probing]  - new fixed Boolean: 864 (1996/73596)
[Probing]  - new integer bounds: 420
[Probing]  - new binary clause: 178141
[SAT presolve] num removable Booleans: 47300 / 68736
[SAT presolve] num trivial clauses: 63504
[SAT presolve] [0s] clauses:93004 literals:656784 vars:27020 one_side_vars:916 simple_definition:19468 singleton_clauses:0
[SAT presolve] [0.0406371s] clauses:88004 literals:550192 vars:26828 one_side_vars:1664 simple_definition:18744 singleton_clauses:588
[SAT presolve] [0.145347s] clauses:47868 literals:506444 vars:17236 one_side_vars:10180 simple_definition:648 singleton_clauses:192
[MaxClique] Merged 21576(46908 literals) into 19416(56256 literals) at_most_ones.
[Probing] deterministic_time: 1.00008 (limit: 1) wall_time: 3.79325 (Aborted 7470/74016)
[Probing]  - new integer bounds: 96
[Probing]  - new binary clause: 140974
[SAT presolve] num removable Booleans: 47972 / 68736
[SAT presolve] num trivial clauses: 0
[SAT presolve] [0s] clauses:40174 literals:490984 vars:16744 one_side_vars:9772 simple_definition:708 singleton_clauses:0
[SAT presolve] [0.00807646s] clauses:37369 literals:473052 vars:16660 one_side_vars:9688 simple_definition:780 singleton_clauses:0
[SAT presolve] [0.012962s] clauses:37369 literals:473052 vars:16660 one_side_vars:9688 simple_definition:780 singleton_clauses:0
Presolve summary:
  - 35040 affine relations were detected.
  - 31047 variable equivalence relations were detected.
  - rule 'TODO linear2: contains a Boolean.' was applied 16032 times.
  - rule 'affine: new relation' was applied 35040 times.
  - rule 'at_most_one: duplicate literals' was applied 564 times.
  - rule 'at_most_one: empty or all false' was applied 120 times.
  - rule 'at_most_one: removed literals' was applied 396 times.
  - rule 'at_most_one: size one' was applied 216 times.
  - rule 'at_most_one: transformed into max clique.' was applied 1 time.
  - rule 'bool_and: always false' was applied 804 times.
  - rule 'bool_and: fixed literals' was applied 60 times.
  - rule 'bool_and: non-reified.' was applied 336 times.
  - rule 'bool_or: always true' was applied 2156 times.
  - rule 'bool_or: fixed literals' was applied 6444 times.
  - rule 'bool_or: implications' was applied 8640 times.
  - rule 'bool_or: only one literal' was applied 1224 times.
  - rule 'bool_or: removed enforcement literal' was applied 10164 times.
  - rule 'deductions: 84372 stored' was applied 1 time.
  - rule 'dual: enforced equivalence' was applied 3396 times.
  - rule 'dual: fix variable' was applied 52 times.
  - rule 'duplicate: merged rhs of linear constraint' was applied 40 times.
  - rule 'duplicate: removed constraint' was applied 40 times.
  - rule 'exactly_one: duplicate literals' was applied 564 times.
  - rule 'exactly_one: removed literals' was applied 972 times.
  - rule 'exactly_one: singleton' was applied 672 times.
  - rule 'exactly_one: size two' was applied 288 times.
  - rule 'exactly_one: x and not(x)' was applied 192 times.
  - rule 'false enforcement literal' was applied 1104 times.
  - rule 'int_abs: converted to equality' was applied 1032 times.
  - rule 'int_abs: propagate domain from x to abs(x)' was applied 1716 times.
  - rule 'int_abs: store abs(x) == y' was applied 1716 times.
  - rule 'linear1: is boolean implication' was applied 67620 times.
  - rule 'linear: always true' was applied 918 times.
  - rule 'linear: empty' was applied 1 time.
  - rule 'linear: extracted enforcement literal' was applied 40 times.
  - rule 'linear: fixed or dup variables' was applied 688 times.
  - rule 'linear: infeasible' was applied 228 times.
  - rule 'linear: negative clause' was applied 15584 times.
  - rule 'linear: negative equal one' was applied 516 times.
  - rule 'linear: negative reified and' was applied 3288 times.
  - rule 'linear: positive at most one' was applied 1704 times.
  - rule 'linear: positive clause' was applied 11116 times.
  - rule 'linear: positive equal one' was applied 3468 times.
  - rule 'linear: positive reified and' was applied 12 times.
  - rule 'linear: reduced variable domains' was applied 1 time.
  - rule 'linear: remapped using affine relations' was applied 69396 times.
  - rule 'linear: simplified rhs' was applied 46340 times.
  - rule 'linear: singleton column' was applied 576 times.
  - rule 'linear: small Boolean expression' was applied 1704 times.
  - rule 'presolve: 11684 unused variables removed.' was applied 1 time.
  - rule 'presolve: iteration' was applied 2 times.
  - rule 'setppc: removed dominated constraints' was applied 14 times.
  - rule 'true enforcement literal' was applied 564 times.
Presolved optimization model '':
#Variables: 20764 (1152 in objective)
  - 1200 in [-1,1]
  - 19564 in [0,1]
#kAtMostOne: 7368 (#literals: 31428)
#kBoolAnd: 3816 (#enforced: 3816) (#literals: 12058)
#kBoolOr: 25311 (#literals: 448936)
#kExactlyOne: 2928 (#literals: 10872)
#kLinMax: 1200
#kLinear3: 1200
#kLinearN: 20158 (#enforced: 20068) (#terms: 2709624)
Preloading model.
#Bound  25.47s best:inf   next:[0,8064]   initial_domain
#Model  25.66s var:20764/20764 constraints:61981/61981
Starting Search at 25.66s with 16 workers and subsolvers: [ default_lp, reduced_costs, pseudo_costs, no_lp, max_lp, core, quick_restart, quick_restart_no_lp, lb_tree_search, probing, feasibility_pump, rnd_var_lns_default, rnd_cst_lns_default, graph_var_lns_default, graph_cst_lns_default, rins_lns_default, rens_lns_default ]
#Bound  39.08s best:inf   next:[84,8064]  default_lp initial_propagation
#Bound  39.24s best:inf   next:[126,8064] default_lp
#Bound  39.31s best:inf   next:[378,8064] default_lp
#Bound  39.33s best:inf   next:[406,8064] default_lp
#Bound  39.49s best:inf   next:[420,8064] default_lp
#Bound  48.42s best:inf   next:[532,8064] max_lp initial_propagation
#Model  50.98s var:20763/20764 constraints:61981/61981
#Model  61.05s var:20762/20764 constraints:61981/61981
#Model  63.43s var:20761/20764 constraints:61981/61981
#Model  63.99s var:20760/20764 constraints:61981/61981
#Model  69.91s var:20759/20764 constraints:61981/61981
#1      95.09s best:840   next:[532,833]  core fixed_bools:2/26104
#Model  95.57s var:20758/20764 constraints:61981/61981
#Model 132.89s var:20755/20764 constraints:61981/61981
#Model 135.91s var:20754/20764 constraints:61981/61981
#Model 165.30s var:20753/20764 constraints:61981/61981
#Model 183.34s var:20750/20764 constraints:61981/61981
#Model 216.41s var:20749/20764 constraints:61981/61981
#Model 217.45s var:20748/20764 constraints:61981/61981
#Model 288.45s var:20747/20764 constraints:61981/61981
#Model 319.32s var:20746/20764 constraints:61981/61981
#Model 342.39s var:20745/20764 constraints:61981/61981
#Model 378.02s var:20744/20764 constraints:61981/61981
#Model 398.60s var:20743/20764 constraints:61981/61981
#Model 421.57s var:20742/20764 constraints:61981/61981
#Model 434.00s var:20741/20764 constraints:61981/61981
#Model 488.96s var:20739/20764 constraints:61981/61981
#Model 568.59s var:20738/20764 constraints:61981/61981
#Model 578.94s var:20737/20764 constraints:61981/61981
Sub-solver search statistics:
  'reduced_costs':
     LP statistics:
       final dimension: 7184 rows, 20764 columns, 270506 entries with magnitude in [1.343212e-01, 1.000000e+00]
       total number of simplex iterations: 61833
       num solves:
         - #OPTIMAL: 158
         - #DUAL_UNBOUNDED: 328
         - #DUAL_FEASIBLE: 4275
       managed constraints: 78653
       merged constraints: 12279
       shortened constraints: 713
       coefficient strenghtenings: 13
       num simplifications: 762
       total cuts added: 45455 (out of 191578 calls)
         - 'AffineMax': 1
         - 'CG': 16130
         - 'IB': 1729
         - 'MIR_1': 24189
         - 'MIR_2': 625
         - 'MIR_2_K': 9
         - 'MIR_3': 632
         - 'MIR_3_K': 2
         - 'MIR_4': 334
         - 'MIR_5': 301
         - 'MIR_6': 162
         - 'ZERO_HALF': 465
         - 'clique': 876
  'pseudo_costs':
     LP statistics:
       final dimension: 7544 rows, 20764 columns, 413863 entries with magnitude in [4.647920e-03, 1.000000e+00]
       total number of simplex iterations: 57585
       num solves:
         - #OPTIMAL: 159
         - #DUAL_UNBOUNDED: 99
         - #DUAL_FEASIBLE: 4048
       managed constraints: 77900
       merged constraints: 9996
       shortened constraints: 222
       coefficient strenghtenings: 16
       num simplifications: 267
       total cuts added: 18702 (out of 143355 calls)
         - 'AffineMax': 2
         - 'CG': 2196
         - 'IB': 1038
         - 'MIR_1': 12690
         - 'MIR_2': 618
         - 'MIR_2_K': 3
         - 'MIR_3': 235
         - 'MIR_4': 217
         - 'MIR_5': 186
         - 'MIR_6': 128
         - 'ZERO_HALF': 655
         - 'clique': 734
  'max_lp':
     LP statistics:
       final dimension: 68198 rows, 20764 columns, 3283187 entries with magnitude in [8.838835e-02, 1.000000e+00]
       total number of simplex iterations: 18172
       num solves:
         - #DUAL_FEASIBLE: 14
       managed constraints: 68198
       merged constraints: 1786
       total cuts added: 0 (out of 0 calls)
  'lb_tree_search':
     LP statistics:
       final dimension: 6449 rows, 20764 columns, 268542 entries with magnitude in [2.032313e-02, 1.000000e+00]
       total number of simplex iterations: 23074
       num solves:
         - #OPTIMAL: 158
         - #DUAL_UNBOUNDED: 15
         - #DUAL_FEASIBLE: 1342
       managed constraints: 77377
       merged constraints: 19454
       shortened constraints: 303
       coefficient strenghtenings: 100
       num simplifications: 359
       total cuts added: 47179 (out of 192476 calls)
         - 'AffineMax': 1
         - 'CG': 11868
         - 'IB': 1204
         - 'MIR_1': 28700
         - 'MIR_2': 2265
         - 'MIR_2_K': 6
         - 'MIR_3': 672
         - 'MIR_3_K': 2
         - 'MIR_4': 574
         - 'MIR_4_K': 1
         - 'MIR_5': 409
         - 'MIR_6': 279
         - 'ZERO_HALF': 467
         - 'clique': 731
Solutions found per subsolver:
  'core': 1
Objective bounds found per subsolver:
  'default_lp': 5
  'initial_domain': 1
  'max_lp': 1
CpSolverResponse summary:
status: FEASIBLE
objective: 840
best_bound: 532
booleans: 26104
conflicts: 0
branches: 10803
propagations: 626739
integer_propagations: 767908
restarts: 10754
lp_iterations: 18172
walltime: 606.104
usertime: 606.104
deterministic_time: 529.407
gap_integral: 3034.73
Statistics
  - status          : FEASIBLE
  - conflicts       : 0
  - branches        : 10803
  - wall time       : 606.104440 s
Total cost = 840
solution costs 840.0
number of technician shifts : 4
number of technician hours : 120
number of technician long shifts : 120

有什么建议么?非常感谢任何见解!

4

1 回答 1

1

这是一个大模型。尤其是 kLinearN 部分 -> 35k 约束和 3.5M 项。这会减慢解决速度。

除此之外,可行性是相当困难的。90年代找到1个可行的解决方案,之后没有改进。

于 2022-02-02T08:49:43.117 回答