Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
add_row: Use @abstract_method
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 12, 2016
1 parent b7d61fc commit 34f22ab
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions src/sage/numerical/interactive_simplex_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -2781,14 +2781,42 @@ def _repr_(self):
"""
return "LP problem dictionary (use typeset mode to see details)"

def add_row(self):
@abstract_method
def add_row(self, nonbasic_coefficients,
constant, slack_variable):
r"""
Update a dictionary with an additional row based on a given dictionary.
Return a dictionary with an additional row based on a given dictionary.
INPUT:
- ``nonbasic_coefficients``-- a list of the coefficients for the
new row
- ``constant``-- a number of the constant term for the new row
- ``slack_variable``-- a string of the name for the new slack variable
OUTPUT:
- a :class:`dictionary <LPDictionary>`
See :meth:`add_row` in :class:`LPDictionary` and
:class:`LPRevisedDictionary` for documentation.
EXAMPLES::
sage: A = ([-1, 1, 7], [8, 2, 13], [34, 17, 12])
sage: b = (2, 17, 6)
sage: c = (55/10, 21/10, 14/30)
sage: P = InteractiveLPProblemStandardForm(A, b, c)
sage: D = P.dictionary("x1", "x2", "x4")
sage: D1 = D.add_row([7, 11, 19], 42, 'c')
sage: D1.row_coefficients("c")
(7, 11, 19)
sage: set(D1.constant_terms()).symmetric_difference(
....: set(D.constant_terms()))
{42}
sage: set(D1.basic_variables()).symmetric_difference(
....: set(D.basic_variables()))
{c}
"""
raise NotImplementedError

def base_ring(self):
r"""
Expand Down

0 comments on commit 34f22ab

Please sign in to comment.