diff --git a/Search-based Planning/.idea/shelf/Uncommitted_changes_before_Update_at_6_27_20,_12_26_AM_[Default_Changelist]/shelved.patch b/Search-based Planning/.idea/shelf/Uncommitted_changes_before_Update_at_6_27_20,_12_26_AM_[Default_Changelist]/shelved.patch deleted file mode 100644 index bf880e7..0000000 --- a/Search-based Planning/.idea/shelf/Uncommitted_changes_before_Update_at_6_27_20,_12_26_AM_[Default_Changelist]/shelved.patch +++ /dev/null @@ -1,299 +0,0 @@ -Index: ara_star.py -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP -<+>import queue\nimport plotting\nimport env\n\nimport matplotlib.pyplot as plt\n\n\nclass AraStar:\n def __init__(self, x_start, x_goal, heuristic_type):\n self.xI, self.xG = x_start, x_goal\n self.heuristic_type = heuristic_type\n\n self.Env = env.Env() # class Env\n\n self.u_set = self.Env.motions # feasible input set\n self.obs = self.Env.obs # position of obstacles\n\n self.e = 2.5\n self.g = {self.xI: 0, self.xG: float(\"inf\")}\n self.fig_name = \"ARA_Star Algorithm\"\n\n self.OPEN = queue.QueuePrior() # priority queue / OPEN\n self.CLOSED = []\n self.INCONS = []\n self.parent = {self.xI: self.xI}\n\n self.path = []\n self.visited = []\n\n def searching(self):\n self.OPEN.put(self.xI, self.fvalue(self.xI))\n self.ImprovePath()\n self.path.append(self.extract_path())\n\n while self.update_e() > 1:\n self.e -= 0.5\n print(self.e)\n OPEN_mid = [x for (p, x) in self.OPEN.enumerate()] + self.INCONS\n self.OPEN = queue.QueuePrior()\n self.OPEN.put(self.xI, self.fvalue(self.xI))\n\n for x in OPEN_mid:\n self.OPEN.put(x, self.fvalue(x))\n\n self.INCONS = []\n self.CLOSED = []\n self.ImprovePath()\n self.path.append(self.extract_path())\n\n return self.path, self.visited\n\n def ImprovePath(self):\n visited_each = []\n while (self.fvalue(self.xG) >\n min([self.fvalue(x) for (p, x) in self.OPEN.enumerate()])):\n s = self.OPEN.get()\n\n if s not in self.CLOSED:\n self.CLOSED.append(s)\n\n for u_next in self.u_set:\n s_next = tuple([s[i] + u_next[i] for i in range(len(s))])\n\n if s_next not in self.obs:\n new_cost = self.g[s] + self.get_cost(s, u_next)\n if s_next not in self.g or new_cost < self.g[s_next]:\n self.g[s_next] = new_cost\n self.parent[s_next] = s\n visited_each.append(s_next)\n\n if s_next not in self.CLOSED:\n self.OPEN.put(s_next, self.fvalue(s_next))\n else:\n self.INCONS.append(s_next)\n\n self.visited.append(visited_each)\n\n def update_e(self):\n c_OPEN, c_INCONS = float(\"inf\"), float(\"inf\")\n\n if not self.OPEN.empty():\n c_OPEN = min(self.g[x] + self.Heuristic(x) for (p, x) in self.OPEN.enumerate())\n\n if len(self.INCONS) != 0:\n c_INCONS = min(self.g[x] + self.Heuristic(x) for x in self.INCONS)\n\n if min(c_OPEN, c_INCONS) == float(\"inf\"):\n return 1\n\n return min(self.e, self.g[self.xG] / min(c_OPEN, c_INCONS))\n\n def fvalue(self, x):\n h = self.e * self.Heuristic(x)\n return self.g[x] + h\n\n def extract_path(self):\n \"\"\"\n Extract the path based on the relationship of nodes.\n\n :param policy: Action needed for transfer between two nodes\n :return: The planning path\n \"\"\"\n\n path_back = [self.xG]\n x_current = self.xG\n\n while True:\n x_current = self.parent[x_current]\n path_back.append(x_current)\n\n if x_current == self.xI:\n break\n\n return list(path_back)\n\n @staticmethod\n def get_cost(x, u):\n \"\"\"\n Calculate cost for this motion\n\n :param x: current node\n :param u: input\n :return: cost for this motion\n :note: cost function could be more complicate!\n \"\"\"\n\n return 1\n\n def Heuristic(self, state):\n \"\"\"\n Calculate heuristic.\n :param state: current node (state)\n :param goal: goal node (state)\n :param heuristic_type: choosing different heuristic functions\n :return: heuristic\n \"\"\"\n\n heuristic_type = self.heuristic_type\n goal = self.xG\n\n if heuristic_type == \"manhattan\":\n return abs(goal[0] - state[0]) + abs(goal[1] - state[1])\n elif heuristic_type == \"euclidean\":\n return ((goal[0] - state[0]) ** 2 + (goal[1] - state[1]) ** 2) ** (1 / 2)\n else:\n print(\"Please choose right heuristic type!\")\n\n\ndef main():\n x_start = (5, 5) # Starting node\n x_goal = (49, 5) # Goal node\n\n arastar = AraStar(x_start, x_goal, \"manhattan\")\n plot = plotting.Plotting(x_start, x_goal)\n\n fig_name = \"ARA* algorithm\"\n path, visited = arastar.searching()\n\n plot.animation_ara_star(path, visited, fig_name)\n\n\nif __name__ == '__main__':\n main()\n -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- ara_star.py (revision 3a87e5d5770f7a88af23b1cf0cf579c63bb5f346) -+++ ara_star.py (date 1593242576435) -@@ -2,8 +2,6 @@ - import plotting - import env - --import matplotlib.pyplot as plt -- - - class AraStar: - def __init__(self, x_start, x_goal, heuristic_type): -Index: .idea/workspace.xml -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP -<+>\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n