Distributed evolutionary computing system based ... - Semantic Scholar

1 downloads 0 Views 316KB Size Report
tionary algorithm is coded in JavaScript language embedded in a web page sent ... also based on JavaScript language, as node.js server was applied.
Distributed evolutionary computing system based on web browsers with JavaScript Jerzy Duda and Wojciech Dłubacz AGH University of Science and Technology, Krakow, Poland {jduda, wdlubacz}@zarz.agh.edu.pl

Abstract. The paper presents a distributed computing system that is based on evolutionary algorithms and utilizing a web browser on a client’s side. Evolutionary algorithm is coded in JavaScript language embedded in a web page sent to the client. The code is optimized with regards to the memory usage and communication efficiency between the server and the clients. The server side is also based on JavaScript language, as node.js server was applied. The proposed system has been tested on the basis of permutation flowshop scheduling problem, one of the most popular optimization benchmarks for heuristics studied in the literature. The results have shown, that the system scales quite smoothly, taking additional advantage of local search algorithm executed by some clients. Keywords: distributed computing; browser-based computation; evolutionary algorithm; JavaScript; flowshop scheduling.

1

Introduction

A lot of problems that can be found in the real world are hard to solve, especially the ones that are proven to be NP-hard. For large instances of such problems it is impossible to find an optimal solution within a reasonable period of time, so various heuristics are usually used in order to find suboptimal solutions in an acceptable time. Among them the most popular and widely studied in the world literature are metaheuristics based on phenomena and laws taken from nature, e.g. evolutionary algorithms (EA), simulated annealing (SA), or most recently, ant colony optimization (ACO), particle swarm optimization (PSO) and artificial bee colonies (ABC). Besides these metaheuristics there are many others like tabu search (TS), iterative local search (ILS) or variable neighbourhood search (VNS). All of them can be divided into two groups: operating on a single solution in each iteration (SA, TS, ILS, VNS) and operating on a set of solutions, often referred to as a population (EA, ACO, PSO, ABC). Further decrease of computation time for hard-to-solve problems can be achieved by the parallelization of heuristic algorithms, which can be introduced in a simple and almost natural way for the metaheuristics, which deal with the population of solutions. There are three general types of such parallelization that are usually exploited in distributed systems. In the global parallelization model there is one population, but calculations of objective function for the population's members are performed in a PARA 2012, p. 1, 2011. © Springer-Verlag Berlin Heidelberg 2012

parallel way by slave units. This approach is particularly useful in a multicore or a multiprocessor architecture, where communication time for large problem instances is almost negligible. In the island model the whole population is divided into subpopulations that can be run even on different heterogeneous machines. In this case communication time is significant, so subpopulations are run independently and occasionally exchange solutions among each other. Finally, in the master-slave model there is a central population that communicates with subpopulations to collect the solutions [1]. Distributed computing usually utilizes the island model, as it is the most universal, machine and system independent and does not require symmetric or synchronised communication. This paper presents such system that is primary intended for computing large instances of NP-hard problems. The system is based on evolutionary algorithm and on the client’s side it utilizes currently probably the most popular and widely used computer tool – a web browser. In the next section the idea of distributed computing over the Internet will be discussed. The third section describes architectural details of the proposed system, while in the fourth section some computational experiments in finding solution to the permutation flowshop scheduling problem are provided.

2

Distributed computing based on web browsers

