sagemath / sage-numerical-backends-gurobi

Gurobi mixed integer linear programming backend for SageMath. Source repository for https://pypi.org/project/sage-numerical-backends-gurobi/, can be installed on top of distributions providing SageMath. See also https://github.com/sagemath/sage-numerical-backends-cplex and https://github.com/sagemath/sage-numerical-backends-coin
GNU General Public License v2.0
7 stars 6 forks source link

incorrect printing of variable indices with Gurobi 10.0.3 #9

Open dimpase opened 9 months ago

dimpase commented 9 months ago
          You can also test installed  Gurobi backend in SAGE_ROOT, by running
./sage -tp src/sage/numerical/

which works for me. What doesn't quite work is the only other place that tests with Gurobi (if available):

sage -t --warn-long 53.9 --random-seed=148439558831923248819587417992715184495 src/sage/combinat/matrices/dancing_links.pyx
**********************************************************************
File "src/sage/combinat/matrices/dancing_links.pyx", line 1038, in sage.combinat.matrices.dancing_links.dancing_linksWrapper.to_milp
Failed example:
    p.show()                                                              # needs sage.numerical.mip
Expected:
    Maximization:
    <BLANKLINE>
    <BLANKLINE>
    Constraints:...
      one 1 in 0-th column: 1.0 <= x_0 + x_1 <= 1.0
      one 1 in 1-th column: 1.0 <= x_0 + x_2 <= 1.0
      one 1 in 2-th column: 1.0 <= x_0 + x_1 <= 1.0
      one 1 in 3-th column: 1.0 <= x_3 <= 1.0
    Variables:
      x_0 is a boolean variable (min=0.0, max=1.0)
      x_1 is a boolean variable (min=0.0, max=1.0)
      x_2 is a boolean variable (min=0.0, max=1.0)
      x_3 is a boolean variable (min=0.0, max=1.0)
Got:
    Maximization:
    <BLANKLINE>
    <BLANKLINE>
    Constraints:
      one 1 in 0-th column: 1.0 <= x_ + x_ <= 1.0
      one 1 in 1-th column: 1.0 <= x_ + x_ <= 1.0
      one 1 in 2-th column: 1.0 <= x_ + x_ <= 1.0
      one 1 in 3-th column: 1.0 <= x_ <= 1.0
    Variables:
      x_ = x_0 is a boolean variable (min=0.0, max=1.0)
      x_ = x_1 is a boolean variable (min=0.0, max=1.0)
      x_ = x_2 is a boolean variable (min=0.0, max=1.0)
      x_ = x_3 is a boolean variable (min=0.0, max=1.0)
**********************************************************************
1 item had failures:
   1 of   8 in sage.combinat.matrices.dancing_links.dancing_linksWrapper.to_milp
    [244 tests, 1 failure, 4.10 s]
----------------------------------------------------------------------
sage -t --warn-long 53.9 --random-seed=148439558831923248819587417992715184495 src/sage/combinat/matrices/dancing_links.pyx  # 1 doctest failed

So something is weird with printing constraints (no index!):

...
one 1 in 3-th column: 1.0 <= x_ <= 1.0
...

Originally posted by @dimpase in https://github.com/sagemath/sage-numerical-backends-gurobi/issues/8#issuecomment-1812895875