Genetic optimization of a fuzzy control system for energy flow management in micro-grids