Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

computation

Article
Modified Kleene Star Algorithm Using Max-Plus Algebra and
Its Application in the Railroad Scheduling Graphical
User Interface
Ema Carnia * , Rinaldi Wilopo, Herlina Napitupulu , Nursanti Anggriani and Asep K. Supriatna

Department of Mathematics, Faculty of Mathematics and Natural Sciences, Universitas Padjadjaran,


Sumedang 45363, Indonesia
* Correspondence: ema.carnia@unpad.ac.id

Abstract: In max-plus algebra, some algorithms for determining the eigenvector of irreducible
matrices are the power algorithm and the Kleene star algorithm. In this research, a modified Kleene
star algorithm will be discussed to compensate for the disadvantages of the Kleene star algorithm.
The Kleene star algorithm’s time complexity is O(n(n!)), and the new Kleene star algorithm’s time
complexity is O n4 , while the power algorithm’s time complexity cannot be calculated. This research


also applies max-plus algebra in a railroad network scheduling problem, constructing a graphical
user interface to perform schedule calculations quickly and easily.

Keywords: eigenvector; time complexity; railroad network; Scilab; GUI

1. Introduction
Max-plus algebra was one of the topics introduced in 1956 [1]. Max-plus algebra
is denoted by Rmax , defined as Rmax = R ∪ {−∞}, where R is a set of real numbers
and is accompanied by two binary operations, ⊕, which is maximum operation, and ⊗,
Citation: Carnia, E.; Wilopo, R.;
which is regular addition operation. The structure of max-plus algebra is an idempotent
Napitupulu, H.; Anggriani, N.;
semifield. Recently, there has been a great deal of research conducted using max-plus
Supriatna, A.K. Modified Kleene Star
Algorithm Using Max-Plus Algebra
algebra. According to the author of [2], the max-plus algebra approach offers a relatively
and Its Application in the Railroad
compact and unified way of describing system dynamics, which may provide a valuable
Scheduling Graphical User Interface. basis for both analytical study and simulation of queueing systems. He demonstrates that
Computation 2023, 11, 11. the network dynamics also allow for representation in the specific dynamic state equation
https://doi.org/10.3390/ in terms of max-plus algebra. In 1998, Olsder and Subiono conducted research using
computation11010011 a large-scale model of a time table of all train connections of the whole Dutch railway
system. It is provided in terms of max-plus algebra [3]. Elmahi et al. [4] used a max-
Academic Editor: Demos T. Tsahalis
plus algebra approach for modeling and controlling a supply chain. Max-plus algebra is
Received: 2 December 2022 an attractive tool for the modeling of manufacturing systems because any deterministic
Revised: 2 January 2023 manufacturing system’s event timing dynamics can express by a set of linear equations [5].
Accepted: 3 January 2023 A novel approach to modeling deterministic manufacturing systems was proposed by
Published: 9 January 2023 Imaev and Judd [5]. This model is based on block diagrams and is described using max-
plus algebra. Becker and Lastovetsky [6] explored computing max-plus algebra operations
and discrete event simulations on parallel hierarchal heterogeneous platforms. The main
goal of their research was to present benefits waiting to be exploited by the use of max-plus
Copyright: © 2023 by the authors.
algebra operations on these platforms, thus speeding up more complex and quite common
Licensee MDPI, Basel, Switzerland.
computational topic areas such as discrete event simulation.
This article is an open access article
Eigenvalues and eigenvectors in max-plus algebra are important topics because the
distributed under the terms and
method used to calculate the eigenvectors in ordinary algebra cannot be used in max-plus
conditions of the Creative Commons
Attribution (CC BY) license (https://
algebra matrices. Based on previous studies, there are several algorithms available to
creativecommons.org/licenses/by/
determine the eigenvalues and eigenvectors of the irreducible matrix in max-plus algebra.
4.0/).

Computation 2023, 11, 11. https://doi.org/10.3390/computation11010011 https://www.mdpi.com/journal/computation


Computation 2023, 11, 11 2 of 13

