Search code examples
scalasatsat4j

Using a SAT solver from Scala class


I need to invoke a generic SAT solver from an application written in Scala. I was looking into SAT4J since it can be easily imported as a jar file however am finding it difficult to actually use it. Is there a way I can fire the SAT4j jar file to compute my SAT problem from within my Scala code?

If SAT4J is not the right approach, are there any SAT libraries I can use directly instead of launching an external SAT solver?


Solution

  • Sat4j is pure Java so you can directly use it within scala as long as the jar is available on Scala classpath.

    Sat4j has a scala binding: https://gitlab.ow2.org/sat4j/sat4j/tree/master/org.sat4j.scala

    You can build it from source, or grab it from continuous integration: https://gitlab.ow2.org/sat4j/sat4j/pipelines/95/builds