How to transform a list of weights, given that they must sum to 1 and obey bounds?
The conditions may fail to be compatible, and there can be different ways to cope:

declare "no solution",

relax type 1 or type 2 constraint,

compute a "best fit" by assigning a penalty to a constraint that is not fulfilled.


Divide every w by the sum of all w to achieve the condition 2. Then if you are lucky, the conditions 1 may hold by chance.
Suppose I have some weights [w_1,w_2,...,w_n] and I have the following conditions:

a < w_i < b for each i
w_1 + w_2 + ... + w_n = 1

Is there a way to transform (squeeze) my original weights to obey these rules?
Any help would be hugely appreciated!