fix a bug of intersecting constraints when instning memory edges, also add the compareTo() method for sorting edges in summary