15. checking speed
16. checking KKT conditions