implemented simple_optimize algorithm