An Enhanced Features Extractor for a Portfolio of Constraint Solvers

08/01/2013 ∙ by Roberto Amadini, et al. ∙ 0

Recent research has shown that a single arbitrarily efficient solver can be significantly outperformed by a portfolio of possibly slower on-average solvers. The solver selection is usually done by means of (un)supervised learning techniques which exploit features extracted from the problem specification. In this paper we present an useful and flexible framework that is able to extract an extensive set of features from a Constraint (Satisfaction/Optimization) Problem defined in possibly different modeling languages: MiniZinc, FlatZinc or XCSP. We also report some empirical results showing that the performances that can be obtained using these features are effective and competitive with state of the art CSP portfolio techniques.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI


1 Introduction

The past decade has witnessed a significant increase in the number of constraint solving systems deployed for solving Constraint Satisfaction Problems (CSPs). It is well recognized within the field of Constraint Programming that different solvers are better when solving different problem instances, even within the same problem class [DBLP:journals/ai/GomesS01]. It has also been shown in other areas, such as SATisfiability testing [DBLP:conf/cp/XuHHL07]

and Integer Linear Programming 

[DBLP:conf/cp/Leyton-BrownNS02], that the best on-average solver can be out performed by a portfolio of possibly slower on-average solvers. In a nutshell, a portfolio approach [DBLP:journals/ai/GomesS01]

for constraint solving can be seen as a methodology that exploits the significant variety in performances observed in different algorithms and combines them in order to create a globally better solver. A crucial step for the performance of a portfolio solver is the selection of (one of) the solvers composing the portfolio for solving a specific problem instance. Such a selection process is usually performed by using Machine Learning techniques based on

features extracted from the instances that need to be solved.

Portfolio approaches have been extensively studied and used in the SAT solving field. The large number of different SAT solvers available, the presence of a standard input language and the availability of a huge dataset of instances has fostered the study of how different solvers can be exploited in order to improve performances, thus bringing to the definition of several portfolio solvers for SAT.

Unfortunately, no such a growth exists in the CSP field, where the only solver which uses a portfolio approach is the Case-Based Reasoning system CPHydra [cphydra]. There are several reasons for this gap between CSP and SAT. First of all, the CSP solving field is more complex than SAT: constraints can be arbitrary complex (e.g. global constraints like regular or bin-packing) and some of them are supported by only a few solvers. Moreover, no standard input language for CSP exists and there are no immediately available big dataset for constraint solving problems. These limitations affect also CPHydra: indeed, it can only treat problems expressed in the XCSP format, it uses a rather small portfolio (just 3 solvers) and it can extract only a limited number of features from a CSP model (a set of 36 features extracted by Mistral solver [mistral_old]). Nevertheless, CPHydra was able to win the 2008 International CSP Solver Competition: this witnesses that portfolios may be powerful also in CSP domain.

In this paper we address these problems and we perform a first step in the direction of filling the gap between SAT and CSP portfolio solvers. In particular, we present a framework that is able to:

  • extract an exhaustive set of 155 features from a general MiniZinc [Nethercote07minizinc:towards] specification;

  • process different formats like XCSP and FlatZinc
    through a simple pre-processing phase;

  • deal with both satisfaction and optimization problems;

  • provide a fundamental support for a portfolio of constraint solvers.

We decided to use MiniZinc as source format of our tool because it is nowadays the most used, supported and general language to specify constraint problems. MiniZinc supports also optimization problems and is the source format used in the MiniZinc challenge [DBLP:journals/constraints/StuckeyBF10], the only surviving international competition to evaluate the performances of constraint solvers. From a technical point of view, MiniZinc is compiled into the low level language FlatZinc using ad hoc global constraint redefinitions and this format is then used to extract the features.111We decided to start from a MiniZinc specification in order to capture an extensive set of global constraints that may be lost during the compilation in FlatZinc, depending on the solver specific redefinitions. However, our framework offers a full compatibility with XCSP and FlatZinc. Indeed, on one hand, we developed a compiler xcsp2mzn for converting problem instances from XCSP to MiniZinc by preserving the most important global constraints. On the other hand, the feature extractor tool called mzn2feat supports natively the FlatZinc format and can extract the features from every FlatZinc model (possibly ignoring unknown solver specific redefinitions).

