cvxgrp / ncvx

GNU General Public License v3.0
74 stars 17 forks source link

ncvx/examples/circle_packing.py - "TypeError: ABCMeta object argument after * must be an iterable, not numpy.int64" #8

Closed Shuvomoy closed 6 years ago

Shuvomoy commented 6 years ago

I am trying to run the circle_packing.py example (located in ncvx/examples/). My python is 2.7, cvxpy is 1.0.8 and I believe all other packages are up to date. To make the code compatible with cvxpy 1.0.8, I have changed: objective = cp.Minimize(cp.max_elemwise( *(x_vals + y_vals) ) + 0.5) to objective = cp.Minimize(cp.maximum( *(x_vals + y_vals) ) + 0.5)

However, while running the circle_packing.py I am getting the following error:

TypeError                                 Traceback (most recent call last)
<ipython-input-9-2615d25cb940> in <module>()
      3     for j in range(i+1,N):
      4         t = cp.Variable()
----> 5         diff_vars.append(ncvx.Annulus(2, 0.5 * (r[i]+r[j]), N))
      6         constraints += [
      7             cp.vstack(x_vals[i] - x_vals[j],

/home/shuvomoy/anaconda2/lib/python2.7/site-packages/ncvx/annulus.pyc in __init__(self, rows, r, R, *args, **kwargs)
     28         self.R = R
     29         assert 0 < r <= R
---> 30         super(Annulus, self).__init__(rows, 1, *args, **kwargs)
     31 
     32     def _project(self, matrix):

/home/shuvomoy/anaconda2/lib/python2.7/site-packages/ncvx/noncvx_variable.pyc in __init__(self, *args, **kwargs)
     28         super(NonCvxVariable, self).__init__(*args, **kwargs)
     29         self.noncvx = True
---> 30         self.z = cvxpy.Parameter(*self.size)
     31         self.u = cvxpy.Parameter(*self.size)
     32         self.u.value = np.zeros(self.size)

TypeError: ABCMeta object argument after * must be an iterable, not numpy.int64

Any help in fixing the issue will be much appreciated.

Shuvomoy commented 6 years ago

I am closing this one, as none of the examples actually runs with the latest version of CVXPY and NCVX. Please see the new issue: None of the examples in ncvx/examples that use NC-ADMM run properly .

jamesdvance commented 6 years ago

I'm catching this exact same error. Code worked with previous install (~ March 2018)