INCLP(R)

Interval-based Nonlinear Constraint Logic Programming over the Reals

Leslie De Koninck, K.U.Leuven

Introduction

INCLP(R) is a free Constraint Logic Programming system for SWI-Prolog, capable of solving nonlinear constraints over the real numbers. The system is based on ideas from interval analysis and is written using Constraint Handling Rules. The system is described in this paper, presented at WLP 2006.

Requirements, download and installation

The INCLP(R) system requires an up-to-date installation of SWI-Prolog and the K.U.Leuven CHR implementation that is delivered with it. The system can be downloaded here. Installation is easy: just unpack the archive in a directory of your choice. The system can be used by loading the module called inclpr (the file 'inclpr.pl').

Predicates

The following predicates are available. The syntax of the arguments is described later.

{+Constraints}

Enters a new constraint or conjunction of constraints. Succeeds when the system has returned to a consistent state and fails when an inconsistency is detected.

solve

Backtracks over the different solutions of the current set of constraints. A solution is reached if the variables have sufficiently small domains or the constraint functions prevent further domain reduction.

change_incremental(+Boolean)

Changes the way in which a conjunctions of constraints, entered via {}/1, are handled. If Boolean is true then the system returns to a consistent state each time a new constraint in the conjunction has been processed. If Boolean is false then the system waits until all constraints in the conjunction have been processed before returning to a consistent state.

change_standard_domain(+Interval)

Changes the default domain for new constraint variables.

get_domain(+Var,-Interval)

Returns an interval representing the domain of the given variable.

Syntax

The syntax of constraints is given here in BNF form.

<Constraints> ::= <Constraint>
| <Constraints> ',' <Constraints>
<Constraint> ::= <Expression> '=' <Expression>
| <Expression> '=<' <Expression>
| <Expression> '>=' <Expression>
<Expression> ::= a variable
| a number
| <Expression> '+' <Expression>
| <Expression> '-' <Expression>
| <Expression> '*' <Expression>
| <Expression> '**' a natural number
| '-' <Expression>

Examples

Here are some examples on how to use INCLP(R).

?- {X**2=2,X>=0}.

   {1.41421356237305473 =< X =< 1.41421356237469542}

?- {X**2=Y,X=2*Y},solve.

   {-0.0 =< Y =< 4.94065645841246544e-323}
   {-0.0 =< X =< 9.88131291682493088e-323} ;

   {0.249999999980638377 =< Y =< 0.250000000001623646}
   {0.499999999961277086 =< X =< 0.500000000003247735}

Benchmarks

The benchmarks used in the paper can be downloaded below.

Contact Information

For more information, contact the author: E-mail.