Optimal assignment of task modules with precedence for distributed processing by graph matching and state-space search