enforce_nonneg_weights function

Enforce nonnegativity of weights