|We don't bite newbies here... much|
Powerset short-circuit optimizationby Limbic~Region (Chancellor)
|on Oct 03, 2006 at 15:23 UTC||Need Help??|
Limbic~Region has asked for the wisdom of the Perl Monks concerning the following question:
I would like to find a way to generate the powerset such that all subsets below the current set can be skipped if a condition is met. I think a concrete example might better explain. Assume our set contains 'A' .. 'D';
I omitted the empty set as it has no practical purposes for my problem. The following re-ordering is an example of the optimization I am hoping to use:
So if the condition for 'ABCD' was true, I would skip the entire powerset. If 'ABC' was true I would skip to 'ABD'. If 'ABD' was false but 'AD' was true I would skip to 'BD'.
This exact ordering isn't necessary and I am not sure if it helped explain my desire at all. Ultimately the goal is to generate the powerset for a list of sets but avoid duplication where possible. Using another example:
They share sets ABC, AB, AC, BC, A, B, and C so why generate them three times? I have used a similar technique in the past with success but I can't seem to wrap my head around how to do it here. Your thoughts and insights are appreciated.
Update: It was suggested in a /msg that I be more specific about the rules and not assume the examples are sufficient.
Cheers - L~R