Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit b922d16

Browse files
author
Frédéric Chapoton
committed
trac 20766 correcting the code
1 parent d3a0a1b commit b922d16

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/sage/geometry/lattice_polytope.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -6292,19 +6292,19 @@ def positive_integer_relations(points):
62926292
a = nonpivot_relations.stack(a).transpose()
62936293
# a = sage_matrix_to_maxima(a)
62946294
# maxima.load("simplex")
6295-
MIP = MixedIntegerLinearProgram(maximization=False)
6296-
w = MIP.new_variable(integer=True, nonnegative=True)
62976295
new_relations = []
62986296
for i in range(n_nonpivots):
62996297
# Find a non-negative linear combination of relations,
63006298
# such that all components are non-negative and the i-th one is 1
6299+
MIP = MixedIntegerLinearProgram(maximization=False)
6300+
w = MIP.new_variable(integer=True, nonnegative=True)
63016301
b = vector([0] * i + [1] + [0] * (n_nonpivots - i - 1))
6302-
c = [0] * (n + i) + [1] + [0] * (n_nonpivots - i - 1)
63036302
MIP.add_constraint(a * w == b)
6303+
c = [0] * (n + i) + [1] + [0] * (n_nonpivots - i - 1)
63046304
MIP.set_objective(sum(ci * w[i] for i, ci in enumerate(c)))
63056305
# x = maxima.linear_program(a, b, c)
63066306
MIP.solve()
6307-
x = MIP.get_values(w).values()[:n]
6307+
x = [ZZ(k) for k in MIP.get_values(w).values()[:n]]
63086308
# x = x.sage()[0][:n]
63096309
v = relations.linear_combination_of_rows(x)
63106310
new_relations.append(v)
@@ -6315,7 +6315,7 @@ def positive_integer_relations(points):
63156315
for j in range(n):
63166316
coef = relations[j,nonpivots[i]]
63176317
if coef < 0:
6318-
relations.add_multiple_of_row(j, n+i, -coef)
6318+
relations.add_multiple_of_row(j, n + i, -coef)
63196319
# Get a new basis
63206320
relations = relations.matrix_from_rows(relations.transpose().pivots())
63216321
# Switch to integers

0 commit comments

Comments
 (0)