#NEWLINE# def parse_opbdp( variables , optimization , stdout ) : #NEWLINE# #INDENT# 'Parse output from the SCIP solver(s).' #NEWLINE# if re . search ( '^Constraint Set is unsatisfiable\\r?$' , stdout , re . M ) : #NEWLINE# #INDENT# return ( 'UNSATISFIABLE' , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if re . search ( '^Global Minimum: ****** -?[0-9]+ ******\\r?$' , stdout , re . M ) : #NEWLINE# #INDENT# solution_match = re . search ( '^0-1 Variables fixed to 1 :([x0-9 ]*)\\r?$' , stdout , re . M ) #NEWLINE# if solution_match : #NEWLINE# #INDENT# solution = numpy . zeros ( solution_match , bool ) #NEWLINE# ( solution_chunk , ) = answer_match . groups ( ) #NEWLINE# for part in solution_chunk . split ( ) : #NEWLINE# #INDENT# solution [ ( int ( part [ 1 : ] ) - 1 ) ] = True #NEWLINE# #UNINDENT# return ( ( 'OPTIMUM FOUND' if optimization else 'SATISFIABLE' ) , [ ( ( '' if t else '-' ) + ( 'x%i' % ( v + 1 ) ) ) for ( v , t ) in enumerate ( solution ) ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return None