Bayesian Heuristic Approach to Discrete and Global Optimization