Countably orderable sets and their applications in optimization