Opened 5 years ago
Closed 5 years ago
#20337 closed enhancement (fixed)
MIP: Several fixes regarding constant terms in the objective function
Reported by: | mkoeppe | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-7.2 |
Component: | numerical | Keywords: | lp |
Cc: | dimpase, vdelecroix, jdemeyer | Merged in: | |
Authors: | Matthias Koeppe | Reviewers: | Dima Pasechnik |
Report Upstream: | N/A | Work issues: | |
Branch: | ad40508 (Commits, GitHub, GitLab) | Commit: | ad40508934049090580c678ec4249588273b43cf |
Dependencies: | Stopgaps: |
Description (last modified by )
Contrary to documentation, one cannot set a constantly zero objective function by passing 0 to set_objective
.
sage: p = MixedIntegerLinearProgram(maximization=True) sage: x = p.new_variable(nonnegative=True) sage: p.set_objective(0) AttributeError: 'sage.rings.integer.Integer' object has no attribute 'dict'
This ticket fixes that and actually allows any field number (which ends up in the obj_constant_term
).
Moreover, the backend slot obj_constant_term
is accessed directly by MixedIntegerLinearProgram.show
; it should instead be exposed by a backend method, which this ticket adds as well.
Finally, the show
method added an extraneous blank line when a nonzero obj_constant_term
was present. Fixed and doctest added.
Change History (8)
comment:1 Changed 5 years ago by
- Branch set to u/mkoeppe/mip_backends__obj_constant_term_should_be_exposed_by_a_backend_method
comment:2 Changed 5 years ago by
- Commit set to ad40508934049090580c678ec4249588273b43cf
- Description modified (diff)
- Status changed from new to needs_review
- Summary changed from MIP backends: obj_constant_term should be exposed by a backend method to MIP: Several fixes regarding constant terms in the objective function
comment:3 Changed 5 years ago by
do all backends support this? how do we know?
comment:4 Changed 5 years ago by
Objective constant terms are already part of the backend interface.
#20323 addresses the issue of making the testing of backends more rigorous.
comment:5 Changed 5 years ago by
- Reviewers set to Dima Pasechnik
- Status changed from needs_review to positive_review
ok.
comment:7 Changed 5 years ago by
- Status changed from needs_work to positive_review
comment:8 Changed 5 years ago by
- Branch changed from u/mkoeppe/mip_backends__obj_constant_term_should_be_exposed_by_a_backend_method to ad40508934049090580c678ec4249588273b43cf
- Resolution set to fixed
- Status changed from positive_review to closed
New commits:
objective_constant_term: New MIP backend method
MixedIntegerLinearProgram.show: Remove extraneous blank line when objective constant term is nonzero; add doctest
MixedIntegerLinearProgram.set_objective: Accept constants as objective