Exploring Energy Landscapes for Minimal Counterfactual Explanations: Applications in Cybersecurity and Beyond