[ library(gfd) | Reference Manual | Alphabetic Index ]

min_first_index(+Collection,?Index)

Index is constrained to the index of the first variable with the minimum value in Collection
Collection
A collection (a la collection_to_list/2) of integers or d(omain) variables
Index
(Domain) variable or integer (array notation accepted)

Description

Index is constrained to the index of the first (smallest index) variable(s) with the minimum value in Collection. If Index is a variable, it must not occur in Collection..

You may find it more convenient to embed min_first_index(Vars) in a constraint expression.

As with all constraints that involve indexes, the index starts from 1, unlike Gecode's native indexes that starts from 0 - a dummy first element is added to Collection in the constraint posted to Gecode if Collection is not empty.

This constraint is a variation of min_index in the global constraint catalog, and is implemented using Gecode's minarg() constraint with tie-break set to true..

See Also

min_index / 2, max_first_index / 2, max_index / 2, min / 2, max / 2, eclipse_6 : collection_to_list / 2, lists : collection_to_list / 2