You are on page 1of 8

Science and Information Conference 2014

August 27-29, 2014 | London, UK

An Optimized Single-Finger Arabic Keyboard


Layout

Manar I. Hosny∗ , Nourah Alswaidan† , and Abir Benabid Najjar‡


College of Computer and Information Sciences
King Saud University, Riyadh, Saudi Arabia
Email: ∗ mifawzi@ksu.edu.sa, † nourah swaidan@yahoo.com, ‡ abbenabid@ksu.edu.sa

Abstract—Cellular phones and other hand-held devices are This research aims to optimize a single-finger (s-finger)
now extensively used to write emails, notes and long texts. keyboard layout for the Arabic language. Optimizing the layout
However, the arrangement of keys in the current keyboards for the s-finger keyboard, in terms of key arrangement, is
is not optimized to facilitate rapid and ergonomic typing. In essential to improve the typing speed as well as the comfort
this paper, we aim to optimize the Arabic keyboard layout of the user and accuracy of the text.
for applications that predominantly use a single pointer. The
single-finger keyboard layout problem can be modeled in terms
of the Quadratic Assignment Problem (QAP), which can be Designing a keyboard for people using mobile devices or
solved using metaheuristic algorithms. To adapt the problem for users with special needs is a challenging task, and the
to the requirements of optimizing the single-finger keyboard, research in such domain is relatively scarce, especially in
we used three measures in our objective function: the distance non-Latin languages. To the best of our knowledge, there is
between pairs of letters, a weight for each row in the keyboard, only one previous attempt to optimize the s-finger keyboard
and the hit direction of the finger. A Genetic Algorithm (GA) layout for the Arabic language in an early version of this
approach with two crossover types (2-point and modified uniform
research [1]. Also, the results of research done on optimizing
crossovers) and two different mutation operators (swap and
insertion) was developed and thoroughly tested. The performance the many-finger (m-finger) keyboard layout cannot be used
of the Genetic Algorithm was also compared against a Simulated for applications intended for an s-finger. To increase the typing
Annealing (SA) algorithm using the same objective function. speed, the m-finger keyboard places the frequent pairs of letters
Moreover, we developed a Memetic Algorithm combining GA at a distance from each other; hence when the first letter is
and SA to maximize the chances of obtaining good solutions. being typed another finger is ready to type the next letter [2].
We compared our resulting optimized keyboard layouts with Contrary to that, frequently occurring pairs of letters in the
different existing and proposed layouts. The comparison results s-finger keyboard must be placed close to each other, to make
show that our keyboard layouts are more efficient, in terms it easier for a finger to move from one letter to another.
of the optimization criteria considered, than the tested layouts.
Finally, the performance of our keyboards was tested by virtually
estimating the speed of typing. Our keyboards also outperform The Arabic language is unlike other languages, because the
other layouts in terms of the measured typing speed. The details number of letters is different and the text is written from right
of the algorithms and the experimental results are reported in to left, which affects the placement of letters on the keyboard.
this paper. To optimize the s-finger Arabic keyboard layout, we have to
take into consideration that hand-held devices are typically
Keywords—Keyboard Design; Combinatorial Optimization; small in size, and hence the keyboard grid will be small as
Metaheuristics; Genetic Algorithms; Quadratic Assignment Prob-
lem
well. Therefore, not all characters can be assigned to different
keys. Some characters will have to share the same location and
accessed through a shift key. The placement of letters on the
keyboard must take into account the frequency of appearance
I. I NTRODUCTION
of single letters, and of pairs of letters as well. In addition,
Nowadays, there is a widespread use of wireless and hand- the movement direction of the finger from right to left must
held devices such as cellphones, smart phones, Portable Data be considered in the layout design.
Assistant (PDA), tablets, and many others. These devices en-
able sending emails and include applications that allow writing The s-finger keyboard layout problem can be modeled in
long text. When holding a mobile device, only one hand or one terms of the famous Quadratic Assignment Problem (QAP) [3].
pointer is available for data input. Therefore, optimizing the The QAP is a well-known combinatorial optimization problem.
keyboard layout for such use is essential. Moreover, for people It was proposed in 1957 by Koopmans and Beckmann [4]. The
with significant motor disabilities, typing a text using both problem involves assigning n facilities to n locations. Two
hands may be a very difficult task. For example, a person who measures are used in the objective function: the first measure is
cannot use his hands may use a mouth stick to type. Typing the flow cij between the facilities i and j. The second measure
with a stick mimics typing with a single finger. Despite the is the distance dkl between location k and location l. When a
advancement in hand-held devices, the present day keyboards facility i is assigned to location p(i), and facility j is assigned
are not optimal for the aforementioned applications, in terms to location p(j), the cost of this assignment is calculated as
of enhancing the writing speed and increasing the accuracy cij ×dp(i)p(j) . Then the total cost of assignment of all facilities
and comfort of typing. will be the sum of each assignment over all i and j. The

