Utility functions
MCDMSetting
JMcDM.MCDMSetting
— Typestruct MCDMSetting
df::Matrix
weights::Array{Float64, 1}
fns::Array{Function, 1}
end
Immutable data structure for a MCDM setting.
Arguments
df::Matrix
: The decision matrix in type of Matrix.weights::Array{Float64,1}
: Array of weights for each criterion.fns::Array{<:Function, 1}
: Array of functions. The elements are either minimum or maximum.
Description
Many methods including Topsis, Electre, Waspas, etc., use a decision matrix, weights, and directions of optimizations in types of Matrix and Vector, respectively. The type MCDMSetting simply holds these information to pass them into methods easly. Once a MCDMSetting object is created, the problem can be passed into several methods like topsis(setting), electre(setting), waspas(setting), etc.
# Examples
julia> df = DataFrame();
julia> df[:, :x] = Float64[9, 8, 7];
julia> df[:, :y] = Float64[7, 7, 8];
julia> df[:, :z] = Float64[6, 9, 6];
julia> df[:, :q] = Float64[7, 6, 6];
julia> w = Float64[4, 2, 6, 8];
julia> fns = [maximum, maximum, maximum, maximum];
julia> setting = MCDMSetting(Matrix(df), w, fns)
julia> result = topsis(setting);
julia> # Same result can be obtained using
julia> result2 = mcdm(setting, TopsisMethod())
mcdm
JMcDM.mcdm
— Function mcdm(df, w, fns, method)
Perform selected method for a given decision matrix, weight vector, and function list.
Arguments:
df::Matrix
: n × m matrix of decision matrix in type of Matrix.weights::Array{Float64, 1}
: m-vector of weights for criteria.fs::Array{Function, 1}
: m-vector of functions that are either maximize or minimize for each single criterion.method::MCDMMethod
: Preferred MCDMMethod.
Description
The method is one of the subtypes of MCDMMethod type. See examples.
Output
::MCDMResult
: An object derived from subtypes of MCDMResult type.
Examples
julia> subtypes(MCDMMethod)
23-element Vector{Any}:
ArasMethod
CocosoMethod
CodasMethod
CoprasMethod
CriticMethod
EdasMethod
ElectreMethod
GreyMethod
LMAWMethod
LOPCOWMethod
MabacMethod
MaircaMethod
MarcosMethod
MERECMethod
MooraMethod
MoosraMethod
OCRAMethod
PIVMethod
PrometheeMethod
PSIMethod
ROVMethod
SawMethod
TopsisMethod
VikorMethod
WaspasMethod
WPMMethod
julia> # mcdm() for Topsis:
julia> # mcdm(df, w, fns, TopsisMethod())
julia> # mcdm() for Saw:
julia> # mcdm(df, w, fns, SawMethod())
julia> # mcdm() with optional parameters:
julia> # mcdm(df, w, fns, GreyMethod(0.6))
mcdm(setting, method = TopsisMethod())
Perform selected method for a given decision matrix, weight vector, and function list.
Arguments:
setting::MCDMSetting
: MCDMSetting object that holds the decision matrix, weight vector, and functions.method::MCDMMethod
: Preferred MCDMMethod. The default is TopsisMethod().
Description
The method is one of the subtypes of MCDMMethod type. See examples.
Output
::MCDMResult
: An object derived from subtypes of MCDMResult type.
Examples
julia> # mcdm() for Topsis:
julia> # mcdm(setting, TopsisMethod())
julia> # mcdm() for Saw:
julia> # mcdm(setting, SawMethod())
julia> # mcdm() with optional parameters:
julia> # mcdm(setting, GreyMethod(0.6))
summary
JMcDM.summary
— Function summary(decisionMat, weights, fns, methods)
Apply more methods for a given decision problem. The methods accept standart number of arguments.
Arguments:
decisionMat::Matrix
: n × m matrix of objective values for n candidate (or strategy) and m criteriaweights::Array{Float64, 1}
: m-vector of weights that sum up to 1.0. If the sum of weights is not 1.0, it is automatically normalized.fns::Array{<:Function, 1}
: m-vector of function that are either minimize or maximize.methods::Array{Symbol, 1}
: Array of symbols. The elements can be :topsis, :electre, :cocoso, :copras, :moora, :vikor, :grey, :aras, :saw, :wpm, :waspas, :edas, :marcos, :mabac, :mairca, :copras, :critic
Description
This method outputs a summarized output using more than MCDM methods in a comparable way.
# Output
::Matrix
: A DataFrame object, methods in columns, and alternatives in rows. Green check symbol indicates the selected alternative as the best by the corresponding method.
Examples
julia> df = DataFrame(
:age => [6.0, 4, 12],
:size => [140.0, 90, 140],
:price => [150000.0, 100000, 75000],
:distance => [950.0, 1500, 550],
:population => [1500.0, 2000, 1100]);
julia> methods = [:topsis, :electre, :vikor, :moora, :cocoso, :wpm, :waspas]
julia> w = [0.036, 0.192, 0.326, 0.326, 0.12];
julia> fns = [maximum, minimum, maximum, maximum, maximum];
julia> result = summary(Matrix(df), w, fns, methods)
3×7 DataFrame
Row │ topsis electre cocoso moora vikor wpm waspas
│ String String String String String String String
─────┼─────────────────────────────────────────────────────────
1 │ ✅ ✅
2 │ ✅ ✅ ✅ ✅ ✅
3 │
summary(setting, methods)
Apply more methods for a given decision problem. The methods accept standart number of arguments.
Arguments:
setting::MCDMSetting
: MCDMSetting object.methods::Array{Symbol, 1}
: Array of symbols. The elements can be :topsis, :electre, :cocoso, :copras, :moora, :vikor, :grey, :aras, :saw, :wpm, :waspas, :edas, :marcos, :mabac, :mairca, :copras, :critic
Description
This method outputs a summarized output using more than MCDM methods in a comparable way.