For a preliminary validation of the framework, following the approach presented in [DBLP:conf/cpaior/AmadiniGM13] we built different portfolio solvers consisting of up to 11 solvers taken from those used in MiniZinc challenge 2012. We used off-the-shelf machine learning algorithms as well as state of the art portfolio techniques in order to exploit the new extracted features. To obtain an extensive evaluation as possible the tests were conducted by using a dataset obtained by combining the CSP instances of the MiniZinc benchmark with the dataset of the last two International Constraint Solver Competitions (ICSCs) [CSC09]. Results indicate that the performances that can be obtained using the new set of features are competitive with state of the art CSP portfolios techniques.

Paper structure. In Section 2 we recall some preliminary notions and we discuss the related literature. In Section 3 we describe the technical details of our framework while in Section 4 we discuss the empirical validation. Finally, in Section 5 we report some concluding remarks.

2 Background

In this Section we introduce some preliminary notions that we need later in the paper, then we discuss the related work.

2.1 Preliminaries

A Constraint Satisfaction Problem (CSP) consists of a finite set of variables , each of which associated with a domain of possible values that a variable could take, and a set of constraints that define the set of allowed assignments of values to the variables [DBLP:journals/ai/Mackworth77]. Given a CSP the goal is normally to find a solution, that is an assignment to the variables that satisfies all the constraints of the problem, through one suitable constraint solver.

Machine Learning (ML) is a broad field that uses concepts from computer science, mathematics, statistics, information theory, complexity theory, biology and cognitive science [Mitchell97] to “construct computer programs that automatically improve with experience”. In particular, classification

is a well-known ML problem that, given a finite number of classes (or categories), consists in identifying to which class belongs each new observation. This problem is solved by using an appropriate classifier which is essentially a function mapping a new instance - characterized by one or more discrete or continuous

features - to one class [Mitchell97]. The classifier is defined on the basis of a dataset of instances whose class is already known, trying to exploit such a knowledge to properly classify each new instance.

As previously mentioned a portfolio approach [DBLP:journals/ai/GomesS01] is a general methodology that, in our case, allows to exploits the synergies of different (constraint) solving algorithms in order to obtain a globally better solver. We can then consider a portfolio of solvers as a particular solver consisting of a number of different (constituent) solvers . When a new problem is given, the portfolio tries to predict which is the best constituent solver for solving the specific problem and then uses it for solving . This solver selection process, which is clearly a fundamental part for the success of the approach, is usually performed by using ML techniques. In particular, classification techniques are often used to make predictions on the basis of the features extracted from a relevant set of problem instances. There are also hybrid approaches that integrate ML with other techniques (e.g. Integer Programming) in order to improve the accuracy of the predictions and to maximize the number of solved problems.

2.2 Related Work

To the best of our knowledge, CPHydra [cphydra] is currently the only CSP solver which uses a portfolio approach. For the feature extraction it uses the code of Mistral, one of its constituent solvers, that is able to extract only 36 features. In [KMMO11] the feature extraction code was improved allowing the extraction of few additional features. The main weakness of CPHydra concerns the fact that it is not very scalable w.r.t. the number of the constituent solvers since it has to solve an NP-hard problem to decide the schedule of solvers to use to solve an instance. Moreover, it assumes that problem instances are formulated in the XCSP format, which is less expressive (and less used today) than MiniZinc.

On the other hand, there are several portfolio solvers for SAT. 3S [DBLP:conf/cp/KadiogluMSSS11] is a SAT solver that conjugates a fixed-time static solver schedule with the dynamic selection of one long-running component solver. 3S solves the scalability issues of CPHydra because the scheduling is computed offline and covers only 10% of the time limit. If a given instance is not yet solved after the short runs, a designated solver is chosen at runtime (using a -nearest neighbors algorithm) and executed.

SATzilla [DBLP:conf/cp/XuHHL07] is a SAT solver that relies on runtime prediction models to select the solver that (hopefully) has the fastest running time on a given problem instance. Its last version [DBLP:conf/sat/XuHHL12]

