plt.style.use('ggplot') import numpy as np from scipy.stats import ttest_ind from dataAnalysis import * from machinePolicy.onlineVIWithObstacle import RunVI gridSize = 15 noise = 0.067 noiseActionSpace = [(0, -1), (0, 1), (-1, 0), (1, 0), (1, 1), (1, -1), (-1, -1), (-1, 1)] gamma = 0.9 goalReward = [30] actionSpace = [(0, -1), (0, 1), (-1, 0), (1, 0)] runVI = RunVI(gridSize, actionSpace, noiseActionSpace, noise, gamma, goalReward) softmaxBeta = 2.5 softmaxPolicy = SoftmaxPolicy(softmaxBeta) initPrior = [0.5, 0.5] intentionInfernce = IntentionInfernce(initPrior, softmaxPolicy, runVI) inferThreshold = .9 calFirstIntentionFromPosterior = CalFirstIntentionFromPosterior(inferThreshold) if __name__ == '__main__': resultsPath = os.path.join(os.path.join(DIRNAME, '..'), 'results') statsList = [] stdList = [] statData = [] # participants = ['human', 'softmaxBeta0.1', 'softmaxBeta0.5', 'softmaxBeta1', 'softmaxBeta2.5', 'softmaxBeta5'] # participants = ['human', 'noise0.0673_softmaxBeta2.5']
def main(): picturePath = os.path.abspath(os.path.join(os.path.join(os.getcwd(), os.pardir), 'pictures')) resultsPath = os.path.abspath(os.path.join(os.path.join(os.getcwd(), os.pardir), 'results')) machinePolicyPath = os.path.abspath(os.path.join(os.path.join(os.getcwd(), os.pardir), 'machinePolicy')) dataPath = os.path.abspath(os.path.join(os.path.join(os.getcwd(), os.pardir), 'conditionData')) df = pd.read_csv(os.path.join(dataPath, 'DesignConditionForAvoidCommitmentZone.csv')) df['intentionedDisToTargetMin'] = df.apply(lambda x: x['minDis'] - x['avoidCommitmentZone'], axis=1) gridSize = 15 bounds = [0, 0, gridSize - 1, gridSize - 1] screenWidth = 600 screenHeight = 600 fullScreen = False renderOn = False initializeScreen = InitializeScreen(screenWidth, screenHeight, fullScreen) screen = initializeScreen() # pg.mouse.set_visible(False) leaveEdgeSpace = 2 lineWidth = 1 backgroundColor = [205, 255, 204] lineColor = [0, 0, 0] targetColor = [255, 50, 50] playerColor = [50, 50, 255] targetRadius = 10 playerRadius = 10 textColorTuple = (255, 50, 50) drawBackground = DrawBackground(screen, gridSize, leaveEdgeSpace, backgroundColor, lineColor, lineWidth, textColorTuple) drawText = DrawText(screen, drawBackground) drawNewState = DrawNewState(screen, drawBackground, targetColor, playerColor, targetRadius, playerRadius) drawImage = DrawImage(screen) # condition maps condition = namedtuple('condition', 'name decisionSteps initAgent avoidCommitPoint crossPoint targetDisToCrossPoint fixedObstacles') map1ObsStep0a = condition(name='expCondition1', decisionSteps=0, initAgent=(0, 2), avoidCommitPoint=(1, 2), crossPoint=(3, 3), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(1, 1), (1, 3), (3, 1)]) map2ObsStep0a = condition(name='expCondition2', decisionSteps=0, initAgent=(0, 2), avoidCommitPoint=(1, 2), crossPoint=(4, 4), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(1, 1), (1, 3), (3, 1), (1, 4), (4, 1)]) map1ObsStep0b = condition(name='expCondition1', decisionSteps=0, initAgent=(2, 0), avoidCommitPoint=(2, 1), crossPoint=(3, 3), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(1, 1), (1, 3), (3, 1)]) map2ObsStep0b = condition(name='expCondition2', decisionSteps=0, initAgent=(2, 0), avoidCommitPoint=(2, 1), crossPoint=(4, 4), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(1, 1), (1, 3), (3, 1), (1, 4), (4, 1)]) map1ObsStep1a = condition(name='expCondition1', decisionSteps=1, initAgent=(1, 0), avoidCommitPoint=(2, 1), crossPoint=(3, 3), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(1, 1), (1, 3), (3, 1)]) map2ObsStep1a = condition(name='expCondition2', decisionSteps=1, initAgent=(1, 0), avoidCommitPoint=(2, 1), crossPoint=(4, 4), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(1, 1), (1, 3), (3, 1), (1, 4), (4, 1)]) map1ObsStep1b = condition(name='expCondition1', decisionSteps=1, initAgent=(0, 1), avoidCommitPoint=(1, 2), crossPoint=(3, 3), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(1, 1), (1, 3), (3, 1)]) map2ObsStep1b = condition(name='expCondition2', decisionSteps=1, initAgent=(0, 1), avoidCommitPoint=(1, 2), crossPoint=(4, 4), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(1, 1), (1, 3), (3, 1), (1, 4), (4, 1)]) map1ObsStep2 = condition(name='expCondition1', decisionSteps=2, initAgent=(0, 0), avoidCommitPoint=(2, 2), crossPoint=(3, 3), targetDisToCrossPoint=[4, 5, 6], fixedObstacles=[(1, 1), (1, 3), (3, 1)]) map2ObsStep2 = condition(name='expCondition2', decisionSteps=2, initAgent=(0, 0), avoidCommitPoint=(2, 2), crossPoint=(4, 4), targetDisToCrossPoint=[4, 5, 6], fixedObstacles=[(1, 1), (1, 3), (3, 1), (1, 4), (4, 1)]) map1ObsStep4 = condition(name='expCondition1', decisionSteps=4, initAgent=(0, 0), avoidCommitPoint=(3, 3), crossPoint=(4, 4), targetDisToCrossPoint=[4, 5, 6], fixedObstacles=[(2, 2), (2, 0), (2, 4), (0, 2), (4, 2)]) map2ObsStep4 = condition(name='expCondition2', decisionSteps=4, initAgent=(0, 0), avoidCommitPoint=(3, 3), crossPoint=(5, 5), targetDisToCrossPoint=[4, 5, 6], fixedObstacles=[(2, 2), (2, 0), (2, 4), (0, 2), (4, 2), (2, 5), (5, 2)]) map1ObsStep6 = condition(name='expCondition1', decisionSteps=6, initAgent=(0, 0), avoidCommitPoint=(4, 4), crossPoint=(5, 5), targetDisToCrossPoint=[4, 5, 6], fixedObstacles=[(3, 3), (4, 0), (3, 1), (3, 5), (5, 3), (1, 3), (0, 4)]) map2ObsStep6 = condition(name='expCondition2', decisionSteps=6, initAgent=(0, 0), avoidCommitPoint=(4, 4), crossPoint=(6, 6), targetDisToCrossPoint=[4, 5, 6], fixedObstacles=[(3, 3), (4, 0), (3, 1), (3, 5), (5, 3), (1, 3), (0, 4), (3, 6), (6, 3), ]) specialCondition = condition(name='specialCondition', decisionSteps=0, initAgent=(0, 0), avoidCommitPoint=[-1, -1], crossPoint=(5, 5), targetDisToCrossPoint=[5], fixedObstacles=[(3, 0), (0, 3), (1, 4), (1, 6), (4, 1), (6, 1), (6, 2), (2, 6), (5, 3), (3, 5)]) controlCondition1 = condition(name='controlCondition', decisionSteps=0, initAgent=(0, 0), avoidCommitPoint=[-1, -1], crossPoint=(5, 5), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(3, 0), (0, 3), (1, 4), (1, 6), (4, 1), (6, 1), (6, 2), (2, 6), (5, 3), (3, 5)]) controlCondition2 = condition(name='controlCondition', decisionSteps=0, initAgent=(0, 0), avoidCommitPoint=[-1, -1], crossPoint=(5, 5), targetDisToCrossPoint=[5, 6, 7], fixedObstacles=[(3, 0), (0, 3), (1, 4), (5, 3), (4, 1), (3, 5), (2, 2), (6, 1), (6, 2), (1, 6), (2, 6), (5, 3)]) numOfObstacles = 18 controlDiffList = [0, 1, 2] minSteps = 8 maxsteps = 13 minDistanceBetweenTargets = 4 minDistanceBetweenGrids = max(controlDiffList) + 1 maxDistanceBetweenGrids = calculateMaxDistanceOfGrid(bounds) - minDistanceBetweenGrids randomWorld = RandomWorld(bounds, minDistanceBetweenGrids, maxDistanceBetweenGrids, numOfObstacles) randomCondition = namedtuple('condition', 'name creatMap decisionSteps minSteps maxsteps minDistanceBetweenTargets controlDiffList') randomMaps = randomCondition(name='randomCondition', creatMap=randomWorld, decisionSteps=0, minSteps=minSteps, maxsteps=maxsteps, minDistanceBetweenTargets=minDistanceBetweenTargets, controlDiffList=controlDiffList) conditionList = [map1ObsStep0a, map1ObsStep0b, map1ObsStep1a, map1ObsStep1b, controlCondition1] + [map1ObsStep2, map1ObsStep4, map1ObsStep6] * 2 + [map2ObsStep0a, map2ObsStep0b, map2ObsStep1a, map2ObsStep1b, controlCondition2] + [map2ObsStep2, map2ObsStep4, map2ObsStep6] * 2 + [randomMaps] * 2 targetDiffsList = [0, 1, 2, 'controlAvoid'] # conditionList = [map1ObsStep0a] + [randomMaps] * 2 n = 1 numBlocks = 3 * n expDesignValues = [[condition, diff] for condition in conditionList for diff in targetDiffsList] * numBlocks numExpTrial = len(expDesignValues) # conditionList = [condition2] specialDesign = [specialCondition, 0] numTrialsPerNoiseBlock = 3 noiseCondition = list(permutations([1, 2, 0], numTrialsPerNoiseBlock)) + [(1, 1, 1)] blockNumber = int(numExpTrial / numTrialsPerNoiseBlock) noiseDesignValues = createNoiseDesignValue(noiseCondition, blockNumber) rotatePoint = RotatePoint(gridSize) isInBoundary = IsInBoundary([0, gridSize - 1], [0, gridSize - 1]) rotateAngles = [0, 90, 180, 270] creatMap = CreatMap(rotateAngles, gridSize, rotatePoint, numOfObstacles) checkBoundary = CheckBoundary([0, gridSize - 1], [0, gridSize - 1]) noiseActionSpace = [(0, -1), (0, 1), (-1, 0), (1, 0), (1, 1), (1, -1), (-1, -1), (-1, 1)] normalNoise = AimActionWithNoise(noiseActionSpace, gridSize) specialNoise = backToCrossPointNoise # initPrior = [0.5, 0.5] # inferGoalPosterior = InferGoalPosterior(goalPolicy) softmaxBetaList = [2.5] noise = 0.067 gamma = 0.9 goalReward = [50, 50] actionSpace = [(0, -1), (0, 1), (-1, 0), (1, 0)] runVI = RunVI(gridSize, actionSpace, noiseActionSpace, noise, gamma, goalReward) for softmaxBeta in softmaxBetaList: # for noise in noiseList: for i in range(20): print(i) expDesignValues = [[condition, diff] for condition in conditionList for diff in targetDiffsList] * numBlocks random.shuffle(expDesignValues) expDesignValues.append(specialDesign) modelController = ModelControllerOnline(softmaxBeta) # modelController = AvoidCommitModel(softmaxBeta, actionSpace, checkBoundary) controller = modelController renderOn = 1 normalTrial = NormalTrial(renderOn, controller, drawNewState, drawText, normalNoise, checkBoundary) specialTrial = SpecialTrial(renderOn, controller, drawNewState, drawText, specialNoise, checkBoundary) experimentValues = co.OrderedDict() experimentValues["name"] = "noise" + str(noise) + '_' + "softmaxBeta" + str(softmaxBeta) + '_' + str(i) resultsDirPath = os.path.join(resultsPath, "noise" + str(noise) + '_' + "softmaxBeta" + str(softmaxBeta)) if not os.path.exists(resultsDirPath): os.mkdir(resultsDirPath) writerPath = os.path.join(resultsDirPath, experimentValues["name"] + '.csv') writer = WriteDataFrameToCSV(writerPath) experiment = ObstacleModelSimulation(creatMap, normalTrial, specialTrial, writer, experimentValues, drawImage, resultsPath, runVI) experiment(noiseDesignValues, expDesignValues)
def main(): picturePath = os.path.abspath( os.path.join(os.path.join(os.getcwd(), os.pardir), 'pictures')) resultsPath = os.path.abspath( os.path.join(os.path.join(os.getcwd(), os.pardir), 'results')) machinePolicyPath = os.path.abspath( os.path.join(os.path.join(os.getcwd(), os.pardir), 'machinePolicy')) dataPath = os.path.abspath( os.path.join(os.path.join(os.getcwd(), os.pardir), 'conditionData')) df = pd.read_csv( os.path.join(dataPath, 'DesignConditionForAvoidCommitmentZone.csv')) df['intentionedDisToTargetMin'] = df.apply( lambda x: x['minDis'] - x['avoidCommitmentZone'], axis=1) gridSize = 15 screenWidth = 600 screenHeight = 600 fullScreen = False renderOn = False initializeScreen = InitializeScreen(screenWidth, screenHeight, fullScreen) screen = initializeScreen() # pg.mouse.set_visible(False) leaveEdgeSpace = 2 lineWidth = 1 backgroundColor = [205, 255, 204] lineColor = [0, 0, 0] targetColor = [255, 50, 50] playerColor = [50, 50, 255] targetRadius = 10 playerRadius = 10 textColorTuple = (255, 50, 50) drawBackground = DrawBackground(screen, gridSize, leaveEdgeSpace, backgroundColor, lineColor, lineWidth, textColorTuple) drawText = DrawText(screen, drawBackground) drawNewState = DrawNewState(screen, drawBackground, targetColor, playerColor, targetRadius, playerRadius) drawImage = DrawImage(screen) # condition width = [5] height = [5] intentionDis = [2, 3, 4] decisionSteps = [0, 1, 2, 4, 6, 8] # decisionSteps = [1] targetDiffs = [0, 0, 1, 2] rotateAngles = [0, 90, 180, 270] obstaclesMapStep0 = [[(1, 4), (1, 5), (1, 6), (3, 2), (4, 2), (5, 2), (6, 2), (7, 2)]] obstaclesMapStep1 = [[(1, 2), (1, 4), (1, 5), (1, 6), (3, 2), (4, 2), (5, 2), (6, 2)]] obstaclesMapStep2 = [[(2, 2), (2, 4), (3, 5), (3, 6), (4, 2), (5, 3), (6, 3)], [(2, 2), (2, 4), (2, 5), (3, 6), (4, 2), (5, 2), (6, 3)], [(2, 2), (2, 4), (3, 5), (2, 6), (4, 2), (5, 3), (6, 2)]] obstaclesMapStep4 = [[(3, 3), (4, 1), (1, 4), (5, 3), (3, 5), (6, 3), (3, 6)], [(3, 3), (5, 1), (1, 5), (5, 3), (3, 5), (6, 3), (3, 6)], [(3, 3), (3, 1), (1, 3), (5, 3), (3, 5), (6, 3), (3, 6)]] obstaclesMapStep6 = [[(4, 4), (4, 1), (4, 2), (6, 4), (4, 6), (1, 4), (2, 4)], [(4, 4), (5, 1), (4, 2), (6, 4), (4, 6), (1, 5), (2, 4)], [(4, 4), (3, 1), (4, 2), (6, 4), (4, 6), (1, 3), (2, 4)]] obstaclesMapStep8 = [[(5, 5), (4, 2), (2, 4), (6, 1), (6, 2), (6, 3), (1, 6), (2, 6), (3, 6), (7, 5), (5, 7)]] obstaclesCondition = [ obstaclesMapStep0, obstaclesMapStep1, obstaclesMapStep2, obstaclesMapStep4, obstaclesMapStep6, obstaclesMapStep8 ] obstaclesMaps = dict(zip(decisionSteps, obstaclesCondition)) rotatePoint = RotatePoint(gridSize) checkBoundary = CheckBoundary([0, gridSize - 1], [0, gridSize - 1]) noiseActionSpace = [(0, -1), (0, 1), (-1, 0), (1, 0), (1, 1), (1, -1), (-1, -1), (-1, 1)] normalNoise = AimActionWithNoise(noiseActionSpace, gridSize) specialNoise = backToCrossPointNoise initPrior = [0.5, 0.5] # inferGoalPosterior = InferGoalPosterior(goalPolicy) softmaxBetaList = [5] noise = 0 gamma = 0.9 goalReward = [50, 50] actionSpace = [(0, -1), (0, 1), (-1, 0), (1, 0)] runVI = RunVI(gridSize, actionSpace, noiseActionSpace, noise, gamma, goalReward) for softmaxBeta in softmaxBetaList: # for noise in noiseList: for i in range(20): print(i) numBlocks = 3 expDesignValues = [[b, h, d, m, diff] for b in width for h in height for d in intentionDis for m in decisionSteps for diff in targetDiffs] * numBlocks random.shuffle(expDesignValues) numExpTrial = len(expDesignValues) condition = namedtuple('condition', 'name decisionSteps') expCondition = condition(name='expCondition', decisionSteps=decisionSteps) lineCondition = condition(name='lineCondition', decisionSteps=decisionSteps) conditionList = [expCondition ] * numExpTrial # + [lineCondition] * numExpTrial random.shuffle(conditionList) numNormalTrials = len(conditionList) noiseDesignValues = [0] * numNormalTrials if len(conditionList) != len(noiseDesignValues): raise Exception("unmatch condition design") # deubg # expDesignValues = [specialDesign] * 10 # noiseDesignValues = ['special'] * 10 # conditionList = [expCondition] * 10 # debug isInBoundary = IsInBoundary([0, gridSize - 1], [0, gridSize - 1]) creatRectMap = CreatRectMap(rotateAngles, gridSize, obstaclesMaps, rotatePoint) creatLineMap = CreatLineMap(rotateAngles, gridSize, rotatePoint, isInBoundary) samplePositionFromCondition = SamplePositionFromCondition( creatRectMap, creatLineMap, expDesignValues) modelController = ModelControllerOnline(softmaxBeta) # modelController = AvoidCommitModel(softmaxBeta, actionSpace, checkBoundary) controller = modelController renderOn = 1 normalTrial = NormalTrial(renderOn, controller, drawNewState, drawText, normalNoise, checkBoundary) experimentValues = co.OrderedDict() experimentValues["name"] = "noise" + str( noise) + '_' + "softmaxBeta" + str(softmaxBeta) + '_' + str(i) resultsDirPath = os.path.join( resultsPath, "noise" + str(noise) + '_' + "softmaxBeta" + str(softmaxBeta)) if not os.path.exists(resultsDirPath): os.mkdir(resultsDirPath) writerPath = os.path.join(resultsDirPath, experimentValues["name"] + '.csv') writer = WriteDataFrameToCSV(writerPath) experiment = ObstacleModelSimulation(normalTrial, writer, experimentValues, samplePositionFromCondition, drawImage, resultsPath, runVI) experiment(noiseDesignValues, conditionList)
def main(): picturePath = os.path.abspath( os.path.join(os.path.join(os.getcwd(), os.pardir), 'pictures')) resultsPath = os.path.abspath( os.path.join(os.path.join(os.getcwd(), os.pardir), 'results')) machinePolicyPath = os.path.abspath( os.path.join(os.path.join(os.getcwd(), os.pardir), 'machinePolicy')) dataPath = os.path.abspath( os.path.join(os.path.join(os.getcwd(), os.pardir), 'conditionData')) df = pd.read_csv( os.path.join(dataPath, 'DesignConditionForAvoidCommitmentZone.csv')) df['intentionedDisToTargetMin'] = df.apply( lambda x: x['minDis'] - x['avoidCommitmentZone'], axis=1) gridSize = 15 screenWidth = 600 screenHeight = 600 fullScreen = False renderOn = False initializeScreen = InitializeScreen(screenWidth, screenHeight, fullScreen) screen = initializeScreen() pg.mouse.set_visible(False) leaveEdgeSpace = 2 lineWidth = 1 backgroundColor = [205, 255, 204] lineColor = [0, 0, 0] targetColor = [255, 50, 50] playerColor = [50, 50, 255] targetRadius = 10 playerRadius = 10 textColorTuple = (255, 50, 50) introductionImage = pg.image.load( os.path.join(picturePath, 'introduction.png')) finishImage = pg.image.load(os.path.join(picturePath, 'finish.png')) introductionImage = pg.transform.scale(introductionImage, (screenWidth, screenHeight)) finishImage = pg.transform.scale( finishImage, (int(screenWidth * 2 / 3), int(screenHeight / 4))) drawBackground = DrawBackground(screen, gridSize, leaveEdgeSpace, backgroundColor, lineColor, lineWidth, textColorTuple) drawText = DrawText(screen, drawBackground) drawNewState = DrawNewState(screen, drawBackground, targetColor, playerColor, targetRadius, playerRadius) drawImage = DrawImage(screen) # condition width = [5] height = [5] intentionDis = [3, 4, 5] decisionSteps = [2, 4, 6, 10] targetDiffs = [0, 2, 4] rotateAngles = [0, 90, 180, 270] obstaclesMap1 = [(2, 2), (2, 4), (2, 5), (2, 6), (4, 2), (5, 2), (6, 2)] obstaclesMap2 = [(3, 3), (4, 1), (1, 4), (5, 3), (3, 5), (6, 3), (3, 6)] obstaclesMap3 = [(4, 4), (4, 1), (4, 2), (6, 4), (4, 6), (1, 4), (2, 4)] speicalObstacleMap = [(4, 1), (4, 2), (6, 3), (6, 4), (1, 4), (2, 4), (3, 6), (4, 6)] obstaclesCondition = [ obstaclesMap1, obstaclesMap2, obstaclesMap3, speicalObstacleMap ] obstaclesMaps = dict(zip(decisionSteps, obstaclesCondition)) rotatePoint = RotatePoint(gridSize) checkBoundary = CheckBoundary([0, gridSize - 1], [0, gridSize - 1]) noiseActionSpace = [(0, -1), (0, 1), (-1, 0), (1, 0), (1, 1), (1, -1), (-1, -1), (-1, 1)] normalNoise = AimActionWithNoise(noiseActionSpace, gridSize) specialNoise = backToCrossPointNoise initPrior = [0.5, 0.5] # inferGoalPosterior = InferGoalPosterior(goalPolicy) softmaxBetaList = [6] noiseList = [0] # noise = 0.067 # for softmaxBeta in softmaxBetaList: softmaxBeta = 6 for noise in noiseList: for i in range(20): print(i) numBlocks = 5 expDesignValues = [[b, h, d, m, diff] for b in width for h in height for d in intentionDis for m in decisionSteps for diff in targetDiffs] * numBlocks random.shuffle(expDesignValues) numExpTrial = len(expDesignValues) specialDesign = [5, 5, 4, 10, 0] expDesignValues.append(specialDesign) condition = namedtuple('condition', 'name decisionSteps') expCondition = condition(name='expCondition', decisionSteps=decisionSteps[:-1]) lineCondition = condition(name='lineCondition', decisionSteps=decisionSteps[:-1]) specialCondition = condition(name='specialCondition', decisionSteps=[10]) numControlTrial = int(numExpTrial / 2) conditionList = [expCondition] * numControlTrial + [ lineCondition ] * numControlTrial conditionList = [lineCondition] * numControlTrial random.shuffle(conditionList) numNormalTrials = len(conditionList) numTrialsPerBlock = 3 noiseCondition = list(permutations([1, 2, 0], numTrialsPerBlock)) noiseCondition.append((1, 1, 1)) blockNumber = int(numNormalTrials / numTrialsPerBlock) noiseDesignValues = createNoiseDesignValue(noiseCondition, blockNumber) conditionList.append(specialCondition) if noise == 0: noiseDesignValues = [0] * len(conditionList) if len(conditionList) != len(noiseDesignValues): raise Exception("unmatch condition design") # deubg # expDesignValues = [specialDesign] * 10 # noiseDesignValues = ['special'] * 10 # conditionList = [expCondition] * 10 # debug isInBoundary = IsInBoundary([0, gridSize - 1], [0, gridSize - 1]) creatRectMap = CreatRectMap(rotateAngles, gridSize, obstaclesMaps, rotatePoint) creatLineMap = CreatLineMap(rotateAngles, gridSize, rotatePoint, isInBoundary) samplePositionFromCondition = SamplePositionFromCondition( creatRectMap, creatLineMap, expDesignValues) runVI = RunVI(gridSize, noise, noiseActionSpace) modelController = ModelControllerOnline(softmaxBeta, runVI) controller = modelController renderOn = 0 normalTrial = NormalTrial(renderOn, controller, drawNewState, drawText, normalNoise, checkBoundary) specialTrial = SpecialTrial(renderOn, controller, drawNewState, drawText, specialNoise, checkBoundary) experimentValues = co.OrderedDict() experimentValues["name"] = "noise" + str( noise) + '_' + "softmaxBeta" + str(softmaxBeta) + '_' + str(i) writerPath = os.path.join(resultsPath, experimentValues["name"] + '.csv') writer = WriteDataFrameToCSV(writerPath) experiment = ObstacleExperiment(normalTrial, specialTrial, writer, experimentValues, samplePositionFromCondition, drawImage, resultsPath) experiment(noiseDesignValues, conditionList)