GeezerVison is showing jbytecode.github.io — Location Selection · OperationsResearchModels.jl
OperationsResearchModels.PMedian.PMedianProblemWithDistances — Type
OperationsResearchModels.PMedian.PMedianProblemWithCoordinates — Type
OperationsResearchModels.PMedian.PMedianResult — Type
OperationsResearchModels.solve — Method
solve(p::PMedianProblemWithDistances)
Description
The function selects ncenters locations that minimize the total distances to the nearest rows based on the provided distance matrix.
Arguments
p::PMedianProblemWithDistances: PMedian problem with distances.
Output
PMedianResult: PMedianResult object.
See also solve(::PMedianProblemWithCoordinates)
sourceOperationsResearchModels.solve — Method
solve(p::PMedianProblemWithCoordinates)
Description
The function calculates Euclidean distances between all possible rows of the matrix data. ncenters locations are then selected that minimizes the total distances to the nearest rows.
Arguments
p::PMedianProblemWithCoordinates: PMedian problem with coordinates.
Output
PMedianResult: PMedianResult object.
Example
data1 = rand(10, 2)
data2 = rand(10, 2) .+ 50
data3 = rand(10, 2) .+ 100
data = vcat(data1, data2, data3)
problem = PMedianProblemWithCoordinates(data, 3)
result = solve(problem)
println(result.centers)
# 3-element Vector{Int64}:
# 1
# 16
# 21
println(result.objective)
# 11.531012240599605
source