<!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>Determining optimal route using fuzzy logic and Dijkstra's algorithm</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Julia Iskierka, Szymon Lipiec Faculty of Applied Mathematics Silesian University of Technology Kaszubska 23</institution>
          ,
          <addr-line>Gliwice, 44-100</addr-line>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <fpage>10</fpage>
      <lpage>15</lpage>
      <abstract>
        <p>-How to find optimal route between two cities of Silesian voivodeship taking into consideration four factors road's distance, condition, traffic level and maximum speed? A combination of fuzzy logic, graphs theory and Dijkstra's algorithm is an answer for this quation. Taking all this components, a simple system solving this problem was presented in this paper. A weighted graph with edges' weights defined by fuzzy logic was applied in Dijkstra's algorithm and a route between two given cities was found as a result. The proposed solution and conducted experiments are described and discussed in this paper.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>
        In XII century technical development and geopolitical
situation caused sudden increase of travel possibilities and therefore
showed up new problems connected with transport. People
could not memorize all the roads and using regular paper
map costed valuable time, not necessarily giving the best
of possible ways. Furthermore, there was no possibility of
measuring other factors than distance, like traffic level or
road’s condition, which are also very important. So people
began to look for mathematical models to solve cumulative
problems. New way of describing the world was invented
fuzzy sets [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>
        Fuzzy sets are an important element of today’s computer
science, which find a wide range of applications in
practical problems. To this day, mathematical aspects are being
expanded and improved, what can be seen on the example
of the presented works around the world. In [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], an efficient
fuzzy logic system with triangular type-2 sets was presented.
Again in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], a fuzzy controler was used for purposes of
making decisions in the object recognition system. Fuzzy
sets were used for inference [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Moreover, existing graph
theory was used to present maps what was described in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]
and algorithms determining the shortest path (for example
      </p>
    </sec>
    <sec id="sec-2">
      <title>Dijkstra’s algorithm) were created [6]. We connected mentioned methods in one system, which finds the best from available roads, given various factors.</title>
    </sec>
    <sec id="sec-3">
      <title>II. MATHEMATICAL PART</title>
      <sec id="sec-3-1">
        <title>A. Fuzzy sets</title>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>a) Usage: Fuzzy sets are used in situations when we can</title>
      <p>not describe things in true or false terms. If some people are
c 2019 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0)
hot
(1)
(2)
1
0:8
p
i
h
s
r
e
b 0:6
m
e
m
f
o 0:4
e
e
r
g
e
D 0:2
0
0
10
20
30
40
50</p>
    </sec>
    <sec id="sec-5">
      <title>Temperature [ C]</title>
      <p>At the example fuzzy set above we can see that for
values 18 C - 24 C it is hot in some extent defined by the
membership function, then from 24 C to 30 C it is definitely
hot and finally, again, definition of hotness is not so clear.
Such functions are based on expert knowledge - experience,
statistics or other sources. It depends on modeled system.</p>
    </sec>
    <sec id="sec-6">
      <title>b) Definition: Fuzzy set A in set X is a pair:</title>
      <p>A = f(x); A(x)jx 2 X)
where A : X ! [0; 1] is a membership function. It is often
denoted by (proposed by Lotfi Zadeh):
for finite set X:</p>
      <p>n
A = X
i=1</p>
      <p>A(x)=x;
where / is not division mark and sum does not mean
summing, but the fuzzy set being built from elements
xi of finite set X and being described by membership
function A(x);
for infinite set X:</p>
      <p>Z</p>
      <p>x2X
A =</p>
      <p>A(x)=x;
(3)
where / is not division mark and sum does not mean
summing, but the fuzzy set being built from elements
xi of infinite set X and being described by membership
function A(x).</p>
      <p>Membership functions have many shapes, but the most used
ones are trapezoidal, triangular, Gaussian and sigmoid.</p>
      <sec id="sec-6-1">
        <title>B. Mamdani’s fuzzy inference system</title>
        <p>With help of fuzzy sets it is possible to make a decision
making system. For example, we wonder if it is a good idea
to go running given the time of the day and the temperature.
Using suitable mathematical method, this decision can be
easily made. One of those methods is Mamdani’s fuzzy inference
system. It’s schematic way of working is shown below:</p>
      </sec>
      <sec id="sec-6-2">
        <title>Scheme of how Mamdani’s fuzzy inference system works</title>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>Input: Input vector with numerical description of parameters, on the basis of which we want to make a decision (like time and temperature).</title>
    </sec>
    <sec id="sec-8">
      <title>Fuzzy: Calculating the outcome of proper membership</title>
      <p>function for each element of input vector.</p>
    </sec>
    <sec id="sec-9">
      <title>Rules: Set of rules made from linguistic expressions of natural language, which are later transformed into numeric values needed in the decision making process. They are built in specific way, as shown below:</title>
      <p>If time is late and temperature is high, then probability of
