4.2.7.1. Annotations provided to guide the MiniZinc diversity extension.

In this section: diverse_pairwise, diversity_aggregator, diversity_combinator, diversity_incremental.

Functions and Predicates

diverse_pairwise

1.  annotation diverse_pairwise(array [int] of var int: x,
                                string: distance_metric)

2.  annotation diverse_pairwise(array [$T] of var int: x,
                                string: distance_metric)

3.  annotation diverse_pairwise(array [int] of var int: x,
                                string: distance_metric,
                                int: min_dist,
                                int: max_dist,
                                int: weight)

4.  annotation diverse_pairwise(array [$T] of var int: x,
                                string: distance_metric,
                                int: min_dist,
                                int: max_dist,
                                int: weight)

5.  annotation diverse_pairwise(array [int] of var float: x,
                                string: distance_metric)

6.  annotation diverse_pairwise(array [$T] of var float: x,
                                string: distance_metric)

7.  annotation diverse_pairwise(array [int] of var float: x,
                                string: distance_metric,
                                float: min_dist,
                                float: max_dist,
                                float: weight)

8.  annotation diverse_pairwise(array [$T] of var float: x,
                                string: distance_metric,
                                float: min_dist,
                                float: max_dist,
                                float: weight)
1, 2.

Use distance_metric on x when computing distance to solutions. Here same index on different solutions are compared. For example, when obtaining the distance to k-th diverse solution using the incremental approach (diversity_incremental) each index of x in k-th solution is compared to the corresponding index of all previously obtained diverse solutions.

3, 4.

Use distance_metric on x to compute the distance to solutions, and apply constraints using min_dist to enforce a minimum distance and max_dist to enforce a maximum distance. The weight parameter can be used to set relative priorities between multiple distance measures. Distance measures with higher weights are given greater priority. For example, when obtaining the distance to k-th diverse solution using the incremental approach (diversity_incremental) each index of x in k-th solution is compared to the corresponding index of all previously obtained diverse solutions.

5, 6.

Use distance_metric on x when computing distance to solutions. Here same index on different solutions are compared. For example, when obtaining the distance to k-th diverse solution using the incremental approach (diversity_incremental) each index of x in k-th solution is compared to the corresponding index of all previously obtained diverse solutions.

7, 8.

Use distance_metric on x to compute the distance to solutions, and apply constraints using min_dist to enforce a minimum distance and max_dist to enforce a maximum distance. The weight parameter can be used to set relative priorities between multiple distance measures. Distance measures with higher weights are given greater priority. For example, when obtaining the distance to k-th diverse solution using the incremental approach (diversity_incremental) each index of x in k-th solution is compared to the corresponding index of all previously obtained diverse solutions.

Annotations

diversity_aggregator

annotation diversity_aggregator(string)

An aggregator combines pairwise diversity measures from each pair of solutions into an overall diversity score to identify the k most diverse solutions, using an incremental approach (i.e., diversity_incremental). Currently, it supports three methods: sum, which sums up the pairwise diversity measures; min, which selects the minimum; and max, which selects the maximum.

diversity_combinator

annotation diversity_combinator(string)

Use to combine distance functions to diversity of a diverse solution. Currently, it supports three methods: sum, which sums up the distance measures; min, which selects the minimum; and max, which selects the maximum.

diversity_incremental

annotation diversity_incremental(int: k, float: gap)

Produce at most k number of diverse solutions with thier objective values bounded between optimal value and gap % from the optimal. Diverse solutions are obtained one after the other and distance to k-th diverse solution is sum of pairwise distance to all the previous diverse solutions