[BUG] Java: variable objective coefficients are ignored after setObjective

Open
#2,223 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
63/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java
Domain
api, backend

Research direction

Read the Java bindings' Problem objective construction and the disabled reproductions named in #2219: NativeEdgeCaseTest.aVariableCoefficientChangedAfterSettingTheObjectiveChangesTheSolve and NativeEdgeCaseTest.aVariableAddedAfterSettingTheObjectiveKeepsItsCoefficient. Trace how setObjective and variable coefficients reach the solve, then enable or run those tests. Done means the solve uses current coefficients, or coefficient changes after setObjective are rejected.

Written by the indexing model from the issue text.

Description

bug

In the Java bindings, Problem builds the objective from the setObjective expression once an objective is set, so later changes to variable objective coefficients are ignored by the solve.

  • x.setObjectiveCoefficient(...) after setObjective does not change the next solve.
  • A variable added after setObjective with a nonzero coefficient has that coefficient ignored.

Expected: the solve uses the current variable coefficients, or setting a coefficient after setObjective is rejected.

Disabled tests that reproduce both (in #2219):

  • NativeEdgeCaseTest.aVariableCoefficientChangedAfterSettingTheObjectiveChangesTheSolve
  • NativeEdgeCaseTest.aVariableAddedAfterSettingTheObjectiveKeepsItsCoefficient

🤖 Generated with Claude Code

Dominant language
Cuda
Stars
1.1k
Forks
249
Avg merge
1d 16h
Merged PRs (30d)
127

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/cuopt

All issues in NVIDIA/cuopt

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.