added tree distance metric and tree distance based constraints on bond rules