Previous Up Next
10.2 Solver predicates

10.2.1 {}/1

Templates
{+Constraint}
Description

{Constraint} succeeds if Constraint is a term accepted by the grammar below. If the corresponding constraint is linear, it is added to the current constraints store which is then checked for satisfiability, otherwise it is frozen until it becomes a linear constraint.



Constraint -->      Constraint , Constraint       conjunction 
                  | Constraint ; Constraint       disjunction 
                  | Expr = Expr                   equation 
                  | Expr =< Expr                  inequation 
                  | Expr >= Expr                  inequation

Expr       -->      Variable                      variable (attributed or not)
                  | Evaluable                     evaluable expression
                  | + Expr                        unary plus
                  | - Expr                        unary minus
                  | Expr +  Expr                  binary plus
                  | Expr -  Expr                  binary minus
                  | Expr *  Expr                  binary multiplication
                  | Expr /  Expr                  binary division
                  | Expr ** Evaluable             raise to power
                  | abs(Expr)                     absolute value 
                  | sin(Expr)                     trigonometric sine 
                  | cos(Expr)                     trigonometric cosine 
                  | min(Expr,Expr)                minimum of the two arguments 
                  | max(Expr,Expr)                maximum of the two arguments 

To learn more about evaluable expressions refer to the evaluation of an arithmetic expression (section 7.6.1).

Errors
Constraint is not a structure or its main functor is neither '=' nor '=<' nor '>='    type_error('expected a constraint, found', Constraint)

Portability

GNU Prolog RH predicate.

10.2.2 inf/2, sup/2

Templates
inf(+term, -float)
sup(+term, -float)
Description

inf(ExprLin, Inf) computes the infimum of the linear expression ExprLin and unifies it with Inf. Failure indicates that this infimum is equal to -oo .

sup(ExprLin, Sup) computes the supremum of the linear expression ExprLin and unifies it with Sup. Failure indicates that this supremum is equal to +oo .

Errors
ExprLin is either a atom or a list or a FD variable    type_error('expected a linear expression, found', ExprLin)
ExprLin is not a linear expression    system_error('expected a linear expression')
Inf (or Sup) is neither a variable nor a CLP(R) variable nor a float    type_error('float', Inf)

Portability

GNU Prolog RH predicate.

10.2.3 clpr_get_store/2

Templates
clpr_get_store(+list, -list)
Description

clpr_get_store(Vars, Constraints) unifies Constraints with the list of CLP(R) constraints, which constrain the variables in Vars.

Errors
Vars is not a list    type_error(list, Vars)

Portability

GNU Prolog RH predicate.




Copyright (C) 1999-2002 Daniel Diaz.

Chapters 9 and 10 : Copyright (C) 2002-2003 INRIA, Rémy Haemmerlé.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.

More about the copyright
Previous Up Next