trying to find curves for cost function depending on distance between start and row, row and prev row, etc.