Added a new class and some functions for optimization in matlab