title: How to transform a list of weights, given that they must sum to 1 and obey bounds?
body: <p>Suppose I have some weights <code>[w_1,w_2,...,w_n]</code> and I have the following conditions:</p>
  <ol>
  <li><code>a &lt; w_i &lt; b</code> for each <em>i</em></li>
  <li><code>w_1 + w_2 + ... + w_n = 1</code></li>
  </ol>
  <p>Is there a way to transform (squeeze) my original weights to obey these rules?</p>
  <p>Any help would be hugely appreciated!</p>