Generate unit samples of a linear program

66 Views Asked by At

Given $N \in \mathbb{N}$ segments with a width of $w_i\quad i=1,\ldots,N$.

The sum of the segments have to be 1:

$$\sum_{i=1}^{N}{w_i}=1$$

In average, the width of a segment is $1/N$ but can vary around a spread $s$:

$$\frac{1-s}{N}\leq w_i\leq \frac{1+s}{N}\quad i=1,\ldots,N$$

The problem is to generate sample data $W=(w_1,\ldots,w_N)^T$ that satisfy the constraints.

The given constraints looks like a linear program (without a min/max function). I've found the article generate-uniform-data-in-a-simplex but this requires a unit simplex. As described in the article, a simplex is the set

$$\Delta=\left\{x|\sum^{d}_{i=1}{x_i}=1\enspace\text{and}\enspace 0\leq w_i \leq 1 \enspace\text{for}\enspace i=1,\ldots,d\right\}$$

Is there a way to map the given problem to a simplex, generate random samples of it and remap it to the original problem?