Skip to content

Refactor: math_optimization namespace#1446

Draft
mlubin wants to merge 8 commits into
NVIDIA:mainfrom
mlubin:refactor/math-optimization-namespace
Draft

Refactor: math_optimization namespace#1446
mlubin wants to merge 8 commits into
NVIDIA:mainfrom
mlubin:refactor/math-optimization-namespace

Conversation

@mlubin

@mlubin mlubin commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Claude-assisted refactor.

Renames the cuopt::linear_programming umbrella namespace to cuopt::math_optimization and reorganizes its internals to match the actual architecture. The old name had outgrown its scope (it houses MILP, QP, and conic/barrier solving, not just LP).

The public C++ include path moves accordingly:
include/cuopt/linear_programming/include/cuopt/math_optimization/.

New internal structure — one namespace per clash domain, no more detail:

cuopt::math_optimization        public surface (problem, solution, settings, solve) + io
  ::pdlp           GPU first-order LP      (was ::detail)
  ::dual_simplex   CPU simplex             (folds in stray primal/dual/phase2)
  ::barrier        interior-point          (was ::dual_simplex)
  ::mip            B&B + cuts + heuristics  (was split across ::dual_simplex and ::detail)

Note

  • C++ namespace is a hard break (no alias); the C API is source-compatible.
    The old cuopt::linear_programming namespace is gone, so C++ consumers must
    update qualifiers and #includes. The C API is unchanged (same symbols), and a
    forwarding shim at <cuopt/linear_programming/cuopt_c.h> keeps the legacy
    include path working (with a deprecation warning) — C consumers need no changes.
  • Python is unchanged. The cuopt.linear_programming Python package keeps its name — only the C++ side is renamed. This leaves a deliberate, temporary cross-language mismatch (C++ math_optimization vs Python linear_programming); renaming the Python package is a separate follow-up and requires more care given it's a public API.
  • Shared problem_tmip. The core problem representation is used by both PDLP and MIP but defined under mip_heuristics/, so it landed in ::mip — meaning pdlp now references mip::problem_t. Accepted for now; a shared-infra home could be revisited later.
  • detail fully eliminated under the umbrella: generic GPU helpers (hashing, launch-dims, double-buffer, segmented-sum) moved to the top-level cuopt namespace; module-specific helpers to their module's namespace; file-local helpers to anonymous namespaces.
  • Left intentionally untouched: routing's separate cuopt::detail (different namespace, out of scope), the global-scope ::detail in a gRPC serialization header, the vendored cxxopts library's own detail, the cpp/tests/linear_programming/ directory, and the Cython bridge type cuopt::cython::linear_programming_ret_t.
  • A few carved-out files keep a dual_simplex block / using namespace dual_simplex where they instantiate or call genuine simplex templates (explicit template instantiations must live in the template's own namespace).

mlubin and others added 7 commits June 20, 2026 18:37
Mechanical rename of the umbrella namespace and public include path
(include/cuopt/linear_programming -> include/cuopt/math_optimization).
No structural or behavioral change. Python package cuopt.linear_programming
intentionally unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Miles Lubin <mlubin@nvidia.com>
Out of the overloaded ::detail namespace; folds pdlp_hyper_params in.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Miles Lubin <mlubin@nvidia.com>
Out of dual_simplex; barrier now owns its own cusparse_view_t cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Miles Lubin <mlubin@nvidia.com>
'1' and 'best_results.txt' are solver/benchmark stdout captures that a
broad 'git add -A' swept into the umbrella-rename commit. Not source.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Miles Lubin <mlubin@nvidia.com>
Branch-and-bound, cuts, and heuristics were split across ::dual_simplex
and ::detail; unify them in one ::mip namespace. The shared problem_t
representation (used by pdlp/barrier too) moves to ::mip as well.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Miles Lubin <mlubin@nvidia.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Miles Lubin <mlubin@nvidia.com>
Generic GPU helpers moved to the cuopt namespace; module-specific helpers
into their module namespace; file-local helpers into anonymous namespaces.
detail no longer used for organization (routing's cuopt::detail and the
third-party cxxopts detail are unrelated and untouched).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Miles Lubin <mlubin@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jun 21, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

The C API is unchanged (same symbols, C linkage); only its header path
moved to <cuopt/math_optimization/cuopt_c.h>. Add a forwarding shim at the
legacy path (with a deprecation #pragma message) so existing C/C++ consumers
keep compiling. Installs via the existing include/cuopt/ directory rule.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Miles Lubin <mlubin@nvidia.com>
@mlubin mlubin added non-breaking Introduces a non-breaking change improvement Improves an existing functionality labels Jun 21, 2026
@mlubin

mlubin commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 57a51ee

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

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant