<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Process Fuzzing as an Approach for Genetic Programming</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Tom Wallis</string-name>
          <email>w.wallis.1@research.gla.ac.uk</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Tim Storer</string-name>
          <email>timothy.storer@glasgow.ac.uk</email>
        </contrib>
      </contrib-group>
      <abstract>
        <p>Genetic Programming (GP) has recently seen a growing application in the area of writing and improving computer programs. Generally, for experiments in this area, bespoke tools are constructed to perform research. In this paper, it is demonstrated that GP behaviour can be achieved via process fuzzing, and an implementation of the adaptation of ASTs for GP behaviour in the process fuzzing tool PyDySoFu is described.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Genetic Programming (GP) is a very well-established and promising
eld which has returned impressive results in a number of areas. The
eld has spawned a number of similar approaches which, while based
on the same underlying concept, attempt an evolution-based solution
in novel ways. Cartesian GP[
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] uses a directed graph to represent a
solution to a problem, and has seen great success, for its ability to
converge on an acceptable solution in a relatively short number of
generations. Stack-based GP[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] employs the use of multiple di erent
stacks so as to work with state and keep track of multiple values,
which can be di cult for the traditional tree-based genetic
programming (TGP) approach.
1.1
      </p>
    </sec>
    <sec id="sec-2">
      <title>Genetic Improvement</title>
      <p>
        Generally, variants of GP present methods for improving
mathematicallooking functions against some tness function. However, variants
have begun to arise which, rather than mutating some abstract
representation of a program, mutate the program itself. Stack-based GP
in the Push family of languages[
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], for example, features an approach
where values on stacks can be code, which can be subsequently
executed; in this way, Stack-based GP can be used to achieve a kind of
metaprogramming. Similarly, Linear Genetic Programming[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] (LGP)
is a method which evolves a series of instructions, rather than a tree
of operations, to achieve a solution.
      </p>
      <p>
        Indeed, approaches involving the alteration of source code have
garnered a growing amount of attention: in the improvement of Java
programs alone, several tools for the improvement of a codebase have
arisen[
        <xref ref-type="bibr" rid="ref1 ref3 ref4">4,1,3</xref>
        ]. As well as improving codebases, genetic
