BrowserUk,
I really like this heuristic approach. Take a best guess and then see if it can be refined to get a better score. I am thinking about posting a "Challenge: Letter Power Revisited" thread so I have been considering how to generate puzzles at random. I was able to find an example where your solution does not provide the best solution in just 3 tries:

modems decamp saddens invokes paw odysseys fuddled absorbs delude eyes +ore cleat cloaks clincher sometime mating bushel shinnied probably fuckers lummo +xes uptown caseload hawker sleekest buzzard bartered songbird pilgrim steepen pithily bruiser shirking kin +ks hooking chalice town clutch mongrels frig pine fibre spindles doughy printing burned rendered warhorse spooked glumness solarium baseless roared steward lo +am carillon ratting inhabits examiner marshals rockiest jemmied zappy alcohols fixers refiners modeler outlook pastels spin prior paired gli +ders wags demean intend stalest streaker twinset equated negated quenched sheered accord shambles capably raffia page washer brownie hussar etches tethe +rs track lifts ricks knows giblets dozy pacify exhausts haulage squires bologna stacking __DATA__ 335 : [ eyesore sleekest bartered printing rendered marshals alcohols +streaker shambles exhausts ] 340 : [ eyesore sleekest steepen printing rendered marshals alcohols s +treaker shambles exhausts ] 374 : [ eyesore sleekest steepen spindles rendered marshals alcohols s +treaker shambles exhausts ] 402 : [ eyesore sleekest steepen spindles baseless marshals alcohols s +treaker shambles exhausts ] 424 : [ eyesore sleekest steepen spindles baseless marshals refiners s +treaker shambles exhausts ] 428 : [ eyesore sleekest steepen spindles baseless marshals pastels st +reaker shambles exhausts ] 434 : [ eyesore sleekest steepen spindles baseless marshals pastels sh +eered shambles exhausts ]
It can be show that a better solution exists (not necessarily best):
438 : [ eyesore sleekest steepen spindles baseless rockiest refiners s +heered tethers exhausts ]

My heuristic solution is very similar to yours. Rather than picking the best individual score from each group, I calculate the letter frequency across all words. Then I select the word from each group that has the highest score based on that frequency analysis. I have also modified the refinement loop to limit the number of loops to handle the edge case where picking the best individual scores is the worst thing to do.

LOOP: for (1 .. $max_loops) { # your refinement loop if ($better) { # update best next LOOP; } # end of your refinement loop last; }
This way you pick a "good enough" score in a reasonable time frame no matter what.

I am now going to try and figure out if I can do a smart exhaustive search to guarantee best solution in a reasonable runtime (less than 2 hours). If I can, I will post a new thread comparing naive brute force, optimized brute force, heuristic, optimized heuristic.

Cheers - L~R


In reply to Re^2: Challenge: Letter Power by Limbic~Region
in thread Challenge: Letter Power by Tanktalus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.