Skip to content

Add MOA.AllowInnerInterrupt to support interrupting an inner solve#188

Merged
odow merged 3 commits intomasterfrom
interrupt-inner
Mar 16, 2026
Merged

Add MOA.AllowInnerInterrupt to support interrupting an inner solve#188
odow merged 3 commits intomasterfrom
interrupt-inner

Conversation

@odow
Copy link
Member

@odow odow commented Mar 16, 2026

Closes #187

With this PR:

julia> using Revise

julia> using JuMP, HiGHS

julia> import MultiObjectiveAlgorithms as MOA

julia> begin
           model = Model(() -> MOA.Optimizer(HiGHS.Optimizer))
           N = 10_000
           set_attribute(model, MOA.SilentInner(), false)
           set_attribute(model, MOA.ComputeIdealPoint(), false)
           set_attribute(model, MOA.AllowInnerInterrupt(), true)
           w, C = rand(N), rand(3, N)
           @variable(model, 0 <= x[1:N] <= 3, Int)
           @constraint(model, w' * x <= 0.1 * N)
           @objective(model, Max, C * x)
           optimize!(model)
       end
-----------------------------------------------------------
        MultiObjectiveAlgorithms.jl
-----------------------------------------------------------
Algorithm: Nothing
-----------------------------------------------------------
solve #     Obj. 1       Obj. 2       Obj. 3       Time    
-----------------------------------------------------------
Running HiGHS 1.13.1 (git hash: 1d267d97c): Copyright (c) 2026 under Apache 2.0 license terms
Using BLAS: blastrampoline 
MIP has 1 row; 10000 cols; 10000 nonzeros; 10000 integer variables (0 binary)
Coefficient ranges:
  Matrix  [2e-05, 1e+00]
  Cost    [3e-05, 1e+00]
  Bound   [3e+00, 3e+00]
  RHS     [1e+03, 1e+03]
WARNING: Problem has some excessively small costs
Presolving model
1 rows, 10000 cols, 10000 nonzeros  0s
1 rows, 10000 cols, 10000 nonzeros  0s
Presolve reductions: rows 1(-0); columns 10000(-0); nonzeros 10000(-0) - Not reduced

Solving MIP model with:
   1 row
   10000 cols (0 binary, 10000 integer, 0 implied int., 0 continuous, 0 domain fixed)
   10000 nonzeros

Src: B => Branching; C => Central rounding; F => Feasibility pump; H => Heuristic;
     I => Shifting; J => Feasibility jump; L => Sub-MIP; P => Empty MIP; R => Randomized rounding;
     S => Solve LP; T => Evaluate node; U => Unbounded; X => User solution; Y => HiGHS solution;
     Z => ZI Round; l => Trivial lower; p => Trivial point; u => Trivial upper; z => Trivial zero

        Nodes      |    B&B Tree     |            Objective Bounds              |  Dynamic Constraints |       Work      
Src  Proc. InQueue |  Leaves   Expl. | BestBound       BestSol              Gap |   Cuts   InLp Confl. | LpIters     Time

 z       0       0         0   0.00%   inf             -0                 Large        0      0      0         0     0.8s
 J       0       0         0   0.00%   inf             2.987582924        Large        0      0      0         0     0.8s
 S       0       0         0   0.00%   15110.711809    4421.126918      241.78%        0      0      0         0     0.8s
         1       0         1 100.00%   4421.480061     4421.126918        0.01%        0      0      0         0     0.8s

Solving report
  Status            Optimal
  Primal bound      4421.126918
  Dual bound        4421.48006064
  Gap               0.00799% (tolerance: 0.01%)
  P-D integral      28.0956224817
  Solution status   feasible
                    4421.126918 (objective)
                    0 (bound viol.)
                    0 (int. viol.)
                    0 (row viol.)
  Timing            0.80
  Max sub-MIP depth 0
  Nodes             1
  Repair LPs        0
  LP iterations     0
    1    4.42113e+03  3.22219e+03  3.40196e+03  8.90220e-01
MIP has 2 rows; 10000 cols; 20000 nonzeros; 10000 integer variables (0 binary)
Coefficient ranges:
  Matrix  [2e-05, 1e+00]
  Cost    [2e-05, 1e+00]
  Bound   [3e+00, 3e+00]
  RHS     [1e+03, 4e+03]
WARNING: Problem has some excessively small costs
Presolving model
2 rows, 10000 cols, 20000 nonzeros  0s
2 rows, 10000 cols, 20000 nonzeros  0s
Presolve reductions: rows 2(-0); columns 10000(-0); nonzeros 20000(-0) - Not reduced

Solving MIP model with:
   2 rows
   10000 cols (0 binary, 10000 integer, 0 implied int., 0 continuous, 0 domain fixed)
   20000 nonzeros

Src: B => Branching; C => Central rounding; F => Feasibility pump; H => Heuristic;
     I => Shifting; J => Feasibility jump; L => Sub-MIP; P => Empty MIP; R => Randomized rounding;
     S => Solve LP; T => Evaluate node; U => Unbounded; X => User solution; Y => HiGHS solution;
     Z => ZI Round; l => Trivial lower; p => Trivial point; u => Trivial upper; z => Trivial zero

        Nodes      |    B&B Tree     |            Objective Bounds              |  Dynamic Constraints |       Work      
Src  Proc. InQueue |  Leaves   Expl. | BestBound       BestSol              Gap |   Cuts   InLp Confl. | LpIters     Time

         0       0         0   0.00%   14879.292791    -inf                 inf        0      0      0         0     0.6s
         0       0         0   0.00%   3255.055537     -inf                 inf        0      0      0         9     0.6s
 C       0       0         0   0.00%   3255.055537     3233.412133        0.67%        0      0      9         9     0.6s
 L       0       0         0   0.00%   3255.055537     3233.699126        0.66%        0      0      9         9     0.9s

63.5% inactive integer columns, restarting
^C         0       0         0   0.00%   3255.055537     3233.699126        0.66%        0      0      0       292     1.3s

Solving report
  Status            Interrupted by user
  Primal bound      3233.69912594
  Dual bound        3255.0555372
  Gap               0.66% (tolerance: 0.01%)
  P-D integral      0.00452400191569
  Solution status   feasible
                    3233.69912594 (objective)
                    0 (bound viol.)
                    0 (int. viol.)
                    0 (row viol.)
  Timing            1.32
  Max sub-MIP depth 6
  Nodes             0
  Repair LPs        0
  LP iterations     292
                    0 (strong br.)
                    0 (separation)
                    283 (heuristics)
    2    4.42121e+03  3.23370e+03  3.40720e+03  2.22012e+00
-----------------------------------------------------------
termination_status: INTERRUPTED
result_count: 1

Total solve time:          2.22026e+00
Time spent in subproblems: 2.20962e+00 (100%)
Number of subproblems:     2
-----------------------------------------------------------

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.76%. Comparing base (1a25bab) to head (9df6525).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #188   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files          12       12           
  Lines        1290     1301   +11     
=======================================
+ Hits         1287     1298   +11     
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 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.

@sandyspiers
Copy link
Contributor

Looks great, works exactly as expected. Thanks very much!!

@odow odow merged commit 19fb9e0 into master Mar 16, 2026
7 checks passed
@odow odow deleted the interrupt-inner branch March 16, 2026 06:43
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.

2 participants