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

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jan 6, 2023
1 parent a1d1ca4 commit 3bad25c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/sage/numerical/mip.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ cdef class MIPVariable(FiniteFamily_base):
cdef object _lower_bound
cdef object _upper_bound
cdef object _backend_variable_value_method
cdef object _tolerance
cdef object _generators
cdef _matrix_rmul_impl(self, m)
cdef _matrix_lmul_impl(self, m)

Expand Down
11 changes: 9 additions & 2 deletions src/sage/numerical/mip.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,10 @@ cdef class MixedIntegerLinearProgram(SageObject):
c = {k: get_backend_variable_value(self, v, tolerance)
for (k,v) in l.items()}
else:
c = l._backend_variable_value_method(
get = l._backend_variable_value_method
c = sum(get(self, v, l._tolerance) * l._generators[k]
for (k,v) in l.items()) ### parent's zero?

val.append(c)
elif isinstance(l, list):
if len(l) == 1:
Expand Down Expand Up @@ -3337,7 +3340,8 @@ cdef class MIPVariable(FiniteFamily_base):
self._lower_bound = lower_bound
self._upper_bound = upper_bound
self._name = name
self._backend_variable_value_method = mip._backend_variable_value_method
self._backend_variable_value_method = mip._backend_variable_value_method(convert, tolerance)
self._tolerance = tolerance
if components is not None:
if indices is not None:
self._dict = dict(zip(indices, components))
Expand All @@ -3348,6 +3352,9 @@ cdef class MIPVariable(FiniteFamily_base):
for i in indices:
self[i] # creates component
self._keys = indices
if generators is not None:
generators = Family(generators)
self._generators = generators

def __copy__(self):
r"""
Expand Down

0 comments on commit 3bad25c

Please sign in to comment.