The stupid question is the question not asked PerlMonks

### Comment on

 Need Help??
> record their performance in previous runs and you sort them accordingly.

OK some theoretical thoughts of how to sort them:

be c[i] the average cost to run filter[i] on 1 object

be r[i] the average ratio of remaining/checked objects after applying filter[i]

be o the number of objects, c the costs so far

so after applying a filter i

o*=r[i] and c+=o*c[i]

so with an chosen ordering 0,1,2 we get

c = o*c[0]+ o*r[0]*c[1] + o*r[0]*r[1]*c[2] + ...

after restructuring we get

c = o * ( c[0] + r[0] * ( c[1] + r[1] * ( ... ) ) )

I don't know if there is a direct solution for this optimization problem (I could ask some colleagues from uni, I'm pretty sure they know) but this equation is a good base for a "branch-and-bound"¹ - graph search algorithm:

the minimal cost-factor after the first filter is  > c[0] + r[0] * c[min] with c[min] being the minimal cost after excluding filter[0].

These are pretty good branch and bound criteria, which should lead very fast to an optimal solution w/o trying each faculty(@filters) permutation like tye did here.

That means even if your recorded performance for each filter is fuzzy and unstable you can always adapt and recalculate on the fly, even if you have more complicated models with ranges of values for c and r.

Cheers Rolf

¹) for examples of B&B applications see Possible pairings for first knockout round of UEFA champions league or Puzzle Time

In reply to Re^2: Evolving a faster filter? (combinatorics) by LanX
in thread Evolving a faster filter? by Ovid

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.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, 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: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
 [LanX]: b) you cahnge my wikisyntax to support markdown and stay PM compatible [holli]: see moritz, the , how do i put it, robust charme of this site is what separates the wheat from the chaff ^^ [LanX]: I'm willing to improve the code, but we have a götterdämmerung at the moment, Corion is the only active god for some time now [moritz]: and everybody is like "if you just copy 250 lines of ugly JS into your free nodelet, and happent to know about it, there is a 40% that this workaround kinda works, sometimes" [moritz]: ... "so there is no need to do anything" [LanX]: and the code is a bit of a mess [LanX]: moritz, no ... jsut copy one line of my code [moritz]: I'm still using the CB, because ambrus's #cbstream makes it bearable [LanX]: ... the rest is loaded from a node [holli]: the best course of action would be to transfer the data to something well tested. even if it isnt perl based

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2017-11-20 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
In order to be able to say "I know Perl", you must have:

Results (291 votes). Check out past polls.

Notices?