Skip to content

Commit

Permalink
Trac #20296: MixedIntegerLinearProgram: New backend using Interactive…
Browse files Browse the repository at this point in the history
…LPProblem

If one has to solve a small LP with irrational (say, `AA`) data (and
needs access to the exact solution), the only available tool is the
didactical implementation of the simplex method in
`InteractiveLPProblem` (but see #18735). This ticket implements a
`MixedIntegerLinearProgram` backend using `InteractiveLPProblem`.

Example:
{{{
            sage: poly = polytopes.dodecahedron(base_ring=AA)
            sage: lp = poly.to_linear_program(solver='InteractiveLP')
            sage: b = lp.get_backend()
            sage: b.set_objective([1, 1, 1])
            sage: lp.solve()
            2.291796067500631?
}}}
(This example uses backend functions because of #20301; and the
`base_ring=AA` is there because of #13041.)

URL: http://trac.sagemath.org/20296
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Andrey Novoseltsev, Dima Pasechnik
  • Loading branch information
Release Manager authored and vbraun committed Apr 6, 2016
2 parents 378801d + 8c1fd4a commit 9ddd231
Show file tree
Hide file tree
Showing 9 changed files with 1,489 additions and 46 deletions.
3 changes: 3 additions & 0 deletions src/module_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,9 @@ def uname_specific(name, value, alternative):
Extension("sage.numerical.backends.glpk_graph_backend",
["sage/numerical/backends/glpk_graph_backend.pyx"]),

Extension("sage.numerical.backends.interactivelp_backend",
["sage/numerical/backends/interactivelp_backend.pyx"]),

OptionalExtension("sage.numerical.backends.gurobi_backend",
["sage/numerical/backends/gurobi_backend.pyx"],
libraries = ["stdc++", "gurobi"],
Expand Down
2 changes: 1 addition & 1 deletion src/sage/numerical/backends/coin_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ cdef class CoinBackend(GenericBackend):
INPUT:
- ``indices`` (list of integers) -- this list constains the
- ``indices`` (list of integers) -- this list contains the
indices of the constraints in which the variable's
coefficient is nonzero
Expand Down
2 changes: 1 addition & 1 deletion src/sage/numerical/backends/generic_backend.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ cdef class GenericBackend:

cdef object obj_constant_term

cpdef GenericBackend get_solver(constraint_generation = ?, solver = ?)
cpdef GenericBackend get_solver(constraint_generation = ?, solver = ?, base_ring = ?)
139 changes: 100 additions & 39 deletions src/sage/numerical/backends/generic_backend.pyx

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions src/sage/numerical/backends/interactivelp_backend.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
##############################################################################
# Copyright (C) 2010 Nathann Cohen <nathann.cohen@gmail.com>
# Copyright (C) 2016 Matthias Koeppe <mkoeppe@math.ucdavis.edu>
# Distributed under the terms of the GNU General Public License (GPL)
# The full text of the GPL is available at:
# http://www.gnu.org/licenses/
##############################################################################

from sage.numerical.backends.generic_backend cimport GenericBackend

cdef class InteractiveLPBackend(GenericBackend):

cdef object lp
cdef object row_names
cdef object prob_name

cdef object lp_std_form
cdef object final_dictionary
cdef int verbosity

cpdef dictionary(self)

cpdef interactive_lp_problem(self)
Loading

0 comments on commit 9ddd231

Please sign in to comment.