def setUp(self): self.p1 = air_cargo_p1() self.act1 = Action( expr('Load(C1, P1, SFO)'), [[expr('At(C1, SFO)'), expr('At(P1, SFO)')], []], [[expr('In(C1, P1)')], [expr('At(C1, SFO)')]] )
def setUp(self): self.p1 = air_cargo_p1( ) #Execute air caogo 1 initiation including building list of actions self.act1 = Action( expr('Load(C1, P1, SFO)'), [[expr('At(C1, SFO)'), expr('At(P1, SFO)')], []], [[expr('In(C1, P1)')], [expr('At(C1, SFO)')]])
def compare(): print("Comparative") #print(PROBLEMS) #print(SEARCHES) #main(['1', '2', '3'], ['1', '2', '3', '4', '5']) compare_searchers( [air_cargo_p1(), air_cargo_p2(), air_cargo_p3()], ["ACP1", "ACP2", "ACP3"], [ breadth_first_search, depth_first_graph_search, ])
def setUp(self): self.p1 = air_cargo_p1()
from my_air_cargo_problems import ( air_cargo_p1, air_cargo_p2, air_cargo_p3, ) from aimacode.search import (breadth_first_search, astar_search, breadth_first_tree_search, depth_first_graph_search, uniform_cost_search, greedy_best_first_graph_search, depth_limited_search, recursive_best_first_search) from run_search import run_search if __name__ == '__main__': p1 = air_cargo_p1() print("Initial state for this problem is {}".format(p1.initial)) #print("Actions for this domain are:") #for a in p1.actions_list: # print(' {}{}'.format(a.name, a.args)) #print("Fluents in this problem are:") #for f in p1.state_map: # print(' {}'.format(f)) print("Goal requirement for this problem are:") for g in p1.goal: print(' {}'.format(g)) print() print("*** A-star ignore preconditions heuristic") run_search(p1, astar_search, p1.h_ignore_preconditions) print("A-star levelsum heuristic") run_search(p1, astar_search, p1.h_pg_levelsum)
import argparse from timeit import default_timer as timer from aimacode.search import InstrumentedProblem from aimacode.search import (breadth_first_search, astar_search, breadth_first_tree_search, depth_first_graph_search, uniform_cost_search, greedy_best_first_graph_search, depth_limited_search, recursive_best_first_search,Node) from my_air_cargo_problems import air_cargo_p1, air_cargo_p2, air_cargo_p3 from my_planning_graph import PlanningGraph from run_search import run_search print(air_cargo_p1) #node = Node(air_cargo_p1.initial) #print(node) p = air_cargo_p1() print("**** Have Cake example problem setup ****") print("Initial state for this problem is {}".format(p.initial)) print("Actions for this domain are:") for a in p.actions_list: print(' {}{}'.format(a.name, a.args)) print("Fluents in this problem are:") for f in p.state_map: print(' {}'.format(f)) print("Goal requirement for this problem are:") for g in p.goal: print(' {}'.format(g)) print() print("*** Breadth First Search") run_search(p, breadth_first_search) print("*** Depth First Search")
def setUp(self): self.p = have_cake() self.pg = PlanningGraph(self.p, self.p.initial) def test_add_action_level(self): for level, nodeset in enumerate(self.pg.a_levels): for node in nodeset: print("Level {}: {}{})".format(level, node.action.name, node.action.args)) #self.assertEqual(len(self.pg.a_levels[0]), 3, len(self.pg.a_levels[0])) #self.assertEqual(len(self.pg.a_levels[1]), 6, len(self.pg.a_levels[1])) if __name__ == '__main__': p = air_cargo_p1() print("Initial state for this problem is {}".format(p.initial)) print("Actions for this domain are:") print(len(p.initial)) print(len(p.state_map)) for a in p.actions_list: print(' {}{}'.format(a.name, a.args)) print("Fluents in this problem are:") for f in p.state_map: print(' {}'.format(f)) print("Goal requirement for this problem are:") for g in p.goal: print(' {}'.format(g)) #print(decode_state(p.initial, p.state_map)) p2 = air_cargo_p1()