Giter Club home page Giter Club logo

Comments (2)

johnyf avatar johnyf commented on August 30, 2024

Thanks for reporting this error. This error does not arise when scipy is present and cvxopt.glpk absent. It arises with cvxopt.glpk present. Minimal example using e030e12:

In [1]: import cvxopt.glpk

In [2]: import polytope as pt

In [3]: p = pt.Polytope.from_box([[0, 1]])

In [4]: p.bounding_box
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-4-03e06b93ceaf> in <module>()
----> 1 p.bounding_box

/path/polytope/polytope/polytope.py in bounding_box(self)
    406         """
    407         if self.bbox is None:
--> 408             self.bbox = bounding_box(self)
    409         return self.bbox
    410 

/path/path/polytope/polytope/polytope.py in bounding_box(polyreg)
   1288         if sol['status'] == 0:
   1289             x = sol['x']
-> 1290             l[i] = x[i]
   1291     # upper corner
   1292     for i in xrange(0, n):

IndexError: too many indices for array

The relevant lines are polytope.polytope#L1290 and
polytope.polytope#L1299 (corresponding to lower and upper corners of the bounding box, respectively).

This bug was introduced in 79d85ec. It does not exist in 25dbe65 and appears in the merge commit 907934a. The bug is caused by a zero-dimensional array returned by the function lpsolve.

The error is introduced by the call to numpy.squeeze on line 2282. Squeezing yields a zero dimensional array when fed with an array of shape (1,):

import numpy as np

a = np.array(1)
>>> a.shape
()
>>> a.ndim
()

b = np.array([1])
>>> b.shape
(1,)

c = np.squeeze(b)
>>> c.shape
()

In other words, there is still an asymmetry between the GLPK branch and the SciPy branch of the selection statement within lpsolve. So the aim of 79d85ec has not been accomplished yet.

from polytope.

johnyf avatar johnyf commented on August 30, 2024

See also comments about bb568be.

from polytope.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.