Among them are the power algorithm and the Kleene star algorithm (KSA). The power algo-
rithm was first introduced by Olsder [7] and then developed by Braker [8] and Subiono [9].
Fahim [10] studied this algorithm’s generalization, starting from various existing power
algorithms. The resulting algorithm can determine the so-called generalized eigenmode
of any regular square matrix using max-plus algebra. The KSA existed before 1992 [11],
and is still being discussed and applied in several studies. Furche et al. [12] proposed
OXPATH: A language for scalable data extraction, automation, and crawling on the deep
web, which use Kleene star iteration in its process. A recent study regarding this algorithm
is presented by Ernawati et al. [13]; they apply the KSA to the mRNA translation. The
Kleene star matrix has also been applied in several studies, i.e., the tropical optimization
technique in bi-objective project scheduling under temporal constraints, as developed by
Krivulin [3,14]. Trunk et al. [15] used the Kleene star operator in their research regarding
the modeling and controlling of periodic time-variant event graphs in dioids.
The KSA requires improvement, as it takes a significant amount of time to determine
the eigenvalues in a large matrix. This study will discuss the modified Kleene star algorithm
(MKAS) using the idea of Rudhito [16] to improve the weaknesses that exist in the KSA.
Then, the time complexity analysis will be carried over to the KSA, MKSA, and the power
algorithm. The complexity value of an algorithm is obtained by calculating the worst time
translated into the pseudo-codealgorithm. For KSA, the complexity is O(n(n!)), and for
MKSA, the complexity is O n4 . This proves that the modified Kleene star is superior
to the KSA, providing the most efficient algorithm in determining the eigenvectors of an
irreducible matrix in max-plus algebra.
In addition, in this paper, the application of max-plus algebra on the scheduling of
the railroad network system is presented. The railroad network system will model linear
equations in max-plus algebra, and an irreducible square matrix will be obtained from the
model. This matrix’s eigenvalue and eigenvector information are essential in determining
the railroad schedule. In a complex rail network system, the matrix of the resulting model
is large, so a graphical user interface will be created to calculate a schedule for the railroad
network system based on information regarding the eigenvalues and eigenvectors in max-
plus algebra. This leads to a fast and easy-to-use railroad network scheduling system with
an intuitive interface.

2. Research Methods
2.1. Max-Plus Algebra
Suppose Rmax = R ∪ {−∞}, and two binary operations are defined as follow:
• a ⊕ b = max{ a, b}
• a ⊗ b = a + b, and is normal addition operation.
For each, a, b ∈ Rmax . Rmax , with the two binary operations defined above, is defined
as max-plus algebra [11].
The identity element of the ⊕ operation is −∞, which will be further denoted by ε,
while the identity element of the ⊗ operation is 0.

2.2. Matrices in Max-Plus Algebra


m×n . As in ordinary
A set of matrices of m × n size in max-plus algebra is denoted by Rmax
m × n
algebra, if A ∈ Rmax , then A is a matrix with m row and n column, with aij ∈ Rmax , ∀i =
1, 2, . . . , m and ∀ j = 1, 2, . . . , n.
Addition and multiplication in max-plus algebra matrices are performed in the same
way as in ordinary algebra, replacing + and × with ⊕ and ⊗, respectively.
An identity matrix of n × n size in max-plus algebra is denoted as En , defined as
follows. For each i, j = 1, 2, . . . , n, then [1]

0, i f i = j
[ En ]ij =
ε, i f i 6= j
Computation 2023, 11, 11 3 of 13

 
n×n is irreducible if and only if
Theorem 1 ([16]). A ∈ Rmax A ⊕ A⊗2 ⊕ . . . ⊕ A⊗(n−1) 6= ε for
ij
each i, j and i 6= j.

Definition 1 ([11]). Suppose A ∈ Rnmax ×n is max-plus algebra matrix of n × n size. Then, the

precedence graph of A, denoted by G ( A) = (V ( A), E( A)) , is a graph with the following charac-
teristics.
• G ( A) is a weighted directed graph.
• The number of vertices of G ( A) is n.
• If aij 6= ε, then edge ( j, i ) ∈ E( A).
• Element aij ∈ Rmax is the weight of edge ( j, i ). In other words, aij = w( j, i ).

2.3. Eigenvalues and Eigenvectors in Max-Plus Algebra



n×n , vector v 6 = ε in Rn →
Suppose A ∈ Rmax max is called the eigenvector of the matrix A if
→ →
there exists a scalar λ ∈ Rmax , that fulfills A ⊗ v = λ ⊗ v , λ is called the eigenvalue of A,

and v is called the eigenvector of the matrix A corresponding to λ [11].

×n is an irreducible matrix, and v is the eigenvector of the matrix A
Theorem 2 ([17]). If A ∈ Rnmax

 
corresponding to eigenvalue λ from A, then α ⊗ v is also the eigenvector of A, for each α ∈ R.

2.4. Model of a Railroad Network System in Max-Plus Algebra


The model of a railroad network system is expressed in following form.

→ → →
x ( k + 1) = A ⊗ x ( k ) ⊕ d ( k + 1) (1)

