Skip to content

Commit

Permalink
update test and export compatible MCDM methods from JMcDM
Browse files Browse the repository at this point in the history
  • Loading branch information
jmejia8 committed Nov 13, 2022
1 parent 796942d commit 1b0182a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
4 changes: 0 additions & 4 deletions docs/src/mcdm.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ more details about the methods.
Performing MCDM using a population.

```julia-repl
julia> using JMcDM
julia> _, _, population = Metaheuristics.TestProblems.ZDT1();
julia> dm = mcdm(population, [0.5, 0.5], TopsisMethod());
Expand All @@ -103,8 +101,6 @@ julia> population[dm.bestIndex]
Performing MCDM using results from metaheuristic.

```julia-repl
julia> using JMcDM
julia> f, bounds, _ = Metaheuristics.TestProblems.ZDT1();
julia> res = optimize(f, bounds, NSGA2());
Expand Down
2 changes: 1 addition & 1 deletion src/DecisionMaking/DecisionMaking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include("ROI.jl")
include("CompromiseProgramming.jl")

export decisionmaking, dm, best_alternative, ROIArchiving, CompromiseProgramming
export WeightedSum, Tchebysheff, AchievementScalarization
export WeightedSum, Tchebysheff, AchievementScalarization, summary

"""
decisionmaking(fs, w, method)
Expand Down
7 changes: 7 additions & 0 deletions src/DecisionMaking/JMcDM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ export summary
export best_alternative


export ArasMethod, CocosoMethod, CodasMethod, CoprasMethod
export EdasMethod, ElectreMethod, GreyMethod, MabacMethod, MaircaMethod
export MooraMethod, SawMethod, TopsisMethod, VikorMethod, WPMMethod
export WaspasMethod, MarcosMethod
export DataFrame


"""
mcdm(fs, w, method)
Expand Down
16 changes: 3 additions & 13 deletions test/decisionmaking.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
import Metaheuristics.JMcDM
import Metaheuristics.JMcDM: ArasMethod, CocosoMethod, CodasMethod, CoprasMethod
import Metaheuristics.JMcDM: EdasMethod, ElectreMethod, GreyMethod, MabacMethod, MaircaMethod
import Metaheuristics.JMcDM: MooraMethod, SawMethod, TopsisMethod, VikorMethod, WPMMethod
import Metaheuristics.JMcDM: WaspasMethod, MarcosMethod
import Metaheuristics.JMcDM: DataFrame


@testset "DecisionMaking: Compromise Programming" begin
function test_cp()
_, _, pf = Metaheuristics.TestProblems.ZDT1();
Expand Down Expand Up @@ -52,8 +44,6 @@ end

w = [0.5, 0.5]

# PrometheeMethod
# PSIMethod, MoosraMethod --err
methods = [
ArasMethod, CocosoMethod, CodasMethod, CoprasMethod,
EdasMethod, ElectreMethod, GreyMethod, MabacMethod, MaircaMethod,
Expand All @@ -62,8 +52,8 @@ end
]

for method in methods
res_dm = JMcDM.mcdm(res, w, method())
res_dm2 = JMcDM.mcdm(MCDMSetting(res, w), method())
res_dm = mcdm(res, w, method())
res_dm2 = mcdm(MCDMSetting(res, w), method())
@test res_dm.bestIndex == res_dm2.bestIndex

# bestIndex can be touple and needs to be handled...
Expand All @@ -74,7 +64,7 @@ end
@test Metaheuristics.compare(fval(best_sol), fval(ref_sol)) == 0
end

@test JMcDM.summary(res, w, [:topsis, :electre, :vikor]) isa DataFrame
@test Metaheuristics.summary(res, w, [:topsis, :electre, :vikor]) isa DataFrame

# check default method TopsisMethod
@test mcdm(MCDMSetting(res, w)).bestIndex == mcdm(res, w, TopsisMethod()).bestIndex
Expand Down

0 comments on commit 1b0182a

Please sign in to comment.