Пример #1
0
def prepareOptimization(filename, options):
    
    param_xml_file = open(filename)
    param_config_data = param_xml_file.read()
    
    OptimExper = OptimizationExperiment(param_config_data)
    optimizingParameters = OptimExper.parseExperimentXML()

    stddev_for_parameters=1
    
    scaling_factor=float(0.3)
        
    ai_params_list = []
    ai_param_names_list = []
    ai_lower_bounds = []
    ai_upper_bounds = []
    ai_step_scaling = []
    
    
    for ai_param in optimizingParameters:
        ai_params_list.append(ai_param.get_original())
        ai_param_names_list.append(ai_param.get_name())
        ai_lower_bounds.append(ai_param.get_min())
        ai_upper_bounds.append(ai_param.get_max())
        """ 
        This is magic stuff here
        Scaling stddev for all the parameters acording the min/max values for the search
        apparently this should be 0.3 of the search area if your search area is perfectly round 
        """
        ai_step_scaling.append( (ai_param.get_max()-ai_param.get_min())*scaling_factor )
   
    ai_bounds = [ai_lower_bounds, ai_upper_bounds]
    
    return [ai_bounds, ai_params_list, ai_param_names_list,
     stddev_for_parameters, ai_step_scaling]
Пример #2
0
    def depentantOptimizeParemters(self, options):
        availableProcesses = int(options.processes)
        _dataPath = options.dataPath
        _scenarioSetInitId = options.scenarioSetStartId
        benchmarkFileName = options.benchmarkFileName
        benchmarkTechnique = options.benchmark
        aiModuleName = options.steeringAlgorithm
        logfileName = options.benchmarkFileName
        scenarioSetPath = options.scenarioDirectory
        frameSize = options.frameSize
        _numScenarios = int(options.numScenarios)

        steersuite_semaphore = Semaphore(availableProcesses)

        i = 0

        if options.commandLine:
            commandLine = "-commandline"
        else:
            commandLine = ""

        # ../build/bin/steersim -module $moduleParams -config $configFile
        # valgrind ../build/bin/steersim -module $moduleParams -config $configFile

        optimization_experiement_processes = []

        param_xml_file = open(options.paramFile)
        param_config_data = param_xml_file.read()

        OptimExper = OptimizationExperiment(param_config_data)
        optimizingParameters = OptimExper.parseExperimentXML()

        aiParams = {}

        # optimization_experiment = RunOptimizatinoExperiement()

        experiement_arguments = []

        # this will create a lot of directories but I won't have to worry about
        # syncroniztion and reuse of directories

        results = self.OptimizeParameter(options, optimizingParameters)
        options.i = results[1]
        experiement_arguments.extend(results[0])

        #for experiment in experiement_arguments:
        #    print experiment['steersuite_params']

        # At this point a large list of dictionary objects will have been created that can be
        # passed to an optimization_experiement object to be run

        # print experiement_arguments

        print "Number of experiments in-line: " + str(options.i)

        # sys.exit()
        processes_pool = Pool(processes=availableProcesses)

        processes_pool.map(func=RunExperiment, iterable=experiement_arguments)
        print "Waited for subprocess"
