refactor optimizers, cost functions; logistic impl; ex1.py-->all.py