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

# min_first_index_g(+Collection,?Index)

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

## Description

This version of min_first_index/2 uses the native Gecode indexing, which starts from 0, i.e. the first element of Collection has index 0. This is different from normal ECLiPSe's indexing, which starts from 1.

This predicate maps directly to Gecode's native implementation of the constraint, and may therefore be more efficient, but could also be incompatible with existing ECLiPSe code.

This constraint can be embedded in a constraint expression in its functional form (without the last argument).

See min_first_index/2 for a more detailed description of this predicate.

## Examples

```[eclipse 11]: min_first_index([1,2,3], I).

I = 1

[eclipse 12]: min_first_index([1,2,3,1,10,9,10], I).

I = 1

[eclipse 13]: L = [A,B,C,D,E], L :: 1..10, min_first_index(L, 3), C #> 4.

L = [A{[6 .. 10]}, B{[6 .. 10]}, C{[5 .. 9]}, D{[5 .. 10]}, E{[5 .. 10]}]
A = A{[6 .. 10]}
B = B{[6 .. 10]}
C = C{[5 .. 9]}
D = D{[5 .. 10]}
E = E{[5 .. 10]}
[eclipse 14]: L = [A,B,C,D,E], L :: 1..10, min_first_index(L, 3), B #> 4.

L = [A{[2 .. 10]}, B{[5 .. 10]}, C{[1 .. 9]}, D{[1 .. 10]}, E{[1 .. 10]}]
A = A{[2 .. 10]}
B = B{[5 .. 10]}
C = C{[1 .. 9]}
D = D{[1 .. 10]}
E = E{[1 .. 10]}

[eclipse 15]: L = [A,B,C,D,E], L :: 1..10, min_first_index(L, 3), B #< 4.

L = [A{[2 .. 10]}, B{[2, 3]}, C{[1, 2]}, D{[1 .. 10]}, E{[1 .. 10]}]
A = A{[2 .. 10]}
B = B{[2, 3]}
C = C{[1, 2]}
D = D{[1 .. 10]}
E = E{[1 .. 10]}

[eclipse 16]: [A,B,D] :: 1..10, C :: 20..30, min_first_index([A,B,C,D], I).

A = A{[1 .. 10]}
B = B{[1 .. 10]}
D = D{[1 .. 10]}
C = C{[20 .. 30]}
I = I{[1, 2, 4]}

```