Distributed computing based on the Internet clients for solving large scientific problems has become popular in the recent decade, since contemporary ordinary personal computers that can be found at our homes or offices have significant computing power that, if combined, can outperform not one contemporary supercomputer. Currently (as of October 2012), the world’s fastest supercomputer IBM Sequoia has a computing power of 16.3 PetaFLOPS, the second K computer has 10.5 PetaFLOPS and the third Tianhe-IA has 'only' 2.5 PetaFLOPS [2], while the most popular distributed computing network BOINC consisted of more than 300 thousand computers is estimated to have a 24-hour average computing power of more than 7.2 PetaFLOPS [3]. The most frequently used platforms for distributed computing over the Internet are the aforementioned Berkeley Open Infrastructure for Network Computing (BOINC) and distributed.net. They both require the participants in a computational project to install a special application dedicated to a particular operating system. Such application can be then run in a background as a demon or as a service, utilizing some of the client’s CPU or GPU resources to perform a particular task. The task that is calculated depends on the project, e.g. participants compute some mathematical problems in ABC@home for, biochemical problems in Rosetta@home or astronomical challenges in the most popular project SETI@home. Despite the growing popularity of distributed computing over the Internet, systems that do not require any additional application on the client’s side, e.g. based entirely on a web browser and JavaScript are very uncommon. Only few examples of such systems can be found in the world literature. One of the first was a browser-based distributed evolutionary system proposed by Merelo et. al. [4]. The system utilized the master-slave model of distributed computing and used AJAX technology for sending

a request from a client to a server in order to receive a task to compute. The server for each request generated an individual and sent it back to the client for evaluation. After evaluation the value of objective function for that individual was sent back to the server. As only the server was responsible for generation of new populations, the system scaled poorly. Moreover, the clients’ web browsers were permanently occupied with the calculations of objective functions so it was virtually impossible to simultaneously use them for other purposes like browsing the Internet. More efficient distributed system called Parasitic JavaScript was proposed by Jenkin in [5]. The system utilized JavaSript Object Notation (JSON) instead of XML for exchanging information between the web browsers and the server, and it was possible to limit the CPU load on the clients machines thanks to timer based programming. The author described that his system could be used e.g. for genetic algorithm solving n-queens problem, but did not provide any detailed results. The idea of parasitic computing was first described by Barabasi et al in [6]. Their system consisted of a collection of target nodes (web servers) connected to a network and a single home parasite node that initiated the computation by sending messages to target computers directing them to perform particular computations. The construction of the message was such that an invalid solution failed the TCP checksum and was dropped, thus only valid solutions were carried back to the server. In that way the authors solved a 2-SAT problem. Although the proposed method was not very practical for solving the problem, it showed that user computers could be applied for computational purpose even without the awareness of their owners. The system proposed in this paper can be also used in parasitic computing, however, the users that would like to participate in some computations have to intentionally go to a given web address. Moreover, they can look at the JavaScript code that is embedded in a web page to see what kind of computations are performed.

3

System architecture

Distributed evolutionary system proposed in this paper uses Internet technologies similar to the ones used in Jenkin’s Parasitic JavaScript system, but first of all, it is based on the island model, so the best solutions found by the clients are exchanged and the system uses collective intelligence of the independent agents running in web browsers. The second difference is that our system is based almost solely on the JavaScript language, as also the server side is built around node.js system [15]. Node.js is a framework for developing high-performance, concurrent programs that do not rely on the mainstream multithreading approach, but use asynchronous I/O with an event-driven programming model [16]. The prototype version of the system uses node.js version 0.6.10 with socket.IO library version 0.8.7 [17]. One of the advantages of the node.js server is its ability to serve a huge number of concurrent requests. In the preliminary tests presented in Section 4 there were only 16 clients used, however, the tests performed by some developers indicate that node.js is able to handle even 100 000 concurrent connections on a single core [18]. Moreover, the current version of node.js framework has an experimental support for easy cluster-

