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

Commit

Permalink
Flip the constant term sign when converting min problems to standard …
Browse files Browse the repository at this point in the history
…form.
  • Loading branch information
novoselt committed Apr 11, 2016
1 parent 78d0e78 commit 7145f7d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sage/numerical/interactive_simplex_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,14 +1781,16 @@ def standard_form(self, transformation=False, **kwds):
objective_name = SR(kwds.get("objective_name", default_variable_name(
"primal objective" if self.is_primal() else "dual objective")))
is_negative = self._is_negative
constant_term = self._constant_term
if self._problem_type == "min":
is_negative = not is_negative
c = - c
constant_term = - constant_term
objective_name = - objective_name
kwds["objective_name"] = objective_name
kwds["problem_type"] = "-max" if is_negative else "max"
kwds["is_primal"] = self.is_primal()
kwds["objective_constant_term"] = self._constant_term
kwds["objective_constant_term"] = constant_term
P = InteractiveLPProblemStandardForm(A, b, c, x, **kwds)
f = P.c().parent().hom(f, self.c().parent())
return (P, f) if transformation else P
Expand Down

0 comments on commit 7145f7d

Please sign in to comment.