Skip to content

Commit

Permalink
fixed bug with objective function
Browse files Browse the repository at this point in the history
  • Loading branch information
ComboProblem committed May 10, 2024
1 parent b380794 commit fd06c70
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sage/numerical/interactive_simplex_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
from sage.rings.infinity import Infinity
from sage.rings.polynomial.polynomial_ring import polygen
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.polynomial.polynomial_element import Polynomial
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF
from sage.rings.integer_ring import ZZ
Expand Down Expand Up @@ -1852,7 +1853,7 @@ def standard_form(self, transformation=False, **kwds):
c = - c
constant_term = - constant_term
objective_name = - objective_name
kwds["objective_name"] = objective_name
kwds["objective_name"] = objective_name # algebraic object no longer a string
kwds["problem_type"] = "-max" if is_negative else "max"
kwds["is_primal"] = self.is_primal()
kwds["objective_constant_term"] = constant_term
Expand Down Expand Up @@ -2019,7 +2020,10 @@ def __init__(self, A, b, c, x="x", problem_type="max",
if objective_name is None:
objective_name = default_variable_name(
"primal objective" if is_primal else "dual objective")
self._objective_name = polygen(ZZ, objective_name)
if isinstance(objective_name, Polynomial):
self._objective_name = objective_name
else:
self._objective_name = polygen(ZZ, objective_name)

@staticmethod
def random_element(m, n, bound=5, special_probability=0.2,
Expand Down

0 comments on commit fd06c70

Please sign in to comment.