Repository navigation
Initialize the objective sense of mps_data_model_t to minimize - #2181
rapids-bot[bot] merged 2 commits into
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
| } | ||
| } | ||
|
|
||
| TEST(mps_data_model, default_sense_is_minimize) |
There was a problem hiding this comment.
Please delete this test. We don't need such an invasive test to check default values for every struct field.
5d7997f to
f7e6646
Compare
mps_data_model_t's default constructor left maximize_ uninitialized; it is the only data member without a default member initializer. A model built through the public C++ API without an explicit set_maximize() call could therefore be solved or written to MPS as a maximization problem, depending on whatever bytes happened to be in memory. Default the sense to minimize, as data_model_view_t already does, and add a test that default-constructs the model over non-zero storage. Signed-off-by: Nicolò Angileri <nicoloangileri635@gmail.com>
As requested in review, the one-line initializer doesn't need a dedicated test. Signed-off-by: Nicolò Angileri <nicoloangileri635@gmail.com>
f7e6646 to
ba04f1f
Compare
|
/ok to test ba04f1f |
|
/merge |
CI Test Summary✅ All 21 test job(s) passed. |
Description
mps_data_model_t::maximize_is the only data member without a default member initializer, and the default constructor is= default, so a model built through the C++ API without an explicitset_maximize()call has an indeterminate objective sense.solve()copies it into the optimization problem (mps_data_model_to_optimization_problem), andmps_writer_twritesOBJSENSE MAXIMIZEwhen it happens to read as true.data_model_view_talready defaults tomaximize_{false}; this PR does the same formps_data_model_t. All internal callers (MPS/LP parsers, presolve, pseudo-costs,solve.cu) already callset_maximize(), so their behavior does not change.Checklist