Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Using solver.Solution.Error() is awkward and unintuitive #139

Closed
joelanford opened this issue Aug 11, 2023 · 0 comments · Fixed by #140
Closed

Using solver.Solution.Error() is awkward and unintuitive #139

joelanford opened this issue Aug 11, 2023 · 0 comments · Fixed by #140

Comments

@joelanford
Copy link
Member

I expected this to work correctly:

if err := solution.Error(); err != nil {
  log.Println(err)
}

In reality, this code always logs "constraints not satisfiable", even the the solution was SAT.

To handle this correctly, I had to use this code instead:

unsat := deppy.NotSatisfiable{}
if errors.As(solution.Error(), &unsat); len(unsat) > 0 {
	log.Println(unsat.Error())
}

We should fix solution.Error() to return an untyped nil error if the solution was SAT.

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

Successfully merging a pull request may close this issue.

1 participant