A Swarm Art Based on Evolvable Boids with Genetic Programming

In this paper, we proposed a swarm art system. The proposed system receives an image and embellishes it to present an abstract and complex image. This system consists of a famous swarm behavior model, Boids and an evolutionary algorithm, Genetic Programming (GP). So, by combining the swarm behavior with the evolutionary principle, the proposed system may have a better-enhanced emergent property. Therefore, the proposed system can produce different and diverse images for each execution thanks to the emergent property. To best of our knowledge, this is the first approach to combine Boids model with GP to make a system that can produce vast abstract and complex art pieces from one input image. This system may be utilized in creating art as well as in a variety of entertainment area such as games, movies.


I. INTRODUCTION
Generative art is computer based art that in some part of an artwork is designed by a non-human autonomous system.Here, an autonomous system usually refers to one that can independently create some characteristics of artwork.The important feature of Generative art is that it can produce abstract art pieces thanks to its dynamic and complex properties.In other words, Generative art can generate unpredictable art pieces that may expand human creativity.
Craig Reynolds introduced a simple yet elegant swarm behavior model called Boids [1][2][3].Boids model contains a set of agents and each agent maneuver through simple behavior rules with the locations and velocities of its nearby agents.Although these behavior rules are fairly simple, Boids model is capable of displaying amazing and unpredictable group movements like living creatures.This property had a profound impact on not only computer scientists but also many different area practitioners including artists.
Since the beginning of the 21st century, artworks called Swarm art that refers to the combined Swarm intelligence and Generative art [4,5]  pieces called Swarm art possess some interesting properties such as self-organization, communication, behavior, and interaction, that is, to say emergence [6].The articles [4,5,[7][8][9][10][11][12][13][14][15] introduced some famous Swarm art examples and Fig. 1 shows two of them [4,5].Coded Beauty (2008) [5] In this paper, we proposed a swarm art system.The proposed system receives an image and embellishes it to provide an abstract and complex image.The proposed system is designed to use a set of evolvable Boids agents.Here, each agent has three different Genetic Programming (GP) trees, which represents an RGB color.So, each agent has its unique color and gets around the canvas environment that has the same size (width and height) as an input image.If an agent has a better color to represent the corresponding position of the input image than the color that environment has, the agent put a dot with its color to the position.The proposed system checks the agents every predetermined period, and if an agent is not satisfied with the number of left colors above a certain threshold, it is discarded from the population.After that, new agents are generated through the evolution of remained agents.As a result, by combining the swarm behavior with the evolutionary principle, the proposed system may have a better-enhanced emergent property, which makes it possible to produce different and diverse images for each execution.To best of our knowledge, this is the first approach to combine Boids model with Genetic Programming to make a system that can produce vast abstract and complex art pieces.Boids is an artificial life program that simulates swarm behavior such as bird flocking, animal herding, and fish schooling [1][2][3].This model has an interesting property called emergence, which is that the complexity of the model occurs from the interaction of agents adhering to simple behavior rules [1][2][3].These behavior rules that applied in agents are as follows:

A. Boids Model
Alignment: each agent steers toward the average heading of its local agents Cohesion: each agent steers toward the average position of its local agents Separation: each agent steers to avoid crowding of its local agents More behavior rules such as avoiding obstacles and seeking a goal can be added.The stirring movement of Boids agents can be described as either chaotic or orderly [3].Also, unpredictable behavior like separating and reorganizing flocks can be considered emergent behavior [3].As a result, Boids model has been widely applied in computer graphics to represent swarm behavior such as bird flocking, animal herding, and fish schooling.Fig. 3 shows an example of Boids model.

B. Genetic Programming
GP [16][17][18][19] is an attempt to deal with a question that how a computer can learn to solve problems without being explicitly programmed [20].GP is an extension of an evolutionary algorithm called Genetic Algorithm (GA).While the expression of the genotype of GA is an array, GP uses a tree structure genotype.Thus, GP can express a formula or a program that GA may not.Fig. 4 shows how the expression of the genotype of GP can represent a formula.In GP, crossover and mutation operators are just as important as GA because these operators act to increase the diversity of the evolutionary algorithms.Since the representation of the genotype of GP is a tree structure, the methods for crossover and mutation slightly differ    from GA.The crossover of GP is applied to an individual by exchanging one of its nodes with another node from another individual.In a tree structure like GP, to switch a node means that to switch a branch.So, crossover results are quite different from their parent individuals.Also, the mutation of GP is applied to an individual by replacing one of its nodes with a new node or a new branch.Fig. 5 shows an example of the crossover and mutation results of GP.
To sum up, GP is a powerful evolutionary algorithm at solving any problems that can is tractable to machine learning and has been successful at evolving new and unpredictable ways of solving problems [21].

III. THE PROPOSED SYSTEM
In this section, we introduce the proposed Swarm art system.The proposed system is designed to develop a method that can provide abstractly and complexly modified images in each execution with a given input image.We designed the proposed system with following key properties:  An image drawing method with different patterns in each execution  A method of embellishing a given art piece in abstract and complex ways To embed these properties, we designed the proposed system to use a set of evolvable Boids agents.Evolvable Boids is a combination of the swarm behavior with the evolutionary principle, which moves around the environment like a Boids agent and leaves its unique color that generated by its GP programs.Because crossover and mutation operators can evolve the color of a Boids agent, we named it evolvable Boids.
The proposed system uses Boids model to draw images with different patterns in each execution.As we described in Section II, Boids model can show unpredictable group behavior based on simple behavior rules.Therefore, by using Boids model, the proposed system can draw images with the emergence property.From Algorithm 1 to Algorithm 4 shows our implementation of Boids model based on articles [1][2][3] GP is usually applied to solve some optimization problems such as classification or regression, but there is some work that applied it to create artistic and interesting images which are quite difficult to be made by human beings [22][23][24][25][26][27][28].In the proposed system, each agent has three different GP trees, which represents an RGB color.So, each agent has its unique color and gets around the canvas environment that has the same size (width and height) as an input image.If an agent has a better color to represent the corresponding position of the input image than the color that environment has, the agent put a dot with its color to the position.Fig. 6 shows the example of two evolvable Boids agents on the proposed system.The proposed system evaluates Boids agents every predetermined period.If an agent is not satisfied with the number of left colors above a certain threshold, it is discarded from the population.Here, each Boids agents moves for every 0.001 seconds, and the evaluation procedure occurs for every second.Also, we choose the threshold as 150.So, if a Boids agent leaves its color above 150, it will be survived, and otherwise, removed.After that, new agents are generated through the evolution of remained agents.Each survived agent produce one child agent by using the mutation operator of GP.So the child agent will possess slightly different RGB trees and be placed in the same location of its parent.This process is repeated until there is no agents exist in the canvas.As we described earlier, art pieces based on GP can show abstract and complex patterns.Therefore, by using GP with Boids model, the proposed system can embellish a given input image to produce interesting images.Also, the modifying image process of the system can also be interesting to users.
As a result, the proposed system can produce emergently modified images and display their processes on a given input image.

IV. RESULTS
In this section, we introduce a set of the results of the proposed system.Fig. 7 to Fig. 10 are the first result of the proposed system.Fig. 7 shows the original image and from Fig. 8 and Fig. 9 show some of the results.And Fig. 10 shows a set of results.As we can see, the proposed system can embellish a given image in abstract and complex ways in each execution.Fig. 11 to Fig. 12 are the second result of the proposed system.Fig. 11 shows the original image and Fig. 12 shows the progress of creating the art piece of the proposed system.As we can see, the proposed system can draw images in swarm behavior thanks to the emergent property.Therefore, the processing of creating an art piece is also may present artistic and interesting to users.

V. CONCLUSION
In this paper, we proposed a system for generating abstract and complex images based on the given input image.The proposed system can produce artistic and complex art pieces, and the progress of creating an image is also dynamic and interesting to users.The proposed system can be described as a fusion of Swarm Intelligence and Generative Art.We introduced evolvable Boids model that is the combination of Boids model and GP.Boids is an artificial life program that simulates swarm behavior, and this model has an interesting property called emergence, which is that the complexity occurs from the interaction of agents adhering to simple behavior rules.GP is an extension of GA and can produce artistic and interesting images as well as to solve some optimization problems.The proposed system is designed to maximize the emergent feature by using these approaches, and hence, can take advantage of these systems to create art pieces.The proposed system may be utilized Art as well as in a variety of entertainment such as games, movies.
have emerged.Swarm art is characterized by the use of the extended version of Boids model as its creative procedure.Art Manuscript received July 21, 2016; revised November 1, 2016.

Figure 2 .
Figure 2. Three behavior rules of Boids model

Figure 4 .
Figure 4.A formula represented by GP GP consists of three major operators, selection, crossover, and mutation.The flow of GP is similar to GA.The four steps that GP proceed to solve problems are as follows: 1. Generate an initial population 2. Execute each individual and evaluate its fitness 3. Create a new population A. Select a randomly selected parent individual based on fitness and copy it B. Create a child individual by crossover with two randomly selected parent individuals based on fitness C. Create a child individual by mutation with a randomly selected parent individual based on fitness 4. If the best-so-far GP program satisfies a termination criterion, return the program.Otherwise, go back to step 3.

Figure 5 .
Figure 5.The crossover and mutation results of GP

Figure 6 .
Figure 6.The proposed system: Boids agent with GP The terminal nodes of GP are {X, Y, R}, where X and Y are the locations of an agent and R is a random real number.The function nodes of GP are as follows: 1. Bit-wise AND: X & Y (or R) 2. Bit-wise OR: X | Y (or R) 3. Bit-wise XOR: X ^ Y (or R) 4. NOT: !X 5. Left-shift: X << 2 (multiplied by 2) 6. Right-shift: X >> 2 (divided by 2) 7. ADD: X + Y (or R) 8. SUB: X -Y (or R) 9. MUL: X * Y (or R) 10.DIV: X / Y (or R) if Y > 0.0001 11.SIN: sin(X) * 255 12. COS: cos(X) * 255 13.TAN: tan(X) * 255The proposed system evaluates Boids agents every predetermined period.If an agent is not satisfied with the number of left colors above a certain threshold, it is discarded from the population.Here, each Boids agents moves for every 0.001 seconds, and the evaluation procedure occurs for every second.Also, we choose the threshold as 150.So, if a Boids agent leaves its color above 150, it will be survived, and otherwise, removed.After that, new agents are generated through the evolution of remained agents.Each survived agent produce one child agent by using the mutation operator of GP.So the child agent will possess slightly different RGB trees and be placed in the same location of its parent.This process is repeated until there is no agents exist in the canvas.As we described earlier, art pieces based on GP can show abstract and complex patterns.Therefore, by using GP with Boids model, the proposed system can