code: def acquisition_function_withGradients(self, x):
          
          f_acqu,df_acqu = self._compute_acq_withGradients(x)
          cost_x, cost_grad_x = self.cost_withGradients(x)
          f_acq_cost = f_acqu/cost_x
          df_acq_cost = (df_acqu*cost_x - f_acqu*cost_grad_x)/(cost_x**2)
          return -f_acq_cost*self.space.indicator_constraints(x), -df_acq_cost*self.space.indicator_constraints(x)
docs: Takes an acquisition and it gradient and weights it so the domain and cost are taken into account.