, which consistently outperforms the previous ones, uses a weighted random forest approach provided with an explicit cost-sensitive loss function punishing misclassifications in direct proportion to their impact on portfolio performance.

In [DBLP:conf/cpaior/MalitskyS12] the Instance-Specific Algorithm Configuration tool ISAC [DBLP:conf/ecai/KadiogluMST10] has been used as solver selector. The aim of ISAC is to optimally tune the solver parameters on the basis of the given instance features, behind the primary assumption that a solver will have consistent performance on instances that are clustered together.

In [DBLP:conf/cpaior/AmadiniGM13]

an empirical evaluation and comparison of portfolio approaches is presented. Different portfolio sizes and evaluation metrics were used on a dataset of XCSP instances taken from the last two ICSCs.

Recalling that in this work we focus only on sequential approaches, we would however mention some porfolio-based parallel SAT solvers, like ManySAT [Hamadi09manysat:a], PeneLoPe [AHJ+-12-3] and ppfolio [ppfolio_web].

Other recent works show that the interest in algorithm runtime prediction is quite general and growing. A detailed overview of the state of the art in this context is provided in [DBLP:journals/corr/abs-1211-0906] that also describes new features for predicting algorithm runtime for SAT, MIP (Mixed Integer Programming), and TSP (Traveling Salesperson) problems.

In [Arbelaez09onlineheuristic], [DBLP:conf/ictai/ArbelaezHS10]

ML techniques are used to enhance the performances of a single CSP solver by dynamically adapting its search heuristics. This work lists an extensive set of features to train and improve the heuristics model through Support Vector Machines.

Feature filtering techniques for ISAC tool are described in [citeulike:10395539]: instead of using traditional approaches, the authors introduce new evaluation functions to quickly evaluate subsets of features. Numerical results on both SAT and CSP domains show that the number of features can be significantly reduced while often providing considerable performances gains. Moreover, in [snnap]

the authors introduce SNNAP (Solver-based Nearest Neighbors for Algorithm Portfolios), an alternative view of ISAC which uses the existing features to predict the best three solvers for a particular instance. A brand new classifier that selects solvers based on a Cost-Sensitive Hierarchical Clustering (CSHC) model is presented in

[DBLP:conf/ijcai/MalitskySSS13]. CSHC solver won 2 gold medals in SAT competition 2013.

Finally, a number of tools are being developed in order to improve portfolio solvers usability. snappy (Simple Neighborhood-based Algorithm Portfolio in PYthon) [DBLP:conf/sat/SamulowitzRSS13] is a simple and training-less algorithm portfolio which relies on a nearest neighbors prediction mechanism. LLAMA (Leveraging Learning to Automatically Manage Algorithm) [kotthoff_llama_2013] is instead a framework that facilitates the exploration of different portfolio techniques on any problem domain, by supporting the most common solver selectors and possibly combining them.

3 Framework

In this section we present the technical details of our framework, introducing the compiler xcsp2mzn and the features extractor mzn2feat (together with a detailed list of the features it extracts).

3.1 xcsp2mzn and mzn2feat 

MiniZinc is nowadays the most used language to encode CSPs while XCSP was mainly used in the past for the International Constraint Solver Competition (ICSC), which ended in 2009. Nevertheless, the ICSC dataset is by far the biggest dataset of CSP instances existing today. Hence, in order to exploit such a dataset for building better portfolios, we developed a compiler from XCSP to MiniZinc.

xcsp2mzn was developed by adapting x4g [DBLP:conf/cilc/MoraraMG11], a converter from XCSP to Gecode [gecode_fzn] used in particular to support the XCSP abridged notation. Since we focused mainly on CSP we did not consider XCSP extensions like weighted constraints or quantifiers over constraints. All the code is written in C++ using the well known libxml2 libraries.

Exploiting the fact that MiniZinc is more expressive than XCSP (i.e. the majority of the primitive constraint of XCSP are also primitive constraints of MiniZinc) the translation was straightforward. The only notable difference was the compilation of extensional constraints (i.e. relations explicitly expressed in terms of all the allowed or not allowed tuples) which are a native feature in XCSP only. To overcome this limitation we used the table global constraint for encoding the allowed set of tuples and a conjunction of disjunctions of inequalities for mapping the forbidden set of tuples.

