[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4586: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4588: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4589: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4590: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
AI Challenge Forums • View topic - Calculating State: performance

It is currently Sun Jan 21, 2018 6:29 am Advanced search

Calculating State: performance

Share and discuss ideas for your entries here.

Calculating State: performance

Postby odinsbane » Fri Sep 17, 2010 5:44 pm

On any turn you can know what all of ship values are for any planet for any time. Has anybody who uses this information found an advantage to calculating the state each turn vs incrementally( creating the state once, and then updating the state each turn ).

I have seen somebody mention doing it incrementally by just evaluating new Fleets (criteria for new fleets), but I'm curious what other techniques might be useful. Currently I re-calculate the state each time without issue but, I plan on making a bot just for smoke screening to see if I can time out my other bot.

Another question along these lines, "How much information do you need?" I mention the timeline to know when each planet will be at a value, but maybe this information can be truncated to certain planets or certain time durations.

I am willing to share/post code.
odinsbane
Cadet
 
Posts: 4
Joined: Fri Sep 17, 2010 2:29 am

Re: Calculating State: performance

Postby Terr » Fri Sep 17, 2010 6:31 pm

I haven't "found an advantage" yet, since my bot isn't operational, but I like the idea of incremental update, since it makes it easier to know what information you don't need to review. The simplest example would be the planet's relative locations and growth rates.

What I did is I created classes FleetHolder and PlanetHolder, which are used only for parsing out the game-state being sent. Only in certain conditions does the information in them affect my persistent collections of Fleet and Planet objects. For example, Fleets cannot be altered mid-flight in any way, so I only need to look for FleetHolder objects which have recently been launched.
Terr
Brigadier-General
 
Posts: 155
Joined: Mon Sep 13, 2010 9:19 pm

Re: Calculating State: performance

Postby voidptr » Fri Sep 17, 2010 10:04 pm

voidptr
Brigadier-General
 
Posts: 139
Joined: Sun Sep 12, 2010 7:22 pm

Re: Calculating State: performance

Postby yellowseed » Sun Sep 19, 2010 3:42 pm

I too am invested in calculating future states. I'm surprised at how little time it takes, and so far I too have had no difficulty calculating the future all over again each turn. I also do a lot of sorting planets by distance, and the only reasons I've ever timed out are bugs and typos.

When this is all over, I'd love to see how others dealt with the problem of predicting the future when heavily armed enemy planets are involved. Is anybody going to try a state-search algorithm like A-star? I'm not sure where to begin with something like that -- it seems like there would be too many calculations involved to treat each turn as a successive state.
yellowseed
Lieutenant
 
Posts: 11
Joined: Fri Sep 10, 2010 10:05 pm

Re: Calculating State: performance

Postby rangzen » Tue Sep 21, 2010 10:08 pm

So far, I didn't have to deal with complex way of calculating cause each time I'm affraid to overload the server and then time out so I find a lot of shortcuts to accelerate and limit at maximum complex prediction. I can actually calculate everything I need at each turn.
But we are here for 2 more months !!! So complexity will come :twisted:
User avatar
rangzen
Lieutenant-Colonel
 
Posts: 42
Joined: Sun Sep 12, 2010 6:14 pm

Re: Calculating State: performance

Postby mleise » Mon Sep 27, 2010 6:24 pm

For those who try updating the data only on new fleets, keep in mind that theoretically no fleets are created for ships traveling to a planet with a distance of 1 or less. They just arrive. At least PlayGame.jar shows this behavoir. You could play a whole game without any 'fleet objects' - blows your mind!
mleise
Lieutenant-Colonel
 
Posts: 42
Joined: Mon Sep 27, 2010 6:18 pm

Re: Calculating State: performance

Postby Coolcat » Tue Sep 28, 2010 4:02 pm

I'm planning to maintain a per planet, which maps remaining turns to the fleet object. This way predicting the future state of a planet would be nothing more than an iteration over this map, while new fleets can easily inserted. Further optimization would be to store just the amount of arriving ships per player per turn. This way the theoretic complexity would be just O(min(maxDistanceOnMap, incommingFleetsForThisPlanet)).

When storing all intermediate results, an update of results you computed earlier can be done at least partially. You can keep all results up to the point in time where the first of the new fleets arrives at your planet. However, most of the time the number of ships available in the current turn changes, so this optimization is pointless.
Coolcat
Lieutenant
 
Posts: 11
Joined: Sat Sep 25, 2010 11:52 am


Return to Strategy

Who is online

Users browsing this forum: No registered users and 2 guests

cron