Skip to content

Algorithmic error in bisection in git-diff-search (no guarantee to find a local minimum) #1

@burnpanck

Description

@burnpanck

git-diff-search selects the midpoint commit in the range of interest, and then restricts the further search to the half on the side of the midpoint that belongs to the better endpoint. However, nothing guarantees that the minimum will be on that side of the midpoint. A known bisecting minimisation algorithm is called 'golden-section-seach', it works as follows: Given three points [A,B,C] with known optimality values [x,y,z], where y is the best of the three, pick a new point D somewhere between B and the range end with the lower value; evaluate it's optimality. If it is better than B, B will be one of the new endpoints and D the new midpoint, otherwise vice versa. This way you guarantee to converge at least to a local minimum. Optimal performance is achieved when D is selected according to the golden section, with the smaller side towards B.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions