Multi-unit optimization for a system with multiple non-identical units and multiple inputs - application to photovoltaic arrays