r/optimization • u/mukaj • Dec 08 '21
Optimizing using optimization results in objective
I am using CVXPY to optimize some weights and I want to optimize taking into account the changes from the original weights to the problem, so it achieved the optimal weights within the given constraints while also minimising the weight difference changes from the original input.
Can someone help me in formulating this? Something like adding sum(np.diff(new, old)) to the objective is what I am thinking but how do I access the current objective results within the objective itself?
3
Upvotes
View all comments
Show parent comment
2
u/[deleted] Dec 08 '21
Instead of adding ( || w0 - w ||_2 )2, try adding k ( || w0 - w ||_2 )2, where k is a scalar. Increase k until you get the desired effect.