Skip to content

Commit

Permalink
(#63) use NLconstraint for the constraints with abs
Browse files Browse the repository at this point in the history
  • Loading branch information
jbytecode committed Nov 8, 2024
1 parent 732526b commit fb00940
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 0.7.21 (Upcoming release)

- Update documentation
- Initial implementation of the Best-Worst method.

### 0.7.20

Expand Down
4 changes: 2 additions & 2 deletions src/bestworst.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fb00940

Please sign in to comment.