Skip to content
This repository was archived by the owner on May 8, 2023. It is now read-only.

Conversation

@32monkeys
Copy link
Collaborator

No description provided.

@32monkeys 32monkeys requested a review from lmbek December 2, 2019 15:05
Copy link
Owner

@lmbek lmbek left a 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">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commited

Copy link
Collaborator Author

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">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back to 13

Copy link
Collaborator Author

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");
Copy link
Owner

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));
Copy link
Owner

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);
Copy link
Owner

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.

Copy link
Collaborator Author

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;
Copy link
Owner

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

Copy link
Collaborator Author

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;
Copy link
Owner

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

Copy link
Collaborator Author

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;
Copy link
Owner

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?

//Vertex endNode = graph.getVertex("F");

Pair<Integer, Map<Vertex, Vertex>> results = dijkstra(startNode, endNode);
Vertex result = dijkstra(startNode, endNode);
Copy link
Owner

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wut?

@lmbek lmbek merged commit 8e72be3 into master Dec 2, 2019
@ahraza51214 ahraza51214 deleted the Emil branch December 3, 2019 09:42
@lmbek lmbek added the enhancement New feature or request label Dec 4, 2019
@lmbek lmbek added this to the Pathfinding Algorithms milestone Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants