fn_map function

mapping function to transform or penalize weights that violate constraints