Optimal constrained self-learning battery sequential management in microgrid via adaptive dynamic programming