-
-
Notifications
You must be signed in to change notification settings - Fork 655
Closed
Description
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