Open gyusang opened 11 months ago
Feature Description | Type | Normalization |
---|---|---|
[Ally/Enemy] [Light/Heavy] Robot 존재 여부 | Bool[2][2] | |
[Ally/Enemy] [Ice/Ore/Water/Metal/Power] [보유량] | Int[2][5] | |
[Ally/Enemy] [Ice/Ore/Water/Metal/Power] [잔여량] | Int[2][5] |
Feature Description | Type | Normalization |
---|---|---|
[Ally/Enemy] Factory 존재 여부 | Bool[2][1] | |
[Ally/Enemy] Factory [Ice/Ore/Water/Metal/Power] 보유량 | Int[2][5] | |
[Ally/Enemy] watering cost | Int[2][1] | |
[Ally/Enemy] delta power | Int[2][1] |
Feature Description | Type | Normalization |
---|---|---|
Lichen Value | Int |
Feature Description | Type | Normalization |
---|---|---|
Rubble value | Int |
Feature Description | Type | Normalization |
---|---|---|
Ice | Bool | |
Ore | Bool |
Feature Description | Type | Normalization |
---|---|---|
Current Cycle | Bool[20] | |
Current Turn in Cycle | Bool[50] | |
If at day | Bool | |
(Ally/Enemy)Total Lichen | Int[2] |
UnitAction(
action_type=Array(0, dtype=int8),
direction=Array(1, dtype=int8),
resource_type=Array(0, dtype=int8),
amount=Array(0, dtype=int16),
repeat=Array(0, dtype=int16),
n=Array(1, dtype=int16)
)
를 아래와 같이 변환
UnitAction(
action_type=Categorical((MOVE, TRANSFER, PICKUP, DIG, SELF_DESTRUCT, RECHARGE), n=6),
direction=Categorical((CENTER, UP, RIGHT, DOWN, LEFT), n=5),
resource_type=Categorical((ice, ore, water, metal, power), n=5),
amount=Array(0, dtype=int16),
repeat=Array(False, dtype=bool),
n=Array(1, dtype=int16)
)
amount & n 을 어떻게 할 것인가...
ActionQueue(
data=UnitAction(...),
front=ShapedArray(int8[]),
rear=ShapedArray(int8[]),
count=ShapedArray(int8[])
)
[front] , [(front+1)%capacity], ..., [(rear - 1) % capacity]
where (rear - 1) % capacity == (front + count - 2) % capacity
unit_type=ShapedArray(int8[2,200]),
action_queue=...,
team_id=ShapedArray(int8[2,200]),
unit_id=ShapedArray(int16[2,200]),
pos=Position(pos=ShapedArray(int8[2,200,2])),
cargo=UnitCargo(stock=ShapedArray(int32[2,200,4])),
power=ShapedArray(int32[2,200])
)
pos를 이용해서 board에 concatenate?
id2idx[4] = [0 0]
id2idx[5] = [0 1]
id2idx[6] = [1 0]
id2idx[7] = [1 1]
state.units.unit_id[0][0]=Array(4, dtype=int16)
state.units.unit_id[0][1]=Array(5, dtype=int16)
state.units.unit_id[1][0]=Array(6, dtype=int16)
state.units.unit_id[1][1]=Array(7, dtype=int16)
id2idx
를 잘라서 batching하고 각 batch마다 이미지에 해당 픽셀에 유닛/팩토리 데이터 넣은 다음에 다 sum() 하면 어차피 한 번씩만 들어갈거고 나머지는 zero니까 좀 병렬적으로 observation을 만들 수 있긴 할듯
한 unit씩 순차적으로 하는 것보다?
id2idx
를 잘라서 배치한다는게 정확히 무슨 뜻인지?0e2de0aa7a9c9dcee621f70b18b078a822b732a5
@partial(vmap, in_axes=0)
def add_at_mask(array, x, y, mask):
zeros = jnp.zeros_like(array)
# `mode=drop` prevents unexpected index-out-of-bound behavior
out = zeros.at[x, y].add(mask, mode='drop')
return out
# TODO: Consider jitting this function
def get_unit_existence(unit_mask, unit_type, x, y):
'''
unit_type : ShapedArray(int8[2, MAX_N_UNITS])
unit_mask : ShapedArray(bool[2, MAX_N_UNITS])
x : ShapedArray(int8[2, MAX_N_UNITS])
y : ShapedArray(int8[2, MAX_N_UNITS])
output: ShapedArray(int8[4, MAX_N_UNITS])
light player 0, light player 1, heavy player 0, heavy player 1
unit type goes to axis 0 to preserve locality of player & unit_id axis
'''
light_mask = unit_mask & (unit_type==UnitType.LIGHT)
heavy_mask = unit_mask & (unit_type==UnitType.HEAVY)
zeros = jnp.zeros((2, MAP_SIZE, MAP_SIZE), dtype=jnp.int8)
light_unit_map = add_at_mask(zeros, x, y, light_mask)
heavy_unit_map = add_at_mask(zeros, x, y, heavy_mask)
unit_map = jnp.concatenate((light_unit_map, heavy_unit_map))
return unit_map
Action queue를 encoding해서 Channel Attention weight로 넣는 건 어떤지
Inputs
Full game state
state._fields
각 field
대부분 같은 세팅으로 플레이할 것이므로 딱히 필요 없음.
env_cfg.map_size
정도?굳이?
논문에서처럼 day/night cycle 고려해서 one-hot으로 encoding?
ice, ore를 합쳐서 0 1 2 one-hot? symmetry는 뭘까
이거를 그 픽셀에 추가로 넣어줘야되나
요것도
요건 bidding이랑 factory placing 때?
Outputs
Pipeline