In the railroad network, A is a matrix in which its elements represent the travel time
between two stations, and aij is the travel time from station j to station i.
→ →
n
Vector x (k) ∈ Rmax represents the kth departure time of all trains. Vector d (k)
represents the kth departure schedule of all trains.
Because train scheduling includes a time span between the current schedule and the
previous schedule, the relationship between the departure schedules is as follows:
→ → →
d ( k ) = d ( k − 1 ) ⊗ T = d ( k − 2 ) ⊗ T ⊗2 = . . . .

Such that,
→ →
d ( k ) = d (0) ⊗ T ⊗ k (2)

for each k. Where d (0) is the initial departure scheduled and T is the span period between
scheduled departures. In algebraic expression, it can be written as
 
d1 (0) + (kT )
→  d2 (0) + (kT ) 
d (k) =  .
 
..
 . 
dn (0) + (kT )


Definition 2 ([18]). The train departure schedule d (k) is realistic if for all k = 0, 1, 2, . . ., then
→ →
A ⊗ d ( k ) ≤ d ( k + 1).
Computation 2023, 11, 11 4 of 13

Definition 3 ([18]). A system with departures scheduled is said to be stable if any delays in
some departure no longer occur after several subsequent departures.

Theorem 3 ([18]). A system is stable if, and only if, λ < T, where λ is the eigenvalue of A.

Theorem 4 ([11]). If A is irreducible, or equivalently, if graph G ( A) is strongly connected, there


exists one, and only one, eigenvalue (out of possibly several eigenvectors).

Lemma 1. If d (0) is the eigenvector of A and the system is stable, then the departure schedule of
the system is realistic.

3. Results and Discussion


3.1. Eigenvector Calculation Algorithm in Max-Plus Algebra
Several algorithms for determining the max-plus algebraic eigenvectors are described
in the following. In each algorithm, the algorithm’s time complexity is calculated and then
the time complexity of all algorithms is compared.

3.1.1. Steps and Time Complexity of the Kleene Star Algorithm


This algorithm is based on finding the maximum average weight of the circuit and
determining the critical circuit of the precedence graph from the inputted matrix. Sup-
×n is irreducible. The steps of the KSA in determining the eigenvalues and
pose A ∈ Rnmax
eigenvectors are as follow [13].
1. Determine λ as the eigenvalues of A, where λ is the maximum circuit average weight
of the matrix A.
2. Determine B = −λ ⊗ A.
3. Determine B∗ = En ⊕ B ⊕ B⊗2 ⊕ . . . ⊕ B⊗(n−1) .
4. The eigenvectors of A which correspond to λ are the vth columns of B∗ , where v is a
critical circuit of A, or A ∈ V c ( A).
The KSA requires a comparison of all elementary circuits in the precedence graph of
matrix A to determine the eigenvalues and critical circuits. Therefore, an additional algo-
rithm is needed to find all elementary circuits of G ( A). One of the efficient and commonly
used algorithms to find elementary circuits from a directed graph is the Johnson algorithm,
which has an algorithmic complexity of O((n + e)(c + 1)), where n is the number of ver-
tices, e is the number of edges, and c is the number of elementary circuits in the graph
G ( A) [19].
This time complexity calculation considers the worst case, i.e., suppose all elements of
the A ∈ Rnmax×n are not ε. Then, the precedence graph of A has n vertices, e = n2 edges, and
 
n n
elementary circuits as great as c = ∑ (n − i )!.
i =1 n − i + 1
The calculation of the time complexity of the algorithm is performed by translating
the algorithm into pseudo-code, then counting the number of operations performed. The
time complexity of each step of the KSA is:
1st step: T1 (n) = O(n(n!))
2nd step: T2 (n) = O n2


3rd step: T3 (n) = O n4




4th step: T4 (n) = O(n)


And hence the total time complexity of the KSA is the sum of all the time complexities
step. Therefore, T (n) = T1 (n) + T2 (n) + T3 (n) + T4 (n) = O(n(n!))+ O n2 +

of each
O n4 + O(n) = O(n(n!)), so that the time complexity of the KSA is O(n(n!)).

Computation 2023, 11, 11 5 of 13

3.1.2. Steps and Time Complexity of the Modified Kleene Star Algorithm
The steps of the Modified KSA in determining the eigenvalues and eigenvectors of
×n are as follow [16].
irreducible matrix A ∈ Rnmax
1. Determine the eigenvalue λ by formula:
 
1  
λ= ⊗nk=1 trace A⊗k (3)
k

2. Determine B∗ and B+ , where B = −λ ⊗ A.


