
| Native   | Generated   | Generated (Flat)   |          |       |          |       |
|----------|-------------|--------------------|----------|-------|----------|-------|
| Problems | solve(s)    | Lines              | solve(s) | Lines | solve(s) | Lines |
| Golfers  | 0.21        | 28                 | 0.21     | 31    | 0.22     | 276   |
| Marriage | 0.01        | 42                 | 0.01     | 46    | 0.01     | 226   |
| 20-Q     | 4.63        | 11                 | 4.65     | 12    | 5.02     | 1162  |
| 28-Q     | 80.73       | 11                 | 80.78    | 12    | 87.73    | 2284  |

Table 2: Solving times and model sizes of native and generated files since it contains several object compositions. In summary, considering the whole set of phases involved, we believe the results show reasonable translation times.

In the second experiment we compare the ECLiPSe files automatically generated by the framework with native ECLiPSe files written by hand (see Table 2). We consider the solving time and the lines of each problem file. The data of the native models is first given. We then introduce generated files where the loops have not been unrolled (avoiding this phase the size of generated solver files is closer to the native ones). In this case, the solving times of both types of files are almost equivalent. At the end, we consider problems including the loop unrolling phase (Flat). This process leads to a considerable increase of model sizes. Only the solving time of the flat 20-Queens and 28-Queens problems are impacted (about 0.4 and 7 seconds). This may be explained by the incremental propagation algorithm commonly implemented in CLP languages. We may suppose that a propagation happens each time a constraint is added to the constraint store. If a for statement is not interleaved with propagation, i.e. it is considered as one block, then only one propagation step is required. This is not the case if loops are unrolled, leading to one propagation for each individual constraint. It results in a slow-down. This negative impact in terms of solving time demonstrates the need for keeping the structure of target models (e.g. not unrolling loops) instead of building a flat model.

## Related Work

Model transformation is a recent research topic in CP. Just a few CP model transformation approaches have been proposed. The solver-independent architecture is likely to be the nearest framework to our approach, for instance, MiniZinc (and Zinc), Essence and s-COMMA.

MiniZinc is a high-level constraint modeling language allowing transformations to ECLiPSeand Gecode models. These mappings are implemented by means of Cadmium. The translation process involves an intermediate model where several MiniZinc constructs are replaced by simplified or solver-supported constructs. This facilitates the translation to get a solver model.

Essence is another language involving model transformations. Its solver-independent platform that allows to map Essence models into ECLiPSeand Minion (Gent, Jefferson, and Miguel 2006). A model transformation system called Conjure (Frisch et al. 2005) is included in the framework, which takes as input an Essence specification and refines it to an intermediate language called Essence'. The translation from Essence' to solver code is currently performed by java translators using the tool Tailor.

s-COMMA is an object-oriented language, supported by a solver-independent platform where solvers can be mapped to ECLiPSe, Gecode/J, RealPaver, and GNU Prolog (Diaz and Codognet 2000). The language also involves an intermediate model called Flat s-COMMA to facilitate the translation. Hand-written translators and MDE-translators have been developed to translate a Flat s-COMMA model in the target solver model.

Our approach can be seen as a natural evolution of this solver-independent architecture. Two major advantages arise. (1) In the aforementioned approaches just one modeling language can be used as the source of the transformation, in our framework many modeling language can be plugged as the source. We believe this enables flexibility and provides freedom to the modelers. (2) In the s-COMMA, MiniZinc, and Essence transformation processes, the refactoring steps (e.g. enumeration removal, loop and set unrolling) are always applied. This makes the structure of the solver file completely different from the original model. In our framework we focus on generating optimized models while trying to maintain as much as possible the original structure of the source model. We believe that keeping the source modeling structures into target models, then improve their readability and understanding.

## Conclusion And Future Work

In this paper, we have presented a new framework for constraint model transformations. This framework is supported by an MDE approach and a pivot metamodel that provides independence and flexibility to cope with different languages. The transformation chain involves three main steps: from the source to the pivot model, refining of the pivot model and from the pivot model to the target. Among others, an important feature of this chain is the modularity of mode transformations and that the hard transformation work (refactoring/optimization) is always performed over the pivot. This makes the transformations from/to pivot simpler, and as a consequence the integration of new languages to the architecture requires less effort.

In a near future, we intend to increase the number of CP
languages our approach supports. We also want to define more pivot refactoring transformations to optimize and reformulate models. Another major outline for future work is to improve the management of complex CP models transformation chains, which is not investigated in this paper. The order in which refactoring steps are applied and which refactoring step to apply can be automated. However, we may investigate how to qualify models and transformations according to the pivot and target metamodels.

## References

[Apt and Wallace 2007] Apt, K. R., and Wallace, M. 2007.

Constraint Logic Programming using Eclipse. New York, NY, USA: Cambridge University Press.