Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.080 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'algorithm': 0.04; 'column': 0.07; '128': 0.09; 'rows': 0.09; 'rows,': 0.09; 'things,': 0.09; 'python': 0.11; 'creates': 0.14; 'times,': 0.14; '1:13': 0.16; 'algorithm.': 0.16; 'cases:': 0.16; 'clues': 0.16; 'columns': 0.16; 'likewise': 0.16; 'posted.': 0.16; 'sense,': 0.16; 'solver': 0.16; 'solver.': 0.16; 'variants': 0.16; 'vastly': 0.16; 'wording': 0.16; 'wrote:': 0.18; '(but': 0.19; 'solution.': 0.20; '>>>': 0.22; 'example': 0.22; 'proposed': 0.22; 'header :User-Agent:1': 0.23; 'error': 0.23; 'replace': 0.24; 'specify': 0.24; 'mon,': 0.24; 'equivalent': 0.26; 'second': 0.26; 'least': 0.26; 'certain': 0.27; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'thus': 0.29; '(since': 0.31; '>>>>': 0.31; 'cells': 0.31; 'equivalent.': 0.31; 'lists': 0.32; 'probably': 0.32; 'covered': 0.32; 'becomes': 0.33; 'maybe': 0.34; 'could': 0.34; 'something': 0.35; 'beyond': 0.35; 'but': 0.35; 'there': 0.35; 'possible': 0.36; 'similar': 0.36; 'example,': 0.37; 'wrong': 0.37; 'christian': 0.38; 'minimum': 0.38; 'ends': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'even': 0.60; 'ian': 0.60; 'affect': 0.61; 'ago,': 0.61; 'new': 0.61; 'matter': 0.61; 'further': 0.61; 'first': 0.61; 'back': 0.62; 'times': 0.62; 'choose': 0.64; 'map': 0.64; 'become': 0.64; 'different': 0.65; '30,': 0.65; 'charset:windows-1252': 0.65; 'between': 0.67; 'mar': 0.68; 'received:74.208': 0.68; 'sound': 0.68; 'eight': 0.74; 'forth': 0.81; '2015': 0.84; '5.9': 0.84; '884': 0.84; 'benchmark': 0.84; 'boxes.': 0.84; 'mirroring': 0.84; 'received:74.208.4.194': 0.84; 'right).': 0.84; 'timings': 0.84; 'careful': 0.91; 'closer.': 0.91; 'examine': 0.93; 'realistic': 0.93 Date: Mon, 30 Mar 2015 04:16:58 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Sudoku solver References: <87r3sdnw5t.fsf@elektro.pacujo.net> <4e81bdb9-52db-46e6-b449-d4241cb2a3f2@googlegroups.com> <87twx8amww.fsf@elektro.pacujo.net> <82e7c5b9-2f0f-405b-859c-b74916c475e0@googlegroups.com> <55176c2c$0$13009$c3e8da3$5496439d@news.astraweb.com> <87619j7kbu.fsf@elektro.pacujo.net> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:KlS5NnbXhr2BJB/Je9bFxPepfrDUkz/PowaRf/95vAI6iRLChfZ zbqfZh2VkBzUA8V9huYVjOd7HKrM59t7nVbahHzxW41tN4Uo3xSquTQRLP9WEOKgvau8XVj vKvWgmyDQ9+panForNkI8nbNEhKocM0uH6Rj8IVW3J7pKtS1pJ0LFQ6+a/MBo3UKwnWlV6V 5b0qzCSrpQfvLfQc6VvkA== X-UI-Out-Filterresults: notjunk:1; X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 67 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427703431 news.xs4all.nl 2966 [2001:888:2000:d::a6]:54024 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 6968 X-Received-Body-CRC: 92578453 Xref: csiph.com comp.lang.python:88323 On 03/30/2015 03:29 AM, Ian Kelly wrote: > On Mon, Mar 30, 2015 at 1:13 AM, Christian Gollwitzer wrote: >> Am 30.03.15 um 08:50 schrieb Ian Kelly: >>> >>> On Sun, Mar 29, 2015 at 12:03 PM, Marko Rauhamaa wrote: >>>> >>>> Be careful with the benchmark comparisons. Ian's example can be solved >>>> with the identical algorithm in eight different ways (four corners, left >>>> or right). I ran the example with my recent Python solver and got these >>>> times in the eight cases: >>>> >>>> 884 s >>>> 2.5 s >>>> 13 s >>>> 499 s >>>> 5.9 s >>>> 128 s >>>> 1360 s >>>> 36 s >>> >>> >>> That sounds to me like either a transcription error was made to the >>> puzzle at some point, or there's something wrong with your solver. The >>> whole point of that example was that it was a puzzle with the minimum >>> number of clues to specify a unique solution. >> >> I think Marko meant, that if he creates symmetrically equivalent puzzles by >> rotating / mirroring the grid, he gets vastly different execution times, but >> ends up with the same solution. > > That makes sense, but it is true for all puzzles that there are eight > possible orientations (since it's impossible for a puzzle solution to > be symmetric), and the wording made it sound like he was describing a > property specific to the puzzle that I posted. > But for some puzzles, the 8 timings may be much closer. Or maybe even further apart. Incidentally, there are many other variants of the same puzzle that might matter, beyond those 8. The digits can all be crypto'ed Like replace all 4 with 8, etc. Probably won't matter for any realistic algorithm. The columns can be reordered, in at least some ways. For example, if the first and second columns are swapped, it's a new puzzle, equivalent. Likewise certain rows. The relationship between row, column and box can be rearranged. Some of these are already covered by the rotations proposed earlier, where for a 90 degree rotate, row becomes column and column becomes row. But in a similar way each box could become a column, and so on. All of these rearrangeements will change the order that an algorithm might choose to examine things, and thus affect timings (but not the solution). When I made my own solver years ago, I considered the puzzle to have 9 columns, 9 rows, and 9 boxes. So these 27 lists of 9 could be analyzed. I just came up with a fast way to map those 243 cells back and forth with the original 81. At that point, it no longer mattered which things were rows and which were columns or boxes. -- DaveA