Playing Regex Golf with Genetic Programming

被引:15
作者
Bartoli, Alberto [1 ]
De Lorenzo, Andrea [1 ]
Medvet, Eric [1 ]
Tarlao, Fabiano [1 ]
机构
[1] Univ Trieste, DIA, I-34127 Trieste, Italy
来源
GECCO'14: PROCEEDINGS OF THE 2014 GENETIC AND EVOLUTIONARY COMPUTATION CONFERENCE | 2014年
关键词
Regular Expressions; Genetic Programming; Programming by Example; Machine Learning; ALGORITHM; AUTOMATA;
D O I
10.1145/2576768.2598333
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
Regex golf has recently emerged as a specific kind of code golf, i.e., unstructured and informal programming competitions aimed at writing the shortest code solving a particular problem. A problem in regex golf consists in writing the shortest regular expression which matches all the strings in a given list and does not match any of the strings in another given list. The regular expression is expected to follow the syntax of a specified programming language, e.g., Javascript or PHP. In this paper, we propose a regex golf player internally based on Genetic Programming. We generate a population of candidate regular expressions represented as trees and evolve such population based on a multi-objective fitness which minimizes the errors and the length of the regular expression. We assess experimentally our player on a popular regex golf challenge consisting of 16 problems and compare our results against those of a recently proposed algorithm the only one we are aware of. Our player obtains scores which improve over the baseline and are highly competitive also with respect to human players. The time for generating a solution is usually in the order of tens minutes, which is arguably comparable to the time required by human players.
引用
收藏
页码:1063 / 1069
页数:7
相关论文
共 18 条
[1]  
[Anonymous], 2013, PMLR
[2]  
Barrero DF, 2009, DATA MINING AND MULTI-AGENT INTEGRATION, P143, DOI 10.1007/978-1-4419-0522-2_9
[3]  
Bartoli A., 2013, COMPUTER
[4]  
Bartoli A, 2012, PROCEEDINGS OF THE FOURTEENTH INTERNATIONAL CONFERENCE ON GENETIC AND EVOLUTIONARY COMPUTATION COMPANION (GECCO'12), P1477
[5]  
Bongard J, 2005, J MACH LEARN RES, V6, P1651
[6]  
Brauer F., 2011, CIKM, V11, P1285, DOI 10.1145/2063576.2063763
[7]  
Cetinkaya A., 2007, Proceedings of the 9th Annual Conference Companion on Genetic and Evolutionary Computation. GECCO'07, P2643
[8]  
Cicchello O., 2003, Journal of Machine Learning Research, V4, P603
[9]   A fast and elitist multiobjective genetic algorithm: NSGA-II [J].
Deb, K ;
Pratap, A ;
Agarwal, S ;
Meyarivan, T .
IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, 2002, 6 (02) :182-197
[10]  
Friedl J.E.F., 2006, Mastering Regular Expressions, V3