@@ -11,16 +11,13 @@ Forces the maximum_weight_maximal_matching function to use a linear programming
1111struct LPAlgorithm <: AbstractMaximumWeightMaximalMatchingAlgorithm end
1212
1313function maximum_weight_maximal_matching (
14- g:: Graph ,
15- w:: AbstractMatrix{T} ,
16- algorithm:: LPAlgorithm ,
17- solver = nothing
14+ g:: Graph ,
15+ w:: AbstractMatrix{T} ,
16+ algorithm:: LPAlgorithm ,
17+ optimizer = nothing
1818) where {T<: Real }
19- if ! isa (solver, JuMP. OptimizerFactory)
20- error (" The keyword argument solver must be an JuMP.OptimizerFactory, as accepted by JuMP." )
21- end
2219
23- return maximum_weight_maximal_matching_lp (g, solver , w)
20+ return maximum_weight_maximal_matching_lp (g, optimizer , w)
2421end
2522
2623"""
@@ -30,10 +27,10 @@ Forces the maximum_weight_maximal_matching function to use the Hungarian algorit
3027struct HungarianAlgorithm <: AbstractMaximumWeightMaximalMatchingAlgorithm end
3128
3229function maximum_weight_maximal_matching (
33- g:: Graph ,
34- w:: AbstractMatrix{T} ,
35- algorithm:: HungarianAlgorithm ,
36- solver = nothing
30+ g:: Graph ,
31+ w:: AbstractMatrix{T} ,
32+ algorithm:: HungarianAlgorithm ,
33+ optimizer = nothing
3734) where {T<: Real }
3835 return maximum_weight_maximal_matching_hungarian (g, w)
3936end
@@ -50,34 +47,34 @@ Edges in `g` not present in `w` will not be considered for the matching.
5047A `cutoff` keyword argument can be given, to reduce computational times
5148excluding edges with weights lower than the cutoff.
5249
53- Finally, a specific algorithm can be chosen (`algorithm` keyword argument);
54- each algorithm has specific dependencies. For instance:
50+ Finally, a specific algorithm can be chosen (`algorithm` keyword argument);
51+ each algorithm has specific dependencies. For instance:
5552
56- - If `algorithm=HungarianAlgorithm()` (the default), the package Hungarian.jl is used.
57- This algorithm is always polynomial in time, with complexity O(n³).
58- - If `algorithm=LPAlgorithm()`, the package JuMP.jl and one of its supported solvers is required.
53+ - If `algorithm=HungarianAlgorithm()` (the default), the package Hungarian.jl is used.
54+ This algorithm is always polynomial in time, with complexity O(n³).
55+ - If `algorithm=LPAlgorithm()`, the package JuMP.jl and one of its supported solvers is required.
5956 In this case, the algorithm relies on a linear relaxation on of the matching problem, which is
60- guaranteed to have integer solution on bipartite graphs. A solver must be provided with
61- the `solver ` keyword parameter.
57+ guaranteed to have integer solution on bipartite graphs. A solver must be provided with
58+ the `optimizer ` keyword parameter.
6259
6360The returned object is of type `MatchingResult`.
6461"""
6562function maximum_weight_maximal_matching (
66- g:: Graph ,
67- w:: AbstractMatrix{T} ;
63+ g:: Graph ,
64+ w:: AbstractMatrix{T} ;
6865 cutoff = nothing ,
69- algorithm:: AbstractMaximumWeightMaximalMatchingAlgorithm = HungarianAlgorithm (),
70- solver = nothing
66+ algorithm:: AbstractMaximumWeightMaximalMatchingAlgorithm = HungarianAlgorithm (),
67+ optimizer = nothing
7168 ) where {T<: Real }
7269
7370 if cutoff != nothing && ! isa (cutoff, Real)
7471 error (" The cutoff value must be of type Real or nothing." )
7572 end
7673
7774 if cutoff != nothing
78- return maximum_weight_maximal_matching (g, cutoff_weights (w, cutoff), algorithm, solver )
75+ return maximum_weight_maximal_matching (g, cutoff_weights (w, cutoff), algorithm, optimizer )
7976 else
80- return maximum_weight_maximal_matching (g, w, algorithm, solver )
77+ return maximum_weight_maximal_matching (g, w, algorithm, optimizer )
8178 end
8279end
8380
@@ -96,4 +93,4 @@ function cutoff_weights(w::AbstractMatrix{T}, cutoff::R) where {T<:Real, R<:Real
9693 wnew
9794end
9895
99- @deprecate maximum_weight_maximal_matching (g:: Graph , solver :: JuMP.OptimizerFactory , w:: AbstractMatrix{T} , cutoff:: R ) where {T<: Real , R<: Real } maximum_weight_maximal_matching (g, w, algorithm= LPAlgorithm (), cutoff= cutoff, solver = solver )
96+ @deprecate maximum_weight_maximal_matching (g:: Graph , optimizer , w:: AbstractMatrix{T} , cutoff:: R ) where {T<: Real , R<: Real } maximum_weight_maximal_matching (g, w, algorithm= LPAlgorithm (), cutoff= cutoff, optimizer = optimizer )
0 commit comments