As far as global constraints are concerned, XCSP supports the majority of the global constraints defined in the Global Constraint Catalog [Beldiceanu:2007:GCC:1232658.1232664]. Since in this catalog there are hundreds of global constraints, a full XCSP support means to provide an encoding for a huge number of them. However, this is out of our scope and we have chosen to support only the subset of the global constraints used in the ICSC.

mzn2feat is a tool that allows to extract from a MiniZinc model a set of 155 features: 144 are static features and are obtained by parsing the problem instance, while 11 are dynamic and are obtained by running the Gecode solver for a short run (for a detailed description of the features please see Section 3.2). Since the complexity of the MiniZinc language (in particular the possibility of using control flow statements) makes the extraction of the syntactical features quite difficult, we decided to not process directly the MiniZinc instances. We instead compile them to FlatZinc [mzn2fzn], a lower level language having a syntax that is mostly a subset of MiniZinc and that can be obtained from MiniZinc by using the mzn2fzn tool provided by the MiniZinc suite.

To develop mzn2feat we first generated the FlatZinc parser of the MiniZinc suite by using the standard Flex and Bison parser tools. Then, the generated parser was extended by integrating suitable C++ code for extracting the static features (for example the number of constraints, their arity, etc.).

The compilation to FlatZinc raised some design choices, since global constraints defined in MiniZinc can be translated in different ways. For example, the alldifferent global constraint is decomposed by default into a conjunction of inequalities. However, if for instance the target solver of the compilation is Gecode, specific definitions can be used to avoid its decomposition. This is a key feature of MiniZinc: starting from a general model each solver can produce a specialized FlatZinc by redefining the global specifications.
Since a proper treatment of global constraints can dramatically improve the solver performances, we thought that keeping track of how and what global constraints are used is rather important. For this reason we decided to consider as input format the FlatZinc obtained by using Gecode redefinitions. Such a choice is justified by the fact that Gecode won the gold medal in all categories of the MiniZinc Challenge 2012 [mznc2012] and it handles natively 47 different global constraints.

The specific FlatZinc model obtained in this way is also exploited to collect the dynamic features. This was done by launching Gecode interpreter fz for short runs (2 seconds).

Summarizing, given a generic MiniZinc model in input, mzn2feat does the following:

  1. it translates into the corresponding FlatZinc specification by using Gecode global redefinitions;

  2. it extracts static features from by using a suitable parser;

  3. it extracts dynamic features from by running the fz interpreter of Gecode for 2 seconds.

We remark that step 2) is applicable to every FlatZinc model (possibly ignoring the unknown solver-specific redefinitions). Moreover, steps 2) and 3) are totally independent and therefore could be parallelized or even reversed. For instance, it could be useless to compute the static features if the given instance is solved by Gecode while trying to compute the dynamic features.

3.2 Features description

In this section we present a detailed list of all the 155 numeric features extracted by mzn2feat. We tried to collect a set of features as exhaustive and general as possible, taking inspiration from and adapting those presented in [DBLP:journals/corr/abs-1211-0906], [DBLP:conf/ictai/ArbelaezHS10]. Although some of these features are quite generic (e.g., the number of variables or constraints) others are specific to FlatZinc (e.g. search annotations) or to Gecode (the global constraints features). For more details about these technical details we defer the interested reader to [mzn2fzn], [fzn_spec], [gecode_fzn].

In the following we denote by the set of the unbounded variables and, if not specified, with the term “variable” we refer to unbounded variables. A variable for us is bounded if it is either bounded to a constant value (and in this case it is called constant for short) or it is bounded to another variable (i.e, it is an alias). If are aliases of a variable , we compute the corresponding features by assuming to replace each by the aliased variable . Moreover, we denote by the domain size of a variable , by its degree (i.e. the number of constraints in which occurs) and we define as .

Similarly, we will denote by the set of constraints that constrain at least one variable. For each , we denote by the set of variables that occur in , by , (we use the logarithm since for large domains the computation of may cause an overflow), and the arity of (i.e. the number of its arguments; note that iff all the variables occurring in are distinct).

