Optimization of module configuration in membrane gas separation