Optimal efforts in heterogeneous agents population with global and local interactions