nation of all object variable names. The two for loops (lines 2 and 3) were created from the arrays of objects using their name for index variables.

![0_image_0.png](0_image_0.png)

![0_image_1.png](0_image_1.png)

![0_image_2.png](0_image_2.png)

6 } 7 }
Fig. 9. Extract of the social golfers pivot model after composition **removal and enumeration removal transformations.**
Enumeration removal **During this refactoring step, enumeration variables are**
replaced by integer variables with a domain defined as an interval from one to the number of elements within the enumeration. Line 1 in Figure 9 shows the result of this transformation on the enumeration called Name **in the social golfers**
model: the variable has an integer domain from 1 to 9 replacing the set **of nine** values {a, b, c, d, e, f, g, h, i}**. In the same way, occurences of** CSPEnumLiteral are replaced by their position in the sequence of elements of the enumeration type.

Other implemented refactoring steps **Some other generic refactoring steps**
have been implemented in ATL to handle some structural needs. They are not detailed since their complexity is similar to the previous examples and to **detail**
all of them is not the scope of this paper.

- **If statements can be replaced by one constraint based on one or two boolean**
implications. For instance, if a then b else c **becomes (**a → b) ∧ (¬a → c).

- Loop structures can be unrolled, i.e. the loop is replaced by the whole **set of**
constraints it implicitly contains. Within expressions, the iterator variable used by the loop structure is replaced by an integer corresponding **to the** current number of loop turns.

- **Expressions can be simplified if they are constants. Boolean and integer**
expressions are replaced by their evaluation. Real expressions are not processed, because of real number rounding errors. More subtle simplifactions can be performed on boolean expressions such as a ∨ ¬a **that is always true.**
Only atomic boolean elements are processed by this last step.

- Matrices are not allowed in all CP language, thus they can be replaced **by one**
dimension arrays. Their occurrences in expressions must also be adapted: the index of the array is computed as follows: m[i, j] becomes m[j + (i ∗ ncols)],
where ncols **is the number of columns of the matrix** m.

- The ECLiPSe**language does not allow some sort of expressions. For instance,**
arrays of int sets cannot be accessed like other arrays with '[ ]'. Thus, an