#NEWLINE# def parse_minion( instance , stdout ) : #NEWLINE# #INDENT# answer_match = re . search ( '^Problem solvable\\?: ([a-z]+)\\r?$' , stdout , re . M ) #NEWLINE# if answer_match : #NEWLINE# #INDENT# ( status , ) = answer_match . groups ( ) #NEWLINE# if ( status == 'yes' ) : #NEWLINE# #INDENT# answer_type = ( 'SATISFIABLE' if ( instance . objective is None ) else 'OPTIMUM FOUND' ) #NEWLINE# solution_group = re . findall ( '^Sol: ([01 ]+)\\r?$' , stdout , re . M ) [ ( - 1 ) ] #NEWLINE# solution = map ( int , solution_group . split ( ) ) #NEWLINE# certificate = [ ( ( '' if ( t == 1 ) else '-' ) + ( 'x%i' % ( v + 1 ) ) ) for ( v , t ) in enumerate ( solution ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( status == 'no' ) : #NEWLINE# #INDENT# answer_type = 'UNSATISFIABLE' #NEWLINE# certificate = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# return ( answer_type , certificate ) #NEWLINE# #UNINDENT# return None