Repository navigation
Release 0.6.3
[0.6.3] - 2026-10-06
Added
- LP/MILP input:
solve_lpandsolve_milpaccept sparse rows ({column: coefficient}dicts, mixable with dense rows), per-rowsenses("<=",">=","=") and variable boundslb/ub.solve_milpaddsbinary=(0/1 variables) andintegersbecomes optional. The 0.6.2 call form is unchanged. - Incremental MILP:
MilpModeladds rows and re-solves warm (lazy cuts, objective locks, new objectives);solve_lexicographicoptimizes objectives in priority order on a model (a 270-variable, 4-stage downstream model: 7.4 ms). Adding a cut to a 540-variable model and re-solving takes 13% of a fresh solve.
Fixed
- Deep graphs:
articulation_points,bridgesandstrongly_connected_componentsno longer raiseRecursionErrorwhen the DFS goes deeper than Python's recursion limit (about 1,000 nodes on one path; code dependency graphs reach that easily). All three now use an iterative DFS with the same results, result order and iteration counts; a 100,000-node path or tree takes under 0.3 s. The SCC docstring's advice to raise the recursion limit is removed. - Rust SCC crash:
strongly_connected_components_edgeswith the Rust backend (the default) no longer kills the Python process with a native stack overflow on deep graphs (a 100,000-node chain did). The Rust implementation is now iterative; results are identical to the Python backend, component order included. - Version:
solvor.__version__reported 0.6.1 in the 0.6.2 release. It now reads the installed package metadata, and the version lives only inrust/Cargo.toml. - Determinism:
louvainandpagerankno longer depend on set iteration order: with mutually comparable nodes (ints, strs, tuples) the same graph gives the same result under anyPYTHONHASHSEED, also whenneighborsreturns values that are not nodes (they are ignored). Result lists and dicts follow sorted node order. - PageRank:
max_iter=0, atolthat is not positive and finite, anddampingoutside[0, 1)now raiseValueErroron both backends (the Python path crashed or misbehaved).pagerank_edges(backend="python")ignores out-of-range edges like the Rust backend instead of raisingIndexError, and the Rust backend now also ignores edges with negative endpoints or endpoints beyond 64 bits (it raisedOverflowError). A negativen_nodesraisesValueErroron both backends. - Badly scaled MILPs (big-M):
solve_milpandMilpModelcould return a point that violates a constraint, a worse objective than the optimum, or no solution for a feasible model when big-M coefficients of about 1e5 and up sit next to coefficients near 1 (0.6.2 too). The LP relaxations now use their own 1e-9 tolerance, rows and columns whose coefficients differ by a factor of 256 or more are scaled by powers of two, every integer solution is checked against all rows after it is snapped to integers, a warm-started "infeasible" verdict in such a model is confirmed with a fresh LP, and branching can no longer repeat a node. On 2,000 solves of random binary models with coefficients from 0.1 to 9e6, 0.6.2 returned 131 points that violate a row, 67 worse objectives and 115 "no solution" answers for feasible models, all without a warning; 0.6.3 returns 0, 2 and 4, each with the reason inerrorand none markedOPTIMAL. - Small costs next to big-M rows: in a badly scaled model the LP behind
solve_lp,solve_milpandMilpModelcould stop short of its optimum when a reduced cost belowepshid a large gain (the slack of a row with a large coefficient costs almost nothing per unit but can move very far). With a goodwarm_start, branch and bound then pruned the root and returned that warm start asOPTIMAL. Such a column now enters when its step gains more thaneps * (1 + |objective|); well-scaled models keep the plain test. On 800 random LPs with costs down to 1e-5 next to coefficients up to 9e6, answers worse than HiGHS dropped from 14 to 1 (0.6.2 had this too).
Result changes
Every change in solver output is listed here, float-level ones included, so downstream caches know which upgrade invalidates them.
- Louvain now runs both phases. Earlier releases only ran local moving and never aggregated communities, although the docs described both phases. Results change: fewer, larger communities with higher modularity (a 1,000-node path: 500 pairs at 0.50 before, above 0.9 now; a 9,091-node code graph: 1,821 communities at 0.587 before, 115 at 0.823 now). Nodes and neighbors are now processed in sorted order, so even the first level only matches earlier releases for inputs that were already sorted. If you store community labels, expect them to change.
result.iterationsnow counts local-moving passes over all levels. Community list order is now by smallest member. - PageRank, Rust backend: scores change at the float level (now bit-identical to the Python backend; it used an L1 convergence test before, so it ran more iterations). Rust
pagerank_edgesnow reportsobjective= the last iteration's largest score change andevaluations= the number of nodes (it returned 0.0 and 0). - PageRank, Python backend: scores change in their last few bits (up to about 4 ulp: it multiplies by the reciprocal of the out-degree instead of dividing); iteration counts are unchanged.
- Result order:
louvainandpageranklist and dict entries now follow sorted node order (for mutually comparable nodes) instead of input order. - LP/MILP: optimal objectives are unchanged (a 300-instance snapshot from 0.6.2 is part of the test suite), but where several optimal solutions exist
solve_lpandsolve_milpmay return a different one than 0.6.2 (new LP engine and presolve). - Unbounded LP:
solve_lpreports an objective of-inf(minimize) orinf(maximize) instead of the last vertex's value (solve_milpalready did). - Infeasible LP when maximizing:
solve_lpreports an objective of-inf(it reportedinffor both directions); minimizing still givesinf. - Iteration limit before a feasible point:
solve_lpreportsMAX_ITER(it reportedINFEASIBLE), with no solution;solve_milpreturnsMAX_ITERwhen the root LP hits the limit instead of branching on an unfinished LP, and whenmax_nodesstops the search before any solution is found (it reportedINFEASIBLE, which nothing had proven). - LP iteration counts include bound flips (a variable jumping between its bounds without a pivot).
- MILP solutions: integer variables are exactly integral (
1.0, not0.9999999999999998) and the objective is recomputed from them, so objectives like79.00000000000007become79.0. Withsolution_limit > 1,result.solutionsis now also set when the root LP is already integral (it wasNone). - MILP tie-breaking: the new search order (depth-first dives) can return a different optimal solution than before where several optima tie; objectives are unchanged.
- Badly scaled LPs and MILPs:
solve_lp,solve_milpandMilpModelnow scale every row and column whose nonzero coefficients differ by a factor of 256 or more (binary exponents 8 or more apart). Such models can get a different solution, objective, status,iterationsandevaluations, usually a correct answer where 0.6.2 was wrong. When branch and bound meets a node whose LP solution is visibly inaccurate (outside its bounds, or integral but violating a row), the result isFEASIBLEinstead ofOPTIMAL(orINFEASIBLE), with the reason inerror. Models without such a row or column are not scaled; in every comparison we ran (the golden digests, which now include node and LP iteration counts, and random well-scaled LP and MILP families) their results are bit-identical to those without this change. - MILP rounding heuristic: its flip phase no longer turns off a variable with a negative cost when minimizing (or turns on one with a negative cost when maximizing), which made the first incumbent worse. Incumbents, node counts and, where optima tie, the returned solution can change.
- MILP counts:
iterations(nodes explored) andevaluations(LP iterations, now including bound flips and warm-started dual pivots) change with the new presolve and search, usually to much smaller values.
Changed
- PageRank speed: the callback
pageranknow runs on the Rust backend when installed (9,091 nodes, 33,580 arcs: 345 ms to 12 ms; the pure Python path also dropped to 183 ms). Newbackendkeyword. The Rust and Python backends now return bit-identical scores and iteration counts (same max-norm convergence test, same compensated summation), so results do not depend on whether the Rust wheel is installed. - Wheels: one abi3 wheel per platform (CPython 3.12+) built with pyo3 0.29, instead of one wheel per Python version.
- Rust toolchain: pinned to 1.99.0 for development and CI (
rust-toolchain.toml); building from the sdist needs Rust 1.88 or newer. CI now runs rustfmt, clippy (warnings are errors),cargo testand a 1.88 build check. - LP engine: bounded-variable simplex. Bounds no longer become rows, so binary models no longer need identity rows and branch-and-bound nodes no longer add bound rows (540 binary variables: root LP 108 ms to 11 ms).
- MILP presolve: single-variable rows become bounds; rows with only integer variables and integer coefficients are divided by their gcd and get an integral right-hand side. Lexicographic lock rows with a
+0.5slack now solve at or near the root (a 270-variable model: 83.5 s and 1,391 nodes to 0.01 s and 3 nodes; 20 recorded calls from a downstream project: 105.6 s to 0.05 s, same objectives). - MILP heuristics: the rounding heuristic updates row activities incrementally instead of re-checking every row after every move (a 540-variable model spent 174 s there).
- Validation runs once per call instead of in every branch-and-bound node.
- LP/MILP input: an empty
Ais accepted (only bounds), rows with an infinite right-hand side are dropped when they can never bind and make the model infeasible when they can never hold. A lower bound of+inf, an upper bound of-inf, an infinite cost or constraint coefficient, or anepsthat is negative, NaN or infinite raisesValueError(a negativeepscrashed withZeroDivisionError; the others returnedOPTIMALwith a NaN objective, a violated row or a wrong point). - MILP branch and bound re-solves each node with the dual simplex from its parent's basis and dives depth-first before taking the best queued node (7 branching benchmarks: 8.6 s to 2 s, 5 to 14 times fewer LP pivots).
- LP/MILP Rust kernel: the simplex tableau behind
solve_lp,solve_milpandMilpModelruns in Rust when the extension is installed (newbackendkeyword,"auto"by default). It performs the same float operations in the same order as the Python kernel, so results are bit-identical on either backend; branch and bound, presolve and heuristics stay in Python. 13 branching benchmarks run about 60 times faster in total, the root LP of a 540-variable packing model about 75 times faster.
What's Changed
- Release 0.6.3 by @StevenBtw in #92
Full Changelog: v0.6.2...v0.6.3