Opened 7 years ago

Closed 7 years ago

#20301 closed defect (fixed)

Polyhedron.to_linear_program should return the MIP variable used

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-7.2
Component: geometry Keywords:
Cc: Nathann Cohen, Volker Braun, Vincent Delecroix, Frédéric Chapoton, Dima Pasechnik, Jeroen Demeyer Merged in:
Authors: Matthias Koeppe Reviewers: Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: 280ba21 (Commits, GitHub, GitLab) Commit: 280ba21e94f1cf40631b8b49c9e898f4a4d052f1
Dependencies: Stopgaps:

Status badges

Description

#18815 introduced Polyhedron.to_linear_program -- but there's very little one can do with it. To

  • set an objective other than the default 0;
  • access an optimal solution vector after solving,

one needs the MIP variable (x in the code of to_linear_program). Currently the only way to do anything is by using the MIP backend.

I would propose to return x as a second return value, but this of course changes the interface.

Change History (9)

comment:1 Changed 7 years ago by Dima Pasechnik

well, you may have a parameter governing what you return, and defaulting to not returning x, then the interface is not changed, it is extended (i.e. no need to deprecate anything etc etc).

   def to_linear_program(self, solver=None, return_variable=False):
       ...

comment:2 Changed 7 years ago by Matthias Köppe

Branch: u/mkoeppe/polyhedron_to_linear_program_should_return_the_mip_variable_used

comment:3 Changed 7 years ago by Matthias Köppe

Commit: 280ba21e94f1cf40631b8b49c9e898f4a4d052f1
Status: newneeds_review

OK, I've followed your suggestion. Needs review.


New commits:

280ba21Polyhedron.to_linear_program: Optional argument return_variable

comment:4 Changed 7 years ago by Matthias Köppe

Authors: Matthias Koeppe

comment:5 Changed 7 years ago by Matthias Köppe

Cc: Jeroen Demeyer added

comment:6 Changed 7 years ago by Dima Pasechnik

Status: needs_reviewpositive_review

looks good to me.

comment:7 Changed 7 years ago by Volker Braun

Status: positive_reviewneeds_work

Reviewer name is missing

comment:8 Changed 7 years ago by Dima Pasechnik

Reviewers: Dima Pasechnik
Status: needs_workpositive_review

comment:9 Changed 7 years ago by Volker Braun

Branch: u/mkoeppe/polyhedron_to_linear_program_should_return_the_mip_variable_used280ba21e94f1cf40631b8b49c9e898f4a4d052f1
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.