<s> """<STR_LIT>""" <EOL> import adddeps <EOL> import opentuner <EOL> from opentuner . api import TuningRunManager <EOL> from opentuner . measurement . interface import DefaultMeasurementInterface <EOL> from opentuner . resultsdb . models import Result <EOL> from opentuner . search . manipulator import ConfigurationManipulator <EOL> from opentuner . search . manipulator import IntegerParameter <EOL> import logging <EOL> import argparse <EOL> log = logging . getLogger ( __name__ ) <EOL> def test_func1 ( cfg ) : <EOL> x = cfg [ '<STR_LIT:x>' ] <EOL> y = ( x - <NUM_LIT:10> ) * ( x - <NUM_LIT:10> ) <EOL> log . debug ( "<STR_LIT>" . format ( x , y ) ) <EOL> return y <EOL> def test_func2 ( cfg ) : <EOL> x = cfg [ '<STR_LIT:x>' ] <EOL> y = ( x + <NUM_LIT:10> ) * ( x + <NUM_LIT:10> ) <EOL> log . debug ( "<STR_LIT>" . format ( x , y ) ) <EOL> return y <EOL> def test_func3 ( cfg ) : <EOL> x = cfg [ '<STR_LIT:x>' ] <EOL> y = ( x + <NUM_LIT:20> ) * ( x + <NUM_LIT:20> ) <EOL> log . debug ( "<STR_LIT>" . format ( x , y ) ) <EOL> return y <EOL> def create_test_tuning_run ( db ) : <EOL> parser = argparse . ArgumentParser ( parents = opentuner . argparsers ( ) ) <EOL> args = parser . parse_args ( ) <EOL> args . database = db <EOL> manipulator = ConfigurationManipulator ( ) <EOL> manipulator . add_parameter ( IntegerParameter ( '<STR_LIT:x>' , - <NUM_LIT:200> , <NUM_LIT:200> ) ) <EOL> interface = DefaultMeasurementInterface ( args = args , <EOL> manipulator = manipulator , <EOL> project_name = '<STR_LIT>' , <EOL> program_name = '<STR_LIT>' , <EOL> program_version = '<STR_LIT>' ) <EOL> api = TuningRunManager ( interface , args ) <EOL> return api <EOL> def main ( ) : <EOL> apis = [ create_test_tuning_run ( '<STR_LIT>' ) , <EOL> create_test_tuning_run ( '<STR_LIT>' ) , <EOL> create_test_tuning_run ( '<STR_LIT>' ) ] <EOL> test_funcs = [ test_func1 , test_func2 , test_func3 ] <EOL> for x in xrange ( <NUM_LIT:100> ) : <EOL> for api , test_func in zip ( apis , test_funcs ) : <EOL> desired_result = api . get_next_desired_result ( ) <EOL> if desired_result is None : <EOL> continue <EOL> cfg = desired_result . configuration . data <EOL> result = Result ( time = test_func ( cfg ) ) <EOL> api . report_result ( desired_result , result ) <EOL> best_cfgs = [ api . get_best_configuration ( ) for api in apis ] <EOL> for api in apis : <EOL> api . finish ( ) <EOL> print ( '<STR_LIT>' . format ( best_cfgs ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
