Possible errors

Fragment of a discussion from Talk:WhiteFang
Jump to navigation Jump to search
java.lang.ArrayIndexOutOfBoundsException: 50
	at dsekercioglu.knn.knnCore.ags.kdtree.KdNode.addLeafPoint(KdNode.java:70)
	at dsekercioglu.knn.knnCore.ags.kdtree.KdNode.addPoint(KdNode.java:63)
	at dsekercioglu.knn.knnCore.ags.kdtree.KdTree.addPoint(KdTree.java:7)
	at dsekercioglu.knn.knnCore.KNNPredictor.addData(KNNPredictor.java:67)
	at dsekercioglu.knn.wfGun.gun.TestGun.wavePassed(TestGun.java:24)
	at dsekercioglu.knn.wfGun.Fang.updateWaves(Fang.java:122)
	at dsekercioglu.knn.wfGun.Fang.onScannedRobot(Fang.java:80)
	at dsekercioglu.knn.WhiteFang.onScannedRobot(WhiteFang.java:44)
	at robocode.ScannedRobotEvent.dispatch(ScannedRobotEvent.java:315)
	at robocode.Event$HiddenEventHelper.dispatch(Event.java:259)
	at net.sf.robocode.security.HiddenAccess.dispatch(HiddenAccess.java:191)
	at net.sf.robocode.host.events.EventManager.dispatch(EventManager.java:422)
	at net.sf.robocode.host.events.EventManager.processEvents(EventManager.java:376)
	at net.sf.robocode.host.proxies.BasicRobotProxy.executeImpl(BasicRobotProxy.java:423)
	at net.sf.robocode.host.proxies.BasicRobotProxy.execute(BasicRobotProxy.java:122)
	at net.sf.robocode.host.proxies.StandardRobotProxy.turnRadar(StandardRobotProxy.java:55)
	at robocode._AdvancedRadiansRobot.turnRadarRightRadians(_AdvancedRadiansRobot.java:150)
	at robocode.AdvancedRobot.turnRadarRightRadians(AdvancedRobot.java:1962)
	at dsekercioglu.knn.wfEyes.Lock.run(Lock.java:17)
	at dsekercioglu.knn.WhiteFang.run(WhiteFang.java:39)
	at net.sf.robocode.host.proxies.HostingRobotProxy.callUserCode(HostingRobotProxy.java:274)
	at net.sf.robocode.host.proxies.HostingRobotProxy.run(HostingRobotProxy.java:221)
	at net.sf.robocode.host.proxies.BasicRobotProxy.run(BasicRobotProxy.java:44)
	at java.lang.Thread.run(Thread.java:745)

I got this exception after some testing.

Dsekercioglu (talk)20:13, 25 December 2017

This is a bug in Rednaxela’s kd-tree. I created a PR to fix it in his bitbucket a few years ago, but no response.

IIRC, This bug happens when points are so concentrated that spliting happens more than once in one call, which is not considered at all. That’s why it happens so rarely, and only with some set of dimensions.

Xor (talk)21:44, 25 December 2017

Feel free to use my Kd-Tree, it has protections against infinite splitting and is similar performance to Rednaxela (perhaps even better in mixed workloads due to cache locality).

Skilgannon (talk)19:56, 26 December 2017

Sorry for answering late; I actually wrote an answer but I suppose there was a problem with Wi-fi. WhiteFang has already started to use it and there is also range search in your tree which is wonderful.

Dsekercioglu (talk)13:41, 29 December 2017

What my tree doesn't have is the nearest neighbor iterator feature, where much of the cost of searching is deferred to the iteration over the results so if you don't need all the points it doesn't need to do a full search. This could be added, but would be fairly tricky.

If there are any other things you think my tree really needs, let me know and I'll see what I can do. Only thing I'm not interested in at the moment are balancing, and reclaiming memory from removing points.

Skilgannon (talk)22:31, 29 December 2017