After Taylor approximation, the optimization function needs to optimize the variables each iteration

I have no idea what you’re doing. But you can start by carefully reading

and

http://cvxr.com/cvx/doc/