Antares-Simulator is an Open Source power system simulator to quantify the adequacy or the economic performance of interconnected energy systems, at short or remote time horizons.
Best I could think of for dividing into a smaller functions. Does not make much sense dividing by SetToZero12LinksForAdequacyPatch & SetToZero11LinksForAdequacyPatch.
I will deal with replacing "solution with map" into "dividing into sub-functions", and commit that tomorrow!