Keywords

1 Introduction

In recent years, different optimization problems have been arose in the context of UI design, most of them related to performance, ergonomics, human-error, learnability, accessibility, and aesthetics, among others. Initially those problems were solved by hand with no computational optimization support since the set of potential design combinations was limited. However, when the space of different possible designs increase (e.g. about \(30^{30}\) possible combinations in the problem of arranging 30 menu items), the use of optimization algorithms is mandatory to identify the best design according to all involved factors. To this end, different techniques have been used to solve such problems which are mainly based on mathematical programming such as linear and integer programming.

In the optimization domain, it is well-known that linear objective functions with linear constraints can surely be handled with linear programming methods such as the simplex one. However, several UI design problems are quadratic, for which guaranteeing the global optimum is not possible in polynomial time. In this paper, we propose the use of metaheuristics, which are optimization techniques specially devoted to find locally optimal solutions when the global optimum is not reachable in a reasonable amount of time. Most metaheuristic are inspired by interesting processes and phenomenon from nature and they have widely been used to solve real-world problems from various application domains (e.g. medicine, biology, mechanics, mining, gaming, and engineering). Our goal is to illustrate that metaheuristics can be used to efficiently solve different kind of UI problems. To this end we model a classic quadratic problem concerned to keyboard layout design optimization and we describe how it can straightforwardly be modeled and solved with a modern and powerful optimization technique called Cuckoo Search. To the best of our knowledge this concern has not enough been explored yet.

This paper is organized as follows: Sect. 2 presents the problem followed by the optimization technique employed to solve it. Finally, conclusions and some directions for future work are given.

2 The Letter Assignment Problem

The letter assignment problem (LAP) is an interesting problem concerned with the optimal design of keyboards [2]. Keyboard layout optimization is known to be important as slight improvements are able to improve productivity, ergonomics as well as learnability [3]. Particularly, the goal of the LAP is to minimize the average cost \(c_{kl}\) of selecting letter l after k, considering n letters and n keyslots, and a probability \(p_{kl}\) as depicted in Eq. 1.

$$\begin{aligned} min \sum _{k=1}^n \sum _{l=1}^n p_{kl} \cdot c_{kl} \end{aligned}$$
(1)

The \(p_{kl}\) probabilities are provided by a bigram distribution of representative corpus of text [1] and the cost is calculated as \(c_{kl} = \sum _{i=1}^n \sum _{j=1}^n t_{ij} x_{ki} x_{lj}\), where \(t_{ij}\) is the movement time from key i to key j (normally computed by Fitts’ law as detailed in [4]), and \(x_{lj}=1\) if letter l is assigned to keyslot j and \(x_{lj}=0\) otherwise. The problem is subjected to the following constraints.

$$\begin{aligned} \sum _{l=1}^n x_{lj=1} \qquad \forall j \in \{1,\ldots ,n\} \end{aligned}$$
(2)
$$\begin{aligned} \sum _{j=1} x_{lj} \qquad \forall l \in \{1,\ldots ,n\} \end{aligned}$$
(3)
$$\begin{aligned} x_{lj} \in \{0,1\} \qquad \forall l,j \in \{1,\ldots ,n\} \end{aligned}$$
(4)

Constraint 2 ensures that each slot contains only one letter. Eq. 3 is responsible for assigning each letter to only one slot and finally Eq. 4 guarantees the binary solutions. In the following section, we describe the technique employed to solve this problem.

3 Cuckoo Search

Cuckoo search (CS) is an interesting and efficient metaheuristic inspired by the obligate brood parasitism of some cuckoo species. Brood parasitism involves the manipulation and use of host individuals either of the same or different species for incubation. Details about this metaheuristic can be seen in [6]. CS was developed using three rules, which are detailed in the following.

  1. 1.

    A cuckoo egg represents a solution to the problem and it is left in a randomly selected nest, a cuckoo only can left one egg at a time.

  2. 2.

    Nests holding the higher quality eggs will pass to the next generations.

  3. 3.

    The nest owner can discover a cuckoo egg with a probability \(p_a \in [0, 1]\). If this occurs, the nest owner can left his nest and build other nest in other location. The number of total nests is a fixed value.

The generation of a new solution is performed by using Lévy flight as follows.

$$\begin{aligned} sol_{i}^{t+1} = sol_{i}^{t} + \alpha \oplus \text {Levy(}\beta \text {)} \end{aligned}$$
(5)

where \(sol_{i}^{t+1}\) is the solution in iteration \(t+1\), and \(\alpha \ge 0\) is the step size, which is associated to the range of values that the problem needs (scale value), being determined by the \(U_b\) and \(L_b\) upper and lower bounds as shown below.

$$\begin{aligned} \alpha = 0.01(U_b - L_b) \end{aligned}$$
(6)

The Lévy flight distribution provides the step length in the generation of a new solution.

(7)

To model the LAP, we employ a binary representation as depicted in Fig. 1, where \(x_{lj}=1\) if letter l is assigned to keyslot j and \(x_{lj}=0\) otherwise. We employ the simple CS form where each nest holds only one egg.

Fig. 1.
figure 1

Binary solution representation

figure a

Algorithm 1 depicts the proposed procedure, at the beginning the CS parameters are initialized (\(\alpha \), \(\beta \), \(p_a\), size for the initial population and maximum number of generation) and an initial population of n nests is generated. Then, a while loop manages the CS actions which are self-explanatory. The objective function of the problem (Eq. 1) is employed to compute the fitness of each solution. Solutions are produced by using the Lévy flight distribution according to Eq. 5. From this process, a real number between 0 and 1 is generated, which needs to be discretized. To this end, we proceed as follows [5]:

$$\begin{aligned} {x}_{j}={\left\{ \begin{array}{ll} 1 &{}\mathbf{if }\, r< {x}\text {'}_{j} \,\mathbf{ \,or\, } \,{x}\text {'}_{j} \,> \,U_b \\ 0 &{}\,\mathbf{if }\, r\, \ge {x}\text {'}_{j}\, \mathbf{ \,or\, } \,{x}\text {'}_{j} \,<\, L_b \end{array}\right. } \end{aligned}$$

where \({x}\text {'}_{j}\) holds the value to be discretized for variable \({x}_{j}\) of the SCP solution, and r is a normal distributed random value. Finally, the best solutions are memorized and the generation count is incremented or the process is stopped if the termination criteria has been met.

4 Conclusion

Different UI optimization problems have been appeared during the last years, most of them related to performance, ergonomics, human-error, learnability, accessibility, and aesthetics, among others. In this paper, we have dealt with an interesting problem concerned to keyboard layout optimization called The Letter Assignment Problem. We have illustrated how metaheuristics can straightforwardly be used for solving this problem. Particularly, we have employed Cuckoo Search, which is a modern and powerful technique that can rapidly be mapped to the binary nature of the LAP. As future work we expect to solve more UI problems with different metaheuristics such as for instance artificial bee colony, firefly optimization, and bat algorithms.