'Converts the solver output into standard form.
Parameters
task : mosek.Task
The solver status interface.
data : dict
Information about the problem.
cached_data : dict
A map of solver name to cached problem data.
Returns
dict
The solver output in standard form.'

def format_results(self, task, data, cached_data):

    import mosek
    STATUS_MAP = {mosek.solsta.optimal: s.OPTIMAL, mosek.solsta.prim_infeas_cer: s.INFEASIBLE, mosek.solsta.dual_infeas_cer: s.UNBOUNDED, mosek.solsta.near_optimal: s.OPTIMAL_INACCURATE, mosek.solsta.near_prim_infeas_cer: s.INFEASIBLE_INACCURATE, mosek.solsta.near_dual_infeas_cer: s.UNBOUNDED_INACCURATE, mosek.solsta.unknown: s.SOLVER_ERROR}
    (soltype, solsta) = self.choose_solution(task)
    if (solsta in STATUS_MAP):
        result_dict = {s.STATUS: STATUS_MAP[solsta]}
    else:
        result_dict = {s.STATUS: s.SOLVER_ERROR}
    result_dict[s.SOLVE_TIME] = task.getdouinf(mosek.dinfitem.optimizer_time)
    result_dict[s.SETUP_TIME] = task.getdouinf(mosek.dinfitem.presolve_time)
    result_dict[s.NUM_ITERS] = task.getintinf(mosek.iinfitem.intpnt_iter)
    if (result_dict[s.STATUS] in s.SOLUTION_PRESENT):
        result_dict[s.PRIMAL] = np.zeros(task.getnumvar(), dtype=np.float)
        task.getxx(soltype, result_dict[s.PRIMAL])
        result_dict[s.VALUE] = (task.getprimalobj(soltype) + data[s.OFFSET])
        y = np.zeros(task.getnumcon(), dtype=np.float)
        task.gety(soltype, y)
        result_dict[s.EQ_DUAL] = (- y[:len(data[s.B])])
        result_dict[s.INEQ_DUAL] = (- y[len(data[s.B]):(len(data[s.B]) + data[s.DIMS][s.LEQ_DIM])])
    return result_dict
