Building a generic mathematical formula for a nonlinear model predictive control. Swarm optimization with model predictive control is used to describe the UC/ED nonlinearity. Controlled autoregressive integration moving average is used to predict wind power and disturbance. Swarm model predictive control is used to solve ED on real-time basis.