This commit is contained in:
zhm-real
2020-07-02 11:45:25 -07:00
parent 26c80924ee
commit 997e8f8b27
2 changed files with 41 additions and 16 deletions
+23 -12
View File
@@ -19,10 +19,9 @@
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="025aff36-a6aa-4945-ab7e-b2c625055f47" name="Default Changelist" comment="">
<list default="true" id="025aff36-a6aa-4945-ab7e-b2c625055f47" name="Default Changelist" comment="Merge branch 'master' of https://github.com/zhm-real/path-planning-algorithms&#10;&#10;# Please enter a commit message to explain why this merge is necessary,&#10;# especially if it merges an updated upstream into a topic branch.&#10;#&#10;# Lines starting with '#' will be ignored, and an empty message aborts&#10;# the commit.">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Search_2D/astar.py" beforeDir="false" afterPath="$PROJECT_DIR$/Search_2D/astar.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Search_2D/plotting.py" beforeDir="false" afterPath="$PROJECT_DIR$/Search_2D/plotting.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -216,6 +215,14 @@
<option name="presentableId" value="Default" />
<updated>1592347358698</updated>
</task>
<task id="LOCAL-00001" summary="Merge branch 'master' of https://github.com/zhm-real/path-planning-algorithms&#10;&#10;# Please enter a commit message to explain why this merge is necessary,&#10;# especially if it merges an updated upstream into a topic branch.&#10;#&#10;# Lines starting with '#' will be ignored, and an empty message aborts&#10;# the commit.">
<created>1593715021929</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1593715021929</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@@ -230,6 +237,10 @@
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Merge branch 'master' of https://github.com/zhm-real/path-planning-algorithms&#10;&#10;# Please enter a commit message to explain why this merge is necessary,&#10;# especially if it merges an updated upstream into a topic branch.&#10;#&#10;# Lines starting with '#' will be ignored, and an empty message aborts&#10;# the commit." />
<option name="LAST_COMMIT_MESSAGE" value="Merge branch 'master' of https://github.com/zhm-real/path-planning-algorithms&#10;&#10;# Please enter a commit message to explain why this merge is necessary,&#10;# especially if it merges an updated upstream into a topic branch.&#10;#&#10;# Lines starting with '#' will be ignored, and an empty message aborts&#10;# the commit." />
</component>
<component name="WindowStateProjectService">
<state x="2377" y="197" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1593282711181">
<screen x="1920" y="0" width="1920" height="1080" />
@@ -240,29 +251,29 @@
</state>
<state x="2700" y="297" width="424" height="482" key="FileChooserDialogImpl/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593631602696" />
<state x="819" y="314" key="FileChooserDialogImpl/65.24.1855.1056/1920.0.1920.1080@65.24.1855.1056" timestamp="1592933974409" />
<state width="1832" height="125" key="GridCell.Tab.0.bottom" timestamp="1593714671503">
<state width="1832" height="146" key="GridCell.Tab.0.bottom" timestamp="1593715356351">
<screen x="1920" y="0" width="1920" height="1080" />
</state>
<state width="1832" height="125" key="GridCell.Tab.0.bottom/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593714671503" />
<state width="1832" height="125" key="GridCell.Tab.0.center" timestamp="1593714671503">
<state width="1832" height="146" key="GridCell.Tab.0.bottom/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593715356351" />
<state width="1832" height="146" key="GridCell.Tab.0.center" timestamp="1593715356351">
<screen x="1920" y="0" width="1920" height="1080" />
</state>
<state width="1832" height="125" key="GridCell.Tab.0.center/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593714671503" />
<state width="1832" height="125" key="GridCell.Tab.0.left" timestamp="1593714671503">
<state width="1832" height="146" key="GridCell.Tab.0.center/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593715356351" />
<state width="1832" height="146" key="GridCell.Tab.0.left" timestamp="1593715356351">
<screen x="1920" y="0" width="1920" height="1080" />
</state>
<state width="1832" height="125" key="GridCell.Tab.0.left/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593714671503" />
<state width="1832" height="125" key="GridCell.Tab.0.right" timestamp="1593714671503">
<state width="1832" height="146" key="GridCell.Tab.0.left/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593715356351" />
<state width="1832" height="146" key="GridCell.Tab.0.right" timestamp="1593715356351">
<screen x="1920" y="0" width="1920" height="1080" />
</state>
<state width="1832" height="125" key="GridCell.Tab.0.right/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593714671503" />
<state width="1832" height="146" key="GridCell.Tab.0.right/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593715356351" />
<state x="2406" y="174" key="SettingsEditor" timestamp="1593282573348">
<screen x="1920" y="0" width="1920" height="1080" />
</state>
<state x="2406" y="174" key="SettingsEditor/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593282573348" />
<state x="2701" y="438" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1593242832142">
<state x="2701" y="438" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1593715195096">
<screen x="1920" y="0" width="1920" height="1080" />
</state>
<state x="2701" y="438" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593242832142" />
<state x="2701" y="438" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/65.24.1855.1056/1920.0.1920.1080@1920.0.1920.1080" timestamp="1593715195096" />
</component>
</project>
+18 -4
View File
@@ -56,18 +56,32 @@ class Astar:
return self.extract_path(self.PARENT), self.CLOSED
def repeated_searching(self, e):
def repeated_astar(self, e):
"""
repeated a*.
:param e: weight of a*
:return: path and visited order
"""
path, visited = [], []
while e >= 1:
p_k, v_k = self.repeated_Astar(self.s_start, self.s_goal, e)
p_k, v_k = self.repeated_searching(self.s_start, self.s_goal, e)
path.append(p_k)
visited.append(v_k)
e -= 0.5
return path, visited
def repeated_Astar(self, s_start, s_goal, e):
def repeated_searching(self, s_start, s_goal, e):
"""
run a* with weight e.
:param s_start: starting state
:param s_goal: goal state
:param e: weight of a*
:return: path and visited order.
"""
g = {s_start: 0, s_goal: float("inf")}
OPEN = queue.QueuePrior()
OPEN.put(s_start, g[s_start] + e * self.Heuristic(s_start))
@@ -174,7 +188,7 @@ def main():
path, visited = astar.searching()
plot.animation(path, visited, "A*") # animation
# path, visited = astar.repeated_searching(2.5) # initial weight e = 2.5
# path, visited = astar.repeated_astar(2.5) # initial weight e = 2.5
# plot.animation_ara_star(path, visited, "Repeated A*")