From Requirements to Source Code: Evolution of Behavioral Programs

Research output: Contribution to journalArticlepeer-review

Abstract

Automatically generating executable code has a long history of arguably modest success, mostly limited to the generation of small programs of up to 200 lines of code, and genetic improvement of existing code. We present the use of genetic programming (GP) in conjunction with context-oriented behavioral programming (COBP), the latter being a programming paradigm with unique characteristics that facilitate automatic coding. COBP models a program as a set of behavioral threads (b-threads), each aligned to a single behavior or requirement of the system. To evolve behavioral programs we design viable and effective genetic operators, a genetic representation, and evaluation methods. The simplicity of the COBP paradigm, its straightforward syntax, the ability to use verification and formal-method techniques to validate program correctness, and a program comprising small independent chunks all allow us to effectively generate behavioral programs using GP. To demonstrate our approach we evolve complete programs from scratch of a highly competent O player for the game of tic-tac-toe. The evolved programs are well structured, consisting of multiple, explainable modules that specify the different behavioral aspects of the program and are similar to our handcrafted program. To validate the correctness of our individuals, we utilize the mathematical characteristics of COBP to analyze program behavior under all possible execution paths. Our analysis of an evolved program proved that it plays as expected more than 99% of the times.

Original languageEnglish
Article number1587
JournalApplied Sciences (Switzerland)
Volume12
Issue number3
DOIs
StatePublished - 1 Feb 2022

Keywords

  • Behavioral programming
  • Code generation
  • Genetic programming

ASJC Scopus subject areas

  • Materials Science (all)
  • Instrumentation
  • Engineering (all)
  • Process Chemistry and Technology
  • Computer Science Applications
  • Fluid Flow and Transfer Processes

Fingerprint

Dive into the research topics of 'From Requirements to Source Code: Evolution of Behavioral Programs'. Together they form a unique fingerprint.

Cite this