Exploring Persian Rug Design Using a Computational Evolutionary Approach

Considering the art of Persian rug design as a computation creative design problem, with a vast domain space of possible design solutions that have aesthetic, cultural and historical considerations, we describe our dual stage genetic algorithm system for designing basic patterns of a specific type of Persian rugs. Our approach uses hard and soft design rules that we have been gleaned from the passed down traditions of “Shah Abbas” Persian rug design. We break down the rug generation into two phases. In the first phase, the rug (a collection of connected spirals as a core structure) is generated exploiting the available genetic operators. In the second phase, An evaluation mechanism based on the most basic soft design rules ranks each generated genotype and the highly ranked genotypes are presented to the user to select the most aesthetically acceptable rugs for the next evolution. We report on early results in this paper.


INTRODUCTION
Digital technology introduces new tools for art creation as well as creating a gap between traditional art and modern society. Every day virtual environments, interactive games, online performances, and other appearances of the interplay of technology, art and culture, are increasingly finding their ways into human's lives. On the other side, a nation's life in one of the oldest countries of world -Iran or Persia (and other countries in the Orient) -is strongly connected to the art of carpet design. The Persian carpet, a subgroup of the Oriental carpets specifically woven in Iran (Persia), is one of the greatest manifestations of traditional Persian art and culture, which has also received international acknowledgement for its artistic majesty. People in these parts of the world have been adoring their rugs and enjoying this art form for more than 2,500 years. Carrying a world of artistic magnificence, Persian rug is now an intrinsic part of Iranian's culture and daily lives. Today Persian rug is flourishing not only as an art but also as a successful commercial enterprise (Eiland, 1998;Herbert, 1982) Finding the link between this traditional visual art and the modern technology and is an interesting research topic in the context of digital art. As a very simple example, rug patterns and motifs can be used as visual ornaments; Wong (1998) suggests that: Though technological advances have virtually ignored the creation of ornament, they have at the same time created new opportunities for its use. The dynamic nature of web documents encourages ornament to be generated on the fly to accommodate different browser configurations and fonts. New printing processes make it feasible to print on fabric or wallpaper in small runs, raising the possibility of their custom design and production.

Persian rug: history and description
Oriental rugs vary numerously in design and so do Persian rugs. The three broadest categories we can place all Persian rug designs into are: rectilinear (sometimes called geometric) designs; curvilinear and floral designs; and pictorial designs (Herbert, 1982). Curvilinear designs, which are our category of interest in this research, have floral motifs and patterns with curved outlines and tendrils, in a relatively realistic manner. The drawing is fluid and intricate. They are mostly woven in big cities with an established carpet industry (Eiland, 1998;Herbert, 1982).
Shah Abbas, one of the kings of Safavid Dynasty (15 th century, Iran), played a major role in the Persian rug industry. He also became the source of inspiration for various floral patterns, so that you often see a rug classified as a 'Shah Abbas' design. The Shah Abbas a subgroup of curvilinear patterns is among the finest Persian rugs available today.
The finely woven Persian floral rugs are designed, and carefully drawn on graph papers, by professionals who challenge the market demands while trying to keep continuity with the past (Eiland, 1998). Most often in carpet design workshops or schools, a group of designers work under the supervision of a master designer who has traditionally been accorded considerable respect. This respect brings style and character to the artwork, which count toward the design's originality. However, it sometimes turns into an extreme bias on the masters' specific tradition and leaves less room for creativity.
One of our motivations in this paper for proposing a computational method for rug design is to provide the opportunity of exploring creative and unexpected designs for the designers. Since the problem space of all possible rug designs is simply enormous, in order to approach the problem at all we do limit our domain to Shah Abbas deigns.

