Given a set of n elements and a distance value for every pair of elements, the MaxMin Diversity
Problem consists of selecting a subset of m elements (m < n) such that the smallest pairwise
distance among the selected elements is as large as possible.
- Solution structure: an unordered subset of exactly
melements out of thenavailable in the instance. - Constraints: the subset must contain exactly
melements; bothnandmare fixed by the instance being solved. - Objective function: the minimum pairwise distance among every pair of elements in the selected subset.
- Optimization sense: maximization of a minimum (a maximin objective) — solutions are compared by how large their worst (smallest) pairwise distance is.
This differs from the closely related Maximum Diversity Problem (MDP), whose objective is the sum of the pairwise distances instead of their minimum.
The problem is solved with a multi-start local search:
- Construction: a random selection of
melements out of thenavailable. - Improvement (local search): the neighborhood swaps a selected element for one that is not
currently selected. Two exploration strategies are compared:
- First improvement, trying candidates either in random or in lexicographical order and applying the first swap that improves the solution.
- Best improvement, evaluating every possible swap and applying the one that improves the solution the most.
- Multi-start: construction (optionally followed by improvement) is repeated many times within a time budget, keeping the best solution found across all restarts.
Four configurations are compared experimentally: pure random construction, first improvement with random candidate order, first improvement with lexicographical candidate order, and best improvement.
classDiagram
direction LR
class Experiment
class ExperimentManager
class InstancesManager
class InstanceFile {
<<record>>
+String fileName
+String name
+String type
+loadInstance() Instance
}
class Instance
class Node
class Solution
class MultiStartSearch
class MSConfig {
<<enumeration>>
RANDOM
FIRST_IMPROVEMENT_RANDOM
FIRST_IMPROVEMENT_LEXICOGRAPHICAL
BEST_IMPROVEMENT
}
class Constructive {
<<abstract>>
}
class RandomConstructive
class ImprovementMethod {
<<abstract>>
}
class FirstImprovement
class BestImprovement
Constructive <|-- RandomConstructive
ImprovementMethod <|-- FirstImprovement
ImprovementMethod <|-- BestImprovement
MultiStartSearch --> MSConfig : configured by
MultiStartSearch ..> Constructive : builds with
MultiStartSearch ..> ImprovementMethod : improves with
MultiStartSearch ..> Solution : returns
Experiment ..> InstancesManager : reads instances
Experiment ..> MultiStartSearch : runs configs
Experiment ..> ExperimentManager : records solutions
InstancesManager "1" o-- "*" InstanceFile : registers
InstanceFile ..> Instance : loadInstance()
Instance "1" o-- "*" Node
Solution --> Instance
Solution "1" o-- "*" Node : selected
ExperimentManager ..> Solution : saves + reports
-
mmdp.instance— problem data:Instance: in-memory instance (distance matrix, nodes,m).Node: an element of the instance; asks its owningInstancefor the distance to another node.InstanceFile: a lightweight record (file name, display name and type) that lazily loads anInstancefrom a classpath resource.InstancesManager: holds the registered list of availableInstanceFiles (each tagged with itstype, i.e. its instance set) and lets callers query them all, by type, by position, or by file name.FormatException: signals a malformed instance file.
-
mmdp.algorithm— the search itself:Solution: keeps the list of selected nodes, evaluates the minimum pairwise distance, and implements the node-swap operation used by the local search.MultiStartSearch: drives the multi-start loop under a time limit. ItsMSConfigenum selects one of the four configurations by wiring together aConstructiveand an optionalImprovementMethod.constructive/:Constructive(strategy interface) plusRandomConstructive.improvement/:ImprovementMethod(strategy interface) plusFirstImprovement(with aCandidatesOrderenum for random/lexicographical order) andBestImprovement.
-
mmdp.Experiment/mmdp.ExperimentManager—Experimentis the entry point: it runs the four configurations over every instance and hands each resultingSolutionto theExperimentManager. When the experiment finishes, the manager prints a comparison table to the console (mean deviation from the best solution found — shown as a percentage — and the number of instances where each configuration achieved that best result) and saves every run underexperiments/<datetime>/: the solution obtained for each instance and algorithm (<instance>/<algorithm>.txt) plus an HTML report (report.html) with the results and analysis tables.
Benchmark instances (the GKD-Ia and GKD-Ic sets) live under
src/main/resources/instances and are loaded through
InstanceFile/InstancesManager.