Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTR_KZFD quadratization dispatch not being called #69

Closed
pedroripper opened this issue Feb 17, 2023 · 0 comments · Fixed by #77
Closed

NTR_KZFD quadratization dispatch not being called #69

pedroripper opened this issue Feb 17, 2023 · 0 comments · Fixed by #77

Comments

@pedroripper
Copy link
Member

This function should verify if the coefficient for each term is negative, so it can call the NTR_KZFD dispatch.

function quadratize!(
aux::Function,
f::PBF{S,T},
quad::Quadratization{TERM_BY_TERM},
) where {S,T}
# Collect Terms
Ω = collect(f)
# Stable Quadratization
quad.stable && sort!(Ω; by = first, lt = varlt)
for (ω, c) in Ω
quadratize!(aux, f, ω, c, Quadratization{PTR_BG}(quad.stable))
end
return nothing
end

We can just follow the same logic from this dispatch:

function quadratize!(
aux::Function,
f::PBF{S,T},
ω::Set{S},
c::T,
quad::Quadratization{TERM_BY_TERM},
) where {S,T}
if c < zero(T)
quadratize!(aux, f, ω, c, Quadratization{NTR_KZFD}(quad.stable))
else
quadratize!(aux, f, ω, c, Quadratization{PTR_BG}(quad.stable))
end
return nothing
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant