def convert_to_human_readable(sdp):
objective = "<STR_LIT>"<EOL>indices_in_objective = []<EOL>for i, tmp in enumerate(sdp.obj_facvar):<EOL><INDENT>candidates = [key for key, v in<EOL>sdp.monomial_index.items() if v == i+<NUM_LIT:1>]<EOL>if len(candidates) > <NUM_LIT:0>:<EOL><INDENT>monomial = convert_monomial_to_string(candidates[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>monomial = "<STR_LIT>"<EOL><DEDENT>if tmp > <NUM_LIT:0>:<EOL><INDENT>objective += "<STR_LIT:+>"+str(tmp)+monomial<EOL>indices_in_objective.append(i)<EOL><DEDENT>elif tmp < <NUM_LIT:0>:<EOL><INDENT>objective += str(tmp)+monomial<EOL>indices_in_objective.append(i)<EOL><DEDENT><DEDENT>matrix_size = <NUM_LIT:0><EOL>cumulative_sum = <NUM_LIT:0><EOL>row_offsets = [<NUM_LIT:0>]<EOL>block_offset = [<NUM_LIT:0>]<EOL>for bs in sdp.block_struct:<EOL><INDENT>matrix_size += abs(bs)<EOL>cumulative_sum += bs ** <NUM_LIT:2><EOL>row_offsets.append(cumulative_sum)<EOL>block_offset.append(matrix_size)<EOL><DEDENT>matrix = []<EOL>for i in range(matrix_size):<EOL><INDENT>matrix_line = ["<STR_LIT:0>"] * matrix_size<EOL>matrix.append(matrix_line)<EOL><DEDENT>for row in range(len(sdp.F.rows)):<EOL><INDENT>if len(sdp.F.rows[row]) > <NUM_LIT:0>:<EOL><INDENT>col_index = <NUM_LIT:0><EOL>for k in sdp.F.rows[row]:<EOL><INDENT>value = sdp.F.data[row][col_index]<EOL>col_index += <NUM_LIT:1><EOL>block_index, i, j = convert_row_to_sdpa_index(<EOL>sdp.block_struct, row_offsets, row)<EOL>candidates = [key for key, v in<EOL>sdp.monomial_index.items()<EOL>if v == k]<EOL>if len(candidates) > <NUM_LIT:0>:<EOL><INDENT>monomial = convert_monomial_to_string(candidates[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>monomial = "<STR_LIT>"<EOL><DEDENT>offset = block_offset[block_index]<EOL>if matrix[offset+i][offset+j] == "<STR_LIT:0>":<EOL><INDENT>matrix[offset+i][offset+j] = ("<STR_LIT>" % (value, monomial))<EOL><DEDENT>else:<EOL><INDENT>if value.real > <NUM_LIT:0>:<EOL><INDENT>matrix[offset+i][offset+j] += ("<STR_LIT>" % (value,<EOL>monomial))<EOL><DEDENT>else:<EOL><INDENT>matrix[offset+i][offset+j] += ("<STR_LIT>" % (value,<EOL>monomial))<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>return objective, matrix<EOL>
Convert the SDP relaxation to a human-readable format.

    :param sdp: The SDP relaxation to write.
    :type sdp: :class:`ncpol2sdpa.sdp`.
    :returns: tuple of the objective function in a string and a matrix of
              strings as the symbolic representation of the moment matrix