/usr/share/swi-prolog/pack/clpBNR/prolog/clpBNR.pl
All Application Manual Name SummaryHelp

  • clpBNR
    • prolog
      • clpBNR.pl -- clpBNR: Constraint Logic Programming over Continuous Domain of Reals
        • clpStatistics/0
        • clpStatistic/1
        • clpStatistics/1
        • list/1
        • interval/1
        • interval_degree/2
        • nb_setbounds/2
        • range/2
        • domain/2
        • delta/2
        • midpoint/2
        • median/2
        • lower_bound/1
        • upper_bound/1
        • ::/2
        • {}/1
        • watch/2
        • trace_clpBNR/1
      • clpBNR_toolkit.pl -- clpBNR_toolkit: Toolkit of various utilities used for solving problems with clpBNR
 {+Constraints} is semidet
Succeeds if Constraints is a sequence of one or more boolean expressions (typically equalities and inequalities) defining a set of valid and consistent constraints; otherwise fails. The ',' binary operator is used to syntactically separate individual constraints and has semantics and (similar to the use of ',' in clause bodies). Arithmetic expressions are expressed using the same set of operators used in functional Prolog arithmetic (listed below) with addition of boolean operators to support that sub-domain of reals.

Table of supported interval relations:

+ - * /arithmetic
**includes real exponent, odd/even integer
absabsolute value
sqrtpositive square root
min maxbinary min/max
== is <> =\= =< >= < >comparison (is and =\= synonyms for == and <>)
<=included (one way narrowing)
and or nand nor xor -> ,boolean (`,` synonym for and)
- ~unary negate and not (boolean)
exp logexp/ln
sin asin cos acos tan atantrig functions
integermust be an integer value

clpBNR defines the following additional operators for use in constraint expressions:

op(200, fy, ~)boolean 'not'
op(500, yfx, and)boolean 'and'
op(500, yfx, or)boolean 'or'
op(500, yfx, nand)boolean 'nand'
op(500, yfx, nor)boolean 'nor'

Note that the comparison operators <>, =\=, '<' and '>' are unsound (due to incompleteness) over the real domain but sound over the integer domain. Strict inequality (<> and =\=) is disallowed for type real (will be converted to type integer) but < and > are supported for reals since they may be useful for things like branch and bound searches (with caution). The boolean functions are restricted to type 'boolean', constraining their argument types accordingly. Some examples:

?- {X == Y+1, Y >= 1}.
X::real(2, 1.0Inf),
Y::real(1, 1.0Inf).

?- {X == cos(X)}.
X:: 0.73908513321516... .

?- X::real, {X**4-4*X**3+4*X**2-4*X+3==0}.
X::real(-1.509169756145379, 4.18727500493995).

?- {A or B, C and D}.
C = D, D = 1,
A::boolean,
B::boolean.

Note that any variable in a constraint expression with no domain will be assigned the most general value consistent with the operator types, e.g., real(-1.0Inf,1.0Inf), boolean, etc.