Computational approaches in art and design
Design can be categorised into routine and nonroutine (or creative). In routine design, the knowledge relating forms to satisfaction requirements is available while in non-routine design there is a lack of such knowledge and it highly relies on human's creativity (Rosenman, 1997). Design in different domains of art is mostly creative or non-routine type of design and usually difficult to approach using computational methods.
As a good example of the very few works in this area, Wong et al. (1998) proposed an algorithm called 'adaptive clip art' for generating aesthetically pleasing ornaments. Their method encodes the essence of an ornament pattern as a set of rules structuring geometric primitives. Their algorithm is completely automatic and relies on a static set of principals of ornament design representing balance, analogy, and intention. However, in our perspective it still lacks the qualities of creativity, which is an intrinsic part of any strong art work. In addition, it ignores judging if the patterns are beautiful or pleasant.
A new field that has emerged over the last 10 years in computer 'artificial intelligence' systems is creative evolutionary systems for applications in art and design. Creative evolutionary systems use techniques from evolutionary computation, a class of computer software systems that employs software techniques derived from Darwinian evolution to find an optimised solution within a large search space, the most popular of which are genetic algorithms and genetic programming (DiPaola, 2005). These evolutionary methods are basically generate-and-test methods, which correspond well to the processes of design and evaluation in creative fields such as art, music and design.
To use evolutionary computation in the design scenario, first, the design problem must be mathematically or logically represented so that a typical possible solution is characterised and described by attributes and data structures called genes and genotypes. Then a program generates a large number of possible solutions considering rules and constraints in the problem domain. Members in a population of design solutions are selected to survive based on a selection method, and those survived participate in generating the new population of solutions (Rosenman, 1997) .In some cases, this selection can be done algorithmically regarding a fitness function. But in most of the examples of the evolutionary arts, aesthetic selection is employed by having a human judge subjectively. In Aesthetic Selection, a set of solutions, usually image representations, is displayed to a user to evaluate and select the pleasing ones. The new generation's genotypes are then produced by mutating and crossing-over the selected representations. This cycle of evaluation, selection, and generation continues until an aesthetically satisfactory representation is produced (Dorin, 2001).
Taking advantage of evolutionary algorithms, Grundler & Rolich (2003) created a system for producing textile designs. Considering textile, a net of warps and wefts, it is represented as a matrix of 0s, and 1s. In this matrix, a warp crossing point is denoted by 1 and a weft crossing point is denoted by 0. After generating the first population by assigning random 0s and 1s to the matrices' cells, the chance of a pattern survival in the evolution process is related to the amount of user's satisfaction.
Karl Sims (1991) introduced symbolic expression tree graphs as a genotype structure for creating images of great complexity. This graph structure composed of mathematical functions at internal nodes and arguments at leaves, stores procedural information to create image representations. Traversal of this hierarchy constructs arbitrary expressions, which can be mutated, evolved and evaluated.
The most cited advantage of the evolutionary approach is that a more diverse area of the design space can be explored. The other advantages include but not limit to facilitating product design, producing unexpected designs (sometimes even beyond the imagery of human's mind), and allowing non-expert designers to discover interesting design solutions rather constructing them (DiPaola & Gabora, 2009).
In this paper we introduce an evolutionary procedure for creating patterns of a specific category of Persian rugs computationally. We describe Shah Abbas rug patterns using a tree of fixed length strings with nodes demonstrating elements of design and edges representing their connections. Exploiting techniques of genetic algorithms, this graph-like genotype is evolved and evaluated in several iterations.
Although creative evolutionary systems have shown the ability to create some impressive art, music and design, the evaluation mechanism has always been a dilemma in the field. While subjective evaluation is a successful technique, it has several disadvantages such as slowing down system speed and the impracticability of giving a human all the possible solutions to judge. Therefore, most systems of this type can restrict the evolutionary procedure (DiPaola & Gabora, 2009). On the other hand, developing an intelligent and comprehensive definition of what is satisfactory or pleasant as an artwork seems impossible so that the final judgment has always been subjective, inevitably.
In the early implementation of our proposed system we take advantage of both automatic and subjective selection methods in a two-phase evaluation mechanism. But we design our system so that it has the capability to improve the automatic selection function through many runs of evolutions by analyzing subjective selections. However, the implementation of this evolving intuition is left for the future works.

THE ART OF RUG DESIGN: CHALLENGES AND METHODOLOGIES
The typical format of a Persian rug, specially the floral ones as shown in Figure 1a, is a rectangle encompassing a central medallion, corner elements and borders. The medallion pattern is basically a symmetrical figure residing in the centre. Corners are usually drawn from similar elements or are even quarters of the medallion (Eiland, 1998;Herbert, 1982). The area remaining in between borders and medallions is called the field of the rug, which can be filled with many various patterns on the basis of different design styles. In a Shah Abbas design the rug's field is occupied by flowers, blooms and leaves placed on a complex network of tendrils (Herbert, 1982).
Shah Abbas patterns -similar to most floral ornaments -are plant-like structures transformed through the process of conventionalisation. Conventionalisation in ornaments is the development of abstractions of natural forms, a highly creative process. When artists develop a conventionalisation they perform a sort of inventive pre-filtering of phenomenal reality followed by a creative re-synthesis of form.
The underlying principal of ornamental design, is order, and is conveyed by repetition, balance and conformation to geometric constraints. Although this principle is applicable in the rug design area, we differentiate the nature of rug design from other ornamental design because of the following qualities: Conventionalisation in rug design is being done using filters that are firmly established through hundreds of years and nurtured by symbolism of a rich and old culture. These filters define the territory of abstraction in the context of tradition and determine the originality of designs. (ii) Grammar of conventionalisation in rug design has never been documented in a fairly comprehensive way. It has been transferred from generations to generations and therefore the main source for it is the intuition of local designers.
Consequently, one side of the challenge in generating rug patterns is how to keep continuity with this rich unwritten source of inspiration that lives in the tradition and not to cross its conventions even though they are not clearly stated anywhere.
Another challenge that has not been concerned in works such as Wong et al. (1998) is creating and evaluating 'beauty' beyond the principals of order (Balance, Repetition, and Conformation to the geometrical constrains). Our main attempt in this paper is to generate diverse, creative, and beautiful floral rug patterns through an iterative evolution and evaluation process.
Carol Bier (Bier, 2000) suggests that patterns in oriental rugs are the result of dynamic relationships between choices and constraints, analogous to the pattern formation in nature which is the result of forces and constraints. While the unlimited possibilities of design composition offer choices to create patterns, design is constrained by some laws such as geometrical conventions or symmetry. Possibilities can be achieved by transformations in colours, shapes (e.g. changing the scale or rotation), and space (e.g. illusionist perception of overlapping planes in two dimensions). Constraints, on the other hand, include traditional limitations (conventions) on the extent to which the transformations can occur in each design style, without losing the originality.
Because this 'Choices-and-Constraints' perspective provides a larger space and dynamism for creative patterns to happen, we have chosen it to model our problem. Instead of a rule-based mechanism that outputs a certain set of answers, we propose an explorative method that allows any possible answer, a combination of choices, to be explored to the extent that basic constraints allow. Assorted with automatic and interactive evaluations, the exploration moves towards generating more beautiful patterns in a customised manner.

PROBLEM MODELING
Even though they come in a wide variety of designs and styles, in terms of their shape, Persian carpets as with most of the oriental carpets, have shown little innovations, as they are almost invariably rectangular with possibilities of square, round or hexagonal carpets having been generally ignored in favour of a rectangular format (Eiland, 1998).
The medallion design of the floral category of rugs is symmetrical around both the horizontal and vertical axis passing the centre of the rug. Therefore, only one quarter of the rug has to be designed and the rest is achieved by mirroring that one-quarter horizontally and vertically. As you see an example in Figure 1b, our problem domain is designing patterns that occupy the field of a quarter of a rectangular rug.
Limiting our problem of design to the Shah Abbas style with central and corner medallions, our proposed system generates designs for core patterns that occupy the field of the rug. These patterns are spiral-like tendrils with flowers and leaves placed on them, as shown in Figure 1b. These Flowers and patterns are a well-known type of flower patterns that exist in the Shah Abbas designs called 'Khatayi', or 'Shah Abbas' and they are abstractions of some natural plants, blooms and flowers. Designing these flowers can be another interesting design problem, which we are not going to dig into in this paper. Instead we are interested in generating the spiral patterns, their combinations and the composition of flowers on the spirals. To the extent of our problem definition, we consider the flowers (or any other top elements) as a square or tile encompassing a flower pattern.
We model every possible solution for our design problem as a composition of the following two elements: (i) Spiral network: the backbone structure of the design, including spirals, branches, and spiral connections. (ii) Tiles of flowers, blooms, and leaves which are placed on top of the spiral layer.
Unlimited variety in patterns is achieved through transforming the attributes of the above elements and their composition. Transformations include changing the size, shape, orientation of an element or part of it and they are the choices that can be explored in the design process. Theoretically, these transformations can occur on every minute detail of a pattern and can make each pattern something new and unique. But in practice, designers conventionally or intuitively apply only those types of transformations to the patterns that keep the continuity to the past traditions. This means that there are some constraints on how extensive the choices' domain can be explored in order to maintain the originality of the design in a specific design practice. We exploit these constraints as the rules of forming and composing basic elements into a Shah Abbas deign based on the knowledge we extracted from the educational resources in the rug design schools (Vakili et al., 2004;Eskandarpour Khorrami, 2006). We divide these rules into hard and soft rules as described below: a) b)

Figure 1: a) Elements of a Persian rug in an example of Shah Abbas rug, in the medallion floral designs including central medallion, borders, and floral patterns. b) ¼ of a typical Shah Abbas rug
Hard Rules: hard rules are those rules that are specific and well defined in the design field. They are clearly apparent in all of the Shah Abbas rugs and can never be violated. Otherwise the rug design might not be categorised as a Shah Abbas design (or any other type) anymore. These rules are mostly about the geometry of design elements and are as follows for each of these elements: The distance between the spiral's layers should not be very small or very large. (iii) Flowers should be distributed evenly on the spiral so that there is flowers everywhere and not to many of them very close to each other. (iv) The size of flowers has to be appropriate relative to the spiral size; not too big or too small relatively. (v) As we move towards the centre of spiral, the size of flowers decreases. (vi) Diversity in the types of flowers on each spiral should be considered.
Our rug genotypes are tree-like structures of strings, with each string describing a spiral, and the tree representing the connected spirals. The root of this tree is the first spiral that starts from one corner of the central medallion. Each string is composed of attributes of the corresponding spiral. The most significant characteristic of these attributes is that while they comprehensive describe the geometry of our design elements they should completely obey the hard design rules. These attributes are: • Spiral's radius; • The angle at which the spiral initialises; • Spiral's number of layers; • Spiral's revolving direction; • The angle at which the connecting spirals are connected to the current spiral (this is limited to two connecting spirals for simplicity in implementation); • Characteristics of the main four flowers placed on the spiral's external layer, such as their index -in our database of flowers-and size (these characteristics are kept simple for our first prototypes of the system).
In the next section we describe how our early version of the system is implemented employing the explained model.

