statistics and optimization done