Skip to content

Commit

Permalink
add NotImplementedError test
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterwln committed Mar 15, 2024
1 parent 2ea3de8 commit 49570fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,14 @@ function resolve(model::Model, context::Context, variable::IndexedVariable)
return __resolve(model, global_label)
end

resolve(model::Model, context::Context, variable::IndexedVariable{CombinedRange{NTuple{N, Int}, NTuple{N, Int}}}) where {N} = throw(Graphs.NotImplementedError("Cannot resolve factorization constraint for a combined range of dimension > 2."))


function resolve(model::Model, context::Context, variable::IndexedVariable{<:CombinedRange})
global_label = unroll(context[getname(variable)])[CartesianIndex(firstindex(index(variable))):CartesianIndex(lastindex(index(variable)))]
return __resolve(model, global_label)

Check warning on line 733 in src/plugins/variational_constraints/variational_constraints_engine.jl

View check run for this annotation

Codecov / codecov/patch

src/plugins/variational_constraints/variational_constraints_engine.jl#L731-L733

Added lines #L731 - L733 were not covered by tests
end

function resolve(model::Model, context::Context, constraint::FactorizationConstraint)
vfiltered = filter(variable -> haskey(context, getname(variable)), getvariables(constraint))
lhs = map(variable -> resolve(model, context, variable), vfiltered)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1248,4 +1248,8 @@ end
end
end

constraints_5 = @constraints begin
q(prec, y) = q(prec[(1,1):(3, 3)])q(y)
end
@test_throws GraphPPL.Graphs.NotImplementedError model = create_terminated_model(uneven_matrix; plugins = PluginsCollection(VariationalConstraintsPlugin(constraints_5)))
end

0 comments on commit 49570fb

Please sign in to comment.