Пример #3
0
    def OptimizeParameters2(self, options):

        options = getOptions()
        options.noReturn = True
        availableProcesses = int(options.processes)
        options.processes = int(1)
        steerStats = SteerStats(options)
        steerStats.set_insert_func(InsertStatistics.InsertOptimizationConfig)

        param_xml_file = open(options.paramFile)
        param_config_data = param_xml_file.read()

        OptimExper = OptimizationExperiment(param_config_data)
        optimizingParameters = OptimExper.parseExperimentXML()

        # print "Algorithm param names: " + str(ai_param_names_list)
        experiements = []
        aiParams = []
        for param in optimizingParameters:

            # this will create a lot of directories but I won't have to worry about
            # syncroniztion and reuse of directories
            for n in range(int(param.get_descetization())):
                aiParams_tmp = {}
                """
                for param_ in optimizingParameters:
                    if param_.get_type() == "float":
                        aiParams_tmp[param_.get_name()] = str(float(param_.get_original()))
                    elif param_.get_type() == "integer":
                        aiParams_tmp[param_.get_name()] = str(int(param_.get_original()))
                """
                # calculate param value for this iteration
                if param.get_type() == "float":
                    paramValue = param.get_min() + (
                        ((param.get_max() - param.get_min()) /
                         param.get_descetization()) * n)
                elif param.get_type() == "integer":
                    paramValue = int(param.get_min() +
                                     (((param.get_max() - param.get_min()) /
                                       param.get_descetization()) * n))
                aiParams_tmp[param.get_name()] = paramValue
                tmp_params = []
                tmp_param_names = []
                for key, value in aiParams_tmp.items():
                    tmp_params.append(value)
                    tmp_param_names.append(key)

                experiements.append(copy.deepcopy(tmp_params))
                aiParams.append(copy.deepcopy(tmp_param_names))

                #TODO stuff here.

        print "Number of experiments in-line: " + str(len(experiements))
        print "Size of process pool: " + str(availableProcesses)

        # sys.exit()
        processes_pool = Pool(availableProcesses)

        processes_pool.map(steerStats.RunStats, experiements, aiParams)
        print "Waited for subprocess"
Пример #4
0
def InsertOptimizationConfig(parameters, configFilePath, aiConfigParams):
    insertData = InsertStatistics(parameters, configFilePath)

    print aiConfigParams
    print insertData
    options = getOptions()
    param_xml_file = open(options.paramFile)
    param_config_data = param_xml_file.read()

    OptimExper = OptimizationExperiment(param_config_data)
    optimizingParameters = OptimExper.parseExperimentXML()
    for param in optimizingParameters:
        if not param.get_name() in aiConfigParams:
            if param.get_type() == "float":
                aiConfigParams[param.get_name()] = str(
                    float(param.get_original()))
            elif param.get_type() == "integer":
                aiConfigParams[param.get_name()] = str(
                    int(param.get_original()))
    aiConfigParams['ppr_ai_config_id'] = insertData['config_id']
    _args = parseArg(parameters)
    if 'dbName' in _args:
        conM = ConnectionManager(dbname=_args['dbName'])
        if options.verbose:
            print "DataBase used: " + _args['dbName']
    else:
        if options.verbose:
            print "DataBase used: " + "steersuitedb"
        conM = ConnectionManager()

    cur = conM.getCursor()

    if _args['scenarioAI'] == "pprAI":
        config_ = PPRConfig(aiConfigParams)
        aiConfigParams['ppr_ai_config_id'] = insertData['config_id']
    elif _args['scenarioAI'] == "rvo2dAI":
        config_ = RVO2DConfig(aiConfigParams)
        aiConfigParams['rvo2d_ai_config_id'] = insertData['config_id']
    elif _args['scenarioAI'] == "sfAI":
        config_ = SFConfig(aiConfigParams)
        aiConfigParams['sf_ai_config_id'] = insertData['config_id']
    else:
        print "Configuration not supported for " + str(_args['scenarioAI'])

    config_.insertConfig2(cur)

    conM.dispose()
    # pprC2 = pprC.getConfigData(cur, 1)

    return insertData
Пример #5
0
def OptimizeWithCMA_ES_MixedInt():
    print "blah"
    options = getOptions()
    
    cmaFilePrefix=options.cmaFilePrefix
    
    result = "blah"
    
    param_xml_file = open(options.paramFile)
    param_config_data = param_xml_file.read()
    
    OptimExper = OptimizationExperiment(param_config_data)
    optimizingParameters = OptimExper.parseExperimentXML()

    stddev_for_parameters=1
    
    scaling_factor=float(0.13)
        
    ai_params_list = []
    ai_param_names_list = []
    ai_lower_bounds = []
    ai_upper_bounds = []
    ai_step_scaling = []
    
    
    for ai_param in optimizingParameters:
        ai_params_list.append(ai_param.get_original())
        ai_param_names_list.append(ai_param.get_name())
        ai_lower_bounds.append(ai_param.get_min())
        ai_upper_bounds.append(ai_param.get_max())
        """ 
        This is magic stuff here
        Scaling stddev for all the parameters acording the min/max values for the search
        apparently this should be 0.3 of the search area if your search area is perfectly round 
        """
        ai_step_scaling.append( (ai_param.get_max()-ai_param.get_min())*scaling_factor )
   
    print "Algorithm param names: " + str(ai_param_names_list)
    ai_bounds = [ai_lower_bounds, ai_upper_bounds]
    
    steerStats = SteerStats(options)
    steerStats.setParamNameDict(ai_param_names_list)
    
    print ai_lower_bounds
    print ai_params_list
    print ai_upper_bounds

    steerStats.pleMetric(ai_params_list, None)
