#NEWLINE# @ borg . annotations ( out_path = 'results output path' , portfolio_name = 'name of the portfolio to train' , train_bundle = ( 'path to pre-recorded runs' , 'positional' , None , os . path . abspath ) , test_bundle = ( 'path to pre-recorded runs' , 'positional' , None , os . path . abspath ) , single = ( 'run a single solver' , 'option' ) , workers = ( 'submit jobs?' , 'option' , 'w' , int ) , local = ( 'workers are local?' , 'flag' ) ) #NEWLINE# def main( out_path , portfolio_name , train_bundle , test_bundle , single = None , workers = 0 , local = False ) : #NEWLINE# #INDENT# 'Simulate portfolio and solver behavior.' #NEWLINE# def yield_runs( ) : #NEWLINE# #INDENT# train_data = borg . storage . RunData . from_bundle ( train_bundle ) #NEWLINE# test_data = borg . storage . RunData . from_bundle ( test_bundle ) #NEWLINE# if ( portfolio_name == '-' ) : #NEWLINE# #INDENT# if ( single is None ) : #NEWLINE# #INDENT# makers = map ( SolverMaker , train_data . solver_names ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# makers = map ( SolverMaker , [ single ] ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# makers = [ PortfolioMaker ( portfolio_name ) ] #NEWLINE# #UNINDENT# for maker in makers : #NEWLINE# #INDENT# for _ in xrange ( 4 ) : #NEWLINE# #INDENT# ( yield ( simulate_split , [ maker , train_data , test_data ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# with open ( out_path , 'w' ) as out_file : #NEWLINE# #INDENT# writer = csv . writer ( out_file ) #NEWLINE# writer . writerow ( [ 'path' , 'solver' , 'budget' , 'cost' , 'success' , 'answer' , 'split' ] ) #NEWLINE# condor . do ( yield_runs ( ) , workers , ( lambda _ , r : writer . writerows ( r ) ) , local )