Skip to content

Commit

Permalink
ugly fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GiggleLiu committed Jan 18, 2025
1 parent 97ebb32 commit c6d918d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/OptimalBranchingCore/src/greedymerge.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function greedymerge(cls::Vector{Vector{Clause{INT}}}, problem::AbstractProblem,
end
cls = copy(cls)
size_reductions = [Float64(size_reduction(problem, m, first(candidate), variables)) for candidate in cls]
k = 0
@inbounds while true
nc = length(cls)
mask = trues(nc)
Expand All @@ -42,7 +43,7 @@ function greedymerge(cls::Vector{Vector{Clause{INT}}}, problem::AbstractProblem,
for i 1:nc, j i+1:nc
_, _, _, reduction = reduction_merge(cls[i], cls[j])
dE = γ^(-reduction) - weights[i] - weights[j]
dE <= -1e-12 && enqueue!(queue, (i, j), dE)
dE <= -1e-12 && enqueue!(queue, (i, j), dE - 1e-12 * (k += 1; k))
end
isempty(queue) && return OptimalBranchingResult(DNF(first.(cls)), size_reductions, γ)
while !isempty(queue)
Expand All @@ -67,7 +68,8 @@ function greedymerge(cls::Vector{Vector{Clause{INT}}}, problem::AbstractProblem,
a, b = minmax(i, k)
_, _, _, reduction = reduction_merge(cls[a], cls[b])
dE = γ^(-reduction) - weights[a] - weights[b]
dE <= -1e-12 && enqueue!(queue, (a, b), dE)

dE <= -1e-12 && enqueue!(queue, (a, b), dE - 1e-12 * (k += 1; k))
end
end
end
Expand Down

0 comments on commit c6d918d

Please sign in to comment.