3. Determine a critical vertex of the graph G ( A); that is, when [ B+ ]vv = 0, then v is a
critical vertex of the graph G ( A).
4. Determine the eigenvectors of A which correspond to λ; that is the-vth of matrix B∗ .
The time complexity of each step of the modified KSA is given as follows.
1st step: T1 (n) = O n4


2nd step: T2 (n) = O n4




3rd step: T3 (n) = O(n)


4th step: T4 (n) = O(n)
And hence the total time complexity of the modified KSA is the sum of all the time
T (n) = T1 (n) + T2 (n) + T3 (n) + T4 (n) = O n4 +

complexities of each step. Therefore,
O n4 + O(n) + O(n) = O n4 , so that the time complexity of the modified KSA is O n4 .
  

3.1.3. Steps and Time Complexity of the Power Algorithm


×n is irreducible. The steps of the power algorithm in determining
Suppose A ∈ Rnmax
×n are as follows [9].
the eigenvalues and eigenvectors of the irreducible matrix A ∈ Rnmax
→ → →
1. Choose an initial x (0), with x (0) 6= ε .
→ →
2. Iterate x (k + 1) = A ⊗ x (k), k ≥ 0, until there are integers p > q ≥ 0 and a real
→ →
number c, which satisfy x ( p) = c ⊗ x (q).
3. Determine the eigenvalue
c
λ= (4)
p−q
4. Determine eigenvector

p − q
→ →

v = ⊕ λ⊗( p−q−i) ⊗ x (q + i − 1) (5)
i=1

The power algorithm has two inputs, namely an irreducible square matrix of max-plus

algebra and the initial vector x (0). In the power algorithm, the size of the input matrix
does not affect the speed of completion of the algorithm. Instead, the speed of completion

of the power algorithm is highly dependent on the selection of x (0).
The completion time of the power algorithm is related to the number of iterations
→ →
performed in the second step, i.e., iteration on equation x (k + 1) = A ⊗ x (k) for k ≥ 0
until the termination conditions are met. After the iteration stops, the calculation of the
eigenvalues and eigenvectors can be completed using the provided formula. For some
of the initial vector selections, the algorithm needs to perform more iterations. On the
other hand, choosing the right initial vector causes the algorithm to require only a small

number of iterations. For example, if the initial vector x (0) is an eigenvector of the
input matrix, then the power algorithm only needs to complete one iteration to meet the
termination conditions.
Computation 2023, 11, 11 6 of 13

Because there is no relationship between the size of the input matrix (n) and the
completion time of the power algorithm, the time complexity of the power algorithm
cannot be calculated.

3.1.4. Comparison of Kleene Star Algorithm, Modified Kleene Star Algorithm, and
Power Algorithm
In the discussion in Section 3.1.3, it has been concluded that the complexity of the
power algorithm cannot be calculated, so this discussion will only compare the algorithmic
complexity of the KSA and the MKSA.
It is known from the discussion in Sections 3.1.1 and 3.1.2that the time complexity of
the KSA is O(n(n!)), and time complexity of the MKSA is O n4 . Based on the order of time
complexity of the algorithm, the polynomial time complexity is better than  the factorial
time complexity. However, to more clearly show that the complexity O n4 is better than
complexity O(n(n!)), the growth rate of the function n(n!) and n4 will be simulated to a
large value of n.
Below is a table of values f (n) = n(n!) and g(n) = n4 in relation to the n values to
give an idea of the complexity of time O(n(n!)) and O n4 .
Table 1 shows an illustration of the growth rate of time complexity O(n(n!)) and
O n4 . For n < 5, the value of function n(n!) is smaller than n4 , but for n ≥ 5, it can be seen


that the growth rate n(n!) increases very rapidly compared to n4 . This means that with a
large size of n, the required completion time will be much longer than that of the MKSA.

Table 1. Table of function n(n!) and n4 in regard to the n values.

Input Value (n) KSA (f(n) = n(n!)) Modified KSA (g(n) = n4 )


2 4 16
3 18 81
4 96 256
5 600 625
6 4320 1296
7 35,280 2401
20 4.86 × 1019 160,000
30 7.95 × 1033 810,000
40 3.26 × 1049 2,560,000

Therefore, from the algorithm’s time complexity, it can be concluded that the MKSA is
better than the Kleene Star algorithm for this purpose.

3.2. Max-Plus Algebra and Its Application in Railroad Network System


This section discusses the application of max-plus algebra to a real-life problem,
namely the railroad network system. The information on the eigenvalues and max-plus
algebraic eigenvectors in this problem can be used to arrange regular train departure
schedules, with the eigenvectors as vectors for the initial departure schedule and the
eigenvalues being the minimum period between the scheduled departures. The variables
used in this model are as follows:

