A generic molecular thermodynamic model for linear and branched polymer solutions in a lattice