sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.46k stars 482 forks source link

Interactive Simplex Method - inital dictionary of dual problem not being created #38933

Open ComboProblem opened 2 weeks ago

ComboProblem commented 2 weeks ago

Steps To Reproduce

I have defined an InteractiveLPProblemStandardForm P, then created the dual problem by calling the dual method, Dual = P.dual(). After that I defined the dual problem as a standard form interactive LP problem via the standard form method Dual_stand = Dual.standard_form(). Dual_stand is an instance of InteractiveLPProblemStandardForm and I call Dual_stand.initial_dictionary() to create the initial dictionary.

See attached example (ignore my spelling mistake).

Screenshot from 2024-11-06 14-43-03

Expected Behavior

Dual_stand.initial_dictionary() becomes an instance of :class:LPDictionary and succeeds.

Actual Behavior

A ValueError is raised.

ValueError: variable name '-z' is not alphanumeric

Additional Information

No response

Environment

Checklist

DaveWitteMorris commented 2 weeks ago

Here is a typed copy of the example, for anyone who wants to try to reproduce it:

A = [[-1/5, 2/5], [2/5, -1/5], [1/5, 1/5]]
b = [2, 2, 4]
c = [2, 7]
P = InteractiveLPProblemStandardForm(A, b, c)
Dual = P.dual()
Dual_stand = Dual.standard_form()
Dual_stand.initial_dictionary()