Learning simulator for quantum-algorithm design