Skip to content

Fix several bugs appeared in unit testing of JuMP interface#149

Merged
rapids-bot[bot] merged 24 commits intoNVIDIA:branch-25.08from
rg20:jump_interface_fixes
Jul 8, 2025
Merged

Fix several bugs appeared in unit testing of JuMP interface#149
rapids-bot[bot] merged 24 commits intoNVIDIA:branch-25.08from
rg20:jump_interface_fixes

Conversation

@rg20
Copy link
Copy Markdown
Contributor

@rg20 rg20 commented Jun 26, 2025

Description

While testing the JuMP interface, there were several corner cases showed up. Especially for tiny problems and problems without constraints. This PR has several such fixes.

In addition, following things are added:

  • Implement cuOptGetVersion() in C-API
  • Change the max allowed absolute gap tolerance to INFINITY

Issue

closes #148
closes #147
closes #166

Checklist

  • I am familiar with the Contributing Guidelines.
  • Testing
    • New or existing tests cover these changes
    • Added tests
    • Created an issue to follow-up
    • NA
  • Documentation
    • The documentation is up to date with these changes
    • Added new documentation
    • NA

@rg20 rg20 requested review from a team as code owners June 26, 2025 13:27
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Jun 26, 2025

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.

@rg20 rg20 added bug Something isn't working non-breaking Introduces a non-breaking change labels Jun 26, 2025
@rg20 rg20 added this to the 25.08 milestone Jun 26, 2025
@rg20
Copy link
Copy Markdown
Contributor Author

rg20 commented Jun 26, 2025

/ok to test 19dba1e

Comment thread cpp/include/cuopt/linear_programming/cuopt_c.h Outdated
Comment thread cpp/src/linear_programming/cuopt_c.cpp Outdated
Comment thread cpp/src/linear_programming/cuopt_c.cpp Outdated
@chris-maes
Copy link
Copy Markdown
Contributor

How are you handling problems with zero constraints.

@rg20
Copy link
Copy Markdown
Contributor Author

rg20 commented Jun 27, 2025

How are you handling problems with zero constraints.

For MIP, Alice wrote a special code that assigns lower or upper bound based on the sign of the objective coefficient. I guess we can do the same for LP?

Copy link
Copy Markdown
Contributor

@Kh4ster Kh4ster left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@chris-maes chris-maes left a comment

Choose a reason for hiding this comment

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

Please create a new function to get the dual objective in the C API before merging. I also think we should verify the changes around the objective are correct. As this undos past bug fixes.

Comment thread cpp/src/mip/presolve/trivial_presolve.cuh
@rg20
Copy link
Copy Markdown
Contributor Author

rg20 commented Jul 2, 2025

/ok to test 7c4d589

@rg20 rg20 requested a review from chris-maes July 2, 2025 14:25
@rg20
Copy link
Copy Markdown
Contributor Author

rg20 commented Jul 2, 2025

/ok to test a754b1c

@rg20
Copy link
Copy Markdown
Contributor Author

rg20 commented Jul 7, 2025

/ok to test d18c8b2

f_t compute_user_objective(const lp_problem_t<i_t, f_t>& lp, f_t obj)
{
const f_t user_obj = obj * lp.obj_scale + lp.obj_constant;
const f_t user_obj = lp.obj_scale * (obj + lp.obj_constant);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you are changing the convention for how the scaling is done here. I'm not sure why the current convention was chosen. Can you check with @aliceb-nv or @akifcorduk before changing this convention?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The reason we chose the current convention was to handle obj_scale values other than 1 or -1. The new way is equivalent only if obj_scale is 1 or -1.

Comment thread cpp/src/linear_programming/cuopt_c.cpp Outdated
Copy link
Copy Markdown
Contributor

@chris-maes chris-maes left a comment

Choose a reason for hiding this comment

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

Removing request changes so you can merge while I am out of office. But I left some comments that would be great if you could address.

Also, it wasn't clear to me if the code handled the case where no constraints are present. If so, could you point me to where this is handled?

Copy link
Copy Markdown
Contributor

@akifcorduk akifcorduk left a comment

Choose a reason for hiding this comment

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

Looks good but one note: the objective offset needs to be correctly handled in case the scaling factor is neither 1 nor -1.

@rg20
Copy link
Copy Markdown
Contributor Author

rg20 commented Jul 8, 2025

Removing request changes so you can merge while I am out of office. But I left some comments that would be great if you could address.

Also, it wasn't clear to me if the code handled the case where no constraints are present. If so, could you point me to where this is handled?

in MIP empty problem is handled here:

in LP, dual simplex is solving the problem. I guess initial assignment solves the problem?

@rg20
Copy link
Copy Markdown
Contributor Author

rg20 commented Jul 8, 2025

/ok to test d77cb4d

@rg20
Copy link
Copy Markdown
Contributor Author

rg20 commented Jul 8, 2025

/merge

@rapids-bot rapids-bot bot merged commit 4824781 into NVIDIA:branch-25.08 Jul 8, 2025
72 checks passed
jieyibi pushed a commit to yining043/cuopt that referenced this pull request Mar 26, 2026
While testing the JuMP interface, there were several corner cases showed up. Especially for tiny problems and problems without constraints. This PR has several such fixes.  

In addition, following things are added: 

- Implement `cuOptGetVersion()` in C-API
- Change the max allowed absolute gap tolerance to INFINITY 

## Issue

closes NVIDIA#148 
closes NVIDIA#147 
closes NVIDIA#166

Authors:
  - Rajesh Gandham (https://github.com/rg20)

Approvers:
  - Nicolas Blin (https://github.com/Kh4ster)
  - Ramakrishnap (https://github.com/rgsl888prabhu)
  - Chris Maes (https://github.com/chris-maes)
  - Akif ÇÖRDÜK (https://github.com/akifcorduk)

URL: NVIDIA#149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

None yet

6 participants