running is high</p>
    </sec>
    <sec id="sec-10">
      <title>Inference: Having collected the data from set of rules, we can carry out inference. The easiest way to explain that is to show it on graph.</title>
      <sec id="sec-10-1">
        <title>Inference visualization</title>
        <p>We have two parameters having their own membership
functions, defining their states (like hot, early). We convert crisp
input values into fuzzy ones and take minimum of them for
logical operator or between the parameters and maximum for
and. Later, we aggregate the results of all rules by taking their
maximum.</p>
        <p>Defuzzification: Sharpening the result of inferencing
(fuzzy set) into numeric value. One of defuzzification methods
is centre of gravity method. Outcome is calculated from
formula:
(4)
(5)
for finite sets
for infinite sets
n</p>
        <p>X xi (xi)
output = i=1
n
X
(xi)</p>
        <p>;
i=1
Z X</p>
        <p>a) Graph definition: Graph is a mathematical structure
used for showing relations between objects. In a simplified
way, it is a collection of vertices (or nodes) and connections
between them, called edges. There are specific types of graphs
i.a.:
weighted graph - edges have weights
undirected graph - edges do not have orientations
b) Adjacency matrix: It is a square matrix used to
represent graph. Value of element aij indicate if there is a
connection (edge) between vertices i and j.</p>
      </sec>
    </sec>
    <sec id="sec-11">
      <title>c) Dijkstra’s algorithm: Algorithm used for finding the most optimal route between vertices of a graph. It is a greedy algorithm, so it makes locally optimal choices, which means that the overall result may not always be the best one.</title>
      <p>Algorithm step by step:
1) Mark all vertices unvisited and make a set of them. Label
the starting vertice as current.
2) For each vertice assign a distance - zero for the one you
start from, infinity for the rest.
3) Calculate distance from starting point for all unvisited
neighbours of current vertice. Compare the new value
with the old one and save smaller.
4) Remove the current vertice from the unvisited set (it will
not be checked again).
5) If all vertices have been visited or the smallest distance
among vertices in unvisited set is infinity, then stop.
6) Otherwise, set the vertice with shortest distance as
current and go to step 3.</p>
    </sec>
    <sec id="sec-12">
      <title>III. PROPOSED SYSTEM</title>
    </sec>
    <sec id="sec-13">
      <title>Membership function of length to actual distance ratio</title>
      <sec id="sec-13-1">
        <title>A. Mathematical model</title>
        <p>Weighted, undirected graph was made, where cities of
Silesian voivodeship were vertices and roads between them
were edges. The weights consisted of length, condition, level
of traffic and maximum speed. To save the data in memory a
slightly modified adjacency matrix was used - values inside
it kept not only the information about existence of the road,
but also it’s weight.</p>
        <p>1</p>
      </sec>
      <sec id="sec-13-2">
        <title>Graphical representation of used graph</title>
        <p>Fuzzy sets were modelled for every parameter of the road’s
weight.
Length of the road to actual distance ratio was used to check
how much "unnecessary" track has to be driven. Choosing
only length would make no sense, because it would always
return the same values, no matter if the road would lead
in straight line or be a winding one (so a longer one). For
example, if there would be two roads from city A to B,
one longer that another, but not long enough to qualify to
different fuzzy set, the result might be the same for both. The
method using ratio takes it into consideration.</p>
        <p>The actual distance between cities was calculated using
geographical coordinates and formula:
r
(x2
x1)2 + (cos
(y2</p>
        <p>y1))2
0:8
0:2
0
0
short
average</p>
        <p>long
very long
groups for each linguistic expression in output set (bad,
average, good), for example:
0:2
0:4 0:6</p>
      </sec>
    </sec>
    <sec id="sec-14">
      <title>Traffic level Membership function of maximum speed</title>
      <p>20
40
60
80
100
120
140</p>
      <p>Maximum speed [ khm ]</p>
      <p>Output membership function
1
0:8
0:8
i
c
´
s
o
n
˙ze 0:6
l
a
n
y
z
r
´np 0:4
e
i
p
o
t
S 0:2</p>
      <p>0:8
e
e
r
g
d 0:6
e
p
i
h
s
r
b 0:4
e
m
e
M
0:2
0
0
0:2</p>
      <p>0:4 0:6</p>
    </sec>
    <sec id="sec-15">
      <title>Quality of road</title>
      <p>0:8
1
Set of rules was implemented. They were divided into
Having been applied, Mamdani’s inference system evaluated
weight of every road in adjacency matrix. Dijkstra’s algorithm
used this modified matrix to determine optimal road between
given cities.
low
average</p>
      <p>high
0:8</p>
      <p>1
slow
medium</p>
      <p>fast
very fast</p>
      <p>If length to actual distance ratio is short and condition is
good and traffic level is low and max speed is fast, then
quality of road is good</p>
      <p>If length to actual distance ratio is short and condition is
