SAT4J embbeding solver exception

185 Views Asked by At

i am trying to build N*N Queen placement problem solver for my school project. I have made a program, that is generating CNF statements. I tried to give its adress as argument to the "SAT4J embbeding solver" 7th page, 3.1 ,however it keeps throwing ParseFormatException. I also tried to use this text file i found on stackoverflow:

c you can put comment here.

c Formatted by StackOverFlow.

p cnf 9 12

-1 2

-2 1

-3 4

-4 3

1

3

-5 -4

-6 -4

-7 -4

-8 -4

-9 -4

-2 -4

No luck either. The only thing i editted is the catch block of exception, so i can see which one it is. I am trying to give it arguments trough Alt+Shift+F10 configuration menu in IntelliJ Idea Community edition.

Can someone please help me/guide me? This is my first time working with someones else code + there is nothing i would call tutorial available.

Maybe, you could suggest me other way. I just need the SAT solver to solve this problem and give me output, so i can take it and make graphical representation of the chessboard :)

Class code as of now.

1

There are 1 best solutions below

1
Daniel Le Berre On BEST ANSWER

You just need to end your lines with a 0, and avoid extra newlines,e.g.

c you can put comment here.
p cnf 9 12
-1 2 0
-2 1 0
-3 4 0
-4 3 0
1 0
3 0
-5 -4 0
-6 -4 0
-7 -4 0
-8 -4 0
-9 -4 0
-2 -4 0

should work fine.