The sentence is grammatically correct.


…the locally optimal service…

There is a single "locally optimal service" in each class, so this noun phrase should be singular, which it is.

…from each service class…

Unless each immediately follows a plural noun phrase (which it does not here), then what follows should be singular, which service class is.

Selecting the locally optimal service from each service class…

The gerund is used to turn the verb select into a noun, and the entire phrase above is a noun phrase for the process described, which is singular.

Selecting the locally optimal service from each service class does not create a globally optimal solution.

Three places number comes up, all of them singular, and all of them treated as singular. You're good!