Please help : autoswitch for parallel and series connection

Hi all !
I have 4 supercapasitors connected in parallel to harvest energy from almost completely depleted battery. As voltage reach some level ( for example 0.5 volt ) I swap wires to connect supercapacitors in series to get 2 volts and unload energy to supercapasitor # 5.
As of now I do it simply by manual rewiring.
Please advise circuit to automate this process.
Thank you!