www.conference.thesai.org 1|Page
Science and Information Conference 2014
August 27-29, 2014 | London, UK

objective function of the QAP is defined as follows: of the fingers, the number of keys it takes to type a text,

n ∑
n hand alteration, consecutive usage of the same finger, avoid
cost = min cij × dp(i)p(j) (1) big steps when using the same hand, and when typing two
i=1 j=1
consecutive characters using one hand the movement direction
of the fingers must be from the little finger to the thump.
The QAP is known to be NP-hard [4]. Therefore, meta- 2) Arabic Keyboards: Malas et al. [2] applied a GA to
heuristic algorithms can be used to solve such problem. In the design an m-finger Arabic keyboard layout that optimizes the
current research, we compare two metaheuristic algorithms: typing speed. The characters were divided into two groups
Simulated Annealing (SA) and Genetic Algorithms (GAs) for based on their frequency. The first group contains the char-
solving the single finger Arabic keyboard optimization prob- acters with the highest frequencies, which will be placed on
lem. As mentioned before, an early version of our SA approach the main grid. The second group contains the characters with
was published in [1], while to the best of our knowledge, the lowest frequencies, which will be accessed through a shift
this is the first attempt to use a GA for optimizing the single key. The arrangement of characters on the main grid will be
finger Arabic keyboard. In this paper, we enhance the previous determined based on the frequency of the pair of characters
SA attempt by improving the objective function. In our new and the pair typing time. They have considered the following
objective function, we take into account the convenience of attributes: hand transition, row transition, finger transition, row
typing (in terms of placement of letters on different rows weight and finger weight. The “shift” set was not optimized
of the keyboard), and the movement direction of the finger but assigned manually, by placing the characters in similar
from right to left (called the “hit direction”). In addition, the locations to their placement in the common layout. Their
frequencies of pairs of letters and their separating distances on layout design, shown in Fig. 5(b), solves some of the common
the keyboard is taken into consideration.
Arabic keyboard problems, such as: placing the letter ( X ) in

We implemented a genetic algorithm with two simple mu-
the combination of the
an awkward position, and it eliminated
tations, which are: swap and insertion. Moreover, the genetic not very frequent character pair ( B). Furthermore, this design
algorithm is hybridized with simulated annealing, hoping to increased the typing speed by 35%.
maximize its chances of obtaining good solutions. Since the
optimization will be based on movement time and character Khorshid et al. [7], designed an optimized Arabic keyboard
transition frequency, we need to calculate the frequency of layout using a GA. They started by calculating the frequency
occurrence of each Arabic letter and for pairs of letters as of each character and pairs of characters, based on the Qur’an
well. Arabic articles from Wikipedia were used to calculate holy text. The criteria they tested in their objective function are
this information. the same ones used in Eggers et al. [6]. Their design,shown
in Fig. 5(a), demonstrated a better performance in comparison
The rest of this paper is organized as follows: Section II with the currently used keyboard; it improved the typing speed
is a review of previous work on keyboard layout optimization, by 36.3%.
and the solution methods for different languages. In Section
III, we will present our proposed approaches for solving this B. Single-Finger (S-Finger) Keyboards
problem. Then, in Section IV, the experimental results will be
reported, and finally Section V concludes with a brief summary Li et al. [3] tried to optimize the movement time of key
and intended future work. transition. They used Fitts’ law [8] to calculate the movement
time. Fitts’ law, shown in (2), is a successful and well-studied
II. R ELATED W ORK model for the prediction of human movement time required to
move to a target area.
A. Multiple-Finger (M-Finger) Keyboards
The next step was to calculate pairs of characters’ frequent
1) Latin Keyboards: Light and Anderson [5], designed an appearance. 15,000 of the most common words from the
optimized m-finger English keyboard layout using simulated British National Corpus were used. They tackled this problem
annealing. Their objective function used the frequency of pairs using two models: an IP model, where the transition is fixed
of characters and the time needed to travel to each letter. The between any two keys, and a two stage heuristic. In the second
results showed that the layouts produced by this algorithm is model, the first stage performs an exact search, using a swap
better and faster in comparison to the well known QWERTY neighborhood move to obtain a new solution. The next stage
keyboard and Dvorak’s typewriters. Also, they noticed that the is applying simulated annealing. This algorithm reaches a
algorithm always manages to place the most common letters solution in less than one minute. They noticed that the vowels
where they belong, in order to be typed using the index or are placed close to each other, while their frequencies when
the middle fingers, which are considered to be the strongest they are paired are not high; however, each vowel on its own
of all fingers. In addition, it places the least used letters at the has a high frequency.
bottom row.
Dell’Amico et al. [9] designed an optimized single-finger
Eggers et al. [6], applied an Ant Colony Algorithm (ACO) keyboard layout for different languages: English, French,
to optimize French, German and English keyboard layouts. Italian and Spanish. The goal is to allocate the characters
In their design they aimed to achieve higher typing speed to the keys, where the average time it takes to write a
without causing fatigue or typing errors, and to allow the use of text is the minimal. They also used Fitts’ law to calculate
touch typing. To achieve such goals, they defined an objective average time. They solved this problem using the following
function that tests for six criteria, which are: accessibility and metaheuristics: local search, simulated annealing, tabu search,
load distribution of typing load with regard to the strength variable neighborhood search, and Fast Ant System.

