A MIPVariable's repr should include some useful information
sage: p = MixedIntegerLinearProgram(solver="glpk")
sage: bar = p.new_variable(name="bar")
sage: bar
MIPVariable of dimension 1
sage: bar[0]
x_0
sage: bar
MIPVariable of dimension 1
sage: bar[1]
x_1
sage: bar
MIPVariable of dimension 1
sage: p.solve()
0.0
sage: bar.values()
[x_0, x_1]
sage: p.get_values(bar)
{0: 0.0, 1: 0.0}
I think the print method should instead of "dimension 1" (which apparently means tensor order 1, rather than dimension 1  see #17643) print some useful information, such as the name of the variable and the dimension (number of components).
MIPVariable bar with 7 binary components
MIPVariable bar with 5 real components, >= 0, <= 17
Change History (13)
Cc: 
Dima Pasechnik Vincent Delecroix Jeroen Demeyer added

Description: 
modified (diff)

Description: 
modified (diff)

Description: 
modified (diff)

Summary: 
MIPVariable misreports its dimension (always 1) →
A MIPVariable's repr should include some useful information

Type: 
defect →
enhancement

Cc: 
Yuan Zhou added

Milestone: 
sage7.2 →
sage9.4

Description: 
modified (diff)

Description: 
modified (diff)

Branch: 
→ u/yzh/a_mipvariable_s_repr_should_include_some_useful_information

Authors: 
→ Yuan Zhou

Commit: 
→ dbe38b2c6a92cc470de5607d418113c6ef91fbe6

Status: 
new →
needs_review

Commit: 
dbe38b2c6a92cc470de5607d418113c6ef91fbe6 →
b2b9b366970d9a7aaa25ddfdfab6ef467f412342

Reviewers: 
→ Matthias Koeppe

Status: 
needs_review →
positive_review

Branch: 
u/yzh/a_mipvariable_s_repr_should_include_some_useful_information →
b2b9b366970d9a7aaa25ddfdfab6ef467f412342

Resolution: 
→ fixed

Status: 
positive_review →
closed

New commits:
change MIPVariable's repr to include useful info