#27: extending optimization algorithm to support cost fitting as an optimization goal