www.conference.thesai.org 2|Page
Science and Information Conference 2014
August 27-29, 2014 | London, UK

III. P ROPOSED A PPROACH A. Collect Arabic Text & Calculate the Frequencies
As can be seen from the literature review above, there To make sure that the calculated letter frequencies are
is no previous published research on optimizing the s-finger measured correctly, the data (Arabic text) must be chosen
Arabic keyboard. The first attempt was in our previous work carefully. The data must be reliable and not inclined to any
[1], where an SA algorithm was developed to optimize the particular filed or subject. We used Arabic Wikipedia as a
Arabic keyboard design for single-pointer applications. The source for calculating the letters frequencies. The articles are
design aimed to maximize the typing speed by minimizing available to download from Wikimedia dump service [11]. The
the distance between the most frequent pairs of Arabic letters. articles were downloaded in a single XML file that contains
The transition frequency calculated by Malas et al. [2] was other meta information. Therefore, it was necessary to extract
used for this purpose, and the Euclidean distances measure the Arabic text and prepare it for the calculation of the
was used to calculate the distance dij between each pair of Arabic letters frequencies. NetBeans IDE 7.3 and the Regular
keys. As for the movement time it was measured using Fitts’ Expression library in Java were used in this step. A total of
law [8]. More specifically, according to Fitts’ law, the time and 11,000 articles have been processed, and then the frequency
difficulty required to type consecutively two symbols i and j, of each Arabic letter and the frequency of each pair of letters
can be estimated by: were calculated. Fig. 1 shows the frequency of Arabic letters
obtained in this phase. As can be seen from the figure, the pair
Tij = α + β · log2 (
dij
+ 1) (2) ( È@ ) (meaning “the” in English) has the highest frequency in
Wj the Arabic language.
The parameters α and β are constants, dij is the distance of
the two keys assigned to i and j, and Wj is the width of the
target key assigned to j. The constant α may be omitted since
its contribution to the overall typing time is independent from
the keys’ arrangement. For the constant value β, we set it to
1
4.9 bits/sec which is the value that has been experimentally
determined by MacKenzie et al. [10] in the special case of
using a stylus for data entry. Moreover, we assume that the
keys have equal widths, which implies that Wj = 1, and then
the movement time only depends on the distance of the two
keys and then can be estimated by:

