[ library(tentative) | Reference Manual | Alphabetic Index ]
vs_random_worst(+VS, -X)
Retrieve a worst violated variable from a varset
- VS
- A varset
- X
- Tentative variable (output)
Description
Retrieve a variable from a varset whose violation count is
maximal in the varset. In case of ties, a random candidate
is returned.
Modes and Determinism
- vs_random_worst(+, -) is semidet
Fail Conditions
Fails if there is no violated variable in the set
Examples
?- Vars=[A,B,C], tent_set(Vars, [1,2,3]), vs_create(Vars, VS),
var_inc_violations(A, 2),
var_inc_violations(B, 1),
var_inc_violations(C, 2),
vs_random_worst(VS, Worst).
Vars = [A{1 -> 2}, B{2 -> 1}, Worst{3 -> 2}]
VS = ...
Worst = Worst{3 -> 2} % A or C, the result is random!
Yes (0.00s cpu)
See Also
vs_all_worst / 2, vs_worst / 2, vs_random_worst_index / 2