finish optimal margin machine