ing. Such cluster implements a typical prefork server, in which child processes (called workers) are spawned per CPU. Cluster implementation in node.js also provides crucial functionality like zero-downtime restarts and worker resuscitation [19]. The node.js server has been chosen to build a prototype of the system, because it is relatively easy to implement, as it uses JavaScript language like on the clients’ side. To make the system even more scalable, C++ or some modern functional language will be considered on the server’s side in the future. The clients use JavaScript code embedded in a web page provided by the server. JavaScript code is precompiled by all contemporary web browsers, so computing potential of the language is comparable to other programming languages that use JIT compilation like Java or C#. Very fast interpretation of JavaScript code was first introduced by Google programmers in their V8 engine project [19]. For some popular benchmarks it has been shown that JavaScript was only two times slower than Fortran language that usually had the best performance [20]. The authors of the paper have used different web browsers (Mozilla FireFox, Google Chrome and Internet Explorer 8) for the clients of the system and did not found any significant differences in the time of JS code execution. The server and the clients communicate with each other by sending messages in JSON format. The size of a single message depends on the size of the problem, e.g. for the flowshop problem with 20 jobs it used about 215 bytes per one message – it was then shorter than an average HTTP header. Concerning the memory usage on the clients’ side, the JavaScript code that is run in web browsers is designed in the way that ensures efficient work of a built-in garbage collector. For example the code does not have any cycle references, so the garbage collector can freely remove unused objects from memory. General architecture of the system is outlined in Figure 1.

Fig. 1. The overall system architecture.

A client (a desktop computer, a mobile phone or any other device able to interpret JavaScript code) connects to the server by opening a web page that includes embedded JavaScript code executing a genetic algorithm or a local search algorithm (VNS). Following scenarios are possible: 1. A client is authorized by the server and this request is put on the stack of the users awaiting for the data from the server (solid line). 2. A client finds better solution than the best solution found so far and this solution is put on the stack of the best solutions found by all genetic algorithms executed by the clients. The stack created in this way will be used later for local search algorithms in order to further improve the results. Simultaneously this solution is broadcasted to the remaining clients, informing them about the most current best solution (dashed line). 3. The client that received the request to execute a local search algorithm first requests the server for the solution to be improved (from the stack). The server sends a random solution, and the client executes the local search. If the solution is improved it is sent to the server, but it is not put on the stack of the best solutions (dotted line). As it was mentioned earlier, the framework proposed by Merelo et al. used AJAX technology to maintain client-server communication, what caused the server to be overloaded when too many users were connected. Jenkins used asynchronous AJAX that did not require permanent communication with the server, thus his system scaled more smoothly. The system proposed in this paper uses another, more efficient technology, so called push technology, which can be perceived as a reverse of AJAX. The data is pushed from the server to the clients even if the browser did not request it explicitly. This technology is not natively supported by web browsers, so it was necessary to implement it as AJAX long polling.

4

Computational experiments

In order to evaluate the performance of the system the authors took a permutation flowshop scheduling problem (PFSP), one of the most studied optimization problems in the literature, and commonly used to test new heuristics. The most common objective function for this problem is to find the same order of n jobs on m machines that minimizes the completion time of the last job on the last machine, so called makespan. Finding the makespan for more than three machines was proved to be NPcomplete and is equivalent to travelling salesmen problem (TSP) [7]. As there is n! possible solutions the PFSP becomes really hard to solve, especially for instances with more than 100 jobs. Thus many heuristics have been proposed for solving this problem, including the ones based on metaheuristics like tabu search, genetic algorithms, simulated annealing, and recently also on swarm intelligence, such as ant colony optimization, particle swarm optimization or artificial bee colony. Unfortunately even in the most current publications the authors of the proposed algorithms usually

performed their experiments with maximum 100 jobs as the computation time for larger instances of the problem sometimes exceeded 500 minutes [8]. To overcome this problem, parallel computing can be applied. Parallel methods for the PFSP based on metaheuristics presented in the literature usually utilize either many threads on a single computer or POSIX threads and MPI communication on a dedicated system [9][10]. In our distributed system the web browsers contributing in the calculations together in order to obtain the lowest possible value of makespan. As it was described previously, each client runs its own population and exchanges its best solutions with other clients through the server. The only tasks for the server is then to provide the instance of the problem to be solved by a client, and to receive the best solutions and further broadcast them to other clients. In the preliminary experiments the clients computed a standard version of genetic algorithm (part of evolutionary algorithms family). An outline of this algorithm is presented in Fig. 2. Initialise P = {s , s , … s 1

2

}

pop_size

Repeat P’  Selection(P) For i=1 To pop_size Step 2 If rand