Giter Site home page Giter Site logo

Comments (2)

stephane-caron avatar stephane-caron commented on June 19, 2024

Yes, compute_polytope_vertices won't work well with tight constraints such as the equality constraint you have formulated this way. If we relax the equality constraint a bit it will find a solution:

import pypoman
import numpy as np

# Original problem
A_1 = np.array([[-1, -1, -1], [1, 1, 1], [-1, 0, 0], [1, 0, 0], [0, -1, 0],
                [0, 1, 0], [0, 0, -1], [0, 0, 1], [1, 0, 0]])
b_1 = np.array([-1, 1, -0.0001, 0.4999, -0.0001, 0.4999, -0.0001, 0.4999,
                0.4999])
print("{} vertices".format(len(pypoman.compute_polytope_vertices(A_1, b_1))))

# Add new variable
A_2 = np.hstack([[[-1], [1], [0], [0], [0], [0], [0], [0], [1]], A_1])
b_2 = b_1

# Add (relaxed) constraint that new variable is == 0
epsilon = 1e-3
A_2 = np.vstack([A_2, [[-1, 0, 0, 0], [1, 0, 0, 0]]])
b_2 = np.hstack([b_2, epsilon, epsilon])
print("{} vertices".format(len(pypoman.compute_polytope_vertices(A_2, b_2))))

For me conversion of the second problem works down to epsilon = 1e-4, and starts to fail around epsilon = 1e-5.

For equality constraints, you could switch to pycddlib directly and use the linear set lin_set of equality-constraint generators. I'm not actively developing pypoman any more, but I'd be glad to merge a PR adding this feature to it as well 😉

from pypoman.

stephane-caron avatar stephane-caron commented on June 19, 2024

Closing this issue now, feel free to re-open for further discussion.

from pypoman.

Related Issues (7)

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.