Simulation optimization in the presence of environmental variables