Search Comments and Ratings

go

   
Date File Comment by Comment 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 Sergio

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

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 Sergio

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 Sergio

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

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!

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

Hi,
this function seems what I was looking for, but it displays the following error:
"Error using * Inner matrix dimensions must agree.
Error in cprnd (line 238)
y = y + (tmin+(tmax-tmin)*rand)*e;"

I am trying a very simple code snippet:
A = rand(9,8);
b = rand(9,8);
samples = cprnd(num_samples,A,b);

Please, could you help me to debug it?
Thanks!

20 Feb 2012 Bindings to Course Coding (tile coding) for Reinfocement Learning. Matlab bindings to C code for Course Coding. Author: Nick Birnie Sergio

I have followed these instructions to surmount the gcc version: http://askubuntu.com/questions/75012/how-do-i-install-gcc-4-3

But running in Matlab:

variables = 0.25*ones(4,1);
numTilings = 32;
memorySize = 4^4*numTilings;
tiles = getTiles(variables, numTilings, memorySize)

it outuputs this error:
??? Attempted to access getTiles__rndseq__(449); index out of bounds because
numel(getTiles__rndseq__)=1.

Error in ==> getTiles>hashCoordinates at 70
sum = sum + getTiles__rndseq__(floor(index));

Error in ==> getTiles at 50
tiles(i) = hashCoordinates(coordinates,memorySize);

Indeed getTiles__rndseq__is a scalar equal -1.4845e+09.

Does it make any sense?

20 Feb 2012 Bindings to Course Coding (tile coding) for Reinfocement Learning. Matlab bindings to C code for Course Coding. Author: Nick Birnie Sergio

Hi, I am sorry, but I have not figured how to use your Tile Coding functions. I am able to compile the c file and get the mexa64.

However I do not understand well how to use it. I am lacking some understanding of the input variables.

For instance, where do I set the width of the tiles, perhaps indirectly based on the number of tilings and the total number of tiles?
Where do I set the range of values to grid?
Can I set the displacement vector?
How can avoid hashing if my system is plenty of memory but I want to increase speed?

Thank you very much in advance!!!

22 Mar 2011 Graph adjacency matrix to incidence matrix Conversion from graph adjacency matrix to incidence matrix. Author: Ondrej Sergio

Oops! Forget my latter question :-)

22 Mar 2011 Graph adjacency matrix to incidence matrix Conversion from graph adjacency matrix to incidence matrix. Author: Ondrej Sergio

Please, how could I modify it in order to contain +1 and -1 instead of only logical values? Thanks!

Contact us