<!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>The Combination of Morphological and Evolutionary Algorithms for Graph-based Pathfinding on Maps with Complex Topologies</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Bryansk state technical university;</institution>
          <addr-line>Bryansk</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>I. A. Savostin</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>One of the difficult problems to solve has always been and still remains the problem of finding a path either in a graphic chart or a graphic maze of large size. The main problem is that traditional algorithms require a lot of time due to combinatorial complexity. At the same time, both classical algorithms based on the search of variants (such as Dijkstra's algorithm, A*, ARA*, D* lite), and stochastic algorithms (ant algorithm, genetic), alongside with algorithms based on morphology (wave) are not always able to achieve the goal. The article proposes a new modification of the path-finding algorithm, which is a hybrid of the following: the morphological operations on graphic chart approach and genetic algorithm having a useful property of elasticity in time. The experiments (both synthetic and real data) have shown the feasibility of the proposed idea and its comparison with the most commonly used algorithms of contemporaneity.</p>
      </abstract>
      <kwd-group>
        <kwd>path search</kwd>
        <kwd>genetic algorithms</kwd>
        <kwd>morphological transformations of images</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Finding a path in the maze has been and remained rather a
complex computational task [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. The solution of this problem
is very important for different fields of science. For example,
when driving autonomous vehicles, more often than not it is
critical to construct a path in conditions of large map and
limited resources [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Besides, this algorithm can be used in
automation theory, graph-based image segmentation, transport
problems and other fields. At the same time it is worth noting
that very often the source data is a certain image that needs to
be processed, formalized and only after that finding of the best
route should be reasonable. Today, there are many
problemsolving approaches. For example, in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] we consider a
variantbased approach-A *, which is a classical algorithm that uses
heuristics to speed up the search. This approach fits for
problems of small dimension with a topology that is
advantageous from the heuristic point of view. However, it has
a number of disadvantages: with large size maps the algorithm
operation time increases significantly. Besides it, this algorithm
implies very unfavorable topologies, in which time increases
extremely strongly due to “errors” of heuristics, which prevents
the fulfilment of objectives [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. The paper [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] proposes
algorithm ARA*, which allows varying the time of the
algorithm with respect to the quality of the path, however, like
other algorithms based on brute force and heuristics (for
example, D * lite [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], the most widely used in practice today),
shares the common disadvantages of the class. Another class of
algorithms is stochastic-algorithms based on working with
random and pseudo-random variables. The ant algorithm [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]
copes well with the task of finding a path, however, has a
propensity to falling into local maxima comparing to the genetic
algorithm [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], which is partially deprived of it, but in its turn,
has some problems with convergence in case of a large
genotype length and sequence nature of the path [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
Algorithms based on morphology (wave [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], filler-algorithms
[
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]), as a rule, are unable of both: effective reusing of the
previous runs results and map formalizing. However, this class
is well suited for cases where the source data is given
graphically, which are the subject of this work. Therefore,
despite the abundance of approaches, this problem cannot be
considered to have been completely solved. Most modern
approaches do well with small-sized maps, but their
performance falls heavily with the number of forked roads,
which can be critical for autonomous mobile objects having
limited resources. In such situations, a time-elastic algorithm
that is able to find a good enough solution in a short period of
time and then, if it is necessary to make it specific, can be
considered acceptable.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Statement of the problem</title>
      <p>In this paper, we consider the problem of finding the
optimal route of movement on the map, given graphically. Let
there be given a map as a matrix:</p>
      <p>11 ⋯  1
 = ( ⋮ ⋱ ⋮ ) , (1)</p>
      <p>1 ⋯  
where aij = {wall, free, start, finish}; n – image width; m –
image height.</p>
      <p>It is required to find a path P of length l such that:</p>
      <p>= { 1,  2 , … ,   },  →  ,
where ki = {left, right, up, down}; n – number of turns; l –
geometric path length.</p>
      <p>Graphical representation, complex topology, and large map
size result in the following problems, in the context of
autonomous robot path-finding algorithms:</p>
      <p>As a rule, autonomous robots are used to work in conditions
that are dangerous for human life and health, which often
implies danger also for the robot itself. When the values of
environmental parameters are beyond the permissible values for
the operation of the robot, it is necessary to plan an evacuation
route as quickly as possible. Accordingly, the algorithm must
have the property of elasticity in time that is the ability to vary
the location time, even if it decreases the quality of the
discovered path.</p>
      <p>Graphical representation means a checkered field having
marks and implying the possibility of movement through the
checker squares. The problem is that each free square is a
decision point concerning the direction of further movement,
which greatly increases combinatorial complexity in the case of
large free spaces.</p>
      <p>The non-formalized representation imposes restrictions on
both: the use of graph-based algorithms and the reuse of the
previous algorithm runs results: since the map is an image and
you can just use methods based on morphology, but on large
maps in case of reruns, they are much slower than graph-based
algorithms.</p>
      <p>A large number of nodes of the graph is a classical problem
of algorithms based on the search of variants, since
combinatorial, and as a consequence, computational complexity
increases, at best, in proportion to the number of nodes. The use
of heuristics based algorithms improve, in general, the
efficiency of algorithms based on the enumeration of
possibilities, however, in case of unfavorable for heuristics
topology of the maze, these algorithms work extremely
inefficiently.</p>
      <p>To solve these problems, this paper proposes a hybrid
algorithm based on morphological operations in image maps for
pre-optimization, formalization of the map to the graph-based
one as a transition table of a finite-state automation with a
preliminary estimate of the nodes and calculation of arcs
weights, and the application of a modified genetic algorithm to
search the paths in the graph.
3. Use
of
morphological
operations
for
preliminary optimization of the map</p>
      <p>For preliminary optimization of the map it has been decided
to use</p>
      <p>
        morphological transformations [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. The key-note of
morphology is focused on convolution kernel run over the
image in order to transform it according to the given rules.
      </p>
      <p>Suppose A is the map image (1), W is the convolution
kernel, in such case:</p>
      <p>( −1, −1)  ( −1, )

= (  ( , −1)
 ( , )
  −1, +1)
 ( , +1) ) ,
 ( +1, −1)  ( +1, )  ( +1, +1)
where w = {wall, free, no matter}; i, j are coordinates relative to
the center point.</p>
      <p>Suppose  ( ,   ) is a convolution operator, so:
 ( ,   ) = {
,
where</p>
      <p>∈  ,  ∈  .</p>
      <p>In this case, standard operations such as erosion, dilation,
make-and-break
are ill-adapted
for solving the
problem.</p>
      <p>Therefore, to optimize the maze, we’ve developed our own
kernel packages, which are created to fill with “inefficient path”
labels. Their main task is to reduce the number of paths and
branches that can</p>
      <p>be discarded in advance and thereby
downscale the dimension of the problem. The main kernels
were chosen as follows: elimination of nonconvex areas, going
across which is not advantageous for geometric reasons (Fig. 1).
This allows us to eliminate from consideration those paths that
will be obviously longer (for example, diagonally).</p>
      <p>There is an optimization of both: rectangular areas with
multiple inputs and cubes of 2x2 square (bottom row in
Fig. 1-3).</p>
      <p>In all figures, the black color is the indicator of the presence
of obstacles, light gray presents free spaces, dark gray indicates
that the state of the square does not matter in this convolution
operation.</p>
      <p>Mathematically, the kernel is expressed by the
following convolution matrix (for example, for the kernel in
) .</p>
      <p>Fig2. Convolution kernels to remove the 2x2 cubes
Fig3. "Greedy" convolution kernels to fill large empty areas
After these convolution kernels’ run over all maps dead-end
branches would shrink and turn to be completely full, wide
paths and large spaces are compressed either to the optimal
paths or road forks of single width and that results in the map
image being formalized into the graph. In this case, the paths
are treated as arcs because of the single width, while the forks
are regarded as nodes of the graph. In addition, the nodes are
estimated by the farness distance from
the target point,
transition table is constructed,
weights are
counted
and
sequences of commands to move along arcs are recorded. In
other words, after this step the problem is put into a formalized
finite state bot.</p>
      <p>An example of the original map and the results of the
morphology are shown in Fig. 4 and 5. For illustrative purpose
a map of the Bezhitsky district of Bryansk was taken, the image
of which was obtained from the Yandex Map Service (people’s
map). In the original map, white indicates areas, which are good
for moving, while black is the indicator of unfitted areas.
Fig1. Convolution kernels to fill non-convex regions</p>
      <p>Fig 5. Marked paths and road forks</p>
      <p>The image of the result has been inverted in brightness for
better readability, where white presents not available for traffic
areas, light grey indicates available ones, dark grey specifies the
ways of single width and black is the indicator of single width
road forks.</p>
      <p>In its original state, the map contained 61951 locations with
possible movements in more than one direction (road forks).
The use of morphological operations described above reduced
the dimension of the problem to 647 road forks.</p>
    </sec>
    <sec id="sec-3">
      <title>4. The use of evolutionary algorithms</title>
      <p>
        Even after reducing the dimension of the problem, the use
of algorithms based on the search is impractical for reasons of
graphical representation and a large number of the transition
graph nodes. Morphological algorithms are suitable only for
initial optimization and are not good for being the only means
in solving the problem of finding paths. The proposed solution
is connected with stochastic algorithms. However, the ant
algorithm tends to hit local maxima and according to studies [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]
it loses in speed to the genetic one. Nevertheless, the classical
genetic algorithm does not cope with the task perfectly. It has
some very serious problems.
      </p>
      <p>The first and the most serious disadvantage is the” fragility”
of the genotype. From the point of view of the current task the
way can be estimated either by attaining the goals or in case of
covering the distance. The consistent nature of the pathway,
shifted to the chromosomes with which standard genetic
operators work, leads to the fact that random changes in the
genotype violate the integrity and correctness of the paths
resulting in the impossibility to evaluate their optimality in the
context of the active task.</p>
      <p>In terms of implementation it is easier to use approaches
that involve a fixed chromosome length. In this case, it is
convenient to represent the genotype in the form of
chromosomes, in which genes are forks and loci are
respectively directions of movement at the forks. This raises the
following problem: with a large number of forks very long
chromosomes are obtained, that increases the combinatorial
complexity and “fragility " of the genotype significantly.</p>
      <p>These problems make the use of the classical genetic
algorithm almost impossible in the context of the
abovementioned task. However, the work has developed a
modification of the algorithm which is permissive for the
successful purposes of the problem. The basic principles of
modification are as follows.</p>
      <p>Using a greedy algorithm to correct an individual's
genotype is a way to counter destructive mutations. The use of
this mechanism is designed to reduce the search space by
creating obviously integral parts of the path, to align the
population.</p>
      <p>The use of stigmergy mechanism, which is aimed at indirect
interaction of individuals in order to share knowledge about the
world. Stigmergy is the basic principle of the ant colony
optimization algorithm, however, in respect to genetics, it is
advantageous to use this approach not in the framework of the
population, but through many generations of one and the same
individual, i.e. learning cycles.</p>
      <p>When using automatic adjustment of the genotype on the
basis of the greedy algorithm and stigmergy, the classical
mutation and cross are useless, since their effect is offset by the
described above algorithms. To avoid this, allele fixation and
elitism mechanisms have been introduced. Elitism gives the
possibility to disable the actions of all modified genetic
operators, in order not to lose good genotypes for retraining
under the action of stigmergy. Fixation of alleles allows
blocking within a certain number of generations the effect of
greedy algorithm on genes having been under mutation and
cross operations. The result of the algorithm is shown in Fig. 6.
The obtained path is shown in red.</p>
      <p>Fig 6. The result of the algorithm</p>
    </sec>
    <sec id="sec-4">
      <title>5. Testing and results</title>
      <p>For the combined algorithm testing the images of mazes
generated in Daedalus were used, as well as images of maps in
the areas with selected roads.</p>
      <p>At first there were some tests, which were carried out to
compare the full-time operation of the genetic algorithm and
then in the mode with disabled operators of crossing and
mutation. The main idea of the test is to illustrate that using
greedy algorithm with stigmergy solely is less optimal than
applying a combination of genetics. The result is an
acceleration of convergence by using crossing and mutation
operators.</p>
      <p>Then a series of comparisons of the developed algorithm
with the algorithm D * lite took place, taking into account the
fact that D* lite is the most popular in the control devices of
autonomous robots. These comparisons were made by using
large mazes with the best algorithms based on the variety of
being tried topologies, average cases, unfavorable topology
(multiple nested horseshoe-shaped obstacles –fig. 7), as well as
by using the terrain map small image.</p>
      <p>The main interest lies in the card with bad topology. The
image of the maze is generated by Daedalus, then it is manually
amended: horseshoe-shaped walls have been added and besides
it, some passages have to be also made because of the walls,
which create unattainable areas in some places making
impossible to find the way to the goal.</p>
      <p>In the case of an advantageous topology D* lite made a
quick work of it, for the average case and on the terrain map it
dispatched the developed hybrid algorithm, but if it were
disadvantageous topology D* lite would fail because of 2 GB
memory. The exact time of the algorithms is given in table 1.
Table 1
D* lite
Developed
algorithm</p>
      <p>Time taken by an algorithm
Complex Average Advantageous
topology case topology</p>
      <p>OOM 225 129</p>
    </sec>
    <sec id="sec-5">
      <title>6. Conclusion</title>
      <p>In the course of investigation we've succeeded in the
development of a hybrid algorithm for finding a path in the
maze, surpassing the analogues used in practice in complex
topologies on large maps.</p>
      <p>Further research is required by policies of step-by-step map
corrections with rebalance of the graph, the use of concurrent
and adaptive crossover and mutation operators.</p>
    </sec>
    <sec id="sec-6">
      <title>7. References</title>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Alhanjouri</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Alfarra</surname>
            <given-names>B</given-names>
          </string-name>
          .
          <source>Ant Colony versus Genetic Algorithm based on Travelling Salesman Problem // International Journal of Computer Technology and Applications</source>
          . - Vol.
          <volume>2</volume>
          ,
          <year>2011</year>
          . - pp.
          <fpage>570</fpage>
          -
          <lpage>578</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Cormen</surname>
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Leiserson</surname>
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rivest</surname>
            <given-names>R.</given-names>
          </string-name>
          , Stein C. Introduction to Algorithms. - 3rd
          <string-name>
            <surname>edition</surname>
          </string-name>
          . - The MIT Press,
          <year>2009</year>
          . - 1292 p.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Delling</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ; Sanders,
          <string-name>
            <given-names>P.</given-names>
            ;
            <surname>Schultes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            ;
            <surname>Wagner</surname>
          </string-name>
          , D. Engineering Route Planning Algorithms // Algorithmics of Large and Complex Networks: Design,
          <string-name>
            <surname>Analysis</surname>
          </string-name>
          , and
          <string-name>
            <surname>Simulation</surname>
          </string-name>
          . - Springer,
          <year>2009</year>
          . - pp.
          <fpage>117</fpage>
          -
          <lpage>139</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Dorigo</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Maniezzo</surname>
            <given-names>V.</given-names>
          </string-name>
          <string-name>
            <surname>Colorni</surname>
          </string-name>
          <article-title>A.Ant System: Optimization by a Colony of Cooperating Agents /</article-title>
          / IEEE Transactions on Systems, Man, and
          <string-name>
            <surname>Cybernetics-Part B</surname>
          </string-name>
          . - pp.
          <fpage>29</fpage>
          -
          <lpage>41</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Gonzalez</surname>
            <given-names>R.C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Woods</surname>
            <given-names>R.E. Digital Image</given-names>
          </string-name>
          <string-name>
            <surname>Processing</surname>
          </string-name>
          . - 4rd
          <string-name>
            <surname>edition</surname>
          </string-name>
          . - Prentice-Hall,
          <year>2018</year>
          . - 976 p.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Hangl</surname>
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ugur</surname>
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Piater</surname>
            <given-names>J</given-names>
          </string-name>
          . Autonomous robots: potential, advances and future direction // Elektrotechnik und Informationstechnik.
          <source>- 2017</source>
          , Volume
          <volume>134</volume>
          , Issue 6. - pp.
          <fpage>293</fpage>
          -
          <lpage>298</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Koenig</surname>
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Likhachev M. D*</surname>
          </string-name>
          lite // Eighteenth national conference on
          <source>Artificial intelligence</source>
          . - Edmonton, Alberta, Canada,
          <year>2002</year>
          . - pp.
          <fpage>476</fpage>
          -
          <lpage>483</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Likhachev</surname>
            <given-names>M.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Gordon G.; Thrun S. ARA</surname>
          </string-name>
          <article-title>*: formal analysis</article-title>
          // School of Computer Science, Carnegie Mellon University,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <article-title>[9] Maze classification. Lists of Maze generation methods, Maze solving methods, and classes of Mazes in general.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Russell</surname>
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Norvig</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          <string-name>
            <surname>Artificial Intelligence</surname>
            :
            <given-names>A Modern</given-names>
          </string-name>
          <string-name>
            <surname>Approach</surname>
          </string-name>
          , 2rd
          <string-name>
            <surname>Edition</surname>
          </string-name>
          . - M.:
          <string-name>
            <surname>Wiliams</surname>
          </string-name>
          ,
          <year>2006</year>
          . - pp.
          <fpage>157</fpage>
          -
          <lpage>162</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Rutkovskaya</surname>
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pilinsky</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rutkovsky</surname>
            <given-names>L</given-names>
          </string-name>
          .
          <article-title>Neural networks, Genetic algorithms and Fuzzy systems</article-title>
          ., 2nd ed. - M
          <string-name>
            <surname>: Hotline-Telecom</surname>
          </string-name>
          ,
          <year>2008</year>
          . - 452 p.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Savostin</surname>
            <given-names>I. A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Trubakov</surname>
            <given-names>A. O.</given-names>
          </string-name>
          <article-title>Application of genetic programming for the solution of the problem of the optimal robot's motion path construction / / [Proc. of the XVI international scientific-practical conference of students, postgraduates and young scientists "Youth and modern information technologies."] -</article-title>
          <string-name>
            <surname>Tomsk</surname>
          </string-name>
          ,
          <year>2018</year>
          . - рp.
          <fpage>118</fpage>
          -
          <lpage>119</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>