Finally, we will denote respectively by , , avg, CV, and H the minimum, maximum, average, variation coefficient and entropy values.

Static Features

We extracted 144 static features grouped in the following different categories.

  • Variables (27):

    • the number of variables , the number of constants, the number of aliases, the ratio , the ratio ;

    • the number of defined variables (i.e. defined as a function of other variables), and the number of introduced variables (i.e. auxiliary variables introduced during the FlatZinc conversion);

    • , ;

    • , , ;

    • , , avg, CV, and H of ;

    • , , avg, CV, and H of ;

    • , , avg, CV, and H of .

  • Domains (18): Since variables could have different domains, we compute the number of:

    • boolean variables and the ratio ;

    • float variables and the ratio ;

    • integer variables and the ratio ;

    • set variables and the ratio .

    Moreover, we compute the number of:

    • array constraints and the ratio ;

    • boolean constraints and the ratio ;

    • int constraints and the ratio ;

    • float constraints and the ratio ;

    • set constraints and the ratio .

  • Constraints (27):

    • the total number of constraints , the ratio , the total number of constraints using boundsZ (or bounds), boundsR, boundsD, domain or priority specific FlatZinc annotations;

    • , ;

    • , , ;

    • , , avg, CV, and H of ;

    • , , avg, CV, and H of ;

    • , , avg, CV, and H of .

  • Global Constraints (29): We consider the total number of global constraints, the ratio and the number of global constraints for each one of the 27 equivalence classes in which we have grouped the 47 global constraints that Gecode supports.222 As an example, the class bool lin includes the constraints bool_lin_eq, bool_lin_ne, bool_lin_le, bool_lin_lt, bool_lin_ge, bool_lin_gt.

  • Graphs (20): In order to capture the interactions between variables and constraints we computed the followings non oriented graphs:333Constraint Graph and Variable Graph are also known as Dual and Primal graph respectively.

    • Constraint Graph (CG): the graph obtained adding a node for each constraint and an edge between and iff they share at least one variable (i.e. );

    • Variable Graph (VG): the graph obtained adding a node for each variable and an edge between and iff they occur together in at least one constraint (i.e. ).

    Then, starting from the graphs and following [DBLP:journals/corr/abs-1211-0906], we computed , , avg, CV, and H of the:

    • CG nodes degree;

    • CG nodes clustering coefficient;

    • VG nodes degree;

    • VG nodes diameter, where by the diameter of a node we mean the maximum among the minimum distances between and each other node (we set to 0 the diameter of two not connected nodes)

    We noticed that for huge instances the generation of the graphs was time and space consuming. To limit the time and the memory needed to extract the features we have then imposed a timeout of 2 seconds to compute both CG and VG features. In case of timeouts these features where set to the default value of -1.

  • Solving (11): From the solve goal we extract the following features:

    • the number of labeled variables, i.e. the variables to be assigned;

    • goal: it can be either 1, 2, or 3 depending on the fact that the goal is satisfy, minimize, or maximize, respectively;

    • search type: the number of bool_search,
      int_search, set_search annotations;

    • variable choice: the number of input order,
      first_fail, or other heuristics;

    • value choice: the number of indomain_min,
      indomain_max, or other heuristics.

  • Objective (12): Named the variable that has to be optimized, and

    the average and the standard deviation of

    resp., and the average and the standard deviation of resp., we compute the following features:

    • , , , and ;

    • , , , and ;

    • the degree of in the variable graph, its diameter , , and

    Obviously, these features make sense only for optimization problems: in case of satisfaction problems (or if the denominator of the above ratios is 0) we set the default value -1 for such features.

Dynamic features

We extracted the following 11 dynamic features:

  • the number of solutions found, the number of propagations performed, and the ratio ;

  • the number of nodes expanded in the search tree, the number of failed nodes in the search tree, and the ratio ;

  • the maximum depth of the search stack and the peak memory allocated;

  • the CPU time needed for converting from MiniZinc to FlatZinc, the CPU time required for static features computation, and the total CPU time needed for extracting all the features.

The first 8 features are collected by short runs (2 seconds) of Gecode with default parameters and by using -s and -time options for the fz interpreter.444

