Selectors

The list of integer variable selectors and integer value selectors.

Syntax


intVarSelector selectSmallest(float minNumber, intVarEval eval)
intVarSelector selectSmallest(intVarEval eval, float tolerance = 0)
intVarSelector selectLargest(float minNumber, intVarEval eval)
intVarSelector selectLargest(intVarEval eval, float tolerance = 0)
intVarSelector selectRandomVar()
intValueSelector selectSmallest(float minNumber, intValueEval eval)
intValueSelector selectSmallest(intValueEval eval, float tolerance = 0)
intValueSelector selectLargest(float minNumber, intValueEval eval)
intValueSelector selectLargest(intValueEval eval, float tolerance = 0)
intValueSelector selectRandomValue()

Integer variable selectors

intVarSelector selectSmallest(float minNumber, intVarEval eval)

This selector selects at least minNumber integer variables having the smallest evaluation according to the evaluator eval. The parameter minNumber must be at least 1.

For example, suppose that eight variables (A-H) have evaluations (A) 9, (B) 5, (C) 6, (D) 3, (E) 8, (F) 1, (G) 3, (H) 2. When ordered by increasing evaluation, this gives: (F) 1, (H) 2, (D) 3, (G) 3, (B) 5, (C) 6, (E) 8, (A) 9. If minNumber is 1, then variable F would be selected, if it is 2, then variables F and H would be selected, and if it is 3 or 4 then F, H, D and G would be selected. Note that when minNumber is 3, both D and G are selected as they are considered equivalent.

In addition, it is possible to specify a non-integer value of minNumber. In this case, at least floor(minNumber) selections are made, with probability minNumber - floor(minNumber) of selecting an additional variable.

It is still possible that this selector can select fewer variables than minNumber if there are less than minNumber variables supplied to it for selection, in which case all supplied variables are selected.

intVarSelector selectLargest(float minNumber, intVarEval eval)

This function selects at least minNumber integer variables having the largest evaluation according to the evaluator eval. The parameter minNumber must be at least 1.

For example, suppose that eight variables (A-H) have evaluations (A) 5, (B) 8, (C) 3, (D) 9, (E) 2, (F) 8, (G) 1, (H) 7. When ordered by decreasing evaluation, this gives: (D) 9, (B) 8, (F) 8, (H) 7, (A) 5, (C) 3, (E) 2, (G) 1. If minNumber is 1, then variable D would be selected, if it is 2 or 3, then variables D, B and F would be selected, and if it is 4 then D, B, F, and H would be selected. Note that when minNumber is 2, both B and F are selected as they are considered equivalent.

In addition, it is possible to specify a non-integer value of minNumber. In this case, at least floor(minNumber) selections are made, with probability minNumber - floor(minNumber) of selecting an additional variable.

It is still possible that this selector can select less variables than minNumber if there are less than minNumber variables supplied to it for selection, in which case all supplied variables are selected.

intVarSelector selectSmallest(intVarEval eval, float tolerance = 0)
This selector selects all integer variables whose evaluations are in the range min..min+tolerance, where min is the minimum valuation by eval over the variables to be evaluated. The parameter tolerance must be non-negative.
intVarSelector selectLargest(intVarEval eval, float tolerance = 0)
This selector selects all variables whose evaluations are in the range max-tolerance..max, where max is is the maximum valuation by eval over the variables to be evaluated. The parameter tolerance must be non-negative.
intVarSelector selectRandomVar()
This selector randomly selects a single variable from those available.

Integer value selectors

intValueSelector selectSmallest(float minNumber, intValueEval eval)

This selector selects at least minNumber domain values having the smallest evaluation according to the evaluator eval. The parameter minNumber must be at least 1.

For example, suppose that eight domain values (1-8) have evaluations (1) 9, (2) 5, (3) 6, (4) 3, (5) 8, (6) 1, (7) 3, (8) 2. When ordered by increasing evaluation, this gives: (6) 1, (8) 2, (4) 3, (7) 3, (2) 5, (3) 6, (5) 8, (1) 9. If minNumber is 1, then value 6 would be selected, if it is 2, then values 6 and 8 would be selected, and if it is 3 then values 6, 8, 4 and 7 would be selected. Note that when minNumber is 3, both values 4 and 7 are selected as they are considered equivalent.

In addition, it is possible to specify a non-integer value of minNumber. In this case, at least floor(minNumber) selections are made, with probability minNumber - floor(minNumber) of selecting an additional value.

It is still possible that this selector can select less values than minNumber if there are less than minNumber values supplied to it for selection, in which case all supplied values are selected.

intValueSelector selectSmallest(intValueEval eval, float tolerance = 0)
This selector selects all domain values whose evaluations are in the range min..min+tolerance, where min is is the minimum valuation by eval over the domain values to be evaluated. The parameter tolerance must be non-negative.
intValueSelector selectLargest(float minNumber, intValueEval eval)

This selector selects at least minNumber values having the largest evaluation according to the evaluator eval. The parameter minNumber must be at least 1.

For example, suppose that eight domain values (1-8) have evaluations (1) 5, (2) 8, (3) 3, (4) 9, (5) 2, (6) 8, (7) 1, (8) 7. When ordered by decreasing evaluation, this gives: (4) 9, (2) 8, (6) 8, (8) 7, (1) 5, (3) 3, (5) 2, (7) 1. If minNumber is 1, then value 4 would be selected, if it is 2 or 3, then values 4,2 and 6 would be selected, and if it is 4 then values 4, 2, 6, and 8 would be selected. Note that when minNumber is 2, both 2 and 6 are selected as they are considered equivalent.

In addition, it is possible to specify a non-integer value of minNumber. In this case, at least floor(minNumber) selections are made, with probability minNumber - floor(minNumber) of selecting an additional value.

It is still possible that this selector can select fewer domain values than minNumber if there are less than minNumber values supplied to it for selection, in which case all supplied values are selected.

intValueSelector selectLargest(intValueEval eval, float tolerance = 0)
This selector selects all domain values whose evaluations are in the range max-tolerance..max, where max is is the maximum valuation by eval over the domain values to be evaluated. The parameter tolerance must be non-negative.
intValueSelector selectRandomValue()
This selector randomly selects a single domain value.