def setUp(self): self.cake_problem = have_cake() self.ac_problem_1 = air_cargo_p1() self.ac_problem_2 = air_cargo_p2() self.ac_problem_3 = air_cargo_p3() self.ac_problem_4 = air_cargo_p4() self.cake_node = Node(self.cake_problem.initial) self.ac_node_1 = Node(self.ac_problem_1.initial) self.ac_node_2 = Node(self.ac_problem_2.initial) self.ac_node_3 = Node(self.ac_problem_3.initial) self.ac_node_4 = Node(self.ac_problem_4.initial)
def setUp(self): self.cake_problem = have_cake() self.ac_problem_1 = air_cargo_p1() self.ac_problem_2 = air_cargo_p2() self.ac_problem_3 = air_cargo_p3() self.ac_problem_4 = air_cargo_p4() self.cake_node = Node(self.cake_problem.initial) self.ac_node_1 = Node(self.ac_problem_1.initial) self.ac_node_2 = Node(self.ac_problem_2.initial) self.ac_node_3 = Node(self.ac_problem_3.initial) self.ac_node_4 = Node(self.ac_problem_4.initial) self.msg = "Make sure all your mutex tests pass before troubleshooting this function."
def test_h_ignore_preconditions(self): n = Node(self.p1.initial) self.assertEqual(self.p1.h_ignore_preconditions(n), 2) # Additional tests of my own: self.assertEqual(air_cargo_p2().h_ignore_preconditions(n), 3) self.assertEqual(air_cargo_p3().h_ignore_preconditions(n), 4)
def test_h_ignore_preconditions(self): n = Node(self.p1.initial) self.assertEqual(self.p1.h_ignore_preconditions(n),2)
def test_h_ignore_preconditions(self): #print("in prb4 test4") n = Node(self.p1.initial) self.assertEqual(self.p1.h_ignore_preconditions(n),2)
expr('In(C3, P1)'), expr('In(C3, P2)'), expr('In(C2, P1)'), expr('In(C2, P2)'), expr('In(C1, P1)'), expr('In(C1, P2)'), expr('At(P1, JFK)'), expr('At(P1, ATL)'), expr('At(P1, ORD)'), expr('At(P2, SFO)'), expr('At(P2, ATL)'), expr('At(P2, ORD)'), ] init = FluentState(pos, neg) goal = [expr('At(C1, JFK)'), expr('At(C3, JFK)'), expr('At(C2, SFO)'), expr('At(C4, SFO)'), ] return AirCargoProblem(cargos, planes, airports, init, goal) if __name__ == '__main__': p = air_cargo_p1() for action in p.get_actions(): print(action.name, action.precond_pos, action.precond_neg, action.effect_add, action.effect_rem) node = Node(p.initial) count = p.h_ignore_preconditions(node) print(count)
expr('At(P1, JFK)'), expr('At(P1, ATL)'), expr('At(P1, ORD)'), expr('At(P2, SFO)'), expr('At(P2, ATL)'), expr('At(P2, ORD)') ] init = FluentState(pos, neg) goal = [expr('At(C1, JFK)'), expr('At(C2, SFO)'), expr('At(C3, JFK)'), expr('At(C4, SFO)') ] return AirCargoProblem(cargos, planes, airports, init, goal) if __name__ == '__main__': P1 = air_cargo_p1() # P1.result('TTFTTFTF', P1.actions('TTFTTFTF')[0]) # print(P1.state_map) # Print intial state map of P1 # for a in P1.actions_list: # prinf all possible (concrete) actions P1 # print(a) # print(P1.actions('TTTTTTTTTTTT')) # All actions are possible # print(P1.actions('FFFFFFFFFFFF')) # No actions are possible # print(P1.result('TTFTF', P1.actions('TTFTF')[0])) # print(P1.h_ignore_preconditions(Node('FFTFTTFF'))) # Test the heuritstic for the state # print(P1.h_ignore_preconditions(Node('FFTFTTFF'))) # Test the heuritstic for the state print(P1.h_pg_levelsum(Node('FFTFTTFF'))) # Test the heuritstic for the state PG = PlanningGraph(P1,'FFTFTTFF')