Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
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

@joelanford

Description

@joelanford

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions