Machine-Learning Forecasting and Linear-Programming Optimization for Smart Renewable Energy Management
Abstract
Solar and wind generation swing with the weather, so a grid that leans on them must anticipate supply and demand rather than react to it. This paper develops and evaluates a two-part framework for renewable energy management: a forecasting stage that predicts short-term solar generation, and an optimization stage that schedules battery storage against a time-varying tariff. Both parts are measured, not asserted. Six forecasters are compared on next-hour solar power over a two-year hourly series - a persistence baseline, linear regression, an autoregressive (ARIMA-family) model, a random forest, gradient boosting, and an LSTM. The random forest is the most accurate, with a mean absolute error of 27.1 kW and an $\mathrm{R}^{2}$ of 0.928, and the results contradict a common assumption: the LSTM, though competitive, does not surpass the tree ensembles at this horizon. The optimization stage formulates battery dispatch as a linear program that charges from surplus renewable energy and discharges into the expensive evening peak; it lowers the daily electricity cost by 12.7% and raises self-sufficiency to 43.9% on a six-kilowatt-hour battery. An ablation shows the two stages are complementary - the integrated system beats forecasting alone by 12.7% and optimized storage alone by 5.6% - and the framework scales linearly to a hundred plants. The contribution is a reproducible, quantitatively validated alternative to the conceptual descriptions that dominate this area.