The optimal weight parameter is selected by minimizing an error measure, using the optimize function.
References
R. J. Hyndman and H. L. Shang (2009) "Forecasting functional time series (with discussion)", Journal of the Korean Statistical Society, 38(3), 199-221.