cubing / twsearch

🔍 Twizzle Search — a program to find algs and scrambles for twisty puzzles
GNU General Public License v3.0
27 stars 9 forks source link

How to print ALL optimal solutions? #66

Open DougCube opened 21 hours ago

DougCube commented 21 hours ago

I notice that without additonal options, it usually prints a single (and I assume optimal) solution but sometimes it prints 2 or more solutions at the same depth (curious when and why it does this). But I want it to instead print all solutions of the optimal depth. I tried using "-c num" option but then get some suboptimal solutions in addition to optimal ones.

Is there some option to force it to print all optimal solutions?

rokicki commented 21 hours ago

Howdy!

If you know the optimal length beforehand you can stop it from printing suboptimal solutions using the --maxdepth option.

With the -c option, sometimes you get more than you asked for if you multithread, because I don't actually not print a solution when it would be too many since maybe that solution is actually useful and I hate to throw away work done. But if you think it's better than I go ahead and make the -c strict, I could do that. (There's no reasonable way to stop a thread that's searching, so sometimes a thread finds a solution after a previous one has been found and before that thread realizes it's time to stop searching.)

I can definitely see how "all optimal" might be useful and it's likely easy enough to add . . .

-tom

On Sun, Nov 24, 2024 at 10:44 PM DougCube @.***> wrote:

I notice that without additonal options, it usually prints a single (and I assume optimal) solution but sometimes it prints 2 or more solutions at the same depth (curious when and why it does this). But I want it to instead print all solutions of the optimal depth. I tried using "-c num" option but then get some suboptimal solutions in addition to optimal ones.

Is there some option to force it to print all optimal solutions?

— Reply to this email directly, view it on GitHub https://github.com/cubing/twsearch/issues/66, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMOLSZDDSL3LCZEIDFYNOT2CLBMDAVCNFSM6AAAAABSNHDBW6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGY4DSMZYGQ3DMMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

DougCube commented 3 hours ago

Yes, I do think that would be a really valueable feature to add. Hopefully not too difficult to do. In addition to throw away solutions in threads that returned a suboptimal solution.