Refactored result and cost recording.

Add a MILP switch to optimal balanced solver.