Dynamic optimization is employed to calculate the optimal operating conditions for grade transitions in polymer production. The optimization is based on a detailed process model of a fluidized bed reactor and polymer properties, as well as a thermodynamic model that accounts for interactions between the different gases. It calculates the optimal flow rates of comonomer and hydrogen that ensure the production of the desired polymer (high density polyethylene HDPE, or linear low density polyethylene LLDPE). Constraints are considered on the inputs. Besides, a constraint is put on the bed temperature to ensure that it remains below the polymer melting temperature. The simulations show that the transition time can be reduced, and the final operating conditions allow producing polymer with the desired properties, without risking polymer melting or sticking.