print "All items: ", for item in active: print item, print "" pn = [] pn.append(PlaceNode("kitchen")) pn.append(PlaceNode("livingroom")) pn.append(PlaceNode("garden")) pn.append(PlaceNode("balcony")) pn.append(PlaceNode("corridor")) pn.append(PlaceNode("bedroom")) pn.append(PlaceNode("garage")) # Init memory memory = Memory() for n in pn: # Return the active items memory.addNode(n) printActive(memory) # remove the kitchen node # ... active items should not change (limit = 4) print "Removing kitchen node..." memory.removeNode(str(pn[0])) # remove the garage node # ... active items should change, garage is removed (limit = 4) print "Removing garage node..." memory.removeNode(str(pn[6]))
for item in active: print item, print "" pn = [] pn.append(PlaceNode("kitchen")) pn.append(PlaceNode("livingroom")) pn.append(PlaceNode("garden")) pn.append(PlaceNode("balcony")) pn.append(PlaceNode("corridor")) pn.append(PlaceNode("bedroom")) pn.append(PlaceNode("garage")) # Init memory memory = Memory() for n in pn: # Return the active items memory.addNode(n) printActive(memory) # remove the kitchen node # ... active items should not change (limit = 4) print "Removing kitchen node..." memory.removeNode(str(pn[0])) # remove the garage node # ... active items should change, garage is removed (limit = 4) print "Removing garage node..." memory.removeNode(str(pn[6])) printActive(memory)
(is-in corridor door_li_co) (is-in corridor door_cl_co) (is-in corridor door_ba_co) (is-in corridor door_wc_co) (is-in corridor door_out)""" goals_2 = [ Goal("shoe-ordering", [ Fact("(is-at shoe_cabinet shoepair1)"), Fact("(is-at shoe_cabinet shoepair2)"), Fact("(is-at shoe_cabinet shoepair3)"), ]) ] load_facts_in_node(pddl_2, node_2) load_goals_in_node(goals_2, node_2) memory = Memory() memory.addNode(node_1) memory.addNode(node_2) # Return the active facts retreive_active_items(memory) print "---" print "Deleting fact... + Adding fact...", node_1.delFact(Fact("(is-attached lightbulb8)")) node_1.addFact(Fact("(not (is-attached lightbulb8))")) # Return the active facts retreive_active_items(memory)
(is-in corridor door_li_co) (is-in corridor door_cl_co) (is-in corridor door_ba_co) (is-in corridor door_wc_co) (is-in corridor door_out)""" goals_2 = [ Goal("shoe-ordering", [ Fact("(is-at shoe_cabinet shoepair1)"), Fact("(is-at shoe_cabinet shoepair2)"), Fact("(is-at shoe_cabinet shoepair3)"), ]) ] load_facts_in_node(pddl_2, node_2) load_goals_in_node(goals_2, node_2) memory = Memory() memory.addNode(node_1) memory.addNode(node_2) # Return the active facts retreive_active_items(memory) print "---" print "Deleting fact... + Adding fact...", node_1.delFact(Fact("(is-attached lightbulb8)")) node_1.addFact(Fact("(not (is-attached lightbulb8))")) # Return the active facts retreive_active_items(memory) if __name__ == '__main__':