Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIP: Several fixes regarding constant terms in the objective function #20337

Closed
mkoeppe opened this issue Mar 31, 2016 · 11 comments
Closed

MIP: Several fixes regarding constant terms in the objective function #20337

mkoeppe opened this issue Mar 31, 2016 · 11 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 31, 2016

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.

CC: @dimpase @videlec @jdemeyer

Component: numerical

Author: Matthias Koeppe

Branch/Commit: ad40508

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/20337

@mkoeppe mkoeppe added this to the sage-7.2 milestone Mar 31, 2016
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 2, 2016

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 2, 2016

New commits:

62a4da0objective_constant_term: New MIP backend method
edb9d7fMixedIntegerLinearProgram.show: Remove extraneous blank line when objective constant term is nonzero; add doctest
ad40508MixedIntegerLinearProgram.set_objective: Accept constants as objective

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 2, 2016

Commit: ad40508

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title MIP backends: obj_constant_term should be exposed by a backend method MIP: Several fixes regarding constant terms in the objective function Apr 2, 2016
@dimpase
Copy link
Member

dimpase commented Apr 3, 2016

comment:3

do all backends support this? how do we know?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 3, 2016

comment:4

Objective constant terms are already part of the backend interface.

#20323 addresses the issue of making the testing of backends more rigorous.

@dimpase
Copy link
Member

dimpase commented Apr 3, 2016

comment:5

ok.

@dimpase
Copy link
Member

dimpase commented Apr 3, 2016

Reviewer: Dima Pasechnik

@vbraun
Copy link
Member

vbraun commented Apr 3, 2016

comment:6

Author name

@dimpase
Copy link
Member

dimpase commented Apr 3, 2016

Author: Matthias Koeppe

@vbraun
Copy link
Member

vbraun commented Apr 5, 2016

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

No branches or pull requests

3 participants