public class HeuristicPathTree extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HeuristicPathTree.Node
Class for the creation of a node related to any Heuristic Algorithm.
|
Modifier and Type | Field and Description |
---|---|
static int |
A_STAR |
private HeuristicPathTree.Node |
anchor |
static int |
FIRST_BEST |
private GraphViz |
graphVizHelper |
private HeuristicPathTree.Node |
lastNode |
static int |
UNIFORM_COST |
Constructor and Description |
---|
HeuristicPathTree()
Constructor of the first important URL part of the Heuristic Path Tree.
|
HeuristicPathTree(HeuristicPathTree.Node anchor)
Constructor of the Heuristic Path Tree.
|
Modifier and Type | Method and Description |
---|---|
void |
addMovementAccumulative(HeuristicPathTree.Node child)
Create a step movement between father and child for Uniform Cost Algorithm.
|
void |
addMovementAll(HeuristicPathTree.Node child)
Create a step movement between father and child for A* algorithm.
|
void |
addMovementRemaining(HeuristicPathTree.Node child)
Create a step movement between father and child for First Best Algorithm.
|
void |
addNode(HeuristicPathTree.Node father,
HeuristicPathTree.Node child)
This method adds a child to the specified node.
|
private void |
createDotTree(int expansionAlgorithm)
Method for the creation of the whole dot-language tree depending of what
heuristic algorithm is being executed at the moment.
|
void |
drawDotTree(int expansionAlgorithm)
Method to call the whole drawing of the tree.
|
void |
endTree()
GraphViz URL ending part for the graphic tree.
|
HeuristicPathTree.Node |
getAnchor()
Method to get the first node of the tree.
|
String |
getDotTree()
Method to get the whole tree in dot language for the graphic implementation.
|
HeuristicPathTree.Node |
getFinalNode()
Obtain the final node of the tree.
|
private void |
inAstar(HeuristicPathTree.Node father) |
private void |
inOrderFirst(HeuristicPathTree.Node father)
Algorithm to obtain the tree in an Inorder organization, to make sure it will
be displayed correctly.
|
private void |
inUniformCost(HeuristicPathTree.Node father) |
void |
setAnchor(HeuristicPathTree.Node anchor)
Method to set the anchor node to the heuristic tree.
|
void |
setFinal(HeuristicPathTree.Node node)
Method to set the final configuration of the tree.
|
void |
setInitial(HeuristicPathTree.Node node)
Method to set the initial configuration of the tree.
|
void |
setLastNode(HeuristicPathTree.Node lastNode)
Method to set the last node for the tree.
|
public static final int UNIFORM_COST
public static final int FIRST_BEST
public static final int A_STAR
private HeuristicPathTree.Node anchor
private GraphViz graphVizHelper
private HeuristicPathTree.Node lastNode
public HeuristicPathTree(HeuristicPathTree.Node anchor)
anchor
- Anchor node to start the tree.public HeuristicPathTree()
public void setAnchor(HeuristicPathTree.Node anchor)
anchor
- Anchor node to the heuristic tree.public void addNode(HeuristicPathTree.Node father, HeuristicPathTree.Node child)
father
- parent nodechild
- child nodepublic void addMovementAccumulative(HeuristicPathTree.Node child)
child
- final nodepublic void addMovementRemaining(HeuristicPathTree.Node child)
child
- final nodepublic void addMovementAll(HeuristicPathTree.Node child)
child
- final nodepublic void endTree()
public String getDotTree()
public void setInitial(HeuristicPathTree.Node node)
node
- Initial node.public void setFinal(HeuristicPathTree.Node node)
node
- Final node.public void setLastNode(HeuristicPathTree.Node lastNode)
lastNode
- Last node of the tree.public HeuristicPathTree.Node getFinalNode()
public HeuristicPathTree.Node getAnchor()
private void createDotTree(int expansionAlgorithm)
expansionAlgorithm
- The code of the heuristic algorithm being used,
defined at the top of this document, as final
values.private void inOrderFirst(HeuristicPathTree.Node father)
father
- Father node each time.private void inUniformCost(HeuristicPathTree.Node father)
private void inAstar(HeuristicPathTree.Node father)
public void drawDotTree(int expansionAlgorithm)
expansionAlgorithm
- Code related to one of the three expansion algorithms.