Stability and cost optimality of power generation and supply systems must not be considered independently from one another. Simple examples show that optimizing cost without considering stability may result in modes of operation that, while economically optimal, are unstable. We demonstrate that stability, robustness, and optimality can be considered systematically and simultaneously by combining bifurcation theory and nonlinear optimization. Essentially, the proposed method enforces a backoff distance between the optimal point of operation and operational or stability boundaries in the space of the optimization variables, where bifurcation theory is used to describe nonlinear stability boundaries.We optimize a simple grid to demonstrate the features of the proposed approach. Our results show that the method can be applied to problems with both continuous and Boolean optimization variables, where the latter represent grid breakers in the example. The constraints for robust stability turn out to be crucial in that economically optimal but unstable modes of operation exist despite the small size of the illustrative example. Our results demonstrate that the robustness constraints can affect the optimal value of the Boolean variables. We show that the method provides a measure for the cost of stability and robustness.