[ library(tentative) | The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

cs_random_worst(+CS, -Cstr)

Get random worst violated constraint from the constraint set
CS
Constraint set
Cstr
A constraint term (output)

Description

Returns a worst violated constraint from the constraint set, i.e. a constraint that has maximum violation count among the constraints in the set. If there are several, a random one is picked.

If the constraints were added with aliases (see :~ /2), the alias term is retrieved instead of the constraint goal.

Modes and Determinism

Fail Conditions

Fails if there is no violated constraint in the set

Examples

    ?- [X, Y] tent_set [3, 4], CS :~ (X $= Y), CS :~ (X $\= Y), cs_random_worst(CS, C).
    X = X{3 -> 0}
    Y = Y{4 -> 0}
    CS = constraint_set(TotalVio{1 -> 0}, ...)
    C = X{3 -> 0} $= Y{4 -> 0}
    There are 2 delayed goals.
    Yes (0.00s cpu)
    

See Also

cs_random_violated / 2, cs_all_worst / 2