• x (k): represents the kth—departure time of all trains.

• d (k): represents the kth—departure schedule of all trains.
Suppose there is a railroad network, which is presented in the form of a graph in
Figure 1, as follows.
eigenvalues being the minimum period between the scheduled departures. The variables
used in this model are as follows:
• 𝑥⃗(𝑘): represents the 𝑘th—departure time of all trains.
• 𝑑⃗(𝑘): represents the 𝑘th—departure schedule of all trains.
Computation 2023, 11, 11 Suppose there is a railroad network, which is presented in the form of a graph7 in
of 13
Figure 1, as follows.

Figure
Figure 1. 1. Weighted
Weighted director
director graphofofa arailroad
graph railroadnetwork.
network.The
Theletters
lettersA,
A,B,B,and
andCCindicate
indicatethe
thename
name of
of railroad
railroad stations,
stations, which
which are
are part
part of
ofaarailroad
railroadnetwork.
network.

There
There areare three
three stations,
stations, A,A,
B, B,
andand
C,C, which
which areare part
part ofof a railroad
a railroad network,
network, asas shown
shown inin
Figure
Figure 1. Suppose
1. Suppose that
that thethe system
system hashas four
four trains
trains running
running onon four
four routes
routes with
with thethe following
following
travel
travel pattern:
pattern:
1. The first route starts from station A. Each time a train departs on this route, it runs
from station A to station B.
2. The second route starts from station B. Each time a train departs on this route, it runs
from station B to station C.
3. The third route starts from station C. Each time a train departs on this route, it runs
from station C to station B.
4. The fourth route starts from station B. Each time a train departs on this route, it runs
from station B to station A.
Suppose the train travel time is in hours and is indicated by the weight of the edge in
Figure 1. Therefore, the length of the train journey from station A to station B is 3 h. The
length of the train journey from station B to station C is 8 h. The length of the train journey
from station C to station B is 5 h. The length of the train journey from station B to station A
is 4 h.
The following describes some of the assumptions of this model:
• The travel time for each train is fixed.
• The time for arrival, passenger drop-off, passenger boarding, and departure is consid-
ered 0.
• The train departures must wait for the arrival of the train from the previous departure.
For example, a train departing from station A to station B must wait for the arrival of
a train from station B to station A.
• Each train departure has a schedule. Trains that arrived earlier than the scheduled
departure must wait for the current schedule to depart.
The element of the departure time vector x (k ) in this model is defined as follows:
x1 ( k ): kth departure time on the route from station A to B.
x2 ( k ): kth departure time on the route from station B to C.
x3 ( k ): kth departure time on the route from station C to B.
x4 ( k ): kth departure time on the route from station B to A.
Based on the description given above, the railroad network model in Figure 1 can be
written in the following equation:

x1 ( k + 1) = max{4 + x4 (k), d1 (k + 1)}


x2 ( k + 1) = max{3 + x1 (k), d2 (k + 1)}
(6)
x3 ( k + 1) = max{8 + x2 (k), d3 (k + 1)}
x4 ( k + 1) = max{5 + x3 (k), d4 (k + 1)}

If Equation (4) is written in max-plus algebraic notation, the equation will be written
as follow:
x1 (k + 1) = (4 ⊗ x4 (k)) ⊕ d1 (k + 1)
x2 (k + 1) = (3 ⊗ x1 (k)) ⊕ d2 (k + 1)
(7)
x3 (k + 1) = (8 ⊗ x2 (k)) ⊕ d3 (k + 1)
x4 (k + 1) = (5 ⊗ x3 (k)) ⊕ d4 (k + 1)
Computation 2023, 11, 11 8 of 13

or it can be written in the form of matrix multiplication:


     
x1 ( k + 1) ε ε ε 4 x1 ( k )
 x2 ( k + 1)  3 ε  →
 ⊗  x2 ( k )  ⊕ d ( k + 1)
ε ε  
 x3 ( k + 1)  =  ε 8 (8)
  
ε ε   x3 ( k ) 
x4 ( k + 1) ε ε 5 ε x4 ( k )

Thus, the equation to calculate the vector of kth departure time is

→ → →
x ( k + 1) = A ⊗ x ( k ) ⊕ d ( k + 1) (9)
 
ε ε ε 4
3 ε ε ε 
for k = 0, 1, 2, . . . with A = 
ε 8
.
ε ε 
ε ε 5 ε
Before calculating the eigenvalues and eigenvectors, the irreducibility of matrix A in
Equation (7) will be checked. Know that:
 
ε ε ε 4
3 ε ε ε 
A= ε 8

