[ The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

library(sd)

Simple solver for constraints over unordered symbolic domains

Predicates

?Vars &:: +Domain
All elements of Vars have a value in the domain Domain
?X &= ?Y
X is the same atomic value as Y
&=(?X, ?Y, ?Bool)
Reified version of X &= Y
?X &\= ?Y
X is different from Y
&\=(?X, ?Y, ?Bool)
Reified version of X &\= Y
alldifferent(?List)
All elements of List are different
compare_instances_sd(?, ?, ?)
No description available
copy_term_sd(?, ?)
No description available
delayed_goals_number_sd(?, ?)
No description available
deleteff(-Min, +List, -Rest)
Pick minimum domain size element from a list (first fail principle)
get_domain_as_list(?Term, -List)
Retrieves the domain of a variable (or value) as a list of values
get_domain_size(?Term, -Size)
Gives the size of the domain of a variable (or value)
indomain(?X)
Nondeterministically instantiate to domain values
is_solver_type(?Term)
The argument is a domain variable or atomic constant
is_solver_var(?Term)
The argument is a domain variable
labeling(+Term)
Instantiate all domain variables in a list to domain values
msg(?X, ?Y, -MSG)
MSG is the most specific generalisation of X and Y representable with domain variables from this library
suspensions_sd(?, ?, ?)
No description available
test_unify_sd(?, ?)
No description available
unify_sd(?, ?, ?)
No description available

Other Exports

export op(700, xfx, [&::, &=, &\=])

Description

Overview

This is a simple library implementing variables and constraints over atomic values. Its main purpose is for first experiments with constraint solving. Moreover, those interested in writing their own constraint solvers can use the source code of this library as a starting point.

Domains

Domains are declared by giving a list of possible values for a variable, e.g.
    	?- X &:: [red, green, blue].
	X = X{[blue, green, red]}
	Yes (0.00s cpu)
    
A variable that has been given a domain can only be instantiated to values from this domain. Any attempt to instantiate the variable to a non-domain value will cause failure:
    	?- X &:: [red, green, blue], X = red.
	X = red
	Yes (0.00s cpu)
    	?- X &:: [red, green, blue], X = yellow.
	No (0.00s cpu)
    

Basic Constraints

There are only two basic constraints, equality and disequality:
X &= Y
X is the same as Y
X &\= Y
X is different from Y
Both constraints exist in a reified form:
&=(X,Y,Bool)
Bool is the truth value (0/1) of X &= Y
&\=(X,Y,Bool)
Bool is the truth value (0/1) of X &\= Y

Global Constraints

One derived, global constraint is implemented:
alldifferent(List)
All list elements are different

Search

Domain variables can be instantiated to their domain values using
indomain(X)
enumerate values of X
labeling(Xs)
enumerate values of all elements of list Xs

About


Generated from sd.eci on Mon Mar 31 03:15:13 2008