average and traffic level is high and max speed is fast, then
quality of road is average
If length to actual distance ratio is very long and condition
is bad and traffic level is high and max speed is slow, then
quality of road is bad</p>
      <p>We took two cities - Gliwice and Zawiercie to check
Dijkstra’s algorithm. As shown on Table II, each route’s
weight was determined using fuzzy logic.</p>
      <p>On this small example it is easy to calculate without any
algorithm, that the finest route from Gliwice to Zawiercie leads
through Ruda S´ la˛ska and Katowice. Outcome of Dijsktra’s
algorithm matches with this calculation.</p>
      <p>ID
1
2</p>
      <p>Connecting described mathematical models - fuzzy sets,
graphs theory and Dijkstra’s algorithm - can result in properly
working system for determining optimal route between two
points at the map. In this project data regarding road status
was set statically, but if some sensors or processed satellite’s
images were used to provide the data and graph was expanded,
it could be utilized as navigating system. However, it’s
efficiency might not be the best, as Dijkstra’s algorithm looks
through all vertices, so it could be replaced by different route
finding algorithm.</p>
      <p>Defining fuzzy sets also needs a closer look. As they are
created on basis of experts knowledge, it is not easy to check
if we made them properly. Some research should be made to
have a foundation to work on and determine them the finest
way.
[10] A. Fornaia, C. Napoli, and E. Tramontana, “Cloud services for
ondemand vehicles management,” Information Technology and Control,
vol. 46, no. 4, pp. 484–498, 2017.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>L. A.</given-names>
            <surname>Zadeh</surname>
          </string-name>
          , “Fuzzy logic,” Computer, vol.
          <volume>21</volume>
          , no.
          <issue>4</issue>
          , pp.
          <fpage>83</fpage>
          -
          <lpage>93</lpage>
          ,
          <year>1988</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>J. T.</given-names>
            <surname>Starczewski</surname>
          </string-name>
          , “
          <article-title>Efficient triangular type-2 fuzzy logic systems</article-title>
          ,”
          <source>International journal of approximate reasoning</source>
          , vol.
          <volume>50</volume>
          , no.
          <issue>5</issue>
          , pp.
          <fpage>799</fpage>
          -
          <lpage>811</lpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M.</given-names>
            <surname>Woz</surname>
          </string-name>
          <article-title>´niak and D</article-title>
          . Połap, “
          <article-title>Object detection and recognition via clustered features</article-title>
          ,
          <source>” Neurocomputing</source>
          , vol.
          <volume>320</volume>
          , pp.
          <fpage>76</fpage>
          -
          <lpage>84</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>C.-C.</given-names>
            <surname>Lee</surname>
          </string-name>
          , “
          <article-title>Fuzzy logic in control systems: fuzzy logic controller</article-title>
          . ii,
          <source>” IEEE Transactions on systems, man, and cybernetics</source>
          , vol.
          <volume>20</volume>
          , no.
          <issue>2</issue>
          , pp.
          <fpage>419</fpage>
          -
          <lpage>435</lpage>
          ,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>D. B.</given-names>
            <surname>West</surname>
          </string-name>
          et al.,
          <article-title>Introduction to graph theory. Prentice hall Upper Saddle River</article-title>
          , NJ,
          <year>1996</year>
          , vol.
          <volume>2</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>S. E.</given-names>
            <surname>Dreyfus</surname>
          </string-name>
          , “
          <article-title>An appraisal of some shortest-path algorithms</article-title>
          ,” Operations research, vol.
          <volume>17</volume>
          , no.
          <issue>3</issue>
          , pp.
          <fpage>395</fpage>
          -
          <lpage>412</lpage>
          ,
          <year>1969</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>O.</given-names>
            <surname>Cordón</surname>
          </string-name>
          , “
          <article-title>A historical review of evolutionary learning methods for mamdani-type fuzzy rule-based systems: Designing interpretable genetic fuzzy systems</article-title>
          ,
          <source>” Int. J. Approx. Reasoning</source>
          , vol.
          <volume>52</volume>
          , no.
          <issue>6</issue>
          , pp.
          <fpage>894</fpage>
          -
          <lpage>913</lpage>
          , Sep.
          <year>2011</year>
          . [Online]. Available: http://dx.doi.org/10.1016/j.ijar.
          <year>2011</year>
          .
          <volume>03</volume>
          .004
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>B.</given-names>
            <surname>Kosko</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Toms</surname>
          </string-name>
          ,
          <article-title>Fuzzy thinking: The new science of fuzzy logic</article-title>
          . Hyperion New York,
          <year>1993</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>A.</given-names>
            <surname>Fornaia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          , G. Pappalardo, and E. Tramontana, “
          <article-title>Enhancing city transportation services using cloud support,”</article-title>
          <source>in International Conference on Information and Software Technologies</source>
          . Springer,
          <year>2016</year>
          , pp.
          <fpage>695</fpage>
          -
          <lpage>708</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>