View source for User talk:Wompi
- [View source↑]
- [History↑]
Contents
Thread title | Replies | Last modified |
---|---|---|
How much memory can a bot use? | 4 | 04:30, 2 July 2012 |
Classify Melee Field | 1 | 16:11, 22 June 2012 |
Questions | 10 | 16:00, 25 April 2012 |
Wallaby | 2 | 23:09, 23 April 2012 |
First page |
Previous page |
Next page |
Last page |
Hi mates. I'm playing with my new bot right now and it turned out he use quite a lot of memory. After a couple of rounds the client heap is full and things start to get very "strange". That leads me to the question: How much memory can a bot use? Is it restricted/shared in some way or can just one bot take all memory? It turned out that my test against Diamond and DrussGT leads to huge skipped turn counts on these bots but my bot is still fine (he just use memory like nothing in his current develop state to save on the cpu side).
Take Care
Memory isn't restricted per bot like CPU, so you can use all you want. But if your bot uses way more than its share, people's clients will crash only on battles with your bot and you'll get a lot of complaints. :-) I'd say your bot should be able to battle itself without ever causing OutOfMemory errors.
Do Diamond/DrussGT get the same amount of skipped turns if you pit them against each other, or themselves? I've definitely seen some cumulative CPU load effect on skipped turns - eg, Diamond is less likely to skip turns against Sample Bots than against DrussGT. Some amount of skipped turns is not a huge deal. How many are being skipped? Your high memory usage could lead to increased garbage collection, which I think would count against your bot's CPU time, but that (a bot using a lot of CPU) can also cause a few skipped turns for the other bot in my experience.
Hmm ... 1vs1 is no problem for my bot even against himself. But if it comes to melee it looks different ,because i have to hold combat data of 9 bots. Right now it uses almost 500 MB against a full melee field. But it is not finished yet and i guess i can bring it to 300 MB or less. I was a little surprised that not every bot can use the same memory share.
My test run is with DrussGT/Diamond/Me/ + usual sample bots. After a couple of rounds the memory was near 500 MB and the garbage collection worked very frequently. At this time both bots skipped turns like nothing. Diamond got disabled in 3 rounds and DrussGT had 150+ skipped turns. If i run both bots + samples without me, everything is fine (i have never seen both bots doing this and i use they quite often for tests). My bot got no skipped turn and showed no unusual behavior (beside the memory usage).
My guess is that the garbage collection counts against all bot times because it happens in background and is not related to one bot alone. If you have a bot that is near his cpu limit he will start to skip turns every time the garbage collection kicks in. My bot uses almost no cpu he just grabs the results from some HashMaps and so it got no skipped turns. Just a rough guess right now ... i'm a little sleepy right now and i will observe this a little in the future.
Hmm, that's a little scary that Diamond got disabled. =) Btw, DrussGT doesn't know anything about Melee so I wouldn't use it for Melee testing (maybe you meant Neuromancer?). I'm not really sure how much memory Diamond uses in Melee or if 10 Diamonds would run out of memory at 512 megs or not. He does push the CPU time a little by the end of the match with the amount of processing going on in the gun, though. Getting disabled early in the match would be very surprising to me indeed.
Of course you are right :) replace DrussGT with DemonicRage in the above posts. Like i said i'm very sleepy right now (it's 4:30am).
Hi mates. I'm playing right now with classifying the melee field and maybe we can share some thoughts. What i'm looking for, is to classify the whole field danger beside the single opponent danger. What i got so far is this little table:
It shows the max/min/avg turns when i died - related to the enemies left. The min/max/avg energy is the energy i had if i start to fight xx opponents. Count means how often i finished with x opponents left.
enemies left | count | max turn | min turn | avg turn | max energy | min energy | avg energy |
---|---|---|---|---|---|---|---|
0 | +10 | +1276 | +743 | +937 | +80.9 | +2.9 | +26.0 |
1 | +6 | +1252 | +784 | +983 | +81.6 | +6.9 | +36.7 |
2 | +6 | +1052 | +636 | +739 | +83.3 | +9.2 | +37.7 |
3 | +2 | +685 | +638 | +662 | +96.9 | +4.4 | +50.5 |
4 | +1 | +434 | +434 | +434 | +101.0 | +15.6 | +53.1 |
5 | +2 | +446 | +324 | +385 | +103.3 | +12.9 | +55.4 |
6 | +6 | +386 | +312 | +350 | +105.3 | +0.0 | +53.3 |
7 | +1 | +334 | +334 | +334 | +110.2 | +0.1 | +60.4 |
8 | +0 | NaN | NaN | NaN | +107.7 | +2.5 | +73.0 |
9 | +1 | +222 | +222 | +222 | NaN | NaN | NaN |
enemies left | count | max turn | min turn | avg turn | max energy | min energy | avg energy |
---|---|---|---|---|---|---|---|
0 | +100 | +3131 | +680 | +1227 | +219.0 | +11.1 | +139.5 |
1 | +0 | NaN | NaN | NaN | +220.6 | +41.0 | +145.3 |
2 | +0 | NaN | NaN | NaN | +217.9 | +56.9 | +141.7 |
3 | +0 | NaN | NaN | NaN | +199.0 | +64.0 | +139.8 |
4 | +0 | NaN | NaN | NaN | +184.7 | +64.0 | +136.9 |
5 | +0 | NaN | NaN | NaN | +180.7 | +61.3 | +131.3 |
6 | +0 | NaN | NaN | NaN | +167.6 | +54.8 | +126.5 |
7 | +0 | NaN | NaN | NaN | +164.1 | +59.3 | +122.2 |
8 | +0 | NaN | NaN | NaN | +159.4 | +68.3 | +115.7 |
I'm not sure how fast this values correlate to the current field danger, but i guess it is a good start. As you can see against the samples i could increase my damage and the movement could also be more aggressive because the field is weak. My opinion about the turn information is, you can see if you use the right weapon for the round state. Again - against the samples it looks i have some problems to hit (huge max turn, high diff between min and average) and should use another gun. Against the micros it shows an energy gap between 2-3 opponents left (so i should possible change the movement at this state).
My thought is, if i read this informations while battling and change my tactics on them it could be rewarding. What do you think and maybe there are some other data that should be collected to classify the field danger.
Take Care
Hi. Has somebody an idear how to make this smaller. I need the max bearing difference between all enemys. My gut feeling says it should be easier, but i can't see it.
private void calcBearingDiff()
{
if (myScans.isEmpty()) return;
Comparator<ATarget> compi = new Comparator<ATarget>()
{
@Override
public int compare(ATarget a, ATarget b)
{
double eAbsBearA = a.getBearing() + myRobot.getHeadingRadians();
double eAbsBearB = b.getBearing() + myRobot.getHeadingRadians();
return Double.compare(eAbsBearA, eAbsBearB);
}
};
ArrayList<ATarget> enemys = new ArrayList<ATarget>(myScans.values());
Collections.sort(enemys, compi);
enemys.add(enemys.get(0));
ATarget last = null;
for (ATarget target : enemys)
{
if (last != null)
{
double eAbsBearingA = last.getBearing() + myRobot.getHeadingRadians();
double eAbsBearingB = target.getBearing() + myRobot.getHeadingRadians();
double diff = Utils.normalRelativeAngle(eAbsBearingA - eAbsBearingB);
// .... sort out the max
}
last = target;
}
}
Thanks Chase. ATarget is a comparable but for other stuff. What i was looking for was something around another data structur. The above code snippet is way to much code for my taste. I thougth about to register the next ATarget on every ATarget and then simple ask the difference but it didn't work very well because i had to reorder the references to much. I'm looking for something that can handle ... update ATarget ... sort out the closest (bearing) ATarget ... and give the difference back ... I think i have to find a appropriate List/Tree structure for this.
Hmmm... what are you trying to use this for? I don't think I quite understood the question. Are you trying to get the biggest angle between any two in consecutive radial order? Or the one which is the closest to 180 degrees from it?
Maybe this picture can explain what i need. As you can see the white lines are the absBearing to every enemy and the transparent white area is the area from the two enemys who have the widest bearing to each other. I need this for my radar and my movement.
And yes i need the biggest angle between two in radial order (i guess :)). Nevermind the blue and green lines they are for something else.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
Return to Thread:User talk:Wompi/Questions/reply (6).
You nailed it mate. Thanks. Looks like i was totaly looking at the wrong direction. But at least my gut was right :). Man this is even smaller than i hoped for.
You are welcome, but this code would not work:) Now I have no time to describe why (writing on english is difficult for me), but try to test different cases and you will easy understand the problem.
I also thought there might be some issues at certain angles with the single loop approach.
I think you need to take a <math>n^2</math> approach, ie, a loop within a loop. Otherwise you need to use a sorting technique (with nlogn), then a single loop. Here is pseudocode:
initialise min_sum = Inf For each bot, b: me_b = find the angle from me to b initialise min_rel = Inf, max_rel = -Inf. for each bot c, excluding b: me_c = find the angle from me to c rel = the relative angle between me_b and me_c if rel < min_rel, min_rel = rel. if rel > max_rel, max_rel = rel. sum = max_rel - min_rel if sum < min_sum, min_sum = sum, min_ang = me_b + min_rel, max_ang = me_b + max_rel.
The other approach would be to sort all the angles into radial order, then go through looking for the largest space between two angles, and then use the opposite part of the circle. So in pseudocode:
for each bot, b: me_b = angle from me to b angles[i++] = me_b sort_ascending(angles) max_rel = abs(relative_angle(angles[0] - angles[angles.length - 1])) min_angle = angles[0] max_angle = angles[angles.length-1] max_index = 0 for(i = 1; i < angles.length; i++) rel = abs(relative_angles(angles[i-1] - angles[i])); if rel > max_rel max_rel = rel min_angle = angles[i] max_angle = angles[i-1] max_index = i
Yes Jdev you are right it does not work for all angles and i was aware of that. But it pushed me into another direction to think about it. If the bot stays almost ever on the edge or corner of the battlefield your code works very well i get some really impressive average visit counts with my radar.
Thanks Skilgannon your first approach looks interesting and i will give it a try. Haven't found the time for now. My first thougth to overcome the angle glitch was to throw in a signum() direction check and switch the angles if they don't fit. Don't know how to describe this and its again more of my gut feeling which tells me that this might work. I'm almost sure i did this once but lost it. The second one looks a little like my first try, not really sure about that to.
But anyway, thanks to both of you for bringing me out of my stubborn mind state.
Congratulations on a strong competitor to the micro melee field! It's certainly nice to see some activity there. Based on watching it in just a few battles, Wallaby seems to have an impressive melee gun. Good luck with your robots--CrazyBassoonist 14:21, 22 April 2012 (UTC)
Thanks mate. I'm a big fan of your robots and i hope i can give you a little challenge. It would be nice to see you coming back. If you look at the sources of wallaby you can see i used (stole) some stuff of your robots. And i deeply hope you are ok with this. Right now i'm working on a better movement and i think it can do well, its mainly a codesize problem. The gun has got also a little improvement and it should bring me a little closer to oog.melee.Capulet (hopefully :) ). Would be nice to have someone to discuss do/don't things for micro/nano melee.
Well if you want to talk about small bots or robocode in general, I'm open. I may not be coding actively right now(though we'll see if that continues...) but I do check the wiki frequently. As for using code from my bots, I'm perfectly okay with that in small amounts. However, I would encourage you to find your own ways of doing things; nothing I do is perfect(in fact it's usually the opposite) and most of my successes came from me trying out my own weird ideas instead of copying other bots. Once again, nice to see someone doing something exciting in one of my favorite fields:)
First page |
Previous page |
Next page |
Last page |