Previous Up Next

11.2  Tentative Values

11.2.1  Attaching and Retrieving Tentative Values

A problem variable may be associated with a tentative value. Typically this tentative value is used to record preferred or previous assignments to this variable.

?Vars tent_set ++Values

Assigns tentative values for the variables in a term. These are typically used to register values the variables are given in a partial or initially inconsistent solution. These values may be changed through later calls to the same predicate. Vars can be a variable, a list of variables or any nonground term. Values must be a corresponding ground term. The tentative values of the variables in Vars are set to the corresponding ground values in Values.

?Vars tent_get ?Values

Query the variable’s tentative values. Values is a copy of the term Vars with the tentative values filled in place of the variables. If a variable has no tentative value a variable is returned in its place.

11.2.2  Tenability

A problem variable is tenable when it does not have a tentative value or when it has a tentative value that is consistent e.g. with its finite domain. For example

[eclipse 3]: fd:(X::1..5), X tent_set 3.
X = X{fd:[1..5], repair:3}

produces a tenable variable (note how the tentative value is printed as the variable’s repair-attribute), while on the other hand

[eclipse 3]: fd:(X::1..5), X tent_set 7.
X = X{fd:[1..5], repair:7}

produces an untenable variable. Note that, unlike logical assignments, the tentative value can be changed:

[eclipse 3]: fd:(X::1..5), X tent_set 7, X tent_set 3.
X = X{fd:[1..5], repair:3}


Succeeds if the given variable is tenable. This predicate is the link between repair and any underlying solver that maintains a domain for a variable1.

11.2.3  The Tentative Assignment

The notion of a tentative assignment is the means of integration with the consistency methods of ECLiPSe. The tentative assignment is used for identifying whether a repair constraint is being violated.

The tentative assignment is a function of the groundness and tenability of problem variables according to the following table

Variable GroundnessVariable TenabilityValue in Tentative Assignment
GroundTenableGround Value
GroundNot TenableGround Value
Not GroundTenableTentative Value
Not GroundNot TenableUndefined

A repair constraint is violated under two conditions:

11.2.4  Variables with No Tentative Value

It has been noted above that variables with no associated tentative value are considered to be tenable. Since no single value has been selected as a tentative value, the Repair library checks constraints for consistency with respect to the domain of that variable. A temporary variable with identical domains is substituted in the constraint check.

11.2.5  Unification

If two variables with distinct tentative values are unified only one is kept for the unified variable. Preference is given to a tentative value that would result in a tenable unified variable.

11.2.6  Copying

If a variable with a repair attribute is copied using copy_term/2 or similar, the repair attribute is stripped. If you wish the copy to have the same tentative value as the original, you will need to call tent_get/2 and tent_set/2 yourself.

If you wish to write your own solver and have it cooperate with repair you have to define a test_unify handler

Previous Up Next