  Extending ASP with constraints (CASP) enhances its expressiveness and
performance. This extension is not straightforward as the grounding phase,
present in most ASP systems, removes variables and the links among them, and
also causes a combinatorial explosion in the size of the program. Several
methods to overcome this issue have been devised: restricting the constraint
domains (e.g., discrete instead of dense), or the type (or number) of models
that can be returned. In this paper we propose to incorporate constraints into
s(ASP), a goal-directed, top-down execution model which implements ASP while
retaining logical variables both during execution and in the answer sets. The
resulting model, s(CASP), can constrain variables that, as in CLP, are kept
during the execution and in the answer sets. s(CASP) inherits and generalizes
the execution model of s(ASP) and is parametric w.r.t. the constraint solver.
We describe this novel execution model and show through several examples the
enhanced expressiveness of s(CASP) w.r.t. ASP, CLP, and other CASP systems. We
also report improved performance w.r.t. other very mature, highly optimized ASP
systems in some benchmarks. This paper is under consideration for publication
in Theory and Practice of Logic Programming (TPLP).