EVOLUTIONARY ALGORITHM AND SYSTEM IMPLEMENTATION
Our approach breaks down the Persian rug generation into two phases. In the first phase, the rug (a collection of connected spirals as a core structure) is generated exploiting the hard design rules and the available genetic operators. An evaluation mechanism based on the most elementary soft design rules ranks each generated genotype in the first phase. In the second phase, the highly ranked genotypes are presented to the user (ideally a rug designer) to select the most aesthetically acceptable rugs for the next evolution.

First phase: rug generation
During the evolutionary procedure, our system generates a large number of genotypes by assigning random values (in the appropriate range) to their strings and applying genetic operators. Our algorithm utilises the standard mutation and crossover operators. The mutation operator randomly chooses and alters a spiral. Although there is just an alteration in one of the spirals, the structure of resulted rug can be drastically different. A change in one spiral affects all the spiral's characteristics that may lead to a considerable change in the whole tree structure of the generated rug. The cross-over operator randomly selects two spirals and exchanges their sub-sequences to create new offspring. Before entering the offspring into the new population, our algorithm validates each generated genotype regarding the parameterised form of most of the hard rules. The genotypes are not allowed to enter to the population unless they successfully pass the validation test. Figure 4 illustrates the workflow of our algorithm.

Second phase: automatic evaluation and interactive evaluation
The challenge in our rug generation system is how we can invent an automatic selection function that is able to assess an art work especially in the absence of clear knowledge about what makes a design a high-quality or even acceptable in the culture and market. On the other hand, with a completely subjective aesthetic selection method we need to keep the population size so small that we can display it to the user. This has the disadvantage of losing the capability to explore a wide area of design solutions, which was one of our main reasons to choose an evolutionary approach.
To address this issue, we take advantage of both selection approaches and try to limit the possible shortcomings.
In each round of evolution, an automatic selection function ranks the generated rugs based on some of the attributes that influence how much a rug appears well designed. These attributes are extracted from those soft principles explained earlier, where there is no specific optimal value for them. Instead there is a range of values are usually preferred by the designers. We employ the following two attributes in our first version of system implementation: the number of spirals that form the rug, and the number of overlapping spirals in the rug. In our automatic evaluation mechanism rugs with a larger number of spirals and a lower number of overlaps score higher and are more likely to be selected.
These two rules together give higher scores to the rugs with a balanced distribution of spirals. If the number of spirals is high while the number of overlapping spirals is low, the spirals are very likely to be distributed all over the plane so that they usually do not overlap. It means that they are not concentrated on a small region. Obviously, there are more soft rules that can be used in the automatic evaluation mechanism, but we are keeping our implementation simple and focus on demonstrating the idea.
Highly ranked rugs in each evolution are then presented to the user to be subjectively judged in an interactive graphical user interface as you can see in Figure 5. Users can select patterns which are aesthetically pleasing. This action highly increases the evaluation score and therefore the chance of survival for the selected patterns. A number of patterns with the best evaluation scores go to the next population and are mutated or crossed over to generate new offspring.
Aesthetic selection can occur in each cycle of the evolution or after a number of cycles depending on the population size, the total number of evolutionary cycles, and the desired processing time. Obviously for large numbers of evolutionary cycles, involving the user in each cycle would end up creating a very time consuming processing. On the other hand, more cycles and bigger population sizes are expected to produce better final solutions. Therefore, we prefer to let the system finish several rounds of evolution and run the aesthetic selection afterwards.
The purpose of the automatic evaluation mechanism is to decrease the chance of selection for the very weak and low-ranked rugs (e.g. rugs with just one spiral). Furthermore, the interactive evaluation system can also decrease the selection chance of rugs with extremely high score but without the plausible visual appearance (e.g. rugs with the linear sequence of spirals). Additionally, this process provides the designers with the facilities to determine the ranges based on their preferences. This gives the opportunity for the system to foster creativity and adaptability to different styles.

