Opened 6 years ago

Last modified 3 years ago

#14540 closed defect

MILP constraints do no deal with Python ints properly — at Version 9

Reported by: ncohen Owned by: ncohen
Priority: major Milestone: sage-7.2
Component: linear programming Keywords:
Cc: vbraun, dimpase, mkoeppe, vdelecroix, tscrim Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

sage: p = MixedIntegerLinearProgram()
sage: b = p.new_variable()
sage: p.add_constraint(int(1) <= b[0] + b[1] + b[2] <= int(2))
sage: p.show()
Maximization:
 
Constraints:
  x_0 + x_1 + x_2 <= 2.0
Variables:
  x_0 is a continuous variable (min=0.0, max=+oo)
  x_1 is a continuous variable (min=0.0, max=+oo)
  x_2 is a continuous variable (min=0.0, max=+oo)

Change History (9)

comment:1 Changed 6 years ago by dimpase

In a script - do you mean a Python script, not Sage script, right?

comment:2 follow-up: Changed 6 years ago by ncohen

Well, in any script that does not wrap integers with Integer(). So a .py that you load with %runfile is ok !

Nathann

comment:3 in reply to: ↑ 2 Changed 6 years ago by dimpase

Replying to ncohen:

Well, in any script that does not wrap integers with Integer(). So a .py that you load with %runfile is ok !

Nathann

and it's not only int, but float, too, that gives this problem.

comment:4 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:5 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:6 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:7 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:8 Changed 4 years ago by jdemeyer

  • Description modified (diff)
  • Milestone changed from sage-6.4 to sage-7.2
  • Summary changed from MILP constraints are silently misunderstood to MILP constraints do no deal with Python ints properly

comment:9 Changed 4 years ago by jdemeyer

  • Description modified (diff)
Note: See TracTickets for help on using tickets.