Skip to content

Commit dfebda3

Browse files
Release Managervbraun
Release Manager
authored andcommitted
Trac #20874: LPAbstractDictionary: Add objective_name method
This ticket completes the `LPAbstractDictionary` interface by providing an `objective_name` accessor. URL: https://trac.sagemath.org/20874 Reported by: mkoeppe Ticket author(s): Aedi Wang Reviewer(s): Andrey Novoseltsev
2 parents bd9a9fb + 288e6f7 commit dfebda3

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

src/sage/numerical/interactive_simplex_method.py

+60
Original file line numberDiff line numberDiff line change
@@ -3166,6 +3166,26 @@ def objective_coefficients(self):
31663166
(10, 5)
31673167
"""
31683168

3169+
@abstract_method
3170+
def objective_name(self):
3171+
r"""
3172+
Return the objective name of ``self``.
3173+
3174+
OUTPUT:
3175+
3176+
- a symbolic expression
3177+
3178+
EXAMPLES::
3179+
3180+
sage: A = ([1, 1], [3, 1])
3181+
sage: b = (1000, 1500)
3182+
sage: c = (10, 5)
3183+
sage: P = InteractiveLPProblemStandardForm(A, b, c)
3184+
sage: D = P.initial_dictionary()
3185+
sage: D.objective_name()
3186+
z
3187+
"""
3188+
31693189
@abstract_method
31703190
def objective_value(self):
31713191
r"""
@@ -3983,6 +4003,26 @@ def objective_coefficients(self):
39834003
"""
39844004
return self._AbcvBNz[2]
39854005

4006+
def objective_name(self):
4007+
r"""
4008+
Return the objective name of ``self``.
4009+
4010+
OUTPUT:
4011+
4012+
- a symbolic expression
4013+
4014+
EXAMPLES::
4015+
4016+
sage: A = ([1, 1], [3, 1])
4017+
sage: b = (1000, 1500)
4018+
sage: c = (10, 5)
4019+
sage: P = InteractiveLPProblemStandardForm(A, b, c)
4020+
sage: D = P.initial_dictionary()
4021+
sage: D.objective_name()
4022+
z
4023+
"""
4024+
return self._AbcvBNz[6]
4025+
39864026
def objective_value(self):
39874027
r"""
39884028
Return the value of the objective at the
@@ -4932,6 +4972,26 @@ def objective_coefficients(self):
49324972
"""
49334973
return self.c_N() - self.y() * self.A_N()
49344974

4975+
def objective_name(self):
4976+
r"""
4977+
Return the objective name of ``self``.
4978+
4979+
OUTPUT:
4980+
4981+
- a symbolic expression
4982+
4983+
EXAMPLES::
4984+
4985+
sage: A = ([1, 1], [3, 1])
4986+
sage: b = (1000, 1500)
4987+
sage: c = (10, 5)
4988+
sage: P = InteractiveLPProblemStandardForm(A, b, c)
4989+
sage: D = P.revised_dictionary()
4990+
sage: D.objective_name()
4991+
z
4992+
"""
4993+
return self.problem().objective_name()
4994+
49354995
def objective_value(self):
49364996
r"""
49374997
Return the value of the objective at the basic solution of ``self``.

0 commit comments

Comments
 (0)