RESULTS
Some sample outputs of the system from different evolutions are demonstrated in Figure 6a-c. The evaluation scores mentioned in the image captions can vary in the range of 0 to 100 with higher values representing better designs. A sample complete rug generated by our system is also presented in Figure 7. It seems that the position and direction of flowers have a considerable effect on the appearance of the generated rugs. For example Figure 6 indicates a system-generated rug. On the other hand, Figure 8 presents the design structure with some changes in the placement and type of applied flowers. Despite quite minor differences, the second figure is representing a more realistic rug. In the second image there are more flowers in the joints and also the position of flowers is not restricted to four conditions. Furthermore, flowers are rotated to be in the direction of base spiral.

CONCLUSIONS AND THE FUTURE WORKS
Using an interactive evolutionary approach based on genetic algorithms and basic traditional design rules in the field of Persian rug design, we introduced a computational method and implemented a system for generating core patterns of Shah Abbas rugs. Our system takes advantages of both automatic selection and interactive selection methods in the evolution process in order to be creative while keeps connections to the past traditions of design. Besides exploring a more diverse area of design solutions, our system acts as a designer mind and can collaborate with the users to lead them towards exploring the patterns that are more likely to be pleasant for their taste. Possible future directions for this research include: improving the automatic selection mechanism by involving more parameters in the evaluation function, generating details of Shah Abbas flower patterns using a similar approach, and giving learning abilities to the system so that it can analyze the patterns that are selected by the user and extract their common properties. This way, the system can be more intelligent in leading users towards their desired patterns.
However, the earliest future work that we re planning to perform is designing a more complex genotype structure that overcomes some of the current limitations such as the limited number of connected spirals or flowers for each spiral. Obviously, decreasing limitations expands the exploration space and increases the chance of happening for highly creative patterns.