def _adjust_cost_matrix(self, cost_matrix):
        """Modify cost matrix to fit the optimization problem."""
        new_cost_matrix = cost_matrix
        if not cost_matrix:
            return new_cost_matrix
        first_column = [row[0] for row in cost_matrix]
        last_column = [row[-1] for row in cost_matrix]
        if sum(first_column) < sum(last_column):
            offset = min(first_column)
            sign = 1
        else:
            offset = max(first_column)
            sign = -1
        for i in xrange(len(cost_matrix)):
            for j in xrange(len(cost_matrix[i])):
                new_cost_matrix[i][j] = sign * (
                                        (cost_matrix[i][j] - offset) ** 2)
        return new_cost_matrix
dataset/ETHPy150Open openstack/nova-solver-scheduler/nova_solverscheduler/scheduler/solvers/pulp_solver.py/PulpSolver._adjust_cost_matrix/original