Reputation: 1
I am experiencing this for all formulations now. Previously I had no issues.
Take this example:
from ortools.sat.python import cp_model
from typing import List, Optional
from ortools.sat.python import cp_model
n = 8 # Board size and number of queens
model = cp_model.CpModel()
# Create variables - queens[i] represents the column position of queen in row i
queens = [model.NewIntVar(0, n - 1, f"queen_{i}") for i in range(n)]
# No two queens in same column
model.AddAllDifferent(queens)
# No two queens in same diagonal
for i in range(n):
for j in range(i + 1, n):
model.Add(queens[i] - queens[j] != i - j)
model.Add(queens[i] - queens[j] != j - i)
# Solve
solver = cp_model.CpSolver()
solver.parameters.max_time_in_seconds = 10
solver.parameters.log_search_progress = True
solver.parameters.num_search_workers = 8
status = solver.Solve(model)
This code freezes indefinitely just after starting to solve. Output:
Starting CP-SAT solver v9.11.4210
Parameters: max_time_in_seconds: 10 log_search_progress: true num_search_workers: 8
Initial satisfaction model '': (model_fingerprint: 0x6856406a4ac1332d)
#Variables: 8
- 8 in [0,7]
#kAllDiff: 1
#kLinear2: 56 (#complex_domain: 56)
Starting presolve at 0.00s
1.10e-05s 0.00e+00d [DetectDominanceRelations]
1.49e-04s 0.00e+00d [PresolveToFixPoint] #num_loops=2 #num_dual_strengthening=1
2.00e-06s 0.00e+00d [ExtractEncodingFromLinear]
[Symmetry] Graph for symmetry has 552 nodes and 944 arcs.
[Symmetry] Symmetry computation done. time: 0.000165 dtime: 0.00029732
[Symmetry] #generators: 1, average support size: 72
[Symmetry] 36 orbits with sizes: 2,2,2,2,2,2,2,2,2,2,...
[Symmetry] Num fixable by intersecting at_most_one with orbits: 4 largest_orbit: 2
[SAT presolve] num removable Booleans: 0 / 64
[SAT presolve] num trivial clauses: 0
[SAT presolve] [0s] clauses:252 literals:504 vars:60 one_side_vars:60 simple_definition:0 singleton_clauses:0
[SAT presolve] [1.3e-05s] clauses:252 literals:504 vars:60 one_side_vars:60 simple_definition:0 singleton_clauses:0
[SAT presolve] [2e-05s] clauses:252 literals:504 vars:60 one_side_vars:60 simple_definition:0 singleton_clauses:0
...
#2 0.00s default_lp (fixed_bools=0/60)
#3 0.00s quick_restart (fixed_bools=0/60)
#4 0.00s quick_restart_no_lp (fixed_bools=0/60)
#Model 0.11s var:59/60 constraints:114/114
If I update the num search workers to any number below 8 then there are no issues.
Has anyone seen this before?
Upvotes: 0
Views: 88
Reputation: 11064
Works fine on the next release
#Model 0.00s var:60/60 constraints:43/43
Starting search at 0.00s with 8 workers.
6 full problem subsolvers: [default_lp, max_lp, no_lp, probing, quick_restart, quick_restart_no_lp]
2 first solution subsolvers: [fj, fs_random_no_lp]
2 interleaved subsolvers: [feasibility_pump, rins/rens]
2 helper subsolvers: [neighborhood_helper, synchronization_agent]
#1 0.00s no_lp
#2 0.00s fj_restart(batch:1 lin{mvs:44 evals:60} #w_updates:24 #perturb:0)
Task timing n [ min, max] avg dev time n [ min, max] avg dev dtime
'default_lp': 1 [431.00us, 431.00us] 431.00us 0.00ns 431.00us 1 [337.07us, 337.07us] 337.07us 0.00ns 337.07us
'feasibility_pump': 1 [200.00us, 200.00us] 200.00us 0.00ns 200.00us 0 [ 0.00ns, 0.00ns] 0.00ns 0.00ns 0.00ns
'fj': 1 [ 80.00us, 80.00us] 80.00us 0.00ns 80.00us 1 [ 63.61us, 63.61us] 63.61us 0.00ns 63.61us
'fs_random_no_lp': 1 [254.00us, 254.00us] 254.00us 0.00ns 254.00us 0 [ 0.00ns, 0.00ns] 0.00ns 0.00ns 0.00ns
'max_lp': 1 [402.00us, 402.00us] 402.00us 0.00ns 402.00us 0 [ 0.00ns, 0.00ns] 0.00ns 0.00ns 0.00ns
'no_lp': 1 [332.00us, 332.00us] 332.00us 0.00ns 332.00us 1 [376.61us, 376.61us] 376.61us 0.00ns 376.61us
'probing': 1 [340.00us, 340.00us] 340.00us 0.00ns 340.00us 0 [ 0.00ns, 0.00ns] 0.00ns 0.00ns 0.00ns
'quick_restart': 1 [385.00us, 385.00us] 385.00us 0.00ns 385.00us 1 [334.29us, 334.29us] 334.29us 0.00ns 334.29us
'quick_restart_no_lp': 1 [375.00us, 375.00us] 375.00us 0.00ns 375.00us 1 [352.17us, 352.17us] 352.17us 0.00ns 352.17us
'rins/rens': 0 [ 0.00ns, 0.00ns] 0.00ns 0.00ns 0.00ns 0 [ 0.00ns, 0.00ns] 0.00ns 0.00ns 0.00ns
Search stats Bools Conflicts Branches Restarts BoolPropag IntegerPropag
'default_lp': 60 5 468 255 3'344 0
'fs_random_no_lp': 60 0 108 108 1'216 0
'max_lp': 60 0 120 120 1'340 1'460
'no_lp': 60 15 481 255 3'510 0
'probing': 60 0 120 120 1'340 0
'quick_restart': 60 5 454 255 3'351 0
'quick_restart_no_lp': 60 8 483 255 3'427 0
SAT stats ClassicMinim LitRemoved LitLearned LitForgotten Subsumed MClauses MDecisions MLitTrue MSubsumed MLitRemoved MReused
'default_lp': 0 0 53 0 0 32 208 0 0 0 0
'fs_random_no_lp': 0 0 0 0 0 0 0 0 0 0 0
'max_lp': 0 0 0 0 0 0 0 0 0 0 0
'no_lp': 2 3 169 0 0 32 208 0 0 0 0
'probing': 0 0 0 0 0 0 0 0 0 0 0
'quick_restart': 0 0 49 0 0 32 208 0 0 0 0
'quick_restart_no_lp': 3 5 100 0 0 32 208 0 0 0 0
Lp stats Component Iterations AddedCuts OPTIMAL DUAL_F. DUAL_U.
'max_lp': 1 0 0 0 0 0
Lp dimension Final dimension of first component
'max_lp': 43 rows, 60 columns, 266 entries
Lp debug CutPropag CutEqPropag Adjust Overflow Bad BadScaling
'max_lp': 0 0 0 0 0 0
Lp pool Constraints Updates Simplif Merged Shortened Split Strenghtened Cuts/Call
'max_lp': 43 0 0 0 0 0 0 0/0
LNS stats Improv/Calls Closed Difficulty TimeLimit
'rins/rens': 0/0 0% 5.00e-01 0.10
LS stats Batches Restarts/Perturbs LinMoves GenMoves CompoundMoves Bactracks WeightUpdates ScoreComputed
'fj_restart': 1 1 44 0 0 0 24 60
Solution repositories Added Queried Synchro
'feasible solutions': 2 0 2
'fj solution hints': 0 0 0
'lp solutions': 0 0 0
'pump': 0 0
CpSolverResponse summary:
status: OPTIMAL
objective: NA
best_bound: NA
integers: 0
booleans: 60
conflicts: 15
branches: 481
propagations: 3510
integer_propagations: 0
restarts: 255
lp_iterations: 0
walltime: 0.00413
usertime: 0.00413
deterministic_time: 0.0022054
gap_integral: 0
solution_fingerprint: 0x5e595bf00f728210
Upvotes: 0