Integration of machine learning and optimization for decision making under uncertainties with applications in agriculture and power system