new version of improveFunction
add double-type in images
merge polygons and gradient descent