Did you know ... Search Documentation:
Pack modeling -- prolog/clp.pl
PublicShow source
author
- Francois Fages
version
- 1.1.0

Frontend to library(clpr) and library(clpfd) in order to allow

  • multifile shorthand/3 notations in domains and constraints, including subscripted variables with Array[Indices] notation
?- array(A, [3]), for_all(I in 1..2, A[I] #< A[I+1]).
A = array(_A, _B, _C),
clpfd:(_A#=<_B+ -1),
clpfd:(_B#=<_C+ -1).
  • hybrid clpr clpfd constraints, including op_rel/5, sum/3, and hybrid reification constraints, e.g.
?- array(A, [3]), {A[1] < 3.14} #<==> B.
A = array(_A, _, _),
freeze(B, clp:clpr_boolean(_A<3.14, _A>=3.14, B)),
clpfd:(B in 0..1).

?- array_list(A, [1, 1.5, 2]), {A[1] < 3.14} #<==> B.
A = array(1, 1.5, 2),
B = 1.
  
?- A=array([1,2],[3,4]), op_rel(A, +, A, #=, C).
A = array([1, 2], [3, 4]),
C = array(array(2, 4), array(6, 8)).

?- A=[[1,2],[3,4]], op_rel(A, +, A, #=, C).
A = [[1, 2], [3, 4]],
C = [[2, 4], [6, 8]].

?- L=[X, Y, Z], L ins 1..3, for_all(V in L, V#>1).
L = [X, Y, Z],
clpfd:(X in 2..3),
clpfd:(Y in 2..3),
clpfd:(Z in 2..3).
 minimum(+A, ?Min)
constrains variable Min to be less or equal to all elements in array or list A
 maximum(+A, ?Max)
constrains variable Min to be less or equal to all array cells or list elements in A
 lex_leq(+A, +B)
lexicographic ordering between arrays or lists
 lex_lt(+A, +B)
strict lexicographic ordering between arrays or lists
 op_rel(?Arg1, +Operation, ?Arg2, +Relation, ?Arg3)
applies binary Operation to Arg1 and Arg2, element-wise, and compares the results with Relation to Arg3. The arguments can be arrays, lists, clpfd or clpr variables or constants interpreted as constant array or list. E.g. the Hadamart product of two integer matrices of same dimension can be defined by op_rel(A, *, B, #=, C) over integers, op_rel(A, *, B, '{=}', C) over real numbers.
 sum(+A, +Relation, ?Sum)
hybrid constraint to constrain Sum to in Relation to the sum of clpfd or clpr variables in array or list A.
 scalar_product(+A, +B, +C, ?D)
constraint on arrays or lists of clpfd or clpr variables, similar to library(clpfd) constraint scalar_product on list of integers.
 transpose(+A, ?B)
constraint on arrays or lists A and B similar to library(clpfd) constraint transpose on lists.
 all_different(+A)
constraint on arrays similar to library(clpfd) constraint all_different on lists.
 all_distinct(A)
constraint on arrays or lists using library(clpfd) constraint all_distinct on list.
 lex_chain(+A)
constraint on array or list A similar to library(clpfd) constraint lex_chain on lists.
 tuples_in(+A, +B)
constraint on arrays or lists A and B similar to library(clpfd) constraint tuples_in on lists.
 serialized(+A, +B)
constraint on arrays or lists A and B similar to library(clpfd) constraint serialized on lists.
 global_cardinality(+A, +B)
constraint on arrays or lists A and B similar to library(clpfd) constraint global_cardinality on lists.
 global_cardinality(+A, +B, +C)
constraint on arrays or lists A, B, C similar to library(clpfd) constraint global_cardinality on lists.
 circuit(+A)
constraint on array or list A similar to library(clpfd) constraint circuit on lists.
 cumulative(+A)
constraint on array or list A similar to library(clpfd) constraint cumulative on lists.
 cumulative(+A, +O)
constraint on array or list A with options O similar to library(clpfd) constraint cumulative on lists.
 disjoint2(+A)
constraint on array or list A similar to library(clpfd) constraint disjoint2 on lists.
 element(+A, +B, +C)
constraint on arrays or lists B similar to library(clpfd) constraint element on lists.
 automaton(+A, +B, +C)
constraint on arrays or lists A, B, C similar to library(clpfd) constraint automaton on lists.
 chain(+A, +B)
constraint on array or list A similar to library(clpfd) constraint chain on lists.
 labeling(Options, A)
value enumeration predicate on integer arrays similar to library(clpfd) labeling/2 predicate on lists.
 label(A)
value enumeration predicate on arrays or lists similar to library(clpfd) label/1 predicate on list.s
 {=}(+Expr1, +Expr2)
predicate name for constraint {Expr1 = Expr2}
 {>=}(+Expr1, +Expr2)
predicate name for constraint {Expr1 >= Expr2}
 {=<}(+Expr1, +Expr2)
predicate name for constraint {Expr1 =< Expr2}
 {>}(+Expr1, +Expr2)
predicate name for constraint {Expr1 > Expr2}
 {<}(+Expr1, +Expr2)
predicate name for constraint {Expr1 < Expr2}
 {=\=}(+Expr1, +Expr2)
predicate name for constraint {Expr1 =\= Expr2}
 {+Constraint}
patch of library(clpr) {}/1 predicate for allowing array notations in Constraint.
 entailed(+Constraint)
patch of library(clpr) entailed/1 predicate for allowing array notations in Constraint.
 maximize(+Expression)
patch of library(clpr) maximize/1 predicate for allowing array notations in Expression.
 minimize(+Expression)
patch of library(clpr) minimize/1 predicate for allowing array notations in Expression.
 inf(+Expression, -Inf)
patch of library(clpr) inf/2 predicate for allowing array notations in Expression.
 sup(+Expression, -Sup)
patch of library(clpr) sup/2 predicate for allowing array notations in Expression.
 bb_inf(+Ints, +Expression, -Inf, -Vertex, +Eps)
patch of library(clpr) bb_inf/5 predicate for allowing array notations in Expression.
 bb_inf(+Ints, +Expression, -Inf)
patch of library(clpr) bb_inf/3 predicate for allowing array notations in Expression.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 in(Arg1, Arg2)
 ins(Arg1, Arg2)
 #>(Arg1, Arg2)
 #<(Arg1, Arg2)
 #>=(Arg1, Arg2)
 #=<(Arg1, Arg2)
 #=(Arg1, Arg2)
 #\=(Arg1, Arg2)
 #\(Arg1)
 #<==>(Arg1, Arg2)
 #==>(Arg1, Arg2)
 #<==(Arg1, Arg2)
 #\/(Arg1, Arg2)
 #\(Arg1, Arg2)
 #/\(Arg1, Arg2)
 array(Arg1)
 array(Arg1, Arg2)
 cell(Arg1, Arg2, Arg3)
 cell(Arg1, Arg2)
 array_lists(Arg1, Arg2)
 array_list(Arg1, Arg2)
 set_cell(Arg1, Arg2, Arg3)
 set_cell(Arg1, Arg2)
 nb_set_cell(Arg1, Arg2, Arg3)
 nb_set_cell(Arg1, Arg2)
 inf(Arg1, Arg2, Arg3, Arg4)
 sup(Arg1, Arg2, Arg3, Arg4)
 ordering(Arg1)
 clp_type(Arg1, Arg2)
 dump(Arg1, Arg2, Arg3)