Pathologically Eclectic Rubbish Lister PerlMonks

### Re^5: Evolving a faster filter? (optimal!)

by LanX (Bishop)
 on Jan 04, 2013 at 21:42 UTC ( #1011723=note: print w/replies, xml ) Need Help??

in reply to Re^4: Evolving a faster filter? (optimal?)
in thread Evolving a faster filter?

Well my argument is sufficient to show that a solution where two adjacent filters don't follow this order can't be optimal, because otherwise swapping those adjacent filters f[i] and f[i+1] would improve the result.

So any optimal solution must follow this strict order criteria. ¹

qed! =)

Cheers Rolf

PS: I'm glad I didn't start implementing the B&B algorithm :-)

UPDATE:

¹) and it's easy to see that all ordered solutions (plural b/c adjacent filters can have the same weight) imply the same total cost.

Replies are listed 'Best First'.
Re^6: Evolving a faster filter? (optimal!)
by tye (Sage) on Jan 04, 2013 at 22:35 UTC

Indeed!

And the number of choices that leaves you with is rather tiny.

Worse (or better), from throwing cases at the code, I bet it is possible to prove that all such orderings are optimal so that the one that sort gives you is optimal.

I think it might not be hard to prove and \$a <= \$b <= \$c implies \$a <= \$c (assuming non-negative cost and selectivity between 0 and 1). And that should be enough.

- tye

Log In?
 Username: Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011723]
help
Chatterbox?
 [thao4]: thao4 [hippo]: Indeed you are. [thao4]: Hi all, I am new in perl. I need do somthing in perl: exemple: - search a patern "CADRE 1.1 CPU" in one file.txt - incremente +30 lines from the line with the patern found - replace the patern "Model Regle" by "Heath Rule A" in this new line (30 line [marto]: good morning all [hippo]: Welcome. Tell me, have you read perlintro? That's a great place to start. [thao4]: I seach to do that since a week but I can't found the answer in google. Thank for your help [Eily]: hello thao4 (and hello all :D), you should [id://http:// perlmonks.org/ index.pl?node_id= 479#post|open a question on Seekers of Perl Wisdom], be sure to include whatever you have tried that didn't work, or only does the job partially [thao4]: yes, I do a little perl since some years but not fréquently, I can correct the triggers in Clearcase of IBM, but write the code : no [Eily]: meh, such good link ... [Eily]: here

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2018-02-21 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When it is dark outside I am happiest to see ...

Results (276 votes). Check out past polls.

Notices?