Skip to content

Commit

Permalink
Fix collecting pools of solution for // computing. Fix termination of…
Browse files Browse the repository at this point in the history
… remote processes
  • Loading branch information
Azzaare committed Aug 15, 2024
1 parent 10ddc90 commit 1d6580d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ function _init!(s, ::Val{:local})
get_option(s, "tabu_delta") == 0 && set_option!(
s, "tabu_delta", get_option(s, "tabu_time") - get_option(s, "tabu_local")) # 20-30
state!(s)
@warn "Debug" typeof(s) s
pool!(s)
return has_solution(s)
end
Expand Down
12 changes: 2 additions & 10 deletions src/solvers/lead.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ stop_while_loop(s::LeadSolver, ::Atomic{Bool}, ::Int, ::Float64) = isready(s.rc_

function remote_stop!(s::LeadSolver)
isready(s.rc_stop) && take!(s.rc_stop)
sat = is_sat(s)
if !sat || !has_solution(s)
while isready(s.rc_report)
wait(s.rc_sol)
t = take!(s.rc_sol)
update_pool!(s, t)
sat && has_solution(t) && break
take!(s.rc_report)
end
end
put!(s.rc_sol, s.pool)
take!(s.rc_report)
end
23 changes: 23 additions & 0 deletions src/solvers/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,26 @@ function post_process(s::MainSolver)
write(path, JSON.json(info))
end
end

function remote_stop!(s::MainSolver)
isready(s.rc_stop) && take!(s.rc_stop)
sat = is_sat(s)
@info "Remote stop: report main pool" best_values(s.pool) has_solution(s) s.rc_report s.rc_sol s.rc_stop length(s.remotes)
if !sat || !has_solution(s)
@warn "debugging remote stop" nworkers() length(s.remotes)
while isready(s.rc_report) || isready(s.rc_sol)
wait(s.rc_sol)
t = take!(s.rc_sol)
@info "Remote stop: report remote pool" best_values(t) length(s.remotes)
update_pool!(s, t)
if sat && has_solution(t)
empty!(s.rc_report)
break
end
@info "mark 1"
isready(s.rc_report) && take!(s.rc_report)
@info "mark 2"
end
end
@info "Remote stop: report best pool" best_values(s.pool) length(s.remotes)
end

0 comments on commit 1d6580d

Please sign in to comment.