Skip to content

Improve the performance of Lexicographic - #216

Merged
odow merged 2 commits into
masterfrom
od/improve-lexico
Nov 2, 2026
Merged

odow merged 2 commits into
masterfrom
od/improve-lexico

Conversation

@odow

@odow odow commented Nov 1, 2026

Copy link
Copy Markdown
Member

Closes #215

Before

julia> main()
(0.24277496337890625, [149.60380626534553, 1405.7635667281365, 4120.654033578588])

julia> main()
(0.23576903343200684, [149.60380626534553, 1405.7635667281365, 4120.654033578588])

After

julia> main()
(0.14772701263427734, [149.60380626534553, 1405.7635667281368, 4120.65403357753])

julia> main()
(0.15110421180725098, [149.60380626534553, 1405.7635667281368, 4120.65403357753])

Code:

using JuMP, HiGHS, Random, SparseArrays
import MultiObjectiveAlgorithms as MOA

function main(seed = 1)
    Random.seed!(seed)
    NVARS, NCONS = 3000, 1500
    A = sprand(NCONS, NVARS, 0.004) .* 1.0
    X0 = rand(NVARS) .* 5
    BASE = A * X0 .+ 1.0
    PHASE = rand(NCONS) .* 2π
    COSTS = [
        sparsevec(randperm(NVARS)[1:30], rand(30), NVARS),
        sparsevec(randperm(NVARS)[1:300], rand(300), NVARS),
        sparsevec(1:NVARS, randn(NVARS), NVARS),
    ]
    model = Model(() -> MOA.Optimizer(HiGHS.Optimizer))
    set_silent(model)
    @variable(model, 0 <= x[1:NVARS] <= 10)
    @constraint(model, rows, A * x .<= BASE)
    set_attribute(model, MOA.Algorithm(), MOA.Lexicographic())
    set_attribute(model, MOA.LexicographicAllPermutations(), false)
    set_attribute(model, MOA.ComputeIdealPoint(), false)
    @objective(model, Max, [c' * x for c in COSTS])
    optimize!(model)
    assert_is_solved_and_feasible(model)
    return solve_time(model), objective_value(model)
end

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.65%. Comparing base (7bf6e6e) to head (ed6e576).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #216      +/-   ##
==========================================
- Coverage   99.65%   99.65%   -0.01%     
==========================================
  Files          15       15              
  Lines        1432     1430       -2     
==========================================
- Hits         1427     1425       -2     
  Misses          5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@odow
odow merged commit 71ceb06 into master Nov 2, 2026
6 checks passed
@odow
odow deleted the od/improve-lexico branch November 2, 2026 00:49
@oxinabox

oxinabox commented Nov 2, 2026

Copy link
Copy Markdown

Damn that was fast. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

during Lexigraphic adding and removing constraints each time is ~2x slow than adding all at start and making binding/nonbinding

2 participants