Comparing Energy and Cost Optimization in Distributed Energy Systems Management