From fb009401815fecb8a589db3524f4175ccb42723e Mon Sep 17 00:00:00 2001 From: jbytecode Date: Fri, 8 Nov 2024 13:14:15 +0300 Subject: [PATCH] (#63) use NLconstraint for the constraints with abs --- CHANGELOG.md | 1 + src/bestworst.jl | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc918d7..068b16a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### 0.7.21 (Upcoming release) - Update documentation +- Initial implementation of the Best-Worst method. ### 0.7.20 diff --git a/src/bestworst.jl b/src/bestworst.jl index 3c1a46c..d5dfb4d 100644 --- a/src/bestworst.jl +++ b/src/bestworst.jl @@ -88,11 +88,11 @@ function bestworst(pref_to_best::Vector{Int}, pref_to_worst::Vector{Int})::BestW worstindices = indices[indices.!=worst_index] for i in bestindices - @constraint(model, abs(w[best_index] / w[i] - pref_to_best[i]) <= ε) + @NLconstraint(model, abs(w[best_index] / w[i] - pref_to_best[i]) <= ε) end for i in worstindices - @constraint(model, abs(w[i] / w[worst_index] - pref_to_worst[i]) <= ε) + @NLconstraint(model, abs(w[i] / w[worst_index] - pref_to_worst[i]) <= ε) end @constraint(model, sum(w) == 1)