领域特定语言用于抽象和推理语料库 (ARC-DSL)
该 DSL 旨在表达力足以允许解决任意 ARC 任务的程序,并且是通用的,即只由少量基元组成,每个基元对于许多任务都很有用(见 dsl.py
)。作为概念验证,编写了训练任务的求解程序(见 solvers.py
)。有关该工作的更详细描述,请参阅 arc_dsl_writeup.pdf
。
任务 00d62c1b 的示例求解程序:
def solve_00d62c1b(I):
objs = objects(grid=I, univalued=T, diagonal=F, without_bg=F)
black_objs = colorfilter(objs=objs, value=ZERO)
borders = rbind(function=bordering, fixed=I)
does_not_border = compose(outer=flip, inner=borders)
enclosed = mfilter(container=black_objs, function=does_not_border)
O = fill(grid=I, value=FOUR, patch=enclosed)
return O
任务 5521c0d9 的另一个求解器示例:
def solve_5521c0d9(I):
objs = objects(grid=I, univalued=T, diagonal=F, without_bgT)
foreground = merge(containers=objs)
empty_grid = cover(grid=I, patch=foreground)
offset_getter = chain(h=toivec, g=invert, f=height)
shifter = fork(outer=shift, a=identity, b=offset_getter)
shifted = mapply(function=shifter, container=objs)
O = paint(grid=empty_grid, obj=shifted)
return O