tulip-control / polytope

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

polytope volume changing on each trial #81

Closed mvnayagam closed 11 months ago

mvnayagam commented 1 year ago

Dear Developers & users, recently I face an issue with polytope. I use jupyter notebook for all calculations here is an example: a=np.array([ [ 0.57735,-0.57735, -0.57735], [-0.57735,-0.57735, 0.57735], [ 0.57735, 0.57735, -0.57735], [ 0. , 0. , 1. ], [-0.57735, 0.57735, 0.57735], [-0. ,-0. , -1. ]]) b = np.array([[-0.0241 , -0.19315 , 0.20914, 0.16667, 0.03683 ,-0.125 ]])

s=pc.Polytope(da,db)

print(" Volume is : ", s.volume)

executing the cell prints volume. "Volume is : 1.3701285938484307e-05"

again if I execute the cell then I get a different volume value. Executing for the second time print "Volume is : 1.2551849198678577e-05"

on third Execution: " Volume is : 1.3241511242562017e-05 "

every time the value is changing. what causes this issue in polytope pacakage ?

Though the values are small, I do not expect different volumes for the same polytope defined using the same "a & b".

Looking forward to your suggestions

thank you


Best regards, Muthu TU Feriberg, Feriberg, Germany

mvnayagam commented 1 year ago

following my previous post, i checked extreme points for the same polytope. the extreme points are also changing on first trial :

Volume is : 1.2873691485824182e-05 pc.extreme(s) is [[0.31307 0.18814 0.16667] [0.30205 0.19917 0.16667] [0.2714 0.18814 0.125 ] [0.26038 0.19917 0.125 ] [0.32692 0.20199 0.16667] [0.31589 0.21302 0.16667] [0.28525 0.20199 0.125 ] [0.27422 0.21302 0.125 ]]

on second trial: Volume is : 1.220701817673686e-05 pc.extreme(s) is [[0.2714 0.18814 0.125 ] [0.26038 0.19917 0.125 ] [0.31307 0.18814 0.16667] [0.30205 0.19917 0.16667] [0.28525 0.20199 0.125 ] [0.27422 0.21302 0.125 ] [0.32692 0.20199 0.16667] [0.31589 0.21302 0.16667]]

necozay commented 1 year ago

Volume algorithm in the polytope package is a randomized (sampling based) algorithm that aims to approximate the volume. It is neither exact nor deterministic. More details here: https://github.com/tulip-control/polytope/issues/69#issuecomment-849696661