tulip-control / polytope

Geometric operations on polytopes of any dimension
https://pypi.org/project/polytope
Other
73 stars 19 forks source link

How to use cvxopt to find intersection between polytope #78

Closed mvnayagam closed 11 months ago

mvnayagam commented 1 year ago

Dear Polytope Developers and users, I am new to the polytope package. For my project, I am using the Polytope package to create polytopes and regions. I am able to create regions and plot them. In each region, I have many polytopes.

In one of the problems, I have a region(r1) with 16 polytopes and another region(r2) with 54 polytopes.

when I tried to find the intersection between these two regions, the polytope package take a very long time, even after 20 min, it did not completed and I terminated the process.

Hence I tried to import cvxopt. with

import cvxopt.glpk import cvxopt I am able to import cvxopt. But I do not know how to use it to find the intersection .

So can anyone give your comments on how to use cvxopt for set operations?

YOur answers will be more helpful

and Thanks in advance

Best regards, Muthu

necozay commented 1 year ago

The speed will not only depend on the number of regions but also on the dimension of the space your polytopes are defined in. Since you are using plotting, I assume you mainly have 2d or 3d polytopes so maybe the dimension is not an issue.

For this intersection, since the reduce operation is called for each polytope intersection, there are up to 16 times 54 LPs to be solved, which might take some time.

You can change the default solver at runtime by setting the variable default_solver in the module solvers.

To inspect which solvers were successfully installed:

from polytope import solvers
print(solvers.installed_solvers)

To set the default solver to one from the above list (e.g., scipy), try:

solvers.default_solver = 'scipy'
slivingston commented 1 year ago

@mvnayagam is your question answered? I am reviewing past issues and want to decide if they can be closed.

mvnayagam commented 11 months ago

Respected Scott, My extreme apologies for such a delayed response. Yes this problem is solved. I got required answer

Thank you once again

Thank you

Muthu

On Tue, Aug 29, 2023 at 11:49 PM Scott C. Livingston < @.***> wrote:

@mvnayagam https://github.com/mvnayagam is your question answered? I am reviewing past issues and want to decide if they can be closed.

— Reply to this email directly, view it on GitHub https://github.com/tulip-control/polytope/issues/78#issuecomment-1698191300, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYL2SD7TQK7JJHZIIEJBB33XXZPXLANCNFSM6AAAAAARFFTQ3U . You are receiving this because you were mentioned.Message ID: @.***>

-- Mit freundlichen Grüßen Dr. rer. nat. Muthu Vallinayagam Technische Universität Dresden Helmholtz Zentrum Dresden Rossendorf Ph: (+49) 151 7154 7767

mvnayagam commented 10 months ago

Respected Scott, recently I have posted two questions. Your comments on these issues will be more helpful to me in my research work.

my questions are :

  1. does the polytope package offer an elegant way to combine many polytopes into a single polytope? I have a collection of polytopes, assuming up to 20, they all are touching or partially intersecting each other. if so, I want to combine all of them to form a single polytope. Now solve this problem as follows:

I create an array with the extreme points of each polytope. then using pc.qhull i create new polytope.

  1. Is this the correct method?
  2. Is it possible to get always a convex polytope with this method?
  3. How to delete interior points in this method?

your comments are highly appreciated

thank you

On Tue, Aug 29, 2023 at 11:49 PM Scott C. Livingston < @.***> wrote:

@mvnayagam https://github.com/mvnayagam is your question answered? I am reviewing past issues and want to decide if they can be closed.

— Reply to this email directly, view it on GitHub https://github.com/tulip-control/polytope/issues/78#issuecomment-1698191300, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYL2SD7TQK7JJHZIIEJBB33XXZPXLANCNFSM6AAAAAARFFTQ3U . You are receiving this because you were mentioned.Message ID: @.***>

-- Mit freundlichen Grüßen Dr. rer. nat. Muthu Vallinayagam Technische Universität Dresden Helmholtz Zentrum Dresden Rossendorf Ph: (+49) 151 7154 7767