# Ticket #14395: trac_14395.patch

File trac_14395.patch, 1.7 KB (added by ncohen, 7 years ago)
• ## sage/numerical/mip.pyx

```# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1364835434 -7200
# Node ID 8d64e8397fcfddd103cc5c8f93319e04c991a234
# Parent  9eed6547213ea0120b727ed497db3d98d99c29c9
Bug in MixedIntegerLinearProgram.polyhedron

diff --git a/sage/numerical/mip.pyx b/sage/numerical/mip.pyx```
 a sage: P = p.polyhedron(); P A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 3 vertices and 3 rays A square (see :trac:`14395`) :: sage: p = MixedIntegerLinearProgram() sage: x,y = p['x'], p['y'] sage: p.set_min(x,None) sage: p.set_min(y,None) sage: p.add_constraint( x <= 1 ) sage: p.add_constraint( x >= -1 ) sage: p.add_constraint( y <= 1 ) sage: p.add_constraint( y >= -1 ) sage: p.polyhedron() A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 4 vertices """ from sage.geometry.polyhedron.constructor import Polyhedron from copy import copy coeffs = dict(zip(indices, values)) # Equalities if lb == ub: if (not lb is None) and lb == ub: linear_function = [] linear_function = [coeffs.get(i,0) for i in range(nvar)] linear_function.insert(0,-lb) lb, ub = b.col_bounds(i) # Fixed variable if lb == ub: if (not lb is None) and lb == ub: linear_function = copy(zero) linear_function[i] = 1 linear_function.insert(0,-lb)