update of optimization function