def initialise_mdp(self, blocks): start_config = [-1,-1,-1] startingState = State(0, blocks, start_config) self.initialise_lists() self.success_config[-1].append(startingState) label = len(self.mdp_list[-1]) mdp = MDP(label, blocks) mdp.statelist.append(startingState) mdp.initMDP(startingState) self.mdp_list[-1].append(mdp)
def initialise_mdp(self, state): try: blocks = [] for prop in state.initial_state.block_properties: blocks.append(Block(prop.label, prop.shape, prop.colour, prop.size)) start_config = state.initial_state.configuration.config startingState = State(0, start_config) self.initialise_lists() self.success_config[-1].append(startingState) label = len(self.mdp_list[-1]) print "" print label print "" mdp = MDP(label, blocks) mdp.statelist.append(startingState) mdp.initMDP(startingState) self.mdp_list[-1].append(mdp) print "MDP initialised" return True except: return False