Code Monkey home page Code Monkey logo

pytope's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pytope's Issues

Pip version

Hello Tor,

We've been using your library in safe-control-gym for implementing robust tube MPC among other things.
Would you mind updating the pipy package to be version 0.0.5?
We would greatly appreciate it!
There's a couple features that you added in your latest release that we need and we'd like to avoid having to git clone and pip install from source.

Obtaining H representation from vertices flips the vertices in the one dimensional case

Hi,

I realized that when defining a one-dimensional polytope via its vertices and obtaining the H representation from its V representation, the vertices will be flipped.
For example, we want to define the polytope given by the inverval $[-a,b]$, where $a,b>0$, and define a polytope based on $a$ and $b$.
Then the H representation of this polytope actually describes the polytope $[-b, a]$ and not $[-a, b]$.
Furthermore, when determining the V representation after determining the H representation, the V representation will also contain the flipped vertices.

Below I provide a code snippet to reproduce the issue, where $a=0.5$ and $b=1$.

import numpy as np
import pytope as pt # tested version 0.0.5

# define vertices for the polytope [-0.5, 1]
V= np.array([[-0.5], [1]])

# define polytope by vertices
poly = pt.Polytope(V=V)
print('Vertices describing poly before determining H rep:')
print(poly._get_V().T)
poly.determine_H_rep()
# Check if vertices are in the H representation
for i in range(len(V)):
    vertex = V[i]   
    print(f"Is vertex = {vertex[0]} in the H representation of the polytope defined by [-0.5, 1]?")
    if sum(poly.A*vertex-poly.b>0)>0:
        print("No")
# check vertices after determining the H rep
print('Vertices describing poly after determining H rep:')
print(poly._get_V().T)
# check vertices after determining both the H and V rep
poly.determine_V_rep()
print('Vertices describing poly after determining H rep and V rep:')
print(poly._get_V().T)

This code will print out "No", when we check if the vertex $1$ is in the H representation of the polytope and show that the vertices are flipped when determining the V representation after the H representation.

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.