[ library(tentative) | Reference Manual | Alphabetic Index ]
vs_random_worst_index(+VS, -I)
Retrieve a worst violated variable index from a varset
- VS
- A varset
- I
- An integer (output)
Description
Retrieve a variable index 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_index(+, -) 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_index(VS, Worst).
Vars = [A{1 -> 2}, B{2 -> 1}, Worst{3 -> 2}]
VS = ...
Worst = 1 % 1 or 3, the result is random!
Yes (0.00s cpu)
See Also
vs_all_worst_index / 2, vs_worst_index / 2, vs_random_worst / 2