Python Forum
Need help designing a multi-threaded solver
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help designing a multi-threaded solver
#1
I was sneered at for having too broad a question on stackOverflow, so I hope this is a reasonable place for a poorly-defined question, because I need help in making it better-defined.

I've been working on refining a solution to the strategy game Qubic, and have close to 100 million positions solved.  That's actually just a beginning, so you get some sense of the scope of what I'm working on.  There is a known solution, but it is not optimal.  I want optimal.  It may take 10 years.

I've been doing the work mostly in C and Python.  C where it has to be fast (the actual solver) and Python where the development has to be fast (everywhere else) because I am the bottleneck, since I'm having trouble putting together a framework that organizes the solving process.

I have several multi-core machines: 2 Core i-7s, a 16-core Xeon and a Core i5 laptop.  The Xeon also has a thousand or so available GPU cores on a spare nVidia card, but I haven't even started coding for that.

So I want to create a framework that will manage the solver.  The main problem is that I cannot predict how long it will take so solve any position.  The way I have been working, they may take 6 minutes on my fastest machine, or may exhaust my patience after a couple of weeks (at which point I usually have to take the machine down for updates or some such).  So I plan on a time limit of a few hours.  When a solver times out, I plan to derive the possible subsequent positions (after 2 moves) and solve those.  Generally, almost all of the subsequent positions involve blunders, and are solved very quickly and I'm left with one or two that are slightly easier to solve than the original position.  Positions are expressed as 64-character strings.  Solutions (or failures) are expressed in somewhat longer strings, less than 512 characters.

I've started looking at Python modules multiprocess, subprocess, threading, and pyzmq.  All are interesting, and I'm having trouble deciding which to use.  I need some guidance.

I track my solutions with an SQLite database and module sqlite3, and this database could also be used by the framework.

my code here
Reply


Messages In This Thread
Need help designing a multi-threaded solver - by 4Dummies - May-30-2017, 02:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sudoku Solver in Python - Can someone explain this code ? qwemx 6 2,172 Jun-27-2022, 12:46 PM
Last Post: deanhystad
  Sudoku Solver, please help to solve a problem. AdithyaR 5 2,159 Oct-28-2021, 03:15 PM
Last Post: deanhystad
  building a sudoku solver usercat123 7 2,814 Oct-01-2021, 08:57 PM
Last Post: deanhystad
  Improves performance on socket multi-threaded servers for object detection pennant 1 1,926 Aug-31-2021, 08:43 AM
Last Post: Larz60+
  Get return value from a threaded function Reverend_Jim 3 17,207 Mar-12-2021, 03:44 AM
Last Post: Reverend_Jim
  Help in designing a timestamp finder for chapter-less TV shows Daring_T 1 1,875 Oct-26-2020, 09:30 PM
Last Post: Daring_T
  unable to use result of solver in another function ross1993hall 0 1,426 Aug-10-2020, 10:29 AM
Last Post: ross1993hall
  Designing a "game" loop api pitosalas 2 2,497 Jun-07-2020, 03:20 PM
Last Post: pitosalas
  Trouble with Sudoku Solver Techmokid 2 2,181 Apr-08-2020, 07:55 AM
Last Post: Techmokid
  Simple mutli-threaded scheduler using sched - stuck Mzarour 2 6,163 Nov-12-2019, 07:44 PM
Last Post: Mzarour

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020