Lattice fluid model generalized for specific interactions: An application to ternary polymer solutions