Use minimize instead of fmin_cg. Separate codes into different files.
init...