Choose the right gear

We are given a set of gears, one equation to be satisfied (see picture below) and a number of constraints.


Terms on the left (work and cutter) are given, while A, B, C and PG must be chosen from a set of 29 elements (it is a set in common among unknowns, so we are not allowed to use the same gear twice for two different variables, even though there are duplicates).

How do we find the right gears?