<s> __author__ = '<STR_LIT>' <EOL> def timeBoundExecution ( algo , maxtime ) : <EOL> """<STR_LIT>""" <EOL> return algo <EOL> class LevinSeach : <EOL> """<STR_LIT>""" <EOL> def stoppingCriterion ( self , val ) : <EOL> return val == True <EOL> def run ( self , input , generator ) : <EOL> complexities = { } <EOL> piter = generator . orderedEnumeration ( ) <EOL> maxLevin = <NUM_LIT:1> <EOL> while True : <EOL> c = <NUM_LIT:0> <EOL> while c <= maxLevin : <EOL> try : <EOL> c , p = next ( piter ) <EOL> except StopIteration : <EOL> break <EOL> if c not in complexities : <EOL> complexities [ c ] = [ p ] <EOL> else : <EOL> complexities [ c ] . append ( p ) <EOL> for c in range ( maxLevin ) : <EOL> for p in complexities [ c ] : <EOL> boundP = timeBoundExecution ( p , <NUM_LIT:2> ** ( maxLevin - c ) / maxLevin ) <EOL> res = boundP . run ( input ) <EOL> if self . stoppingCriterion ( res ) : <EOL> return res <EOL> maxLevin += <NUM_LIT:1> </s>
