Rank: 299449 based on 0 downloads (last 30 days) and 0 file submitted
photo

Sergio

E-mail

Personal Profile:

 

Watch this Author's files

 

Comments and Ratings by Sergio View all
Updated File Comments Rating
07 Nov 2014 TCP/IP Socket Communications in MATLAB using Java Classes A simple example TCP/IP server and client using a helper Java class Author: Rodney Thomson

02 Aug 2014 Uniform distribution over a convex polytope Samples uniformly the interior of a convex polytope. Author: Tim Benham

Excellent example. Thank you very much for your kind support.

02 Aug 2014 Uniform distribution over a convex polytope Samples uniformly the interior of a convex polytope. Author: Tim Benham

Yeah, please, that would be awesome.

This function and the Truncated Multivariate Normal distribution constrained to polytopes are exactly what I was looking for!
Thank you very much.

02 Aug 2014 Truncated multivariate normal Generates pseudo-random vectors drawn from the truncated multivariate normal distribution. Author: Tim Benham

02 Aug 2014 Uniform distribution over a convex polytope Samples uniformly the interior of a convex polytope. Author: Tim Benham

Dear Tim, thanks so much for your quick answer.

Sorry for the typo, it should write
"b = rand(9,1);"

I found the reference you include in the comments very useful!
In particular, if I run the example 6.8 in the book "Handbook of Monte % Carlo Methods" by Kroese, Taimre, and Botev, then I get nice results. The following code snippet plots 2 pictures, one with points in the surface and another one with samples inside the polytope, which have been sampled with the shake-and-bake (taken from the book site http://www.maths.uq.edu.au/~kroese/montecarlohandbook/mcmc/ ) algorithm, and with the hit-and-run/achr/gibbs (all your three implementations work well) algorithms, respectively:

A = [0, 0, -1; -1, 0, 0; 1, -2, 0; 1, 2, 1];
A(4,:) = A(4,:)/sqrt(6);
A(3,:) = A(3,:)/sqrt(5);
b = [0; 0; 0; 2/sqrt(6)];
x = [1/2, 1/2, 0]'; % initial point

num_samples = 1e4;

data_sb = shake_bake_sampling(A, b, x, num_samples);
plot3(data_sb(:,1),data_sb(:,2),data_sb(:,3),'k.','MarkerSize', 10);

[data_cprnd S] = cprnd(num_samples,A,b);
figure, plot3(data_cprnd(:,1),data_cprnd(:,2),data_cprnd(:,3),'k.','MarkerSize', 10);

Nevertheless, none of these methods work well with an arbitrary polytope (e.g., random A and b).
What am I missing?
Could it happen that the random polytope is not bounded?

Thanks!

Contact us