'Converts the solver output into standard form.
Parameters
results_dict : dict
The solver output.
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, results_dict, data, cached_data):

    import cvxopt
    new_results = {}
    status = self.STATUS_MAP[results_dict['status']]
    new_results[s.STATUS] = status
    if (new_results[s.STATUS] in s.SOLUTION_PRESENT):
        primal_val = results_dict['primal    objective']
        new_results[s.VALUE] = (primal_val + data[s.OFFSET])
        new_results[s.PRIMAL] = results_dict['x']
        new_results[s.EQ_DUAL] = results_dict['y']
        if data[s.DIMS][s.EXP_DIM]:
            new_results[s.INEQ_DUAL] = results_dict['zl']
        else:
            new_results[s.INEQ_DUAL] = results_dict['z']
        if ('Q' in data):
            y = results_dict['y']
            if (y.size[0] == 0):
                dual_len = data['Q'].size[0]
                new_results[s.EQ_DUAL] = cvxopt.matrix(0.0, (dual_len, 1))
            else:
                new_results[s.EQ_DUAL] = (data['Q'] * y)
        if ('P_leq' in data):
            leq_len = data[s.DIMS][s.LEQ_DIM]
            P_rows = data['P_leq'].size[0]
            new_len = ((P_rows + new_results[s.INEQ_DUAL].size[0]) - leq_len)
            new_dual = cvxopt.matrix(0.0, (new_len, 1))
            z = new_results[s.INEQ_DUAL][:leq_len]
            if (z.size[0] == 0):
                new_dual[:P_rows] = 0
            else:
                new_dual[:P_rows] = (data['P_leq'] * z)
            new_dual[P_rows:] = new_results[s.INEQ_DUAL][leq_len:]
            new_results[s.INEQ_DUAL] = new_dual
        for key in [s.PRIMAL, s.EQ_DUAL, s.INEQ_DUAL]:
            new_results[key] = intf.cvxopt2dense(new_results[key])
    return new_results