We noticed that in few cases the Gecode solving process ignores the time cap, probably because of a bug. In these cases we forced the interruption of

fz after 5 seconds and set the default value to -1 for the 8 first dynamic features.

4 Validation

Since we are not aware of tools that could extract features form MiniZinc models, making a direct comparison between mzn2feat and other similar tools was not possible. Therefore, although it is not the main purpose of this work to identify which are the most significant features for a particular portfolio approach, we decided to compare mzn2feat with the features extractor developed by Mistral and extended in [KMMO11] by using the ICSC dataset. More precisely, we measured and compared the solving time and the number of problem instances solved by different portfolios techniques using, on one hand, the features extracted by mzn2feat and, on the other hand, those extracted by Mistral.

Taking as reference the methodology and the results of [DBLP:conf/cpaior/AmadiniGM13] we considered the most promising portfolio techniques and we evaluated their performances using a time limit of 1800 seconds, which is the same threshold used in ICSC. For building portfolios we reproduced the best performing SAT approaches of [DBLP:conf/cpaior/AmadiniGM13], namely, SATzilla [DBLP:conf/cp/XuHHL07] and 3S [DBLP:conf/sat/XuHHL12], and the best off-the-shelf approaches, viz. Random Forest and SMO, by using the corresponding WEKA [Hall_theweka] classifiers with default parameters.

Portfolios were built by using the following 11 different solvers from the MiniZinc Challenge 2012 [mznc2012]: BProlog, Fzn2smt, CPX, G12/FD, G12/LazyFD, G12/MIP, Gecode, izplus, MinisatID, Mistral555Note that the version of Mistral used in the MiniZinc challenge 2012 is a completely new version of the solver and it is not the one used for extracting the features from XCSP. and OR-Tools.

Every approach was tested by using a 5-repeated 5-fold cross-validation [ArlotCelisse2010]. The dataset was randomly partitioned in 5 disjoint sets called folds. Each of these folds was treated in turn as the test set, considering the union of the 4 remaining folds as training data. In order to avoid a possible overfitting problem (i.e. a portfolio approach that adapts too well on the training data rather than learning and exploiting the generalized pattern) the random generation of the folds was repeated 5 times. For every instance of every test set we computed the solving strategy proposed by the portfolio approach and we simulated it by checking if the solving strategy was able to solve the instance within the time cap. We evaluated the performances of every approach in terms of Average Solving Time (AST) and Percentage of Solved Instances (PSI).

In order to compare mzn2feat w.r.t. the features extracted by Mistral we considered the instances of the ICSC successfully compiled into MiniZinc by using Gecode specifications within 900 seconds. When the compilation time exceeds such a limit it is reasonable to assume that one can use directly Gecode to solve the problem instance, since recompiling the MiniZinc model by using the specification of a different solver would end up in wasting the entire time allowed to solve the instance. We also discarded from the dataset all the instances solved by Mistral666Here we ran the old version of Mistral, the one used in the ICSC competition. and Gecode in less than 2 seconds. These instances were discarded because no prediction was needed: the problems were already solved during the features extraction. In this way we end up with a benchmark consisting of 2595 instances which in the following will be called Benchmark A.

Moreover, we have also tested our tool by combining the CSP instances gathered from the MiniZinc benchmark and the instances of the ICSC successfully converted into MiniZinc. As above, we discarded from this second dataset all the instances whose compilation required more than 900 seconds as well as all the instances solved by Gecode in less than 2 seconds. In this case, we ended up with a larger dataset consisting of 4642 instances: 3538 from the ICSC and 1104 from the Minizinc benchmark. In the following, we will refer to this dataset as Benchmark B.

In order to evaluate portfolio performances we simulated the execution of the solvers keeping track of the solving time of each solver on every CSP and the time needed for the features extraction. In average, the time needed to compute the features for the instances of Benchmark B (the larger one) was 75.61 seconds, with a maximum value of 897.26 seconds. However, the median is 6.85 seconds, hence for half of the instances the total time required for computing the features was less than 7 seconds. It is worth noting that for the other half of the instances the time needed to extract the features is strongly influenced by the compilation into FlatZinc (in average, the 47.28% of the total extraction time). This is due the fact that many of such instances are huge (even in the order of MB) and therefore their compilation is very expensive. Nevertheless, features extraction was performed in less than a minute for 73.52% of the instances.