{
4.9 · log2 (dij + 1), if i ̸= j
1
Tij = (3)
0.127 sec, if i = j

Fig. 1. Frequency of Letter Pairs in Arabic


In order to improve the speed of typing and maintain the
direction of Arabic writing from right to left, the distance
between the pairs will be lower when the pointer moves from B. The Optimization Phase
right to left than when it moves from left to right. The 32 most
frequent letters were placed on a 3 × 11 grid. The objective In this phase a GA approach to solve the keyboard layout
function used was as follows: optimization problem is proposed. Genetic algorithms have
been successfully used in solving the QAP. In addition, a
1 ∑∑ 1 ∑∑ GA was applied to solve the m-finger Persian keyboard in
N N N N
S= fij Tij = fij · log2 (dij + 1) (4) [12], the m-finger Hindi keyboard in [13], and the m-finger
4.9 i=1 j=1 4.9 i=1 j=1 Arabic keyboard in [2] [7]. As far as we know, it has not been
previously used in the optimization of s-finger keyboards in
Where fij is the frequency between a pair of letters, and any language. In the proposed approach, we try to utilize the
Dij is the distance between them. The initial SA temperature success of GAs in solving similar optimization problems for
Tmax was set to 107 and the same temperature was used in solving the s-finger keyboard layout optimization. The steps
15 iterations. The resulting keyboard is shown in Fig. 5(d). of the classical GA framework are followed in our algorithm.
The resulting layout is better by 20% in comparison with the However, two crossover methods are used along with a local
keyboard layouts used in mobile devices. Moreover, it is better search metaheuristic for the mutation operator. Using a local
by 33% in comparison with the keyboard layouts produced by search metaheuristic as a mutation operator can be seen as a
Malas et al. in [2]. “fast track” optimization for some selected individuals, which
can help improve the quality of population and speedup the
To further enhance our research in [1], the current research
optimization process. The following subsections describe the
was divided into two stages:
different components of the GA approach.
(1) Collect Arabic text and calculate the frequency of each
Arabic letter and for each pair of letters, and 1) Solution Representation: A permutation encoding is
(2) The optimization stage which is intended to find the best used to represent the Arabic letters, such that each letter will
allocation of letters in the grid for the s-finger Arabic keyboard be encoded using an integer value. Since we have 36 letters,
layout. we will use the numbers from 1-36 to represent these letters

www.conference.thesai.org 3|Page
Science and Information Conference 2014
August 27-29, 2014 | London, UK

in a 2-D grid. However, the grid size is limited to cellphones In other words, Equation (7) indicates that a penalty is
sizes. The recently developed cellphones place the letters in added to assigning high frequency letters to the upper and
3 × 10 or 3 × 11 grid. Here we use 3 × 11. So the number of bottom rows, with more penalty for the bottom row than the
letters that the grid can hold is 33; hence three letters will not upper, since the upper row is slightly more convenient in typing
be included in the grid and will be accessed through a shift than the bottom row.
key.
We can then combine all three objectives to get the overall
score (objective) of the solution, which would be:
2) The Objective Function: The problem is modeled based
on the QAP, where the objective of a solution is determined by
the flow between the “facilities” (letters in our case) and the n ∑
∑ n ∑
n ∑
n ∑
n
distance between them. Our objective function is determined F = min a Dij + b Sij + c Ri (8)
based on the frequency of occurrence of single letters, the i=1 j=1 i=1 j=1 i=1
frequency of occurrence of pairs of letters together, and by the Where a, b and c are weights that determine the importance
distance between the letters. The Euclidean distance is used to of each term.
measure the distance dij between two keys i, j.