ε ε 
ε ε 5 ε
     
ε ε ε 4 ε ε 9 ε ε 17 ε ε
3 ε ε ε   ε ε ε 7  ε ε 12 ε 
A ⊕ A ⊗2 ⊕ A ⊗3 =
ε 8
⊕ ⊕ 
ε ε  11 ε ε ε  ε ε ε 15 
ε ε 5 ε ε 13 ε ε 16 ε ε ε
 
ε 17 9 4
3 ε 12 7 
=11 8

ε 15 
16 13 5 ε

because A ⊕ A⊗2 ⊕ A⊗3 ij 6= −ε for each i, j = 1, 2, 3, 4 and i 6= j. With Theorem 1, A




is irreducible.
After the irreducibility of A is proven, the eigenvalues and eigenvectors of A are
 
ε ε ε 4
3 ε ε ε 
calculated with the modified Kleene star algorithm. From the matrix A =  ε 8

ε ε 
ε ε 5 ε
→  T
the eigenvalue and eigenvector are λ = 5 and v = 2 0 3 3 . Next, a train schedule
will be created based on the information on the eigenvalues and eigenvectors that have
been obtained.

Based on Lemma 1 for the initial departure vector, d (0) can be taken from eigenvector
→  T
of A, that is, v = 2 0 3 3 . Remember that the eigenvectors are not singular;
→ →
therefore, α ⊗ v for α ∈ R can also be substituted for d (0) according to the need. For the
conditions of time T, according to Theorem 3, time T has to be larger than eigenvalues
T > λ = 5 so that the system becomes stable. The selection of T can be based on various
variables, such as passenger needs and others. For this case, the value for T will be selected
as T = 6, so that the departure schedule vector becomes

2 + ( k ·6)
 
→ → 0 + ( k ·6) 
d ( k ) = d (0 ) ⊗ 6⊗ k =
3 + (k·6) for k = 0, 1, 2, . . .

3 + ( k ·6)
Computation 2023, 11, 11 9 of 13


Therefore, the vector sequence d (k) or kth departure schedule can be derived as
       
2 8 14 20
0 6 12 18
 ,  ,  ,  , . . .
3 9 15 21
3 9 15 21

Because the elements in this railroad network model contain units of travel time in
hours, the design of the train departure schedule can be created as follows.
It should be noted that the departure schedule in Table 2 is not unique. The departure

schedule depends on the initial schedule d (0) and the selection of the period between
schedules T. Figure 2 shows the comparison of the Kleene star algorithm and the modified
Kleene star algorithm complexities. It reveals that for n > 6 the complexity of the KSA is
much larger than the complexity of the MKSA.

Table 2. Design of departure schedule in the railroad network model.

Departure Station Arrival Station Available Departure Hours


A B 02:00 08:00 14:00 20:00
B C 00:00 06:00 12:00 18:00
C B 03:00 09:00 15:00 21:00
Computation 2023, 11, x FOR PEER REVIEW 9 of 13
B A 03:00 09:00 15:00 21:00

(a) (b)

(c)
Figure 2. (a) Comparison of the Kleene star algorithm and the modified Kleene star algorithm; (b)
Figure 2. (a) Comparison of the Kleene star algorithm and the modified Kleene star algorithm;
Kleene star algorithm chart; (c) modified Kleene star algorithm chart.
(b) Kleene star algorithm chart; (c) modified Kleene star algorithm chart.
Table 2. Design of departure schedule in the railroad network model.

Departure Station Arrival Station Available Departure Hours


A B 02:00 08:00 14:00 20:00
B C 00:00 06:00 12:00 18:00
C B 03:00 09:00 15:00 21:00
B A 03:00 09:00 15:00 21:00
1, x FOR PEER REVIEW 10 of 13
Computation 2023, 11, 11 10 of 13

• Select Time Unit: opens User


3.3. Graphical the menu
Interfacetoonselect theRailway
Scilab for unit of time used
Network Systemby the model railroad
Scheduling
matrix. There areThis
twosection
options: hours
discusses theand minutes.
graphical user interface of the Scilab program version 6.02
• to calculate the railroad network
Calculate Period: shows the minimum period between schedule in max-plus algebra. Theorem
departures 1 is used
scheduled. for
In the
a irreducibility check of the matrix, and the modified Kleene star algorithm is used to
space provided, the user
determine then enters
the eigenvalues andaeigenvectors
period between schedules
of the Kleene that is greater than
algorithm.
the minimum schedule period.
The display of the graphical user interface can be seen in Figure 3. The available
• Print Schedule: shows the departure
menus are explained schedule on the Scilab console.
as follows.