#!/usr/bin/python

import unittest
import psycopg2
import psycopg2.extras
import sys

sys.path.append("../")

from steersuite.OptimizationExperiment import OptimizationExperiment

ppr_param_xml_file = open("data/ppr-param-config.xml")
ppr_param_xml_data = ppr_param_xml_file.read()

O_ex = OptimizationExperiment(ppr_param_xml_data)

OptimParams = O_ex.parseExperimentXML()

for param in OptimParams:
    print param.get_name() + " type: " + str(param.get_type())
    print param.get_original()
Пример #7
0
def OptimizeWithBruteForce():
    # Only works for 2D for now
    # clear; clear; time nice -18 python OptimizeAlgorithm.py --ai sfAI --checkAgentInteraction --numScenarios 1 --benchmark compositePLE --statsOnly --scenarioSetInitId 0 --subspace=../subspaces/icra-subspaces/hallway-one-way-100-agents-funnel.xml --dataDir=data/ --numFrames=2000 --optimizeWith=bruteForce --paramFile=xml/config/subspaces/icra-subspaces/hallway-one-way-1pillar-smallOptimizationRegion.xml -c -p 4 --logMetrics
    import time # aint Python crazy like this
    # from multiprocessing import Pool as Pool
    from multiprocessing.pool import ThreadPool
        
    import itertools
    options = getOptions()
    # options.noReturn=True
    availableProcesses=int(options.processes)
    options.processes=int(1)
    steerStats = SteerStats(options)
    # steerStats.set_insert_func(InsertStatistics.InsertOptimizationConfig)
    
    [ai_bounds, ai_params_list, ai_param_names_list,
    stddev_for_parameters, ai_step_scaling]  = prepareOptimization(options.paramFile, options)
 
    # steerStats = SteerStats(options)
    steerStats.setParamNameDict(ai_param_names_list)
    cmaFilePrefix=options.cmaFilePrefix

    param_xml_file = open(options.paramFile)
    param_config_data = param_xml_file.read()
    
    default_params={}
    for param_name,t_param in zip(ai_param_names_list,ai_params_list):
        default_params[param_name]=t_param
        
    print default_params
    
    OptimExper = OptimizationExperiment(param_config_data)
    optimizingParameters = OptimExper.parseExperimentXML()

    op = OptimizeAlgorithm(options=options)
    ppe = PostProcessEvent_TarData(op)
    pped = PostProcessEvent_DumpOptResults(op)
    ppeh = PostProcessEvent_CreateHeatMap(op)
    
    # op._options=options
    # op.set_metric_func(steerStats.timeMetricGlobal)
    op.set_steerstats(steerStats)
    # op.set_metric_func(steerStats.simulationTimeMetricGlobal)
    if options.objectiveFunction != "":
        op.set_metric_func(steerStats.getBoundObjective(options.objectiveFunction))
    else:
        # op.set_metric_func(steerStats.agentFlowMetricGlobal)
        print 'blah'
    
    op.set_penatly_funct(overlapPenalty)
    
    # result = OptimizeParamsCMA(op.eval,
    #                             ai_params_list, 
    #                       stddev_for_parameters, ai_bounds,
    #                       options.cmaProcesses,
    #                        cmaFilePrefix,
    #                        ai_step_scaling)
    
    #opt_log = open(cmaFilePrefix+"SteerStatsOptResult.txt", "w")
    #writeCMAResults(opt_log, result)
    #opt_log.close()
    
    # print "Algorithm param names: " + str(ai_param_names_list)
    # print optimizingParameters
    experiements = []
    experiements_param = []
    aiParams = []
    for param in optimizingParameters:
    
        # this will create a lot of directories but I won't have to worry about
        # syncroniztion and reuse of directories
        for n in range(int(param.get_descetization())):
            # aiParams_tmp = default_params
            aiParams_tmp = {}
            """
            for param_ in optimizingParameters:
                if param_.get_type() == "float":
                    aiParams_tmp[param_.get_name()] = str(float(param_.get_original()))
                elif param_.get_type() == "integer":
                    aiParams_tmp[param_.get_name()] = str(int(param_.get_original()))
            """
            # calculate param value for this iteration
            if param.get_type() == "float":
                paramValue = param.get_min() + (((param.get_max()-param.get_min())/param.get_descetization())*n)
            elif param.get_type() == "integer":
                paramValue = int(param.get_min() + (((param.get_max()-param.get_min())/param.get_descetization())*n))
            aiParams_tmp[param.get_name()] = paramValue
            tmp_params = []
            tmp_param_names = []        
            for key, value in aiParams_tmp.items() :
                tmp_params.append(value)
                tmp_param_names.append(key)
            # print tmp_params
            # print tmp_param_names
            experiements_param.append(copy.deepcopy(paramValue))
            aiParams.append(copy.deepcopy(tmp_param_names))
        
        experiements.append(experiements_param)
        experiements_param = []  
            #TODO stuff here.
    
    
    print "Number of experiments in-line: " + str(len(experiements))
    print "Size of process pool: " + str(availableProcesses)
    #print "experiements: " + str(experiements)
    # print ""
    experiements = list(itertools.product(experiements[0],experiements[1]))
    # print "Cross product: " + str(experiements)
    
    # sys.exit()
    #try: 
    processes_pool = ThreadPool(availableProcesses)
    # results = processes_pool.apply(op.eval, experiements)
    for item in experiements:
        # this ensures the results come out in the same order the the experiemtns are in this list.
        processes_pool.apply_async(op.eval, args = (item, ), callback = op.log_result)
    processes_pool.close()
    processes_pool.join()
    # print op._result_list 
    # Does not acctually place an obstacle in the scenario because it comes from options.subspaceParams
    control_result = steerStats.RunStats((0,0), options=options)
    control_result = op._metric_func((0,0),results=control_result ,options=options)
   
    # print "Control result: " + str(control_result)
    op._result_list = control_result - numpy.array(op._result_list)
    # print "Corrected results" + str( op._result_list) 
    # processes_pool = Pool(availableProcesses)
    # results = processes_pool.map(op.eval, experiements)
    # except :
    # print "Multi-processing failed: "
    op.set_experiements(experiements)
    # results = map(op.eval, experiements)
    print "Waited for subprocess"
    # print "Results: " + str(zip(results,experiements))
	# write all of the result to a file.
    op.add_post_process_event(pped)
    # create a heatmap from the results
    op.add_post_process_event(ppeh)
    # this post processing step should be added last
    op.add_post_process_event(ppe)
    
    op.post_process()
    print "Done"
