Skip to content

[Bug] Stage 3 solve on the dag-viewer random-mixed workloads ~8x slower since #1355 (measured unit costs) #1533

Done

Description

@zzylol

Problem, by example

tools/dag-viewer/workloads/random-mixed-seed-862-long/workload-01.json, planned with the MVP deployment capabilities and --ignore-accuracy-guarantees:

asap_planner --workload tools/dag-viewer/workloads/random-mixed-seed-862-long/workload-01.json \
  --deployment-capabilities caps_mvp.json --ignore-accuracy-guarantees \
  --run-until stage3 --format json --out plan.json
commit --run-until stage2 --run-until stage3
facaec8b2 (#1350) 0.57 s 1.42 s
14308fd2c (#1355) 0.78 s 8.46 s

The workload is the same and Stages 0–2 take about the same time; Stage 3 went from about 0.9 s to about 7.7 s. On current main (b3351bc5b) the same workload spends 13.2 s in the planning stages, 12.4 s of it in the MILP solve.

Across the 34 dag-viewer workloads (viewer34: random-mixed-seed-862, -long, -x5 on MVP caps, plus planner-layering), the planning stages took 42.6 s in total on 2026-11-14 (9ad2c5422) and 304.6 s on b3351bc5b (2026-11-26), at similar candidate and MILP sizes. Each random-mixed workload went from 1.0–1.4 s to 13–14 s; the solve now takes 10–15 s and sometimes branches past the root node.

What should happen: a change to the unit costs should not make Stage 3's solve about 8× slower on an unchanged workload.

What was measured

Release builds of asap_planner at each commit, one workload at a time, on idle identical hosts. Wall time of the command above for four workloads (s):

commit long-01 long-03 long-09 seed-862 workload-07
9ad2c5422 (11-14 main) 1.28 1.41 1.73 1.51
facaec8b2 (#1350) 1.48 1.12 1.65 1.16
14308fd2c (#1355) 8.47 8.09 12.63 9.00
4cb4110c1 (#1363) 9.74 11.53 9.97 8.93
8e65fca45 (#1365) 9.64 11.49 9.88 9.11
79d99326e (#1368) 9.86 11.57 10.03 9.03
2f3664d1f (#1238) 9.62 11.42 9.89 8.78
ca4be93f0 (#1376) 9.66 11.44 9.87 9.08
1760a69f5 (#1239) 15.87 17.68 16.14 15.12
bc725bda8 (#1374) 15.91 17.79 16.22 15.50
b3351bc5b (#1487) 20.42 19.65 23.58 23.24

Suspected cause

#1355 replaced the built-in formulas' one CPU operation per row with the executor's measured time per unit (node::operations_per_unit). The per-unit costs now range from 1 to 35,000 operations: a row kept by a time range 12, a DDSketch fold 210, a KLL merge 7,000, a KLL readout 35,000. Costs change the MILP's objective, and may change which candidates survive cost-based pruning; the MILP's size at the two commits was not compared. The guess is that the wider spread of objective coefficients, and many alternatives whose costs are now close, make HiGHS's root LP and cuts much slower, and sometimes make it branch. This has not been confirmed with the MPS files of the two commits.

Proposal

  1. Dump the Stage 3 MPS and its row and column counts of random-mixed-seed-862-long/workload-01 at facaec8b2 and at 14308fd2c. Compare the presolve, the LP relaxation time, the root-node gap and the node counts under HiGHS with a fixed seed. This confirms or rules out the objective as the cause.
  2. If the objective is the cause, the options are open:

Scope and acceptance

Related

Activity

  1. added
    bug
    cost-model
    optimizer
    on Nov 27, 2026
  2. zzylol commented on Nov 27, 2026

    @zzylol
    ContributorAuthor

    Cause found: HiGHS treats the retention columns as integers, and its root reduced-cost fixing is quadratic in their range

    The cause is not the objective's coefficient spread. The selection MILP's $h_v$ (seconds retained) columns are continuous and unbounded, with whole-number row coefficients ($h_v \ge 60,y$, $300,y$, $3{,}600,y$, …). HiGHS's presolve marks them as implied integers. At every root LP resolve, HighsRedcostFixing::addRootRedcost then steps through up to 1,024 "lurking bounds" for each such column with a nonzero reduced cost. Each insert walks the whole map, so the work is quadratic in the steps. #1355 kept more executions, so more $h_v$ columns.

    random-mixed-seed-862-long/workload-01: the MILP at the two commits and on main

    HiGHS 1.15 on the MILP each commit builds. The planner's settings are gap 0 and one thread; the times are standalone solves of the dumped model on the same idle host.

    facaec8b2 14308fd2c (#1355) main daaa2a207
    columns / rows 10,348 / 15,149 8,463 / 14,604 7,570 / 13,822
    objective coefficient range [3e-4, 1e3] [5e-5, 1e3] [4e-4, 1e6] (#1427 scale)
    continuous columns with an objective term ($h_v$) 33 302 149
    after presolve: columns (implied integer) 293 (30) 1,263 (209) 590 (83)
    B&B nodes 1 1 1
    solve 0.90 s 7.45 s 12.1–15.8 s

    On main the root node takes 14.9 s for 2,115 LP iterations. The time goes into separation rounds that each run only a few hundred iterations: 0.8 s → 6.1 s for 313 iterations. perf puts 81 % of the solve in addRootRedcost, 55 % of it in std::_Rb_tree_increment.

    What was ruled out (same MPS, standalone, long-01 on main)

    HiGHS option or model edit solve
    as built 12.1 s
    user_objective_scale=-10 (largest coefficient 1e6 → about 1e3) 12.9 s
    user_objective_scale=-20 1.2 s, but the optimum moves (wrong)
    presolve=off 6.4 s (21 nodes)
    mip_heuristic_effort=0 11.9 s
    upper bound $h_v \le H_v$ only 11.9 s
    $h_v = H_v \cdot s_v$, $s_v \in [0, 1]$ 1.5 s, same optimum

    Rescaling the objective and bounding $h_v$ do not help. Only shrinking each column's domain to [0, 1] does. The same rewrite of the dumped models:

    commit long-01 long-03 seed-862 workload-07
    facaec8b2 0.89 → 0.12 s 0.40 → 0.21 s 0.53 → 0.20 s
    14308fd2c 7.6 → 1.2 s 7.1 → 1.6 s 7.5 → 2.7 s
    main 12.0 → 1.5 s 12.2 → 1.0 s 15.8 → 2.8 s

    On the 18 paper MILPs (three HiGHS seeds, median), the sum goes from 401.7 s to 201.0 s, with equal optima.

    Fix: #1537

    #1537 holds $h_v$ as longest_need_s * share, with share in [0, 1]. The (R) rows stay in seconds, so the solver's tolerances keep their meaning. It does the same for the resident windows $r_v$. Release build, same idle host, one workload at a time, HiGHS seeds 0–2, median per workload, planning stages summed:

    set workloads planning s, main → #1537 Stage 3 s slowest workload s plan cost differs (workload × seed)
    viewer34 34 343.3 → 99.2 320.9 → 76.5 16.5 → 4.5 0
    r197 197 79.6 → 53.9 64.9 → 39.2 5.9 → 6.0 0
    paper 18 439.6 → 196.9 436.0 → 193.3 146.3 → 55.5 5
    • Paper plan-cost differences. All 5 are within HiGHS's optimality tolerance, at most 2e-7 relative.
      • In four of them the MILP optimum is identical; only plan_cost separates the tied plans. main itself returns the dearer one on paperwhole_rollupheavy with seed 1.
      • The fifth stops 1.9e-8 above the other optimum.
      • Details are in the PR.
    • Against this issue's targets.
      • long-01: 2.48 s, against facaec8b2's 1.73 s on the same host, which is within 2×.
      • viewer34: 99.2 s, against facaec8b2's 48.7 s on the same host (wall time, since that commit panics after Stage 3), so 2.0×. Against the 11-14 figure of 42.6 s it is 2.3×.
    • Where the rest goes. With fix(stage3): retention and resident windows as shares of their largest need (#1533) #1537, addRootRedcost no longer appears in the profile of long-01's solve; no function takes more than 7 %. The rest of the gap to the 11-14 baseline is the larger MILP that the measured unit costs keep (7,570 columns against 10,348 at facaec8b2, but 590 against 293 after presolve). That was not bisected further.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcost-modeloptimizer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions