http://robowiki.net/w/api.php?action=feedcontributions&user=Lavenderwong&feedformat=atomRobowiki - User contributions [en]2024-03-29T13:25:34ZUser contributionsMediaWiki 1.34.1http://robowiki.net/w/index.php?title=Thread:Talk:Main_Page/Running_Error_-_Robot_is_not_stopping,_forcing_a_stop&diff=32636Thread:Talk:Main Page/Running Error - Robot is not stopping, forcing a stop2013-12-07T07:13:26Z<p>Lavenderwong: </p>
<hr />
<div>When I start the battlefield,my robot and other enemy are frozen. The println messages are not displayed in the robot console. But the command prompt shows the following error. I check that the cause of error is the addition of node in my queue (queue.add(n)). However, this line of code shall be fine i guess. So I would like to ask how to solve this error message?<br />
(this part of my program is for path finding using bfs)<br />
<br />
Thank you.<br />
<br />
<br />
***** BATTLE 1, ROUND 1 *****<br />
<br />
TURN 1: StudentRobot* (1) hard deadline exceeded - 532809us<br />
<br />
Err> Robot StudentRobot* (1) is not stopping. Forcing a stop.<br />
<br />
Err> Robot StudentRobot* (2) is not stopping. Forcing a stop.<br />
<br />
Average computation time per turn: 511706<br />
<br />
Max turn computation time: 532809<br />
<br />
<code><br />
private boolean pathFinding_BFS(Node start, Node end){<br />
<br />
LinkedList<Node> queue = new LinkedList<Node>();<br />
<br />
queue.add(start);<br />
<br />
start.setMarked();<br />
<br />
while (!queue.isEmpty()){<br />
<br />
Node temp = (Node)queue.poll();<br />
<br />
System.out.println("first node:" + temp.getPointInPath().getX() + " y " + temp.getPointInPath().getY());<br />
<br />
if (temp.equals(end)){<br />
<br />
temp.setPrevNodeInPath(temp.getPrevNodeInPath());<br />
<br />
return true;<br />
<br />
}else{<br />
<br />
for (Node n : temp.getAdjacentNode()){ <br />
<br />
System.out.println("in node:" + n.getPointInPath().getX() + " y " + <br />
n.getPointInPath().getY());<br />
<br />
if (!n.isMarked()){<br />
<br />
n.setMarked();<br />
<br />
n.setPrevNodeInPath(temp);<br />
<br />
System.out.println("test n");<br />
<br />
queue.add(n); //problem here<br />
<br />
}<br />
}<br />
}<br />
<br />
}<br />
return false;<br />
}<br />
<br />
<br />
public List<Point> getShortestPath(Point start){<br />
<br />
Node src = new Node(start);<br />
<br />
List<Point> path = new ArrayList<Point>();<br />
<br />
for (int i=0;i<endup.size();i++){<br />
<br />
Node destination = new Node(endup.get(i));<br />
<br />
if (pathFinding_BFS(src, destination)){<br />
<br />
while (destination.getPrevNodeInPath() != null){<br />
<br />
destination = destination.getPrevNodeInPath();<br />
<br />
path.add(destination.getPointInPath());<br />
<br />
}<br />
<br />
Collections.reverse(path);<br />
<br />
return path;<br />
}<br />
<br />
}<br />
return path;<br />
}<br />
</code></div>Lavenderwonghttp://robowiki.net/w/index.php?title=Thread:Talk:Main_Page/Running_Error_-_Robot_is_not_stopping,_forcing_a_stop&diff=32635Thread:Talk:Main Page/Running Error - Robot is not stopping, forcing a stop2013-12-07T07:03:04Z<p>Lavenderwong: New thread: Running Error - Robot is not stopping, forcing a stop</p>
<hr />
<div>When I start the battlefield,my robot and other enemy are frozen. The println messages are not displayed in the robot console. But the command prompt shows the following error. I check that the cause of error is the addition of node in my queue (queue.add(n)). However, this line of code shall be fine i guess. So I would like to ask how to solve this error message?<br />
(this part of my program is for path finding using bfs)<br />
<br />
Thank you.<br />
<br />
***** BATTLE 1, ROUND 1 *****<br />
TURN 1: StudentRobot* (1) hard deadline exceeded - 532809us<br />
Err> Robot StudentRobot* (1) is not stopping. Forcing a stop.<br />
Err> Robot StudentRobot* (2) is not stopping. Forcing a stop.<br />
Raw score for 0.0 energy left: 0.0<br />
Robots escaped: 0<br />
Enemy destroyed: 0<br />
Turns past after map reference time: 0<br />
Turns move partially on black blocks: 0<br />
Turns soft deadline excceed: 0<br />
Average computation time per turn: 511706<br />
Max turn computation time: 532809<br />
Total bad events counted: 0<br />
SCORE: 0.0<br />
<br />
<br />
<br />
private boolean pathFinding_BFS(Node start, Node end){<br />
LinkedList<Node> queue = new LinkedList<Node>();<br />
queue.add(start);<br />
start.setMarked();<br />
while (!queue.isEmpty()){<br />
Node temp = (Node)queue.poll();<br />
System.out.println("first node:" + temp.getPointInPath().getX() + " y " + temp.getPointInPath().getY());<br />
if (temp.equals(end)){<br />
temp.setPrevNodeInPath(temp.getPrevNodeInPath());<br />
return true;<br />
}else{<br />
for (Node n : temp.getAdjacentNode()){ <br />
System.out.println("in node:" + n.getPointInPath().getX() + " y " + n.getPointInPath().getY());<br />
if (!n.isMarked()){<br />
n.setMarked();<br />
n.setPrevNodeInPath(temp);<br />
System.out.println("test n");<br />
queue.add(n); //problem here<br />
}<br />
}<br />
}<br />
<br />
}<br />
return false;<br />
}<br />
<br />
public List<Point> getShortestPath(Point start){<br />
Node src = new Node(start);<br />
List<Point> path = new ArrayList<Point>();<br />
for (int i=0;i<endup.size();i++){<br />
Node destination = new Node(endup.get(i));<br />
if (pathFinding_BFS(src, destination)){<br />
while (destination.getPrevNodeInPath() != null){<br />
destination = destination.getPrevNodeInPath();<br />
path.add(destination.getPointInPath());<br />
}<br />
Collections.reverse(path);<br />
return path;<br />
}<br />
<br />
}<br />
return path;<br />
}</div>Lavenderwong