All the approaches were tested with portfolios of different sizes, considering up to a maximum of solvers. Denoting by the set of all our solvers, for each size the portfolio composition was computed considering the subset with cardinality which maximizes the number of solved instances (possible ties were broken by minimizing average solving time).

Following [DBLP:conf/cpaior/AmadiniGM13] we elected MinisatID [minisatid] as backup solver, since it is the one that solved the greatest number of instances within the time limit of 1800 seconds.777 Thanks to the help of Broes De Cat we were able to use a debugged version of MinisatID w.r.t. the one that has competed in the last MiniZinc challenge. The backup solver is used in case the portfolio selects a solver that fails prematurely.

All the code developed to conduct the experiments, together with the xcsp2mzn and mzn2feat source code, is available at [source_code].

4.1 Test Results

Figure 1: PSI comparison using mzn2feat and Mistral features on Benchmark A. For each different portfolio technique, the x-axis is sorted in ascending order according to the number of constituent solvers .

Figure 1 presents the results of the simulated portfolio techniques on Benchmark A by using both Mistral features and the features extracted by mzn2feat. The features for both approaches were normalized in the range and then used to make predictions. Useless features, i.e. features constants for all the instances of the dataset, were removed. The plot presents the PSI obtained by using 4 different portfolio techniques: the first 2 are off-the-shelf approaches (Random Forest and SMO) simulated by using WEKA tool with default parameters, while the others (3S and SATzilla) comes from the SAT field. As baseline we used the Virtual Best Solver (VBS), i.e. an oracle able to choose the best solver to use for every instance.

The results clearly indicate that the performances achieved by using mzn2feat’s features are competitive w.r.t. those obtained by using Mistral’s features. Usually the difference is rather small even though, for instance, the SMO classifier allows to solve even 6.87% of instances more by using our tool. Considering all the tested techniques and all the portfolio sizes, in the worst case we are able to solve only 1.03% less instances while, on average, 1.25% more instances could be solved by using the features extracted by mzn2feat. It is also worth noticing that the peak performances are reached by using 3S approach with the features extracted by our tool.

Figure 2: PSI and AST on Benchmark B.

Figure 2 shows the performances achieved by using different portfolios techniques and the features extracted by mzn2feat on the most extended Benchmark B. The results are similar to those presented in [DBLP:conf/cpaior/AmadiniGM13]

. Indeed, also in this case the two best portfolios approaches are 3S and SATzilla while the other approaches have lower performances. It is worth noticing that we also tried different variants of default WEKA classifiers, obtained by tuning parameters, by using meta-classifiers and by performing features selection; despite this changes we did not observed very significant differences. Moreover, even in these experiments there is a strong anti-correlation between AST and PSI. Differently from

[DBLP:conf/cpaior/AmadiniGM13], where the peak performances were reached by relatively small portfolios (about 6-8 solvers on a total of 16 solvers), here the addition of a solver almost always increases the percentage of solved instances.

Finally, we remark that also in this case the empirical results clearly indicate that a portfolio approach could be far better than a single-solver approach: considering for instance the peak performances of 3S on Benchmark B, we are able solve up to 25.12% instances more than the Single Best Solver (SBS) MinisatID, while the maximum gap w.r.t. the Virtual Best Solver is 7.61%. In particular, 3S is able to close the 89.55% of the gap between SBS and VBS.

4.2 Features preprocessing

We conclude this section with some considerations about features preprocessing. In this work we tried to collect a set of features as large and general as possible, obtaining a number of features that is more than triple of that one of Mistral. Obviously, not all of these features are equally significant. For example, although in principle MiniZinc allows to use float variables and constraints, none of the considered instances contain such constructs. Moreover, having considered only CSPs, all the features related to optimization (e.g. solve goal or objective function features) have assumed the same default value. Following what is usually done by the majority of current approaches, we then decided to remove all the constant features from our features set. In addition, we have scaled all the values in the range [-1, 1]. In this way we ended up with a reduced set of 114 features on which we conducted our experiments.

