Automatic Derivation of Petri Net Based Distributed Specification with Optimal Allocation of Resources