diff --git a/docs/doxygen.rc b/docs/doxygen.rc index a31dbfc67..93ba6d421 100644 --- a/docs/doxygen.rc +++ b/docs/doxygen.rc @@ -880,7 +880,8 @@ RECURSIVE = YES EXCLUDE = *pltotex.pl packages/swig/android \ paackages/chr \ - packages/RDF + packages/RDF \ + packages/pyswip # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded diff --git a/docs/yap.md b/docs/yap.md index 3dce960dc..6c4797355 100644 --- a/docs/yap.md +++ b/docs/yap.md @@ -889,7 +889,9 @@ being designed to work with the swig (@url(www.swig.org}) interface compiler. + @ref DBUsage -+ @ref lambda ++ @ref lambda + ++ @ref clpfd + @ref Block_Diagram diff --git a/library/clp/clpfd.pl b/library/clp/clpfd.pl index 34735be04..23c99f366 100644 --- a/library/clp/clpfd.pl +++ b/library/clp/clpfd.pl @@ -67,138 +67,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/** @pred _X_ #< _B_ is det -reified implication -As an example. consider finding out the people who wanted to sit -next to a friend and that are are actually sitting together: - -~~~~~{.prolog} -preference_satisfied(X-Y, B) :- - abs(X - Y) #= 1 #<==> B. -~~~~~ -Note that not all constraints may be reifiable. - - -*/ -/** @pred _X_ #< _Y_ is semidet -smaller or equal - -Arguments to this constraint may be an arithmetic expression with +, --, \\*, integer division /, min, max, sum, -count, and -abs. Boolean variables support conjunction (/\), disjunction (\/), -implication (=>), equivalence (<=>), and xor. The sum constraint allows a two argument version using the -`where` conditional, in Zinc style. - -The send more money equation may be written as: - -~~~~~{.prolog} - 1000*S + 100*E + 10*N + D + - 1000*M + 100*O + 10*R + E #= -10000*M + 1000*O + 100*N + 10*E + Y, -~~~~~ - -This example uses `where` to select from -column _I_ the elements that have value under _M_: - -~~~~~{.prolog} -OutFlow[I] #= sum(J in 1..N where D[J,I]count constraint counts the number of elements that match a -certain constant or variable (integer sets are not available). - - -*/ -/** @pred _X_ #<==> _B_ is det -reified equivalence - -*/ -/** @pred _X_ #= _Y_ is semidet -equality - -*/ -/** @pred _X_ #=< _Y_ is semidet -smaller - -*/ -/** @pred _X_ #==> _B_ is det -Reified implication - -*/ -/** @pred _X_ #> _Y_ is semidet -larger - -*/ -/** @pred _X_ #>= _Y_ is semidet -larger or equal - -*/ -/** @pred _X_ #\= _Y_ is semidet -disequality - -*/ -/** @pred all_different( _Vs_ ) - -Verifies whether all elements of a list are different. -*/ -/** @pred labeling( _Opts_, _Xs_) -performs labeling, several variable and value selection options are -available. The defaults are `min` and `min_step`. - -Variable selection options are as follows: - -+ leftmost -choose the first variable -+ min -choose one of the variables with smallest minimum value -+ max -choose one of the variables with greatest maximum value -+ ff -choose one of the most constrained variables, that is, with the smallest -domain. - - -Given that we selected a variable, the values chosen for branching may -be: - -+ min_step -smallest value -+ max_step -largest value -+ bisect -median -+ enum -all value starting from the minimum. - - - -*/ -/** @pred scalar_product(+ _Cs_, + _Vs_, + _Rel_, ? _V_ ) - -The product of constant _Cs_ by _Vs_ must be in relation - _Rel_ with _V_ . - - -*/ -/** @pred transpose(+ _Graph_, - _NewGraph_) - - -Unify _NewGraph_ with a new graph obtained from _Graph_ by -replacing all edges of the form _V1-V2_ by edges of the form - _V2-V1_. The cost is `O(|V|^2)`. In the next example: - -~~~~~{.prolog} -?- transpose([1-[3,5],2-[4],3-[], - 4-[5],5-[],6-[],7-[],8-[]], NL). - -NL = [1-[],2-[],3-[1],4-[2],5-[1,4],6-[],7-[],8-[]] -~~~~~ -Notice that an undirected graph is its own transpose. - - -*/ :- module(clpfd, [ op(760, yfx, #<==>), op(750, xfy, #==>), diff --git a/library/dialect/swi.yap b/library/dialect/swi.yap index 69a2dc9d0..b1c321df7 100644 --- a/library/dialect/swi.yap +++ b/library/dialect/swi.yap @@ -5,7 +5,7 @@ /** -@defgroup System SWI Dialect SupportXS +@defgroup System SWI Dialect Support This library provides a number of SWI-Prolog builtins that are not by default in YAP. This support is loaded with the diff --git a/library/ugraphs.yap b/library/ugraphs.yap index 8a212abe4..01bd86d57 100644 --- a/library/ugraphs.yap +++ b/library/ugraphs.yap @@ -569,7 +569,23 @@ p_transpose([From-To|Edges], [To-From|Transpose]) :- p_transpose(Edges, Transpose). +/** @pred transpose(+ _Graph_, - _NewGraph_) + + +Unify _NewGraph_ with a new graph obtained from _Graph_ by +replacing all edges of the form _V1-V2_ by edges of the form + _V2-V1_. The cost is `O(|V|^2)`. In the next example: + +~~~~~{.prolog} +?- transpose([1-[3,5],2-[4],3-[], + 4-[5],5-[],6-[],7-[],8-[]], NL). + +NL = [1-[],2-[],3-[1],4-[2],5-[1,4],6-[],7-[],8-[]] +~~~~~ +Notice that an undirected graph is its own transpose. + +*/ transpose(S_Graph, Transpose) :- s_transpose(S_Graph, Base, Base, Transpose). diff --git a/packages/gecode/clpfd.yap b/packages/gecode/clpfd.yap index 4b98c107c..a75fb23e6 100644 --- a/packages/gecode/clpfd.yap +++ b/packages/gecode/clpfd.yap @@ -27,6 +27,7 @@ Constraints supported are: */ + :- module(gecode_clpfd, [ op(100, yf, []), op(760, yfx, #<==>), @@ -116,6 +117,122 @@ Constraints supported are: fd_dom/2 */ ]). +/** @pred _X_ #< _B_ is det +reified implication + +As an example. consider finding out the people who wanted to sit +next to a friend and that are are actually sitting together: + +~~~~~{.prolog} +preference_satisfied(X-Y, B) :- + abs(X - Y) #= 1 #<==> B. +~~~~~ +Note that not all constraints may be reifiable. + + +*/ +/** @pred _X_ #< _Y_ is semidet +smaller or equal + +Arguments to this constraint may be an arithmetic expression with +, +-, \\*, integer division /, min, max, sum, +count, and +abs. Boolean variables support conjunction (/\), disjunction (\/), +implication (=>), equivalence (<=>), and xor. The sum constraint allows a two argument version using the +`where` conditional, in Zinc style. + +The send more money equation may be written as: + +~~~~~{.prolog} + 1000*S + 100*E + 10*N + D + + 1000*M + 100*O + 10*R + E #= +10000*M + 1000*O + 100*N + 10*E + Y, +~~~~~ + +This example uses `where` to select from +column _I_ the elements that have value under _M_: + +~~~~~{.prolog} +OutFlow[I] #= sum(J in 1..N where D[J,I]count constraint counts the number of elements that match a +certain constant or variable (integer sets are not available). + + +*/ +/** @pred _X_ #<==> _B_ is det +reified equivalence + +*/ +/** @pred _X_ #= _Y_ is semidet +equality + +*/ +/** @pred _X_ #=< _Y_ is semidet +smaller + +*/ +/** @pred _X_ #==> _B_ is det +Reified implication + +*/ +/** @pred _X_ #> _Y_ is semidet +larger + +*/ +/** @pred _X_ #>= _Y_ is semidet +larger or equal + +*/ +/** @pred _X_ #\= _Y_ is semidet +disequality + +*/ +/** @pred all_different( _Vs_ ) + +Verifies whether all elements of a list are different. +*/ +/** @pred labeling( _Opts_, _Xs_) +performs labeling, several variable and value selection options are +available. The defaults are `min` and `min_step`. + +Variable selection options are as follows: + ++ leftmost +choose the first variable ++ min +choose one of the variables with smallest minimum value ++ max +choose one of the variables with greatest maximum value ++ ff +choose one of the most constrained variables, that is, with the smallest +domain. + + +Given that we selected a variable, the values chosen for branching may +be: + ++ min_step +smallest value ++ max_step +largest value ++ bisect +median ++ enum +all value starting from the minimum. + + + +*/ +/** @pred scalar_product(+ _Cs_, + _Vs_, + _Rel_, ? _V_ ) + +The product of constant _Cs_ by _Vs_ must be in relation + _Rel_ with _V_ . + + +*/ + :- use_module(library(gecode)). :- use_module(library(maplist)).