Пример #8
0
    def OptimizeParameter(self,
                          options,
                          params_list=None,
                          _ai_params_so_far=""):

        if len(params_list) < 1:
            return [None, None]

        _dataPath = options.dataPath
        _scenarioSetInitId = options.scenarioSetStartId
        benchmarkFileName = options.benchmarkFileName
        benchmarkTechnique = options.benchmark
        aiModuleName = options.steeringAlgorithm
        logfileName = options.benchmarkFileName
        scenarioSetPath = options.scenarioDirectory
        frameSize = options.frameSize
        _numScenarios = int(options.numScenarios)

        param = params_list.pop(0)

        if not hasattr(options, 'i'):
            i = 0
        else:
            i = options.i

        if options.commandLine:
            commandLine = "-commandline"
        else:
            commandLine = ""

        # ../build/bin/steersim -module $moduleParams -config $configFile
        # valgrind ../build/bin/steersim -module $moduleParams -config $configFile

        optimization_experiement_processes = []

        param_xml_file = open(options.paramFile)
        param_config_data = param_xml_file.read()

        OptimExper = OptimizationExperiment(param_config_data)
        optimizingParameters = OptimExper.parseExperimentXML()

        aiParams = {}

        # optimization_experiment = RunOptimizatinoExperiement()

        experiement_arguments = []
        out_results = []

        # this will create a lot of directories but I won't have to worry about
        # syncroniztion and reuse of directories

        if param.get_descetization() == 0:
            _result = self.OptimizeParameter(options,
                                             copy.deepcopy(params_list),
                                             _ai_params_so_far)
            if _result[0] != None:
                out_results.extend(_result[0])
                i = _result[1]
        else:
            for n in range(int(param.get_descetization())):

                dataPath = _dataPath + "/" + str(i)
                i = i + 1
                # print dataPath

                recordingDirectory = dataPath + "/" + options.recordingDirectory + "/"
                frameDirectory = dataPath + "/" + options.frameDirectory + "/"
                ailogFilePath = dataPath + "/" + aiModuleName + ".log"

                # test if any of the files/directories that are going to be used already exist
                # if they do rename them.
                timeNow = str(datetime.now(
                ))  # this will keep all of the directories renamed
                # with the same timestamp
                if True:
                    if os.path.exists(dataPath + "/" + benchmarkFileName):
                        print "Moving old benchmark log file."
                        os.rename(
                            dataPath + "/" + benchmarkFileName, dataPath +
                            "/" + str(timeNow) + "-" + benchmarkFileName)

                    if os.path.exists(ailogFilePath):
                        print "Moving old AI log file."
                        os.rename(
                            ailogFilePath, dataPath + "/" + str(timeNow) +
                            "-" + aiModuleName + ".log")

                    if os.path.exists(recordingDirectory):
                        print "Moving old recording files:"
                        copy_tree(
                            os.path.abspath(recordingDirectory),
                            os.path.abspath(recordingDirectory) + "_bak_" +
                            str(timeNow))
                        purge(recordingDirectory, "rec[0-9]*.rec")

                    # Create directories if they do not exists
                    if not os.path.exists(recordingDirectory):
                        print "Creating directory: " + recordingDirectory
                        os.makedirs(os.path.abspath(recordingDirectory))

                    if not os.path.exists(frameDirectory):
                        print "Creating directory: " + frameDirectory
                        os.makedirs(os.path.abspath(frameDirectory))

                # configFile="configs/footstep-config2.xml"
                configFile = "configs/" + aiModuleName + "-config.xml"

                # sys.exit()

                # regular need scenario module parameters
                moduleParams = "scenario,scenarioAI=" + aiModuleName + ",useBenchmark,benchmarkTechnique=" + benchmarkTechnique + ",benchmarkLog=" + dataPath + "/" + benchmarkFileName + ",checkAgentValid,reducedGoals,fixedSpeed,fixedDirection,checkAgentRelevant,minAgents=3,ailogFileName=" + ailogFilePath  #,randomSeed=120"
                if options.recordSimulation:
                    moduleParams = moduleParams + ",recFile=rec,recFileFolder=" + recordingDirectory  # save record files for later benchmarking

                # moduleParams=+moduleParams+",dumpFrames,framePath="+frameDirectory #save test frames to make videos

                # one one of the following line should ever be included. THe operations exclude eachother.

                # print "number of scenarios to run will be: " + str(_numScenarios)
                moduleParams = moduleParams + ",scenarioSetPath=" + scenarioSetPath + ",scenarioSetInitId=" + str(
                    _scenarioSetInitId) + ",numScenarios=" + str(
                        _numScenarios
                    )  # can be used to load bunch of testcases

                # calculate param value for this iteration
                paramValue = param.get_min() + (
                    ((param.get_max() - param.get_min()) /
                     param.get_descetization()) * n)
                moduleParams = moduleParams + "," + param.get_name(
                ) + "=" + str(paramValue) + _ai_params_so_far
                # this section is for ppr_ai parameters
                # moduleParams=moduleParams+",ped_max_speed=10"
                # moduleParams=moduleParams+",ped_typical_speed=8"
                moduleParams = moduleParams + ",dbName=" + options.dbName

                for param_ in optimizingParameters:
                    if param_.get_type() == "float":
                        aiParams[param_.get_name()] = str(
                            float(param_.get_original()))
                    elif param_.get_type() == "integer":
                        aiParams[param_.get_name()] = str(
                            int(param_.get_original()))

                for key, value in parseArg(_ai_params_so_far).items():
                    aiParams[key] = value
                aiParams[param.get_name()] = paramValue

                # print aiParams
                # sys.exit()
                args_dict = {}
                args_dict['path_to_steersuite'] = "../build/bin/steersim"
                args_dict['steersuite_params'] = moduleParams
                args_dict['config_file_path'] = configFile
                args_dict['commandline_flag'] = commandLine
                args_dict['ai_params'] = copy.deepcopy(aiParams)

                experiement_arguments.append(args_dict)
                options.i = i
                # _result.append(experiement_arguments)
                print moduleParams
                _result = self.OptimizeParameter(
                    options, copy.deepcopy(params_list), _ai_params_so_far +
                    "," + param.get_name() + "=" + str(paramValue))
                # print moduleParams
                if _result[0] != None:
                    out_results.extend(_result[0])
                    i = _result[1]

                # need to see if this is the last parameter to be tested
                discretization_total = 0
                for paramy in params_list:
                    discretization_total = discretization_total + paramy.get_descetization(
                    )
                if discretization_total == 0 and (
                        n == param.get_descetization() - 1):
                    out_results.extend(experiement_arguments)

        # print "******************** module_params " + str(i)
        return [out_results, i]
