Numerical Modeling and Inverse Design of Complex Nanophotonic Systems