V
- the graph vertex typeE
- the graph edge typepublic class KolmogorovWeightedMatching<V,E> extends Object implements MatchingAlgorithm<V,E>
KolmogorovWeightedPerfectMatching
.
This class reduces both maximum and minimum weight matching problems to the maximum and minimum
weight perfect matching problems correspondingly. See KolmogorovWeightedPerfectMatching
for relative definitions and algorithm description
KolmogorovWeightedPerfectMatching
MatchingAlgorithm.Matching<V,E>, MatchingAlgorithm.MatchingImpl<V,E>
DEFAULT_EPSILON
Constructor and Description |
---|
KolmogorovWeightedMatching(Graph<V,E> initialGraph)
Constructs a new instance of the algorithm using the default options.
|
KolmogorovWeightedMatching(Graph<V,E> initialGraph,
BlossomVOptions options)
Constructs a new instance of the algorithm with the specified
options . |
KolmogorovWeightedMatching(Graph<V,E> initialGraph,
BlossomVOptions options,
ObjectiveSense objectiveSense)
Constructs a new instance of the algorithm with the specified
options . |
KolmogorovWeightedMatching(Graph<V,E> initialGraph,
ObjectiveSense objectiveSense)
Constructs a new instance of the algorithm using the default options.
|
Modifier and Type | Method and Description |
---|---|
double |
getError()
Computes the error in the solution to the dual linear program.
|
MatchingAlgorithm.Matching<V,E> |
getMatching()
Computes and returns a matching of maximum or minimum weight in the
initialGraph
depending on the goal of the algorithm. |
boolean |
testOptimality()
Performs an optimality test after the perfect matching is computed.
|
public KolmogorovWeightedMatching(Graph<V,E> initialGraph)
initialGraph
- the graph for which to find a weighted matchingpublic KolmogorovWeightedMatching(Graph<V,E> initialGraph, ObjectiveSense objectiveSense)
maximize
parameter.initialGraph
- the graph for which to find a weighted matchingobjectiveSense
- objective sense of the algorithmpublic KolmogorovWeightedMatching(Graph<V,E> initialGraph, BlossomVOptions options)
options
. The goal of
the constructed algorithm is to minimize the weight of the resulting matching.initialGraph
- the graph for which to find a weighted matchingoptions
- the options which define the strategies for the initialization and dual
updatespublic KolmogorovWeightedMatching(Graph<V,E> initialGraph, BlossomVOptions options, ObjectiveSense objectiveSense)
options
. The goal of
the constructed algorithm is to maximize or minimize the weight of the resulting matching
depending on the maximize
parameter.initialGraph
- the graph for which to find a weighted matchingoptions
- the options which define the strategies for the initialization and dual
updatesobjectiveSense
- objective sense of the algorithmpublic MatchingAlgorithm.Matching<V,E> getMatching()
initialGraph
depending on the goal of the algorithm.getMatching
in interface MatchingAlgorithm<V,E>
initialGraph
public boolean testOptimality()
KolmogorovWeightedPerfectMatching.testOptimality()
More precisely, checks whether dual variables of all pseudonodes and resulting slacks of all
edges are non-negative and that slacks of all matched edges are exactly 0. Since the
algorithm uses floating point arithmetic, this check is done with precision of
KolmogorovWeightedPerfectMatching.EPS
In general, this method should always return true unless the algorithm implementation has a bug.
public double getError()
KolmogorovWeightedPerfectMatching.getError()
. More precisely, the total error equals
the sum of:
Copyright © 2019. All rights reserved.