The implementation of optimisation in relax is discussed in detail in Chapter 14. To understand the concepts in this subsection, it is best to look at that chapter first.