Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
886f0a6
First stab at QP
chris-maes Oct 14, 2025
a624e23
Add space in scaling
chris-maes Oct 14, 2025
b34300a
Style fixes
chris-maes Oct 14, 2025
e3ef96b
Merge remote-tracking branch 'cuopt-nvidia/branch-25.12' into qp
chris-maes Oct 14, 2025
84eedbf
add header
rgsl888prabhu Oct 14, 2025
29509f9
Fix crashes due to mismatch between Q and A when presolve eliminated …
chris-maes Oct 14, 2025
3f08031
Style fixes
chris-maes Oct 14, 2025
9f04972
Handle SIF files in the script
rg20 Oct 16, 2025
5a0f39f
Fix a bug in computing quadratic objective
rg20 Oct 16, 2025
ef5b72a
handle presolve flag correctly
rg20 Oct 16, 2025
d7069c7
Resize Q matrix to include slack variables
rg20 Oct 16, 2025
781b4e4
Remove stale cout
rg20 Oct 16, 2025
d1824bc
Fix indexing issue
rg20 Oct 16, 2025
4176cf6
Fix warning
rg20 Oct 17, 2025
203212b
Fix out of bounds indexing
rg20 Oct 17, 2025
62b20c3
Add debug function for cudss factorization
rg20 Oct 21, 2025
f8631ac
Merge remote-tracking branch 'upstream/main' into qp
rg20 Oct 27, 2025
42e8290
Merge remote-tracking branch 'upstream/main' into qp
rg20 Oct 29, 2025
4482175
Fix a bug in the sign
rg20 Oct 29, 2025
16d8084
Handle Q matrix changes in presolve
rg20 Oct 30, 2025
af7a30b
Merge remote-tracking branch 'upstream/main' into qp
rg20 Oct 30, 2025
2247d71
Fix compilation errors
rg20 Oct 30, 2025
3503bb8
Fix bug in handling Q expansion for free variables
rg20 Oct 30, 2025
319df11
Style checks
rg20 Oct 30, 2025
8dfc18b
Fix a bug in Q terms
rg20 Oct 30, 2025
32ba29d
Debug info
rg20 Oct 30, 2025
15e914d
Remove print statement
rg20 Oct 30, 2025
ef13697
Fix a sign bug
rg20 Oct 31, 2025
f5bf3e0
Additional stopping criteria for QP
rg20 Oct 31, 2025
6c78ac5
Merge remote-tracking branch 'upstream/main' into qp
rg20 Nov 3, 2025
878f9b9
add debug code
rg20 Nov 3, 2025
6e2fb36
handle .SIF files in the script
rg20 Nov 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions cpp/include/cuopt/linear_programming/optimization_problem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,45 @@ class optimization_problem_t {
* @param objective_offset Objective offset value.
*/
void set_objective_offset(f_t objective_offset);

/**
* @brief Set the quadratic objective matrix (Q) in CSR format for QPS files.
*
* @note This is used for quadratic programming problems where the objective
* function contains quadratic terms: (1/2) * x^T * Q * x + c^T * x
*
* @param[in] Q_offsets Offsets of the CSR representation of the quadratic objective matrix
* @param size_offsets Size of the Q_offsets array
* @param[in] Q_indices Indices of the CSR representation of the quadratic objective matrix
* @param size_indices Size of the Q_indices array
* @param[in] Q_values Values of the CSR representation of the quadratic objective matrix
* @param size_values Size of the Q_values array
*/
void set_quadratic_objective_matrix(const i_t* Q_offsets,
i_t size_offsets,
const i_t* Q_indices,
i_t size_indices,
const f_t* Q_values,
i_t size_values);

/**
* @brief Get the quadratic objective matrix offsets
* @return const reference to the Q_offsets vector
*/
const std::vector<i_t>& get_quadratic_objective_offsets() const;

/**
* @brief Get the quadratic objective matrix indices
* @return const reference to the Q_indices vector
*/
const std::vector<i_t>& get_quadratic_objective_indices() const;

/**
* @brief Get the quadratic objective matrix values
* @return const reference to the Q_values vector
*/
const std::vector<f_t>& get_quadratic_objective_values() const;

/**
* @brief Set the variables (x) lower bounds.
* @note Setting before calling the solver is optional, default value for all
Expand Down Expand Up @@ -392,6 +431,12 @@ class optimization_problem_t {
f_t objective_scaling_factor_{1};
/** offset of the objective function */
f_t objective_offset_{0};

/** Quadratic objective matrix in CSR format (for (1/2) * x^T * Q * x term) */
std::vector<i_t> Q_offsets_;
std::vector<i_t> Q_indices_;
std::vector<f_t> Q_values_;
Comment on lines +435 to +438
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Quadratic matrix stored as host std::vectors while other matrices use rmm::device_uvector. This creates inconsistency in memory management - consider if device storage is needed for GPU operations.

Prompt To Fix With AI
This is a comment left during a code review.
Path: cpp/include/cuopt/linear_programming/optimization_problem.hpp
Line: 435:438

Comment:
**style:** Quadratic matrix stored as host std::vectors while other matrices use rmm::device_uvector. This creates inconsistency in memory management - consider if device storage is needed for GPU operations.

How can I resolve this? If you propose a fix, please make it concise.


/** lower bounds of the variables (primal part) */
rmm::device_uvector<f_t> variable_lower_bounds_;
/** upper bounds of the variables (primal part) */
Expand Down
1 change: 1 addition & 0 deletions cpp/libmps_parser/src/mps_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ void mps_parser_t<i_t, f_t>::fill_problem(mps_data_model_t<i_t, f_t>& problem)

// Process QUADOBJ data if present (upper triangular format)
if (!quadobj_entries.empty()) {
printf("Quadratic objective matrix: %zu nonzeros\n", quadobj_entries.size());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using proper logging instead of printf for consistency with the rest of the codebase

Prompt To Fix With AI
This is a comment left during a code review.
Path: cpp/libmps_parser/src/mps_parser.cpp
Line: 509:509

Comment:
**style:** Consider using proper logging instead of `printf` for consistency with the rest of the codebase

How can I resolve this? If you propose a fix, please make it concise.

// Convert quadratic objective entries to CSR format using double transpose
// QUADOBJ stores upper triangular elements, so we expand to full symmetric matrix
i_t num_vars = static_cast<i_t>(var_names.size());
Expand Down
Loading