Skip to content

Task 007/gurobi 14 release - #289

Open
glebbelov wants to merge 9 commits into
masterfrom
task-007/gurobi-14-release
Open

glebbelov wants to merge 9 commits into
masterfrom
task-007/gurobi-14-release

Conversation

@glebbelov

Copy link
Copy Markdown
Contributor

The NL constraints are a new group, needed that for IIS/Force

glebbelov and others added 3 commits November 13, 2026 17:14
- New option alg:pdhgearlycrossover (PDHGEarlyCrossover, added in the
  14.0.0 release; the beta's PDHGCrossover was dropped).
- pre:sparsify documents value 2 (all model types).
- Ranges of pre:funcpieceerror, pre:funcpiecelength and pre:funcpieces
  follow the limits enforced by Gurobi.
- bar:crossover text covers PDHG and NL barrier.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Gurobi 14 keeps constraints added by GRBaddnlconstr() in their own
list. The driver put them into the algebraic and general groups, so
IISNLConstr was never read and nonlinear IIS members were reported
as 'non'. They now form the CG_Nonlinear group: iis:find reads
IISNLConstr and .iisforce sets IISNLConstrForce. Builds against
Gurobi 13 keep GRBaddgenconstrNL() in the general group.

Document that with Gurobi 14 the .funcpiece... suffixes apply only
to function constraints (acc:_expr=0).

end2end: infeas_nl_01 (nonlinear IIS member; fails without the fix
on Gurobi 14, passes on 13.0.3) and funcpieces_01_lcon with
acc:_expr=0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- The five .funcpieces cases set acc:_expr=0: Gurobi 14 accepts the
  suffix only on function constraints. The separate acc:_expr=0 copy
  of funcpieces_01_lcon is dropped.
- Three ellipse qcpdual cases: QCP duals at the default barrier
  tolerance are accurate to about 1e-3 and differ between Gurobi 13
  and 14. Gurobi runs them with a tighter bar:qcptol; the converged
  duals are accepted next to the previous values.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The missing nonlinear IIS members affected only builds against
Gurobi 14, which were not released.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@fdabrandao fdabrandao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review of the Gurobi 14 NL-constraint IIS group change. The core fix looks right: without it, NL constraints inflated CG_General past Gurobi's general-constraint count. Comments below are from reading the code only (not built against a Gurobi 14 header).

One point outside the diff: InputGurobiFuncApproxParams() (gurobibackend.cc ~L967) reads .funcpieces / .funcpieceerror / .funcpiecelength / .funcpieceratio / .funcnonlinear / .global only from CG_General. With Gurobi 14 and default acc:_expr, these suffixes on NL constraints (now in CG_Nonlinear) are silently ignored; only the changelog mentions acc:_expr=0. Consider warning when these suffixes are set and CG_Nonlinear is non-empty.

🤖 Generated with Claude Code

Comment thread solvers/gurobi/gurobimodelapi.h Outdated
/// Constraints added by GRBaddnlconstr() form their own list
/// in Gurobi (attributes NumNLConstrs, IISNLConstr, ...),
/// separate from the general constraints.
#define GRB_NLCON_GROUP CG_Nonlinear

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Group selection here is gated on the version macro (13.9+ / __GRB_NL_OBJCON__), but IIS read/force for the new group is gated separately on #ifdef GRB_INT_ATTR_IIS_NLCONSTR / _IIS_NLCONSTRFORCE / _NUMNLCONSTRS. If a header passes the version check but lacks (or spells differently) those attributes, NL constraints go to CG_Nonlinear but ConsIIS never fills it: every NL IIS member is reported as non and .iisforce is dropped silently. Suggest gating all of these on the same condition, or #error if the attributes are missing.

Comment thread solvers/gurobi/gurobimodelapi.h Outdated
void SetNLObjective(int, const NLObjective&);
#else
/// GRBaddgenconstrNL(): a general constraint
#define GRB_NLCON_GROUP CG_General

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: GRB_NLCON_GROUP is a #define inside the class body, so it leaks into every TU including this header. Since NLConstraint only exists in the __GRB_NL_OBJCON__ branch, the NLAssign* ACCEPT_CONSTRAINT lines could be written with CG_Nonlinear / CG_General directly in each #if/#else branch (or use a static constexpr member) instead of a macro.

{ CG_General, iis_gencon }}};
#ifdef GRB_INT_ATTR_IIS_NLCONSTR // Gurobi 14: separate NL constraints
std::vector<int> iis_nlcon =
GrbGetIntAttrArray(GRB_INT_ATTR_IIS_NLCONSTR, NumNLCons());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

