-
Notifications
You must be signed in to change notification settings - Fork 0
Dijkstra & A* #36
Conversation
lmbek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, i have added some feedback. I would like to get explained what F and G is in our formula as i'm just unsure of them myself.
Get the rest of the algorithm done, then we'll try to clean it together. Good job!
| <project version="4"> | ||
| <component name="PublishConfigData"> | ||
| <serverData> | ||
| <paths name="wits"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this commited
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dunno, guess it isn't in the out folder
| <option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" /> | ||
| </component> | ||
| <component name="ProjectRootManager" version="2" languageLevel="JDK_13" default="true" project-jdk-name="13" project-jdk-type="JavaSDK"> | ||
| <component name="ProjectRootManager" version="2" languageLevel="JDK_12" default="false" project-jdk-name="13" project-jdk-type="JavaSDK"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
back to 13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have 13, so I will change it back to 12 anyways
| graph = this.makeSmallGraphA(); | ||
| // A | ||
| Vertex startNode = graph.getVertex("A"); | ||
| Vertex endNode = graph.getVertex("F"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great but why is this F in test (we dont have F in that graph)
|
|
||
| public ArrayList<Vertex> aStar(Vertex startNode, Vertex endNode) { | ||
|
|
||
| TreeSet<Vertex> openTreeSet = new TreeSet<>(Comparator.comparingLong(Vertex::getF)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this to we can compare distances? What is getF
| ArrayList<Vertex> closedList = new ArrayList<>(); | ||
|
|
||
| for (Vertex vertex : graph.getVertices()) { | ||
| vertex.setDistance(200); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use infinity here. Will probably have to be reworked from 200 anyways, as our distance can be over 200 in our case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea it was a quick test to make sure infinity wasn't causing problems again
| Vertex successor = edge.getToVertex(); | ||
| int successorG = current.distance + successor.distance; | ||
| long successorH = heuristic(current,endNode); | ||
| long successorF = successorG + successorH; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so F is from the formula. But maybe its good to add comments if the full word is not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no full words, this is maths my friend. f is function. g and h just comes after f in the alphabet, that is all
| } | ||
|
|
||
| return endNode; | ||
| Vertex resultCurrent = endNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure i understand what resultCurrent is used for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it so it returns an arraylist
| public Vertex getPredecessor() { return predecessor; } | ||
| public void setPredecessor(Vertex predecessor) { this.predecessor = predecessor; } | ||
|
|
||
| public long f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is f, is it a function?
src/files/models/Dijkstra.java
Outdated
| //Vertex endNode = graph.getVertex("F"); | ||
|
|
||
| Pair<Integer, Map<Vertex, Vertex>> results = dijkstra(startNode, endNode); | ||
| Vertex result = dijkstra(startNode, endNode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice with something similar with the Pair. Like an arrayList of the Vertex's as we can get the distances or positions of x and y from the vertices in the arrayList.
(this is probably already done by you recently)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wut?
No description provided.