A branch & bound algorithm is presented for a very general scheduling problem with n jobs and m machines. Each job consists of a set of operations. Each operation has to be processed on a dedicated machine. There may be arbitrary precedence relations between the operations. The set of all operations is partitioned into groups. If on a machine an operation belonging to group Gg is processed immediately after an operation belonging to group Gf there is a setup of sfg time units. The authors assume that sfg=0 if f=g and that the sfg satisfy the triangle inequality. Computational results for this general problem as well as for special cases like the job-shop problem and the open-shop problem are reported.