#NEWLINE# def run_solver_on( suite_path , solver_name , task_path , budget , store_answers , seed ) : #NEWLINE# #INDENT# 'Run a solver.' #NEWLINE# import os #NEWLINE# import borg #NEWLINE# logger = borg . get_logger ( __name__ , default_level = 'INFO' ) #NEWLINE# if ( seed is not None ) : #NEWLINE# #INDENT# borg . statistics . set_prng_seeds ( seed ) #NEWLINE# #UNINDENT# suite = borg . load_solvers ( suite_path ) #NEWLINE# with suite . domain . task_from_path ( task_path ) as task : #NEWLINE# #INDENT# with borg . accounting ( ) as accountant : #NEWLINE# #INDENT# answer = suite . solvers [ solver_name ] ( task ) ( budget ) #NEWLINE# #UNINDENT# succeeded = suite . domain . is_final ( task , answer ) #NEWLINE# #UNINDENT# cost = accountant . total . cpu_seconds #NEWLINE# logger . info ( '%s %s in %.2f (of %.2f) on %s' , solver_name , ( 'succeeded' if succeeded else 'failed' ) , cost , budget , os . path . basename ( task_path ) ) #NEWLINE# if store_answers : #NEWLINE# #INDENT# return ( task_path , solver_name , budget , cost , succeeded , answer ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( task_path , solver_name , task , cost , succeeded , None )