How to apply constraints in the optimizer (i.e. somehow change params each time after opt_update function)?