From a67fad31766ee6c18f1234420e862a3b2ab22ab6 Mon Sep 17 00:00:00 2001 From: Bulle Mostovoi Date: Tue, 21 Jul 2026 16:50:24 +0200 Subject: [PATCH 1/4] fix Qc test and added canonicalization --- cpp/src/io/experimental_mps_fast/fast_parser.cpp | 3 +++ cpp/src/io/mps_parser.cpp | 6 ++++++ .../experimental_mps_fast/fast_parser_edge_test.cpp | 1 + 3 files changed, 10 insertions(+) diff --git a/cpp/src/io/experimental_mps_fast/fast_parser.cpp b/cpp/src/io/experimental_mps_fast/fast_parser.cpp index 4b74943a1d..077fcefc17 100644 --- a/cpp/src/io/experimental_mps_fast/fast_parser.cpp +++ b/cpp/src/io/experimental_mps_fast/fast_parser.cpp @@ -42,6 +42,7 @@ #include #include +#include #define MPS_FAST_COMPACT_ROW_HASH #define MPS_FAST_THP_PREFAULT @@ -2769,6 +2770,7 @@ static void finalize_qcmatrix_constraints(parse_state_t& state) return std::get<1>(ea) < std::get<1>(eb); }); + // Match reference ingest: canonicalize MPS symmetric halves to upper-triangular COO. qc.rows.reserve(block.entries.size()); qc.cols.reserve(block.entries.size()); qc.vals.reserve(block.entries.size()); @@ -2778,6 +2780,7 @@ static void finalize_qcmatrix_constraints(parse_state_t& state) qc.cols.push_back(col); qc.vals.push_back(val); } + canonicalize_coo_matrix(qc.rows, qc.cols, qc.vals); state.problem.quadratic_constraints_.push_back(std::move(qc)); } diff --git a/cpp/src/io/mps_parser.cpp b/cpp/src/io/mps_parser.cpp index aed892713b..b9423d81e6 100644 --- a/cpp/src/io/mps_parser.cpp +++ b/cpp/src/io/mps_parser.cpp @@ -1717,5 +1717,11 @@ template void canonicalize_coo_matrix(std::vector&, template void canonicalize_coo_matrix(std::vector&, std::vector&, std::vector&); +template void canonicalize_coo_matrix(std::vector&, + std::vector&, + std::vector&); +template void canonicalize_coo_matrix(std::vector&, + std::vector&, + std::vector&); } // namespace cuopt::mathematical_optimization::io diff --git a/cpp/tests/linear_programming/experimental_mps_fast/fast_parser_edge_test.cpp b/cpp/tests/linear_programming/experimental_mps_fast/fast_parser_edge_test.cpp index 69cc29a0d3..6427e2b2b7 100644 --- a/cpp/tests/linear_programming/experimental_mps_fast/fast_parser_edge_test.cpp +++ b/cpp/tests/linear_programming/experimental_mps_fast/fast_parser_edge_test.cpp @@ -853,6 +853,7 @@ TEST(FastMpsParserEdgeTest, QcMatrixRowsMatchReferenceBitwise) "QCMATRIX QC1\n" " X1 X1 1.25\n" " X1 X2 -2.5\n" + " X2 X1 -2.5\n" "QCMATRIX QC2\n" " X2 X2 3.75\n" "ENDATA\n"); From 897712a49fd3f667f408cb0a4438586d1739a627 Mon Sep 17 00:00:00 2001 From: Bulle Mostovoi Date: Tue, 21 Jul 2026 17:03:15 +0200 Subject: [PATCH 2/4] style --- cpp/src/io/experimental_mps_fast/fast_parser.cpp | 2 +- .../experimental_mps_fast/fast_parser_edge_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/io/experimental_mps_fast/fast_parser.cpp b/cpp/src/io/experimental_mps_fast/fast_parser.cpp index 077fcefc17..1135e0fc1a 100644 --- a/cpp/src/io/experimental_mps_fast/fast_parser.cpp +++ b/cpp/src/io/experimental_mps_fast/fast_parser.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights +// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // reserved. SPDX-License-Identifier: Apache-2.0 #include "fast_parser.hpp" diff --git a/cpp/tests/linear_programming/experimental_mps_fast/fast_parser_edge_test.cpp b/cpp/tests/linear_programming/experimental_mps_fast/fast_parser_edge_test.cpp index 6427e2b2b7..48fd77ae35 100644 --- a/cpp/tests/linear_programming/experimental_mps_fast/fast_parser_edge_test.cpp +++ b/cpp/tests/linear_programming/experimental_mps_fast/fast_parser_edge_test.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 #include "fast_parser.hpp" From 6b4739adb9df199cea2507385b836b1d66cb7e89 Mon Sep 17 00:00:00 2001 From: Bulle Mostovoi Date: Tue, 21 Jul 2026 19:22:36 +0200 Subject: [PATCH 3/4] added check symetrical off diagonal --- cpp/src/io/experimental_mps_fast/fast_parser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/src/io/experimental_mps_fast/fast_parser.cpp b/cpp/src/io/experimental_mps_fast/fast_parser.cpp index 1135e0fc1a..c6a967a139 100644 --- a/cpp/src/io/experimental_mps_fast/fast_parser.cpp +++ b/cpp/src/io/experimental_mps_fast/fast_parser.cpp @@ -2780,6 +2780,7 @@ static void finalize_qcmatrix_constraints(parse_state_t& state) qc.cols.push_back(col); qc.vals.push_back(val); } + check_symmetric_offdiagonal_pairs(qc.rows, qc.cols, qc.vals); canonicalize_coo_matrix(qc.rows, qc.cols, qc.vals); state.problem.quadratic_constraints_.push_back(std::move(qc)); } From b87f7018399178538ffd47d7eac87809bc565e5f Mon Sep 17 00:00:00 2001 From: Bulle Mostovoi Date: Tue, 21 Jul 2026 20:45:37 +0200 Subject: [PATCH 4/4] remove forward declaration of rmm device vector in problem_checking.cuh --- cpp/src/pdlp/utilities/problem_checking.cuh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cpp/src/pdlp/utilities/problem_checking.cuh b/cpp/src/pdlp/utilities/problem_checking.cuh index 217080356c..5dc74808a2 100644 --- a/cpp/src/pdlp/utilities/problem_checking.cuh +++ b/cpp/src/pdlp/utilities/problem_checking.cuh @@ -10,10 +10,7 @@ #include #include -namespace rmm { -template -class device_uvector; -} // namespace rmm +#include namespace cuopt::mathematical_optimization {