Added path optimisation.
Fixes #112
Merge pull request #113 from adobe-research/issue112

Fixes #112
Merge pull request #111 from adobe-research/pathoptim

Added path optimisation.
Merging with “master”