GrbGetIntAttrArray swallows Gurobi errors and returns an empty vector. If the IISNLConstr query fails, CG_Nonlinear gets 0 entries while the model has NumNLCons() NL constraints, and the user gets no diagnostic. Suggest checking the size against NumNLCons() and warning / skipping the group.

Comment thread solvers/gurobi/gurobibackend.cc Outdated
Swap_0_vs_minus1(iisf);
GrbSetIntAttrArray(GRB_INT_ATTR_IIS_GENCONSTRFORCE, iisf);
}
#ifdef GRB_INT_ATTR_IIS_NLCONSTRFORCE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The presolved CG_Nonlinear array is passed to GRBsetintattrarray(IISNLConstrForce, ...) without checking its length equals NumNLCons(). If anything other than NLConstraint / NLAssign* ever maps to this group, this would write past Gurobi's NL constraint list. A cheap size check would guard it.

Comment thread solvers/gurobi/CHANGES.gurobi.md Outdated
- *pre:sparsify* documents value 2 (all model types).
Documented ranges of *pre:funcpieceerror*, *pre:funcpiecelength*
and *pre:funcpieces* follow the Gurobi limits.
- With Gurobi 14, *iis:find* reports nonlinear constraints as

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Commit 144d11b says Gurobi 14 builds were never released, and AGENTS.md says to highlight regressions only when they affected a shipped build. This entry reads as a fix to a shipped Gurobi 14 driver; suggest dropping it or folding it into the Gurobi 14 support note.

},
"values": {
"_con[1]": -1.581437391665411
"_con[1]": [-1.581437391665411, -1.5811388]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Widening the expected dual to [-1.581437391665411, -1.5811388] applies to every solver, not just Gurobi, so a regression between the two values (~3e-4 apart) would pass for all solvers. Could this be a solver-specific expectation, or a single corrected reference with tolerance?

…irst Gurobi 14 release

One condition (MP_GRB_NLCON_LIST) selects the NL constraint group and the IIS
attributes; the group is a constexpr member instead of a macro; the IIS force
array for NL constraints is size-checked; a warning when .funcpiece... suffixes
are set on nonlinear constraints, which ignore them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@glebbelov

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Pushed 6c90c3b; checked with Gurobi 14.0.0
(iis_feasrelax, qp, suf_common, suf_std: no failures).

  • Group vs IIS attributes (gurobimodelapi.h:191): one condition,
    MP_GRB_NLCON_LIST in gurobicommon.h, now selects the group and guards the
    IIS read, the force input and NumNLCons(). Without all three attributes the
    NL constraints stay general constraints.
  • Macro leaking (gurobimodelapi.h:196): GRB_NLCON_GROUP is replaced by the
    constexpr member NLConGroup().
  • GrbGetIntAttrArray swallowing errors (gurobibackend.cc:707): not changed.
    The error-flag overload exists for callers that need it, and no extra
    warning is wanted here.
  • IISNLConstrForce size (gurobibackend.cc:1037): added a size check against
    NumNLCons(); a mismatch stops with an error.
  • CHANGES: rewritten as for the first release with Gurobi 14 support.
  • qp dual interval: kept for all solvers, the same expected interval.
  • Remark outside the diff: a warning is now issued when a .funcpiece...
    suffix is set on nonlinear constraints (they ignore it); use acc:_expr=0.

🤖 Generated with Claude Code

glebbelov and others added 4 commits November 16, 2026 11:15
…well

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The cases set acc:_expr=0, which the MP2NL driver cannot handle for log;
and an MP2NL run does not exercise the suffix anyway.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@glebbelov

Copy link
Copy Markdown
Contributor Author

Pushed three more commits (end2end test lists only, no driver code):

  • 6b5d945, 4aa72c3: the IIS case infeas_nl_01 (a nonlinear constraint in
    the IIS, Gurobi 14) now also runs with CPLEX, Xpress and HiGHS and with the
    same drivers under MP2NL. Xpress reports the upper side only, so N1.iis
    accepts "mem" or "upp". COPT is not run: COPT 9.0.0 has no IIS for models
    with quadratic or conic constraints and does not support mixed-integer
    exponential cones. SCIP does not report IIS of nonlinear constraints.
    ASL drivers are skipped by their tags (and fail on exp in a nonlinear
    constraint when the tags are removed).
  • 3a34ab0, d7a3eb2: the cases with the .funcpieces suffix, which now set
    acc:_expr=0, run with Gurobi only. Under MP2NL they stopped with "Set
    bounds on variables participating in logical expressions" (MP2NL itself
    cannot take acc:_expr=0 for log), and an MP2NL run does not exercise the
    suffix anyway.