To minimize the distance between the most frequent pairs 3) The Crossover Operators: Two crossover methods are
of letters, the distance between the letters is multiplied by the proposed:
frequency of the pair, as shown in Equation (5):
1) Modified Uniform Crossover (MUX): This
crossover is adopted from the regular uniform
Dij = fij dij (5) crossover [14], but it is modified to apply to a 2-D
grid instead of one dimensional permutation (see
Fig. 2 for illustration). In this crossover, two parents
produce two children. Starting from the first location
Hence, pairs of letters that occur frequently together should on the top left, the alleles will be chosen at random
be placed next to each other. Therefore, the frequency of pairs from one of the parents, following a randomly
of letters is used to allocate the pairs to adjacent keys. generated mask pattern of 0’s and 1’s. When the
mask value is 1, the allele in child 1 will be taken
Unlike other languages, the text in the Arabic language is from parent 1, while the allele in child 2 will be
written from right to left, and this must be considered when taken from parent 2. The opposite happens when the
placing the letters in the grid. For example: the most frequent mask value is 0. If the chosen allele has been already
letter pair in the Arabic language is ( È@), so when placing the inherited previously, the allele from the other parent
will be taken instead. If the alleles in both parents
letter ( @ ) in the grid it should be on the right of the letter ( È are already inherited, then the operator will leave the
) (this will be called the “hit direction”). To deal with the hit location empty and move on to the next location. At
direction, a penalty, proportional to the frequency of the pair the end, the letters that have not been assigned yet
of letters, is added when the pointer moves from left to right will be randomly distributed to the empty locations.
regardless of the row or the column. This part of the objective 2) Two Point Crossover (TPX):In this type of
function is formulated as shown in Equation (6). crossover, two cutoff points are randomly selected.
Then the outer parts of the cutoff points will be
inherited by the offspring from one parent, and the
rest of the letters will be taken in the same order as
{ they appear in the second parent, starting after the
0, if xi − xj > 0
Sij = fij vij , where vij = (6) first cutoff point location and moving up row by row,
1, otherwise
as shown in the example in Fig. 3.
4) The Mutation Operators: Two mutation operators are
considered:
Finally, the frequency of each letter will determine the row
to which it will be assigned. The most frequent letters should 1) Swap Mutation: Two locations are selected ran-
be placed in the middle row, since this is more convenient for domly and their letters will be exchanged.
the user, while the less frequent ones should be placed in the 2) Insertion Mutation: A letter is selected at random
upper or bottom rows. As recommended in [2], each row will and inserted into another location in the same row.
have a weight which will be 1, 2 or 3 for the middle, upper, The remaining letters will be shifted to fill in the gap
and bottom rows respectively. If the frequency of occurrence of the removed letter and make room for the newly
of a letter i is fi and wi is the row weight of the row assigned inserted letter.
to letter i, this part of the objective function is represented as
shown in Equation (7): Moreover, we implemented an extension of the traditional
genetic algorithm by replacing the mutation operator by a Sim-
{ ulated Annealing (SA) metaheuristic. The resulting algorithm
yi , if yi = 3 is can be called a Memetic Algorithm that performs local
Ri = fi wi , where wi = (7)
(3 − yi ), otherwise improvement on the child using classical Simulated Annealing.

www.conference.thesai.org 4|Page
Science and Information Conference 2014
August 27-29, 2014 | London, UK

• The cooling rate α = 0.95

A. Objective Function Weights

As mentioned before, there are three measures that are used


to evaluate the objective of a solution: (1) the distance between
each pair of letters and the frequency between them, (2) the
row weight, and (3) The hit direction.

To determine the impact of each measure, it will be


multiplied by a weight value in the range [0−1]. As previously
noted, the most frequent pair of letters in Arabic is ( È@), so it
will be used here to tune the weights for the objective function
components, as explained below:
Fig. 2. Modified Uniform Crossover
• The letters ( @) and ( È) should be placed in the middle
row. So, the row weight value will be started from
zero and then increased gradually until these letters
are placed in the middle row in the final solution.

• The letter ( @ ) must be placed to the right of ( È ). So,


the hit direction constant will be started from zero and
then increased gradually until these letters are in the
order ( È@).

• Finally, it is very important to have the letters ( È@ )


next to each other, so the distance weigh must be set
high enough to accomplish that.

At the beginning of the tuning phase, the only weight that


Fig. 3. Two Point Crossover we considered was the distance weight, where its value was
set to 1, while the other weights were set to 0. Then the row
weight was increased by 0.1 in each step, while the distance
weight was decreased with the same value. The letters ( @) and
The neighborhood moves that have been used are again swap
and insertion.
( È) were placed in the middle row when the row weight was
IV. E XPERIMENTAL R ESULTS set to 0.1, and the distance weight was set to 0.9., The same
process was done when tuning the hit direction weight. The
The GA was implemented using Matlab r2012a. The letters were ordered in the order ( È@ ) when the hit direction
selection method used is Roulette Wheel selection, and the weight was set to 0.2. Hence, the final objective function
replacement method is elitist replacement, where the replace- weights are: 0.7, 0.1, and 0.2 for the distance weight, the row
ment rate determines the percentage of best individuals from weight and the hit direction weight respectively.
the old generation that replaces the worst individuals in the
new generation. The stopping condition is a certain number of
iterations without improvement. To tune the GA parameters, B. Computational Results
extensive parameter tuning process was performed. The final
parameter set used was as follows: To test the results of the algorithm, each crossover method
(2-point crossover, and modified uniform crossover) was tested
• Population Size=50
with the tho mutation types: swap and insertion, as well as
• Crossover rate= 0.7 combined with a SA with swap neighborhood move, and a SA
with insertion neighborhood move. Table I shows the results
• Mutation Rate= 0.2 of each of these experiments, where each one was repeated 10
• Replacement rate= 0.2 times.
• Number of iterations without improvement= 20 At the end of each run, the following information was
The SA parameters are: recorded:

• Initial temperature= 1000


• The average objective of the initial population
• Number of iterations per temperature =10 • The best objective in the initial population

www.conference.thesai.org 5|Page
Science and Information Conference 2014
August 27-29, 2014 | London, UK

TABLE I. GA E XPERIMENTAL R ESULTS

Experiment AVG Init Best AVG Final Best % Improvement AVG Generations
1- TPX & swap 259.0057 192.9269 26% 228
2- TPX &insertion 260.5488 201.289 23% 126
3- TPX &SA with swap 255.284 209.9335 18% 63
4- TPX&SA with insertion 250.2043 213.6137 15% 63
5- MUX & swap 255.4687 193.1369 24% 181
6- MUX & insertion 258.2569 201.4018 22% 103
7- MUX & SA with swap 257.4219 208.598 19% 52
8- MUX & SA with insertion 259.7359 206.9626 20% 57

• The average objective of the final population


• The best objective in the final population

In order to estimate the improvement of the best solution


in the population, the averages of the objective value for the (a) (b)
best solution in the initial population and best solution in the
final population of each experiment (10 runs) were calculated.
The percent improvement of the average for the best solutions
between the initial and final populations is also shown in Table
I. (c) (d)
As the table indicates, the highest percentage of improve-
ment was given in experiment 1 (TPX with swap mutation),
with 26% improvement. It can also be noticed from Table I
that the swap mutation generates better solutions with both
crossover methods, followed by the insertion mutation. Also, (e) (f)
the improvement percentage was slightly more when using the
two-point crossover than the modified uniform crossover. Fig. 4. Best GA Keyboard Layouts
On the other hand, the best final solution objective was
obtained by the modified uniform crossover with the swap
mutation (experiment 5). When we compared the resulting
keyboard layouts in experiments 1 and 5, all the produced
solutions in experiment 5 satisfied the hit direction and row especially the pair ( È@) is always at the center.When looking at
placement of the test case of the pair letters ( È@ ), while four the frequencies of the letters placed in the middle, we found
solutions in experiment 1 had there order reversed ( @ È). that they belong to the top ten in the frequency list. Also, the
letters with the lowest frequencies are placed at the edges.
The experiments showed that the GA with SA did not result
in better average objectives in comparison with the simple
To test the best produced keyboard, other keyboards layouts
mutation methods. Moreover, most of these solutions did not
satisfy the test case of the pair ( È@); they were either reversed,
(shown in Fig. 5) were evaluated using our objective function.
Table II shows the results of the improvement percent of our
in different rows, or both. The reason could be that the best keyboard (Fig. 4(a)) compared to other layouts.
“fast track” improvement during the SA created “super fit”
individuals that may dominate the population, leading to pre-
mature convergence of the GA. As mentioned previously, the optimized keyboard produced
by [7], and [2] are meant for many-finger keyboards; so we
The objective of the best solution found in all experiments can notice that the pair ( È@ ) are placed separately from each
was 190.3563 shown in Fig. 4(a), and was obtained from other. This is favorable for m-finger keyboards, because each
experiment 5, although the best average objective was obtained letter will be typed with different fingers in different hands.
from the experiment 1. However, the difference is too small. However, in s-finger keyboards, this is undesirable, which is
Fig. 4 shows the keyboard layouts that have the best ob- evident when the m-finger keyboards are evaluated using our
jectives, where (a), (b), (c), (d), (e), and (f) have the objectives objective function. So, it can be observed that these keyboards
190.3563, 190.7345, 191.318, 191.7295, 191.8237, 191.8237 are not well suited for s-finger devices. On the other hand,
respectively. The layouts (b), (c), and (d) are produced from when calculating the objective of the iOS keyboard layout,
experiment 1 and the rest are produced from experiment 5. our layout is better by 29%.
The letters ( @) and ( È) are highlighted in the resulting layouts.
As for our keyboard obtained in [1], this s-finger keyboard
It can be noticed from Fig. 4 that all best six keyboards considers only the hit direction besides the distance. So, we
placed the pair ( È@) in the correct order except for the layout calculated its objective twice: once when the row weight
(d). Also, he least frequent letters are placed at the bordered counts, and another when the row weight does not count.
sides, however the most frequent ones are placed at the middle, Its objective is close to the obtained keyboard in the current

www.conference.thesai.org 6|Page
Science and Information Conference 2014
August 27-29, 2014 | London, UK

(a) Korshid [7] (b) Malas et al. [2]


Fig. 6. The Best Keyboard Layout using SA

(c) iOS (d) [1]

Fig. 5. Other Keyboard Layouts

TABLE II. C OMPARISON WITH OTHER K EYBOARD L AYOUTS

Keyboard Objective % Imprv.


Khorshid et al. [7] 301.2801 58%
iOS 205.2760 29%
[1] with row weight 193.5666 1.9%
[1] without row weight 199.8290 2.24%

approach, as can be seen in Table II. Fig. 7. The estimated human time (in seconds) to type the text for
each test case (10 articles in each discipline)
Moreover, to test the performance of our GA against
other metaheuristics using the same objective functions, we
implemented an SA algorithm with the following parameters SA algorithm seems to be much faster than the GA, which
setting: is rather expected due to the population nature of the GA.
The average time needed by the GA for 10 runs ranged from
• Initial Temperature Tmax = 10000 7.38 to 112.79 seconds, while the average time needed by the
SA in 10 runs was only 1.56 seconds, albeit using a different
• Maximum number of iterations Mmax = 10
computer than the one used in the GA. It should be noted,
• Maximum number of iterations in the same tempera- though, that the processing time is not critical in this type of
ture Lmax = 15 optimization, since the optimization is done only once and the
result is adopted for long term use.
• Cooling rate α = 0.98
Finally, to test the effectiveness of our best resulting
• Stopping criteria: kmax = 20 iterations without im- keyboard layouts from both the GA and the SA in terms of the
provement writing speed. We developed an algorithm that virtually esti-
The SA algorithm starts with a randomly generated solu- mates the speed of typing, using the distances between letters
tion. Then the regular SA steps, with a swap neighborhood in a text. In this experiment, we considered 50 articles covering
move, are followed. However, we adopted the same stopping different disciplines (10 articles in each) and randomly chosen
criterion as the GA, i.e., the algorithm was stopped when from the Arabic newspapers “Al Jazeera” and “Asharq Al-
the solution is not improved for a pre-specified number of Awsat”. We computed the distance, and then the movement
iterations. This stopping condition was adopted in both the time, needed to type a given text. The movement time is
general SA cooling process, and in the number of iterations computed using Fitts’ law [8], with the settings indicated in
per temperature. Equations (2) and (3) above.
We used this metric to evaluate and compare the optimized
The SA algorithm was run for 10 times. The average
keyboard arrangements to the standard Arabic keyboard used
objective function result for the 10 runs was 194.9195, which
in the commercial mobile devices, specifically the the iOS
is slightly worse than the average produced by the best GA
devices.
experiments (experiments 1 and 5 that use the swap mutation).
However, the average produced by the SA was better than the Fig. 7 shows the estimated time, in seconds, required to
average produced by the other GA experiments. The average type the given texts by the different layouts. It turned out
percent improvement between the initial and final solution for that, for all the test cases, the estimated movement times of
the 10 runs was 38%. In addition, the best result produced the optimized layouts are less than the standard keyboard.
by the SA was 190.3687, which is very close to the best We notice also the performance stability of the optimized
result produced by the GA. This indicates, in general, that keyboards regardless of the different domains. The average
our objective function is robust and can produce good results improvement percent for all texts was 15% for the GA over
with different metaheuristics. Fig. 6 shows the best resulting the iOS, and 14% for the SA over the iOS.
keyboard optimized using SA.
Using Fitts’ law shows that the optimized layouts outper-
The SA needed an average of 108.1 iterations to reach form the standard Arabic keyboard used in mobile devices.
the final results. However, in terms of processing time, the But this law assumes that the movement time depends only on

www.conference.thesai.org 7|Page
Science and Information Conference 2014
August 27-29, 2014 | London, UK

the distance. The rows’ weights and hit direction components ACKNOWLEDGMENT
in our objective function depend on human behaviour and
actually are not reflected by Fitts’ law. So, the theoretically This project was supported in part by a grant awarded from
optimized new layouts require an assessment involving end- the Research Center in King Saud University (RC121241).
users and comparing them from a practical point of view.
R EFERENCES
[1] A. B. Najjar, “Toward an optimized arabic keyboard design for single-
V. C ONCLUSIONS AND F UTURE D IRECTIONS pointer applications,” pp. 1717–1718, 2013.
In this research, we aimed to design an Arabic keyboard [2] T. Malas, S. Taifour, and G. Abandah, “Toward optimal arabic keyboard
layout using genetic algorithm,” in Proc. 9th Int’l Middle Eastern
that optimizes the keys arrangement for applications that Multiconference on Simulation and Modeling, 2008.
predominantly use just a single pointer. Since the s-finger
[3] Y. Li, L. Chen, and R. Goonetilleke, “A heuristic-based approach
keyboard layout problem can be modeled as the well-known to optimize keyboard design for single-finger keying applications,”
Quadratic Assignment Problem (QAP), it can be tackled using International Journal of Industrial Ergonomics, vol. 36, no. 8, pp. 695–
different metaheuristics that have been used for solving the 704, 2006.
QAP. [4] T. Koopmans and M. Beckmann, “Assignment problems and the loca-
tion of economic activities,” Econometrica, vol. 25, no. 1, pp. 53–76,
The main contributions of this research are: first, we 1957.
calculated the frequencies of the Arabic letters using a large [5] L. Light and P. Anderson, “Typewriter keyboards via simulated anneal-
collection of diverse Arabic articles. Second, we included ing,” AI Expert, vol. 8, no. 9, pp. 20–27, 1993.
new measures in the objective function for optimizing the [6] J. Eggers, D. Feillet, S. Kehl, M. Wagner, and B. Yannou, “Optimization
keyboard design, namely: the row weight and the hit direction, of the keyboard arrangement problem using an ant colony algorithm,”
European Journal of Operational Research, vol. 148, no. 3, pp. 672–
which take into account the user’s convenience and the specific 989, 2003.
property of the Arabic language in terms of the typing direction [7] E. Khorshid, A. Alfadli, and M. Majeed, “A new optimal arabic
from right to left. Third, we developed a new genetic algorithm keyboard layout using genetic algorithm,” Int. J. Design Engineering,
approach, where two kinds of crossover operators were imple- vol. 3, no. 1, pp. 25–40, 2010.
mented: 2-point crossover and modified uniform crossover. The [8] P. M. Fitts, “The information capacity of the human motor system
GA was tested with two mutation methods (swap and insertion) in controlling the amplitude of movement.” Journal of experimental
and combined with a SA. The GA was also compared against psychology, vol. 47, no. 6, p. 381, 1954.
a stand-alone SA approach using the same objective function. [9] M. Dell’Amico, J. C. D. Dı́az, M. Iori, and R. Montanari, “The single-
finger keyboard layout problem,” Computers & Operations Research,
A thorough experimental framework was conducted to test vol. 36, no. 11, pp. 3002–3012, 2009.
the performance of the implemented algorithms. The experi- [10] I. S. MacKenzie, A. Sellen, and W. Buxton, “A comparison of input
mental results showed that simple swap mutation performed devices in elemental pointing and dragging tasks,” in Proceedings of
ACM CHI’91 Conference on Human Factors in Computing Systems,
better than the other tested approaches with both crossover 1991, pp. 161–166.
types. No benefit was realized from hybridising the GA with [11] “Arwiki dump progress,” [Online], 2013,
SA, neither in solution quality nor in processing time. The http://dumps.wikimedia.org/arwiki/20130928/.
results also showed a noticeable improvement of the keyboard [12] N. Samimi, “Optimization of farsi letter arrangement on keyboard
layout obtained over multiple finger and conventional single by simulated annealing and genetic algorithms,” Majlesi Journal of
finger keyboards, in terms of the criteria targeted in our Multimedia Processing, vol. 1, no. 3, 2012.
optimization approach: namely the total distance, the row [13] P. Deshwal and K. Deb, “Design of an optimal hindi keyboard for
weight and the hit direction. Comparing the GA with an SA convenient and efficient use,” Indian Institute of Technology, Tech. Rep.,
2003.
using the same objective function yielded comparable results
[14] E. Talbi, Metaheuristics: From Design to Implementation. Wiley
in terms of the solution quality obtained. Testing the speed Publishing, 2009.
of typing based on the separating distances between the keys,
the results indicate that the layouts produced by our GA and
SA algorithms outperform the layout used by iOS portable
devices. The proposed metaheuristic framework, and especially
the objective function, can also be used to optimizing single
finger keyboards for other languages that are written from right
to left, like Hebrew, Persian Punjabi, and Urdu.
Finally, although the new proposed layout may be optimum
from a theoretical perspective, a new arrangement of keys, even
if better, may be resisted by users. Therefore, an assessment
involving end-users is essential to determine the effectiveness
of the proposed layout from a practical point of view. In
fact, the proposed optimized layouts in the literature have
been tested only from a mathematical point of view, and
there is no study up-to-date that tests end-users feedback and
satisfaction. For our future research directions, we intend to
evaluate the new layout using Eye Tracking technology. Using
performance measures and subjective satisfaction measures can
help determine the most convenient layout in realistic settings.

www.conference.thesai.org 8|Page

You might also like