Figure 3. GraphicalFigure
User 3.
Interface.
Graphical User Interface.

• Matrix Input: opens the “Variable Editor” window to enter the matrix of the railroad
The following will explain how to use the graphical user interface using the model
system model.
that has been discussed
• in restores
Reset: Section the3.2 as seen
program to itsinoriginal
Figure 4 for
state the window
and deletes of matrix
the previously enteredinput
matrix.
on the graphical user
• interface.
Select Meanwhile,
Time Unit: Figures
opens the menu 5 and
to select 6 show
the unit of time the
usedstep
by thethree
modelon the
railroad
matrix. There are two options: hours and minutes.
graphical user interface and the resulting schedule of railroad network model using the
• Calculate Period: shows the minimum period between departures scheduled. In the
graphical user interface.
space provided, the user then enters a period between schedules that is greater than
The detail steps for the use of
the minimum the grapichal
schedule period. user interface are as follows:
1. •
Press the “Input Print Schedule:
Matrix” shows
button the departure
to bring up theschedule on the
“Variable Scilab console.
Editor” window and enter
the input matrix. Note: the syntax to input −∞ on Scilab 6.02 is ‘-%inf,’
The following will explain how to use the graphical user interface using without
the model
quotes. that has been discussed in Section 3.2 as seen in Figure 4 for the window of matrix input
on the graphical user interface. Meanwhile, Figures 5 and 6 show the step three on the
2. Close the “Variable
graphicalEditor” window
user interface andresulting
and the select the appropriate
schedule of railroadtime unit.model
network In this case,
using the
the unit of time is hours.
graphical user interface.
3. Press the “Calculate Period” button to bring up the minimum period between
schedules and enter the desired period between schedules.
4. Press the “Print Schedule” button to bring up the schedule in the Scilab console
window.
Computation 2023,11,
Computation2023, 11,11x FOR PEER REVIEW 11 11
ofof1313

Computation 2023, 11, x FOR PEER REVIEW 11 of 13


Computation 2023, 11, x FOR PEER REVIEW 11 of 13

Figure4.4. Window
Figure Window for
for matrix
matrix input
input on
on the
the graphical
graphical user
user interface.
interface.
Figure 4. Window for matrix input on the graphical user interface.
Figure 4. Window for matrix input on the graphical user interface.

Figure 5.
5.Step
Figure5.
Figure Stepthree
Step threeon
three onthe
on thegraphical
the graphicaluser
graphical userinterface.
interface.
Figure 5. Step three on the graphical user interface.

Figure 6. Resulting schedule of railroad network model using the graphical user interface.
Figure 6.
Figure 6.Resulting
Resultingschedule
scheduleofofrailroad
railroadnetwork
network model
model using
using thethe graphical
graphical user
user interface.
interface.
Figure 6. Resulting schedule of railroad network model using the graphical user interface.
Computation 2023, 11, 11 12 of 13

The detail steps for the use of the grapichal user interface are as follows:
1. Press the “Input Matrix” button to bring up the “Variable Editor” window and
enter the input matrix. Note: the syntax to input −∞ on Scilab 6.02 is ‘-%inf,’ with-
out quotes.
2. Close the “Variable Editor” window and select the appropriate time unit. In this case,
the unit of time is hours.
3. Press the “Calculate Period” button to bring up the minimum period between sched-
ules and enter the desired period between schedules.
4. Press the “Print Schedule” button to bring up the schedule in the Scilab console window.

4. Conclusions
The modified Kleene star algorithm has a time complexity of O n4 , the Kleene star


algorithm has a time complexity of O(n(n!)), while the time complexity of the power
algorithm cannot be determined. In terms of time complexity, the modified Kleene star
algorithm is superior to the Kleene star algorithm. In addition, the eigenvalues and
eigenvectors of the train network system model matrix play a very important role in
train scheduling.
The graphical user interface using Scilab for calculating a railroad network schedule is
proposed in this research. This makes the calculation of the train network system schedule
faster and easier.

Author Contributions: Conceptualization, E.C. and A.K.S.; methodology, H.N.; software, R.W.;
formal analysis, R.W.; resources, E.C., A.K.S. and R.W.; writing—original draft preparation, R.W.;
writing—review and editing, N.A.; visualization, A.K.S.; supervision, E.C. and A.K.S.; project admin-
istration, H.N. and N.A. All authors have read and agreed to the published version of the manuscript.
Funding: This research was funded by Riset Kompetensi Dosen Unpad (RKDU), grant number
2203/UN6.3.1/PT.00/2022 and partially funded by the Academic Leadership Grant to the last author
with contract number 2203/UN6.3.1/PT.00/2022.
Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.
Data Availability Statement: Not applicable.
Acknowledgments: The authors wish to thank the Directorate of Research and Community Service
(DRPM) of Padjadjaran University.
Conflicts of Interest: The authors declare no conflict of interest.

