Opened 11 years ago

Last modified 11 years ago

#10341 closed enhancement

make MIP backend interface more Python-ic — at Version 3

Reported by: malb Owned by: ncohen
Priority: major Milestone: sage-4.6.2
Component: linear programming Keywords: LP, MIP
Cc: ncohen Merged in:
Authors: Martin Albrecht, Nathann Cohen Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by ncohen)

Sage 4.6.1 will contain a new set of backend classes for mixed integer programming, which will make it easier to write interfaces for other solvers. There has been some off-list discussion about this interface and the follow changes were agreed upon:

  • :func: add_linear_constraint should allow lb and ub instead of direction and one bound, it's more expressive.
  • :func:add_variable should return the index of the newly created variable instead of the next index.
  • change :func:add_linear_constraint to accept any iterable of the form [(c,v) ...]
  • min and max should be lower bound (or lb) and upper bound (or ub) to conform to MIP conventions
  • allow parameters in :func:add_variable

The patches are to be applied in this order:

  • mip_interface_changes.patch
  • trac_10431-part2.patch

Change History (5)

Changed 11 years ago by malb

comment:1 Changed 11 years ago by malb

  • Status changed from new to needs_work

The attached patch makes the necessary changes to the GenericBackend? and the GLPK class. Coin and CPLEX are not done yet.

comment:2 Changed 11 years ago by ncohen

  • Status changed from needs_work to needs_review

And here are the modifications to CPLEX and Coin. The doctests pass, plus all the methods of Graph/Digraph/GenericGraph? pass with both GLPK, Coin and CPLEX.

I agreed with you patch almost everywhere ! The only modification I made is the "constraints" argument you had placed in the add_constraint method. I really didn't get why you picked this name. I made it "coefficients", as the pairs are actually the coefficient of the sparse matrix, but of course we can discuss it during the review :-)


Changed 11 years ago by ncohen

comment:3 Changed 11 years ago by ncohen

  • Authors changed from Martin Albrecht to Martin Albrecht, Nathann Cohen
  • Description modified (diff)
Note: See TracTickets for help on using tickets.