Skip to content

Commit

Permalink
Make it possible to thread the classification of solutions (#130)
Browse files Browse the repository at this point in the history
* add @maybethread macro to classification loop

* we can only thread over a collection
  • Loading branch information
oameye committed Dec 27, 2023
1 parent 8f1247b commit a68bb54
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/classification.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ end
according to `f` (`f` takes a solution dictionary, return a boolean)"
function classify_solutions(res::Result, f::Function)
values = similar(res.solutions, BitVector)
for (idx, soln) in enumerate(res.solutions)
@maybethread for (idx, soln) in collect(enumerate(res.solutions))
values[idx] = [f(get_single_solution(res, index=idx, branch=b), res) for b in 1:length(soln)]
end
values
Expand Down Expand Up @@ -144,4 +144,3 @@ function filter_result!(res::Result, class::String)
res.classes[c] = [s[bools] for s in res.classes[c]]
end
end

0 comments on commit a68bb54

Please sign in to comment.