-
Notifications
You must be signed in to change notification settings - Fork 5
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
Constraints engine materializes entire constraint #89
Comments
Documenting this since this problem is way harder than it seems. @model function inner_model(a, b, c)
x ~ Normal(a, b)
c := exp(x)
end
@model function outer_model(in1, in2, out)
x ~ Gamma(in1, in2)
out ~ inner_model(a = 1, b = x)
end With the following constraints: @constraints begin
for q in inner_model
q(x, a, b) = q(x)q(a,b)
end
end This constraint should push a constraint to the FactorizationConstraint(
(
IndexedVariable(:x, nothing),
IndexedVariable(:a, nothing),
IndexedVariable(:b, nothing),
),
[
FactorizationConstraintEntry([
IndexedVariable(:x, nothing),
]),
FactorizationConstraintEntry([
IndexedVariable(:a, nothing),
IndexedVariable(:b, nothing),
]),
],
) Now the context contains a mapping from these Another approach is that we start from the neighbors of the
This illustrates the problem. Since the variable we try to reference with Also, if we replace the constraints with the "global" representation of the variables mentioned we get into trouble, as the constraint specified above would translate to: FactorizationConstraint(
(
IndexedVariable(:x, nothing),
IndexedVariable(:x, nothing),
IndexedVariable(:constvar_9, nothing),
),
[
FactorizationConstraintEntry([
IndexedVariable(:x, nothing),
]),
FactorizationConstraintEntry([
IndexedVariable(:x, nothing),
IndexedVariable(:constvar_9, nothing),
]),
],
) giving the same problem as above: x is referenced twice here. We also cannot store the NodeLabels directly in the FactorizationConstraint as this would mean that we would have to materialize every indexed statement. @bvdmitri I'm curious about your thoughts on this :) |
ping @wouterwln |
@albertpod this is currently WIP, ETA is somewhere at the end of next week. I'll update the timeline |
Should instead check all neighbors and resolve constraint locally as a BitSetTuple
The text was updated successfully, but these errors were encountered: