Re: Logic Life Search
Posted: January 28th, 2018, 5:40 pm
What system do you run? I am trying to find out if any Windows users have compiled glucose.
Forums for Conway's Game of Life
https://conwaylife.com/forums/
Code: Select all
$ python lls -m -b 17 12 --symmetry="D2|" -p 3 -x 0 -y 1 --parameters="-maxnbthreads=32"
Getting search pattern...
Done
Preprocessing...
Done
Number of undetermined cells: 314
Number of variables: 516
Number of clauses: 43417
Active width: 17
Active height: 12
Active duration: 4
Solving...
Done
Time taken: 2.3035531044 seconds
x = 19, y = 14, rule = B3/S23
bbbbbbbbbbbbbbbbbbb$
bbobbbbbbbbbbbbbobb$
bbobbbbooboobbbbobb$
bbboobbobbbobboobbb$
bbbooobbobobbooobbb$
bbbooboboboboboobbb$
bbbbobobobobobobbbb$
bbbbbbobobobobbbbbb$
bbobooboobooboobobb$
bobobobbbbbbbobobob$
boboboobbbbboobobob$
bbooobbbbbbbbbooobb$
bbbbbbbbbbbbbbbbbbb$
bbbbbbbbbbbbbbbbbbb!You can try it yourself by using the -M0 option. One test search you could try would be to rule out a knightship of whatever size you need to get a reasonable rumtime.rokicki wrote:In my experiments the "Knuthian" encoding (using only 3-literal clauses) has always been more efficient than the naive encoding, whether using minisat or glucose. I'd love to hear the examples that lead the original author to
decide the other direction.
I don't really have any insight into why some searches go faster than others, other than low periods are much better than higher ones.calcyman wrote:On the other hand, a search for the symmetric c/4 orthogonal is taking hours.
Code: Select all
My-Username@My-IP ~
$ cd logic-life-search
You-Will@Never-Know ~/logic-life-search
$ ./lls test.txt -i
Getting search pattern...
Done
Preprocessing...
Done
Number of undetermined cells: 0
Number of variables: 0
Number of clauses: 1
Active width: 0
Active height: 0
Active duration: 0
Solving...
Traceback (most recent call last):
File "./lls", line 195, in <module>
indent = indent, verbosity = verbosity
File "/home/My-Username/logic-life-search/src/LLS.py", line 61, in preprocess_solve_and_postprocess
indent = indent, verbosity = verbosity
File "/home/My-Username/logic-life-search/src/LLS.py", line 175, in preprocess_and_solve
indent = indent, verbosity = verbosity)
File "/home/My-Username/logic-life-search/src/LLS.py", line 246, in solve
DIMACS_string, solver=solver, parameters=parameters, timeout=timeout, save_dimacs = save_dimacs, dry_run = dry_run, indent = indent + 1, verbosity = verbosity)
File "/home/My-Username/logic-life-search/src/LLS_SAT_solvers.py", line 48, in SAT_solve
solution, time_taken = use_solver(solver, dimacs_file, parameters = parameters, timeout = timeout, indent = indent, verbosity = verbosity)
File "/home/My-Username/logic-life-search/src/LLS_SAT_solvers.py", line 86, in use_solver
stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1025, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directoryCode: Select all
./lls -i test.txt
Getting search pattern...
Done
Preprocessing...
Done
Number of undetermined cells: 0
Number of variables: 0
Number of clauses: 1
Active width: 0
Active height: 0
Active duration: 0
Solving...
Done
Time taken: 0.0202569961548 seconds
UnsatisfiableI think you might have run into an error with glucose. Very occasionally, and only with easy problems, glucose will solve the problem and then continue to run. You'll be able to tell that this has happened because glucose won't be using as much CPU as it normally does. I'll send the glucose team an email about this.rokicki wrote:For a bounding
box of (20x6) glucose couldn't even prove it unsatisfiable, while minisat did
it in 29s (using -M1, the default).
Code: Select all
clauses_copy = [[literal for literal in clause if literal != "0"] for clause in clauses_copy if "1" not in clause]That does sound quite suspicious. What's the contents of "test.txt"? Is it the example I gave above? Maybe I made a typo up there or something. You could try running "./lls -b 4 -i -p4 -x1 -y1" since that's a search for the glider that doesn't need a file. Also try running in -v3 mode to get a better idea of what LLS is doing.Goldtiger997 wrote:"Number of undetermined cells: 0" sounds quite suspicious.
Thanks for your help Macbi. Yes you are right about the contents of "test.txt". Unfortunately, the other search for the glider didn't work either. Here is the output it generated with -v3:Macbi wrote:That does sound quite suspicious. What's the contents of "test.txt"? Is it the example I gave above? Maybe I made a typo up there or something. You could try running "./lls -b 4 -i -p4 -x1 -y1" since that's a search for the glider that doesn't need a file. Also try running in -v3 mode to get a better idea of what LLS is doing.
EDIT: I tried the example I posted and it worked fine for me. It could also be a Windows problem, since Windows uses a different format for newlines in text files than Linux does. I thought I'd accounted for this, but maybe not.
Code: Select all
$ ./lls -b 4 -i -p4 -x1 -y1 -v3
Getting search pattern...
Creating spaceship search pattern...
Pattern created:
0,0,0,0,0,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,0,0,0,0,0
0,0,0,0,0,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,0,0,0,0,0
0,0,0,0,0,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,0,0,0,0,0
0,0,0,0,0,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,0,0,0,0,0
0,0,0,0,0,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,*,*,*,*,0
0,0,0,0,0,0
Done
Standardising variable names...
Done
Done
Preprocessing...
Forcing pattern to move with speed (1, 1)c/4 ...
Done
Forcing at least one cell to be live in first generation...
Number of clauses used: 1
Done
Optimising search pattern...
Improving search pattern (Pass 1) ...
Improving grid...
Done
Improving clause list...
Tidying clauses...
Done
Removing duplicate clauses...
Done
Making deductions...
Done
Done
Done
Improving search pattern (Pass 2) ...
Improving grid...
Done
Improving clause list...
Tidying clauses...
Done
Removing duplicate clauses...
Done
Making deductions...
Done
Done
Done
Improving search pattern (Pass 3) ...
Improving grid...
Done
Done
Done
Enforcing evolution rule...
Method: 1
Number of clauses used: 14440
Done
Optimising search pattern...
Improving search pattern (Pass 1) ...
Improving clause list...
Tidying clauses...
Done
Removing duplicate clauses...
Done
Making deductions...
Done
Done
Done
Improving search pattern (Pass 2) ...
Improving clause list...
Tidying clauses...
Done
Removing duplicate clauses...
Done
Making deductions...
Done
Done
Done
Done
Search pattern optimised to:
Rule = B3/S23
0, 0, 0, 0, 0, 0
0, c0, c1, c2, 0, 0
0, c3, c4, c5, 0, 0
0, c6, c7, c8, 0, 0
0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0
0', 0', 0, 0', 0', 0'
0', c9, c10, c11, 0', 0'
0, c12, c13, c14, c15, 0'
0',c16, c17, c18, 0', 0'
0', 0',c19, 0', 0', 0'
0', 0', 0', 0', 0', 0'
0', 0', 0, 0', 0', 0'
0',c20, c21, c22, c23, 0'
0, c24, c25, c26, c27, 0'
0',c28, c29, c30, c31, 0'
0',c32, c33, c34, 0', 0'
0', 0', 0', 0', 0', 0'
0', 0', 0, 0, 0', 0'
0',c35, c36, c37, c38, 0'
0, c39, c40, c41, c42, 0
0, c43, c44, c45, c46, 0'
0',c47, c48, c49, c50, 0'
0', 0', 0, 0', 0', 0'
0', 0', 0, 0, 0', 0'
0', 0, 0, 0, 0, 0'
0, 0, c0, c1, c2, 0
0, 0, c3, c4, c5, 0
0', 0, c6, c7, c8, 0'
0', 0', 0, 0, 0', 0'
Converting to DIMACS format...
Subsituting in DIMACS variable names...
Done
Creating DIMACS string...
Done
Done
Done
Number of undetermined cells: 51
Number of variables: 51
Number of clauses: 3234
Active width: 4
Active height: 4
Active duration: 5
Solving...
Preparing SAT solver input...
Writing file "lls_dimacs.cnf" ...
Done
Done
Solving with "glucose-syrup" ... (Start time: Mon Jan 29 13:18:35 2018)
Done
Formatting SAT solver output...
SAT solver output:
Error (if any): ""
Time taken: 0.016294002533
Done
Removing DIMACS file...
Done
Done
Time taken: 0.016294002533 seconds
UnsatisfiableActually it did finish in about 9 minutes (I started it up again after I posted).Macbi wrote: I think you might have run into an error with glucose. Very occasionally, and only with easy problems, glucose will solve the problem and then continue to run. You'll be able to tell that this has happened because glucose won't be using as much CPU as it normally does. I'll send the glucose team an email about this.
Can you post the executable? That would help a lot, and I'll see if I get the same issue.Goldtiger997 wrote: I wonder if anyone else with windows/cygwin can reproduce the same results as me...
I understand what was going wrong. Previously, by using "-S minisat", I got error, so I renamed minisat.exe to glucose-syrup.exe and the errors disappeared, But now looking at lines 75-80 of LLS_SAT_solvers.py, I see why it will not work with renaming:Macbi wrote:Didn't you say you were using minisat? But the command you mentioned doesn't have "-S minisat" and it says it's using glucose-syrup. (By the way the reason it's returning UNSAT is that it's not getting any output back from glucose-syrup. But it is apparently finding a glucose-syrup file.)
Code: Select all
if solver in ["minisat","MapleCOMSPS","MapleCOMSPS_LRB","riss"]:
command = [solver_path, file_name, "temp_SAT_solver_output"] + parameter_list
elif solver in ["lingeling","plingeling","treengeling"]:
command = [solver_path, file_name] + parameter_list
elif solver in ["glucose", "glucose-syrup"]:
command = [solver_path, file_name, "-model"] + parameter_listCode: Select all
Solving...
Traceback (most recent call last):
File "./lls", line 195, in <module>
indent = indent, verbosity = verbosity
File "/home/My Username/logic-life-search/src/LLS.py", line 61, in preprocess_solve_and_postprocess
indent = indent, verbosity = verbosity
File "/home/My Username/logic-life-search/src/LLS.py", line 175, in preprocess_and_solve
indent = indent, verbosity = verbosity)
File "/home/My Username/logic-life-search/src/LLS.py", line 246, in solve
DIMACS_string, solver=solver, parameters=parameters, timeout=timeout, save_dimacs = save_dimacs, dry_run = dry_run, indent = indent + 1, verbosity = verbosity)
File "/home/My Username/logic-life-search/src/LLS_SAT_solvers.py", line 48, in SAT_solve
solution, time_taken = use_solver(solver, dimacs_file, parameters = parameters, timeout = timeout, indent = indent, verbosity = verbosity)
File "/home/My Username/logic-life-search/src/LLS_SAT_solvers.py", line 115, in use_solver
solution = LLS_files.string_from_file("temp_SAT_solver_output", indent = indent + 1, verbosity = verbosity)
File "/home/My Username/logic-life-search/src/LLS_files.py", line 8, in string_from_file
with open(file_name, "r") as pattern_file:
IOError: [Errno 2] No such file or directory: 'temp_SAT_solver_output'Code: Select all
$ ./lls -m -b 16 6 -p 3 -x 0 -y 1
Getting search pattern...
Done
Preprocessing...
Done
Number of undetermined cells: 270
Number of variables: 364
Number of clauses: 34177
Active width: 16
Active height: 6
Active duration: 4
Solving...
Done
Time taken: 0.0167660713196 seconds
Unsatisfiable
Yes! Renaming the solver was a clever idea, but sadly they do input and output slightly differently so LLS has to treat them differently.Goldtiger997 wrote:I understand what was going wrong. Previously, by using "-S minisat", I got error, so I renamed minisat.exe to glucose-syrup.exe and the errors disappeared, But now looking at lines 75-80 of LLS_SAT_solvers.py, I see why it will not work with renaming:
Was a file called "temp_SAT_solver_output" actually created?However, by renaming it back to minisat, I get this new error, which involves temp_SAT_solver_output not being able to be found:
Renaming minisat to glucose-syrup totally won't work, they have different output formats.AforAmpere wrote:I got a weird effect, I managed to rename it so it would not give errors, like Goldtiger did, using the same .exe but when I do the same search rokicki did to find a C/3, it returns unsatisfiable
You would just have to add ".txt" after the filename in the linesAforAmpere wrote:If it is adding .txt to the file names, isn't there a fix for that that could be tried? What areas of code interpret the output?
Code: Select all
solution = LLS_files.string_from_file("temp_SAT_solver_output", indent = indent + 1, verbosity = verbosity)Code: Select all
os.remove("temp_SAT_solver_output")AforAmpere wrote:When I run it, it gives no output on the command line.
I actually can't remember. I see if I can work out what I did. It is entirely possible that my weird way of downloading it was the problem. Anyway, we have lingeling now!AforAmpere wrote:How did you download minisat Goldtiger?