Skip to content

Commit

Permalink
- heuristics + comment to heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
DuncanFinnamore committed May 2, 2018
1 parent 4d02877 commit 3825cc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 461 deletions.
18 changes: 9 additions & 9 deletions GroupProjectRASQL/Heuristics/Heuristic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ public abstract class Heuristic

protected Queue<Node> remainingNodes = new Queue<Node>();

public Heuristic(Node root)
public Heuristic(Node root) // create the heuristics- saving the root of the tree
{
this.root = root;
}

public void Init()
public void Init() // init the heuristic
{
isStarted = true;
remainingNodes = new Queue<Node>();
for (Node node = root.Child(); node != null && node != root; node = node.getNextNode())
isStarted = true; // istarted flag
remainingNodes = new Queue<Node>(); // queue for the nodes
for (Node node = root.Child(); node != null && node != root; node = node.getNextNode()) // for every non-null non-root node
{
remainingNodes.Enqueue(node);
remainingNodes.Enqueue(node); // add it to the queue
}
}

public void Step()
public void Step() // step through the currently active heuristic - called by ui button
{
if (!isStarted) Init();
if (isComplete) return;
Expand All @@ -43,9 +43,9 @@ public void Step()
if (!stop && !isComplete) Step();
}

public void Complete()
public void Complete() // complete the currently active heurisitc - called by ui button
{
while (!isComplete) Step();
while (!isComplete) Step(); // while not done - step without interuptions
}

public void Reset()
Expand Down
Loading

0 comments on commit 3825cc7

Please sign in to comment.