In [citeulike:10395539] the authors show that by using suitable evaluation functions it is possible to perform a feature filtering that, on one hand, drastically reduces the feature number and, on the other hand, also provides performances gains. Therefore, we tried to apply different features selection techniques on Benchmark B for all the off-the-shelf approaches by exploiting and tuning (using forward, backward and bidirectional search) a number of WEKA algorithms, namely: BestFirst (a greedy hillclimbing algorithm), GeneticSearch (based on Bayes Network learning), GreedyStepwise (that uses a greedy search), InfoGainAttributeEval and Ranker (for evaluating and ranking the attributes). Unfortunately, we have not seen significant improvements: all the performance gains were always below 1%. 888We also tried to apply the filtering techniques of [citeulike:10395539] exploiting ISAC code; unfortunately, this proved to be too time consuming (filtering of a single fold took more than a day of computation). However, it is worth noting that merely removing constant features and scaling them in a given range could lead to major enhancements with a small computational effort. Consider for instance Figure 3 that shows a comparison between the performances obtained by 3S on Benchmark B, by using normalized and not normalized features. As it can be seen, the difference is considerable: the performance gap that can be obtained by normalizing the features ranges from a minimum of 3.08% to a maximum of 4.68%.

Figure 3: PSI comparison of 3S using normalized and not normalized features.

5 Conclusions and Extensions

In this work we presented a framework that is able to extract an extensive set of features from both satisfaction and optimization problems defined in possibly different modeling languages: MiniZinc, FlatZinc or XCSP. The main components of the framework are xcsp2mzn, a compiler for converting CSP instances from XCSP to MiniZinc, and specially mzn2feat, a flexible and extendible tool for extracting a set of 155 features from a MiniZinc model. We deem that our work could serve as a prototype for the creation of a modern constraint solver adopting a portfolio approach.

Thanks to the features extracted by mzn2feat, it should be pretty straightforward to build a CSP solver capable of exploiting a portfolio of different solvers: the only requirement is that these solvers must support MiniZinc format. As a future work, we are planning to assemble such a solver, possibly enrolling it to a MiniZinc Challenge.

The set of features we proposed was tested using the best performing portfolio techniques evaluated in [DBLP:conf/cpaior/AmadiniGM13]. A comparison with all the other existing techniques is out of the scope of this paper; nevertheless, we are still interested in testing further portfolio approaches (also coming from different domains, e.g. Answer Set Programming [DBLP:conf/lpnmr/GebserKKSSZ11]).

Another future direction concerns the improvement of the quality of the features. On the one hand, our framework is flexible enough to allow without great effort the addition of new and more sophisticated features (SATzilla for instance uses a local search algorithm to compute some dynamic features). On the other hand, predictions accuracy could be significantly improved by appropriate feature filtering techniques. We noticed that the feature significance depend on the portfolio approach adopted, hence we can not provide the subset of the most significant features that works well for all the portfolio approaches. Thanks to mzn2feat it is however possible to focus on a particular approach and devise different filtering techniques for improving its performance.

One of the most promising extension of our work is to take into account also Constraint Optimization Problems (COPs). In fact, the MiniZinc syntax of COPs is very similar to CSPs: the only significant difference concerns the solve goal that, in case of optimization, defines the integer expression that need to be minimized or maximized. Since mzn2feat

 is currently already able to process MiniZinc COPs, in the future we are planning to investigate if and how a portfolio approach can be effective for solving combinatorial optimization problems. It is our opinion that not all the best portfolio technique practices developed for satisfaction problems could be equally good for the optimization field. For instance, assuming that COPs in average require more time than CSPs to reach the optimal solution, an approach like 3S (which first executes short runs of different solvers for the 10% of the time limit) may not be very effective since few COPs could be solved in just 10% of the allowed time. Finally, in order to evaluate a COP solver new metrics should be considered. In fact, often in real world it is better to get a good solution in a short time rather than consume too much time to find the optimal value. Starting from this assumption, it may be reasonable to give each solver a reward proportional to the distance between the solution found and the optimal one.