Hi,


So here is my problem:


Given a nonlinear, discontinous, cost function $f(x\_1,x\_2,..,x\_N)$ along with linear constraints $x\_n \ge 0, \forall n$
$x\_n \le c\_n$
 and $\sum\_{n=1}^N x\_n = 1$ find an optimal (local) solution by randomly sampling the feasible region. $c\_n$ are just constants.


The issue I am having is indexing the space, since it is not a simple n-dimensional cube but rather a polytope(i believe its convex). Discretizing and enumerating all possible combinations of points to sample is much too hard since N =20. Approximating the polytope with a n-dimensional cube and sampling from the cube, only about 1% of the samples fall within the feasible region...which is inefficient if I'm trying to generate many samples.


I've tried finding the volume of the space analytically, however the complexity of computing the integral gets overwhelming for many dimensions. 


I was wondering if anyone has come across this type of problem and has any recommendation as to different methods I could try to sample this space. Essentially, I need a good way to estimate the volume...am I looking at this the correct way?


any help would be greatly appreciated...



Random Sampling a linearly constrained region in n-dimensions...
Your constraints $x\_n \geq 0$, $\sum\_{n=1}^N x\_n = 1$, are those for the [standard simplex](http://en.wikipedia.org/wiki/Simplex#The_standard_simplex). You could try [uniform sampling from the standard simplex](http://www.cs.cmu.edu/~nasmith/papers/smith+tromble.tr04.pdf), and then reject any sample that doesn't also satisfy the $x\_n \leq c\_n$ constraints.


An alternative to the procedure described in the linked paper above for uniform sampling from the standard simplex is to generate $n$ exponential(1) random variables $X\_1, X\_2, \ldots, X\_n$ and let $Y\_i = X\_i/\sum\_{i=1}^n X\_i$. Then $(Y\_1,Y\_2,\ldots,Y\_n)$ is uniformly distributed on the standard simplex. This can be thought of as [generating a random vector](http://en.wikipedia.org/wiki/Dirichlet_distribution#Random_number_generation) from the symmetric [Dirichlet distribution](http://en.wikipedia.org/wiki/Dirichlet_distribution). (Also, generating exponential(1) random variables is easy; if $Z \sim U(0,1)$ then $-\ln(Z)$ has an exponential(1) distribution.) Once again, you would then reject any sample that doesn't also satisfy the $x\_n \leq c\_n$ constraints.


