jxiong21029 / LuxS2

0 stars 0 forks source link

Win prediction with initial factory setup #2

Open jxiong21029 opened 1 year ago

jxiong21029 commented 1 year ago

Description

The thing that sets Lux AI season 2 apart from most other similar competitions (Battlecode, season 1, etc.) is a setup phase, where players bid for turn order, select their factory locations, and decide on how many resources to allocate to each factory.

Supposing there was a way to predict how advantageous a given initial setup is, one could use a basic search algorithm (e.g. minimax) to determine the optimal starting strategy. The current task is to build that predictive model.

Deliverables

Given the map after the setup phase (once all factories have been placed), we want a model that predicts the winner based on factory locations and resource allocations.

This model can potentially be trained with replays on Kaggle.

brownie-in-motion commented 1 year ago

The replay schema seems to be somewhat inconsistent. In the first step of replay 46906829.json, the rubble on the board is encoded as a 2D array of quantities. However, later steps have rubble encoded as an object. The keys of this object are comma separated coordinates, but the values are always zero.

In commit 85535fee4720f64a52d3d039b6ca3207dbb734ca we assume in initial_prediction/loader.py that in later steps, the rubble has default value zero and the object encodes only relevant entries. Additionally, there seem to be no resources initially on the board. The loader is written to interpret other resources in the same way as rubble with a default value of all zeros.

Lastly, a choice we made was to omit starting resources in our representation. This is because we are classifying on final states and extra resources are discarded before the actual rounds.

jxiong21029 commented 1 year ago

I think the way they encoded the replays, each entry should only encode the changes that occurred that step.

Either way, instead of decoding the replays manually, you could instead use something like this and parse the environment using the luxai_s2 library.

It's true that unused starting resources are discarded. However, the way in which the resources that weren't wasted were distributed to the factories is important. Although, it's likely that most people on the leaderboard currently just distribute resources evenly, 150 water and 150 metal per factory.