next up previous index
Next: Value Selection Up: Selection Strategies Previous: Selection Strategies

Variable Selection

Grace variable selection strategies can be accessed by pressing the VARIABLE... menubutton:

The default strategies and their selection conditions are:

Whenever there are several variables which satisfy the criterion, the first one in the list is selected.

Each variable selection predicate has the format

select_var(+List, -Variable)
where List is a list of domain variables and Variable is the selected variable.

To easily define new selection strategies, Grace provides the predicate grace_var_selection/5   which generates a new variable selection predicate with given properties and which can be used whenever the selection criterion is a numeric value which can be computed from a given variable and which has to be minimised or maximised. When

grace_var_selection(Name, MinOrMax, Pred, Var, Value)
is called, it defines a new predicate Name(List, Variable), which finds the variable Variable from the list List for which the value computed by the predicate Pred is either minimal ( MinOrMax is min) or maximal. Pred is a callable term, which for a given variable Var yields its numeric Value. For example, the Smallest Domain strategy is defined with
grace_var_selection(smallest_domain, min, dvar_size(Var, Size), Var, Size)
and Smallest Maximum as
grace_var_selection(smallest_maximum, min, (dvar_domain(Var, D), dom_range(D, _, Size)), Var, Size)

Variable selection strategies can be selected either using the VARIABLE... menu or using the option var_selection  . The items in the VARIABLE... menu itself can be modified with the var_selections   option.



next up previous index
Next: Value Selection Up: Selection Strategies Previous: Selection Strategies



Micha Meier
Tue Jul 2 10:07:34 MET DST 1996