A Generalized dynamic programming principle and hamilton-jacobi-bellman equation