Cleanup of the legalization file

Splitted in two files, one handling the transportation problem and the
other handling the representations and partitioning
Refactoring + multipartitioning code

The legalizer code has been refactored for clarity
New multipartition functions are available to partition, not only as
post-processing