References
1. Farlow, K.G. Max-Plus Algebra; Virginia Polytechnic Institute and State University: Blacksburg, VA, USA, 2009.
2. Krivulin, N.K. The Max-Plus Algebra Approach in Modelling of Queueing Networks. Available online: http://arxiv.org/abs/12
12.0895 (accessed on 1 December 2012).
3. Olsder, G.J.; Subiono. On Large Scale Max-Plus Algebra Models in Railway Systems. IFAC Proc. Vol. 1998, 31, 649–653. [CrossRef]
4. Elmahi, I.; Grunder, O.; Elmoudni, A. A Max Plus Algebra Approach for Modelling and Control a Supply Chain. In Proceedings
of the 2003 IEEE Conference on Control Applications, Istanbul, Turkey, 23–25 June 2003; Volume 2. [CrossRef]
5. Imaev, A.; Judd, R.P. Block diagram-based modeling of manufacturing systems using. In Proceedings of the 2009 American
Control Conference, St. Louis, MO, USA, 10–12 July 2009. [CrossRef]
6. Becker, B.A.; Lastovetsky, A. Max-Plus Algebra and Discrete Event Simulation on Parallel Hierarchical Heterogeneous Platforms.
In Proceedings of the 2010 Conference on Parallel Processing, San Diego, CA, USA, 13–16 September 2010; pp. 63–70. [CrossRef]
7. Olsder, G.J. Eigenvalues of dynamic max-min systems. Discret. Event Dyn. Syst. Theory Appl. 1991, 1, 177–207. [CrossRef]
8. Braker, J.G. Algorithms and Applications in Timed Discrete Event Systems; Delft University of Technology: Delft, The Netherlands, 1993.
9. Subiono. Aljabar Min-Max Plus dan Terapannya. 2015. Available online: https://docplayer.info/68251215-Aljabar-min-max-
plus-dan-terapannya.html (accessed on 1 December 2021).
10. Fahim, K.; Subiono; van der Woude, J. On a generalization of power algorithms over max-plus algebra. Discret. Event Dyn. Syst.
2017, 27, 181–203. [CrossRef]
Computation 2023, 11, 11 13 of 13

11. Baccelli, F.; Cohen, G.; Olsder, G.J.; Quadrat, J.-P. Quadrat, Synchronization and Linearity: An Algebra for Discrete Event Systems; John
Wiley & Sons: New York, NY, USA, 1992; Volume 7.
12. Furche, T.; Gottlob, G.; Grasso, G.; Schallhart, C.; Sellers, A. OXPath: A language for scalable data extraction, automation, and
crawling on the deep web. VLDB J. 2013, 22, 47–72. [CrossRef]
13. Ernawati; Carnia, E.; Supriatna, A.K. Eigenvectors determination of the ribosome dynamics model during mRNA translation
using the Kleene Star algorithm. IOP Conf. Ser. Mater. Sci. Eng. 2018, 332, 012019. [CrossRef]
14. Krivulin, N. Tropical optimization technique in bi-objective project scheduling under temporal constraints. Comput. Manag. Sci.
2020, 17, 437–464. [CrossRef]
15. Trunk, J.; Cottenceau, B.; Hardouin, L.; Raisch, J. Modelling and control of periodic time-variant event graphs in dioids. Discret.
Event Dyn. Syst. 2020, 30, 269–300. [CrossRef]
16. Rudhito, M.A. Aljabar Max-Plus Dan Penerapannya; Sanata Dharma University Press: Daerah Istimewa Yogyakarta, Indonesia, 2016.
17. Tunisa, K.; Wijayanti, K.; Veronica, R.B. Nilai Eigen Dan Vektor Eigen Matriks Atas Aljabar Max-Plus. UJM 2017, 6, 189–197.
[CrossRef]
18. Alfiah, S. Pemodelan Jaringan Kereta Rel Listrik (KRL) Menggunakan Aljabar Max-Plu. Master’s Thesis, Institut Teknologi
Sepuluh Nopember, Surabaya, Indonesia, 2011.
19. Johnson, D.B. Finding All the Elementary Circuits of a Directed Graph. SIAM J. Comput. 1975, 4, 77–84. [CrossRef]

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual
author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to
people or property resulting from any ideas, methods, instructions or products referred to in the content.

You might also like