The increasing penetration of renewable energy sources in microgrids demands accurate day-ahead
forecasting to support optimal battery energy storage system (BESS) scheduling. Yet the
conventional predict-then-optimize (PtO) paradigm trains forecasters on statistical accuracy
metrics that are agnostic to the asymmetric and time-varying cost impacts of forecast errors.
This work compares two training paradigms for day-ahead load forecasting in a grid-connected
microgrid integrating photovoltaic (PV) generation, a BESS, and a grid connection: conventional
PtO and decision-focused learning (DFL). Both use an identical gated recurrent unit (GRU) network
mapping historical load and calendar features to a 48-hour, 15-minute-resolution trajectory.
The PtO baseline minimizes mean-squared error, whereas DFL trains end-to-end to minimize
realized operational cost, learning to commit prediction errors that are economically inexpensive
rather than merely statistically small. Dispatch is handled by a receding-horizon controller
partitioned into 24 hourly cycles; each solves an economic-dispatch linear program over a 24-
hour look-ahead via a differentiable convex-optimization layer (cvxpylayers), committing only
the first hour. An analytical real-time layer balances residual demand against measured load,
accruing true cost. The summed daily cost forms the DFL loss, with gradients propagated to
the GRU. The framework is validated on the MG2Lab experimental microgrid testbed at Politecnico
di Milano, emulating the operation of a charging station with a BESS of 60 kWh and
a PV plant of 23.5 kWp. The results illustrate that the DFL-trained pipeline reduces operational
cost by 4.08% relative to the accuracy-optimized baseline, while nearly eliminating load-shedding
events. Notably, the DFL forecasters exhibit higher statistical errors than their accuracy-trained
counterparts yet achieve consistently lower operational costs, confirming that forecast accuracy
and decision quality do not share a monotonic relationship in microgrid scheduling.