The document proposes an algorithm for distributed optimization with mobile nodes that do not know the cost function beforehand. Each node estimates the gradient vector to update its location. The proposed algorithm improves upon an existing algorithm by relying on information-rich nodes in the neighborhood instead of a linear combination of neighbors' estimates. It also uses a variable step size to increase the probability of finding information-rich nodes early in the iterations. Simulation results show the proposed algorithm achieves better performance than the existing algorithm and a non-cooperative scheme. The algorithm has applications in sensor networks, environmental monitoring, and other domains.