improvementstyle metaprogramming could be used to implement solutions to
problems in GP, by constructing imperative processes that t a
curve, rather than a functional-style tree representation as in TGP[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
2
2.1
      </p>
      <sec id="sec-2-1">
        <title>Approaches with Process Fuzzing</title>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>A Brief Note on Process Fuzzing</title>
      <p>
        Ultimately, Genetic Programming relies on the mutation and
evaluation of a representation of a problem's solution. Process fuzzing
allows for this to be achieved for imperative code, by modifying
and rewriting it prior to execution. A tool implementing this is
PyDySoFu[
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. PyDySoFu catches function calls and | every time
a function is executed | modi es the function's AST1 and runs the
resulting code, rather than the original. This modi cation is
performed by passing the AST through a particular function, called a
\process fuzzer" (or \fuzzer").
      </p>
      <p>There is a clear link between the requirement for mutation in
GP and the functionality provided by a fuzzer. Some work is
required, however, to represent GP-like interactions within the tool.
Speci cally:
1. Multiple variants must be generated and their outputs tracked,
so they can be compared to each other, and ranked.
2. This ranking must be done by some function appropriate for the
problem domain at hand | GP's \ tness functions".
3. Once variants are ranked, it must be possible to recombine
successful ones and use these in future generations.
1 An Abstract Syntax Tree is a tree representation of an expression in a language
with a formal grammar, such as programming languages.
2.2</p>
    </sec>
    <sec id="sec-4">
      <title>Improving PyDySoFu</title>
      <p>PyDySoFu was originally unable to keep track of multiple variants,
nor record the return values of the variants it produced. The solution
was to extend PyDySoFu's underlying mechanism into a more fully
featured aspect orientation framework, capable of more sophisticated
code weaving.</p>
      <p>
        This extension became an aspect orientation framework, ASP[
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
ASP's pertinent feature is its abilty to weave advice around a method
of a class, such that functions can be executed before and after the
method is called, without being coupled to the original codebase.
2.3
      </p>
    </sec>
    <sec id="sec-5">
      <title>Implementing GP-Like Behaviour</title>
      <p>Critically, aspects in ASP can be objects. When fuzzers are written
as instances of aspect classes, they can use instance variables to keep
track of the variants they generate between invocations. Also,
because ASP is capable not only of including behaviour before method
invocation, but also after, PyDySoFu can utilise this to catch the
output from the method call, and use this to rank variants. This
satis es the rst of the three earlier criteria.</p>
      <p>When instances of fuzzers are created, a success metric2 can be
passed to its constructor, and this is kept within the object's state |
this can then be used in the ranking of variants in a round, ful lling
the second of the above criteria.</p>
      <p>
        Recombination of variants can be done by combining modi ed
ASTs from variants in the previous round when constructing a new
one | this ful ls the third of the above criteria, and is implemented
in such a way as to make recombination easily tailored to individual
problem domains via subclasses. Source for the GeneticImprover
implementation of these improvements can be found in the project's
repository[
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
2.4
      </p>
    </sec>
    <sec id="sec-6">
      <title>Bene ts of the Approach</title>
      <p>Use of PyDySoFu as a GP solution has a number of advantages.
First, it is under active development, meaning that the tool can
2 Improvements to PyDySoFu were not originally developed with GP speci cally in
mind. Therefore, generations are referred to as \rounds", and tness functions as
\success metrics".
be expected to improve. Users can anticipate PyDySoFu to be a
fertile ground for new research, where process fuzzing can be used
to separate concerns in a variety of elds.</p>
      <p>Importantly, PyDySoFu is not just a tool for implementing
solutions to GP problems. Its versatility is a second bene t: its most
active area of study, socio-technical variance, provides a plethora
of problem domains where GP might nd applications. Performing
this research without a cross-disciplinary tool would require lots of
ancillary work, but PyDySoFu bridges this gap.</p>
      <p>Further, PyDySoFu is able to fuzz code as it is run (\dynamic
fuzzing"). This functionality can be used to perform experiments
with GP solutions which might | for example | use dynamic
fuzzing to represent solutions which operate in an unreliable real
world, such as an unreliable network or anomalies in animal
populations.
3</p>
      <sec id="sec-6-1">
        <title>Future Work</title>
        <p>
          PyDySoFu is a new entrant into tools for running experiments within
GP, with the unusual trait that its suitability for evaluating GP
problems comes from its versatility, meaning that PyDySoFu is
positioned to be an unusually e ective tool in a variety of elds. Many
things can be done to increase PyDySoFu's e ectiveness as a GP
tool, and to exploit it's versitility to explore new research
possibilities, including:
{ A wider array of GP-style fuzzers can be implemented, building
on the broad array of code-improving GP approaches surfacing
in the literature. These could also be used to replicate previous
work in the eld.
{ Further exploration of GP using AST-style program mutation for
codebase improvement can also be explored in Python using
PyDySoFu, which, combined with the other research opportunities,
makes it an exciting alternative to existing solutions.
{ Given PyDySoFu naturally links socio-technical modelling and
GP, experiments involving GP solutions to socio-technical
problems are now feasible. A major contribution of GP interactions in
PyDySoFu is that the tool's versitility allows GP to be explored
within socio-technical problem domains[
          <xref ref-type="bibr" rid="ref10">10</xref>
          ].
        </p>
      </sec>
      <sec id="sec-6-2">
        <title>Conclusion</title>
        <p>This paper has given a brief overview of recent development of
PyDySoFu, a process fuzzing tool which is now capable of GP-style
interactions. While GP-style interactions arising from process fuzzing
is an interesting result of its own, the availability of the tool should
inspire further genetic metaprogramming work, and encourage
researchers to make use of its potential across a variety of domains.</p>
      </sec>
      <sec id="sec-6-3">
        <title>Acknowledgements</title>
        <p>The authors would like to thank Obashi Technology for helping to
fund this research, and Rob Dekkers for his help reviewing this work.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Arcuri</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>White</surname>
            ,
            <given-names>D.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Clark</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yao</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          <article-title>: Multi-objective improvement of software using co-evolution and smart seeding</article-title>
          .
          <source>In: Asia-Paci c Conference on Simulated Evolution and Learning</source>
          . pp.
          <volume>61</volume>
          {
          <fpage>70</fpage>
          . Springer (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Brameier</surname>
            ,
            <given-names>M.F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Banzhaf</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          :
          <article-title>Linear genetic programming</article-title>
          . Springer Science &amp; Business
          <string-name>
            <surname>Media</surname>
          </string-name>
          (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Castle</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Johnson</surname>
          </string-name>
          , C.G.:
          <article-title>Evolving high-level imperative program trees with strongly formed genetic programming</article-title>
          .
          <source>In: European Conference on Genetic Programming</source>
          . pp.
          <volume>1</volume>
          {
          <fpage>12</fpage>
          . Springer (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Cody-Kenny</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Galvan-Lopez</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Barrett</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <article-title>: locogp: improving performance by genetic programming java source code</article-title>
          .
          <source>In: Proceedings of the Companion Publication of the 2015 Annual Conference on Genetic and Evolutionary Computation</source>
          . pp.
          <volume>811</volume>
          {
          <fpage>818</fpage>
          .
          <string-name>
            <surname>ACM</surname>
          </string-name>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Koza</surname>
            ,
            <given-names>J.R.</given-names>
          </string-name>
          :
          <article-title>Genetic programming as a means for programming computers by natural selection</article-title>
          .
          <source>Statistics and computing 4</source>
          (
          <issue>2</issue>
          ),
          <volume>87</volume>
          {
          <fpage>112</fpage>
          (
          <year>1994</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Miller</surname>
            ,
            <given-names>J.F.</given-names>
          </string-name>
          :
          <article-title>Cartesian genetic programming</article-title>
          .
          <source>In: Cartesian Genetic Programming</source>
          , pp.
          <volume>17</volume>
          {
          <fpage>34</fpage>
          . Springer (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Perkis</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Stack-based genetic programming</article-title>
          .
          <source>In: Evolutionary Computation</source>
          ,
          <year>1994</year>
          .
          <source>IEEE World Congress on Computational Intelligence</source>
          .,
          <source>Proceedings of the First IEEE Conference on</source>
          . pp.
          <volume>148</volume>
          {
          <fpage>153</fpage>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>1994</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Spector</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>Autoconstructive evolution: Push, pushgp, and pushpop</article-title>
          .
          <source>In: Proceedings of the Genetic and Evolutionary Computation Conference (GECCO-2001)</source>
          . vol.
          <volume>137</volume>
          (
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Wallis</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Storer</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Asp github repository</article-title>
          . http://www.github.com/probablytom/asp (
          <year>June 2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Wallis</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Storer</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Modelling realistic user behaviour in information systems simulations as fuzzing aspects</article-title>
          .
          <source>CAiSE Forum</source>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Wallis</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Storer</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Pydysofu github repository</article-title>
          . http://www.github.com/twsswt/pydysofu (
          <year>June 2018</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>