finished optimization exercises