Checked together with # (the two branches merged; the
only conflicts are textual, in CHANGES.gurobi.md and
iis_feasrelax/modellist.json): Gurobi 14.0.0 passes iis_feasrelax, qp,
suf_common, suf_std, warmstart, conic, mip_basis and logical; the other
drivers (including COPT 9.0.0) show no new failures against the earlier
matrix. The few remaining differences are 5 s limits and tolerances that
also occur on master.

🤖 Generated with Claude Code

@fdabrandao fdabrandao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review of the diff as it is now (read-only review; not built, tests not run). No blocking bugs found.

Checked and fine

  • GetConValues()(CG_Nonlinear) is safe: mv is non-const, so the non-const operator()(int) creates the key instead of hitting the throwing map_.at().
  • NLConstraint, NLAssignEQ/LE/GE all use GRBaddnlconstr under __GRB_NL_OBJCON__ and all go through NLConGroup(), so group order matches Gurobi's NL list order.
  • On Gurobi 14 headers __GRB_NL_OBJCON__ is always defined, so the GRBaddgenconstrNL fallback can't be mixed with CG_Nonlinear.

Suggestions

  1. Gurobi 13.9 (minor, pre-existing): with __GRB_NL_OBJCON__ set but no MP_GRB_NLCON_LIST, cons are added via GRBaddnlconstr but still classified CG_General, so ConsIIS() / .iisforce read IISGenConstr for them. Not a regression, but worth checking on 13.9 if supported.
  2. No test for .iisforce on NL constraints; the new IISNLConstrForce branch and its size check are untested.
  3. The .funcpiece* NL warning has no test; the test edits only add acc:_expr=0.
  4. funcpieceerror [1e-6, 1e6], funcpiecelength [1e-5, 1e6], funcpieces <= 2e8 now apply to all Gurobi versions; older versions may have accepted wider values. Consider gating by version.
  5. The new pdhgearlycrossover text says "default 2"; please verify against the Gurobi 14 docs.
  6. infeas_nl_01 lists 8 solvers with identical expectations (N1.iis = ["mem","upp"]); please confirm they all pass (the comment says Xpress reports the upper side only).
  7. barqcptol=1e-9 / 1e-11 in the qp tests are applied to every Gurobi version, not just 14.
  8. Nit: WarnFuncSuffixOnNLCons parameters are unused when MP_GRB_NLCON_LIST is undefined; may trigger unused-parameter warnings ([[maybe_unused]]).

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants