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

Not_found error when combining constraints with findall_solutions #311

Open
nguermond opened this issue Jan 31, 2025 · 3 comments
Open

Not_found error when combining constraints with findall_solutions #311

nguermond opened this issue Jan 31, 2025 · 3 comments

Comments

@nguermond
Copy link

When I run the following

main :- declare_constraint (U = 2) [U],
        findall_solutions (U = 1) Solns.

I get the error Fatal error: exception Not_found with no explanation.
This feels like an uncaught exception somewhere.
I'm using elpi 2.0.6.

@gares
Copy link
Contributor

gares commented Feb 17, 2025

This is an oversight. Findall creates a new runtime, but does not copy there any constraint.
There is only a check that any solution found does not come with constraints, so I cannot blindly copy the constraints over.

@gares
Copy link
Contributor

gares commented Feb 17, 2025

Maybe we should have 2 APIs:

  • findall_solutions that disregards constraints (and does not raise Not_found either, of course), to be backward compatible
  • findall_solutions_constraints that copies all constraints and accepts solutions with constraints. In this case it may be reasonable to also return these constraints, eg Sols = [ pr Q [declare_constraint C L, ...] , ....]

@nguermond
Copy link
Author

I was able to find a workaround, so no longer have a use case for this, but in principle it would make sense to have findall_solutions_constraints. In the short term it would help to have a more useful error message and a remark in the documentation for findall_solutions.

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

No branches or pull requests

2 participants