Computational active photonics