Пример #9
0
    def OptimizeParameters(self, options):

        availableProcesses = int(options.processes)
        _dataPath = options.dataPath
        _scenarioSetInitId = options.scenarioSetStartId
        benchmarkFileName = options.benchmarkFileName
        benchmarkTechnique = options.benchmark
        aiModuleName = options.steeringAlgorithm
        logfileName = options.benchmarkFileName
        scenarioSetPath = options.scenarioDirectory
        frameSize = options.frameSize
        _numScenarios = int(options.numScenarios)

        steersuite_semaphore = Semaphore(availableProcesses)

        i = 0

        if options.commandLine:
            commandLine = "-commandline"
        else:
            commandLine = ""

        # ../build/bin/steersim -module $moduleParams -config $configFile
        # valgrind ../build/bin/steersim -module $moduleParams -config $configFile

        optimization_experiement_processes = []

        param_xml_file = open(options.paramFile)
        param_config_data = param_xml_file.read()

        OptimExper = OptimizationExperiment(param_config_data)
        optimizingParameters = OptimExper.parseExperimentXML()

        aiParams = {}

        # optimization_experiment = RunOptimizatinoExperiement()

        experiement_arguments = []

        for param in optimizingParameters:

            # this will create a lot of directories but I won't have to worry about
            # syncroniztion and reuse of directories
            for n in range(int(param.get_descetization())):

                dataPath = _dataPath + "/" + str(i)
                i = i + 1
                # print dataPath

                recordingDirectory = dataPath + "/" + options.recordingDirectory + "/"
                frameDirectory = dataPath + "/" + options.frameDirectory + "/"
                ailogFilePath = dataPath + "/" + aiModuleName + ".log"

                # test if any of the files/directories that are going to be used already exist
                # if they do rename them.
                timeNow = str(datetime.now(
                ))  # this will keep all of the directories renamed
                # with the same timestamp
                if True:
                    if os.path.exists(dataPath + "/" + benchmarkFileName):
                        print "Moving old benchmark log file."
                        os.rename(
                            dataPath + "/" + benchmarkFileName, dataPath +
                            "/" + str(timeNow) + "-" + benchmarkFileName)

                    if os.path.exists(ailogFilePath):
                        print "Moving old AI log file."
                        os.rename(
                            ailogFilePath, dataPath + "/" + str(timeNow) +
                            "-" + aiModuleName + ".log")

                    if os.path.exists(recordingDirectory):
                        print "Moving old recording files:"
                        copy_tree(
                            os.path.abspath(recordingDirectory),
                            os.path.abspath(recordingDirectory) + "_bak_" +
                            str(timeNow))
                        purge(recordingDirectory, "rec[0-9]*.rec")

                    # Create directories if they do not exists
                    if not os.path.exists(recordingDirectory):
                        print "Creating directory: " + recordingDirectory
                        os.makedirs(os.path.abspath(recordingDirectory))

                    if not os.path.exists(frameDirectory):
                        print "Creating directory: " + frameDirectory
                        os.makedirs(os.path.abspath(frameDirectory))

                # configFile="configs/footstep-config2.xml"
                configFile = "configs/" + aiModuleName + "-config.xml"

                # sys.exit()

                # regular need scenario module parameters
                moduleParams = "scenario,scenarioAI=" + aiModuleName + ",useBenchmark,benchmarkTechnique=" + benchmarkTechnique + ",benchmarkLog=" + dataPath + "/" + benchmarkFileName + ",checkAgentValid,reducedGoals,fixedSpeed,fixedDirection,checkAgentRelevant,minAgents=3,ailogFileName=" + ailogFilePath  #,randomSeed=120"
                if options.recordSimulation:
                    moduleParams = moduleParams + ",recFile=rec,recFileFolder=" + recordingDirectory  # save record files for later benchmarking
                if options.numFrames != None:
                    moduleParams = moduleParams + ",maxFrames=" + str(
                        options.numFrames)

                moduleParams = moduleParams + ",egocentric"  # puts the reference agent right in the middle of the scenario

                # moduleParams=+moduleParams+",dumpFrames,framePath="+frameDirectory #save test frames to make videos
                if (options.saveFrames and options.framePath != ""):
                    moduleParams = moduleParams + ",dumpFrames,framePath=" + str(
                        options.framePath)
                # one one of the following line should ever be included. THe operations exclude eachother.

                # print "number of scenarios to run will be: " + str(_numScenarios)
                moduleParams = moduleParams + ",scenarioSetPath=" + scenarioSetPath + ",scenarioSetInitId=" + str(
                    _scenarioSetInitId) + ",numScenarios=" + str(
                        _numScenarios
                    )  # can be used to load bunch of testcases
                for param_ in optimizingParameters:
                    if param_.get_type() == "float":
                        aiParams[param_.get_name()] = str(
                            float(param_.get_original()))
                    elif param_.get_type() == "integer":
                        aiParams[param_.get_name()] = str(
                            int(param_.get_original()))
                # calculate param value for this iteration
                paramValue = ""
                if options.passAllParams:
                    for param__ in optimizingParameters:
                        if param_.get_type() == "float":
                            moduleParams = moduleParams + "," + param__.get_name(
                            ) + "=" + str(float(param__.get_original()))
                        elif param_.get_type() == "integer":
                            moduleParams = moduleParams + "," + param__.get_name(
                            ) + "=" + str(float(param__.get_original()))
                else:
                    paramValue = param.get_min() + (
                        ((param.get_max() - param.get_min()) /
                         param.get_descetization()) * n)
                    moduleParams = moduleParams + "," + param.get_name(
                    ) + "=" + str(paramValue)
                    aiParams[param.get_name()] = paramValue
                # this section is for ppr_ai parameters
                # moduleParams=moduleParams+",ped_max_speed=10"
                # moduleParams=moduleParams+",ped_typical_speed=8"
                moduleParams = moduleParams + ",dbName=" + options.dbName

                # print aiParams
                # sys.exit()
                args_dict = {}
                args_dict['path_to_steersuite'] = "../build/bin/steersim"
                args_dict['steersuite_params'] = moduleParams
                args_dict['config_file_path'] = configFile
                args_dict['commandline_flag'] = commandLine
                args_dict['ai_params'] = copy.deepcopy(aiParams)

                experiement_arguments.append(args_dict)

        # At this point a large list of dictionary objects will have been created that can be
        # passed to an optimization_experiement object to be run

        # print experiement_arguments

        print "Number of experiments in-line: " + str(i)

        # sys.exit()
        processes_pool = Pool(processes=availableProcesses)

        processes_pool.map(func=RunExperiment, iterable=experiement_arguments)
        print "Waited for subprocess"