After the vector is sorted, we assume that the element with index i
correspond to the percentile 100*(i+0.5)/size. For percentiles before the
first element (resp. after the last one) we return the first element (resp.
the last). And otherwise we do a linear interpolation between the two element
around the asked percentile.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePercentile\u003c/code\u003e class is a utility for calculating percentiles for a limited number of records, referencing the Wikipedia definition of percentile.\u003c/p\u003e\n"],["\u003cp\u003eIt assumes the sorted element with index \u003ccode\u003ei\u003c/code\u003e corresponds to the percentile \u003ccode\u003e100*(i+0.5)/size\u003c/code\u003e, performing linear interpolation for percentiles between elements.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to add records (\u003ccode\u003eAddRecord\u003c/code\u003e), retrieve a specific percentile (\u003ccode\u003eGetPercentile\u003c/code\u003e), and get the total number of records (\u003ccode\u003eNumRecords\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGetPercentile\u003c/code\u003e has a time complexity of O(n log n) for n records.\u003c/p\u003e\n"]]],["The `Percentile` class calculates percentiles for a limited number of records. It uses a sorted vector, with element index `i` corresponding to the percentile `100*(i+0.5)/size`. `AddRecord` adds a record. `GetPercentile` retrieves the percentile, using linear interpolation between elements for requested values, and it runs in O(n log n). `NumRecords` returns the count of stored records. The constructor initializes the record limit.\n"],null,["# Percentile\n\nC++ Reference: class Percentile\n===============================\n\n\nNote: This documentation is automatically generated.\nUtility to calculate percentile (First variant) for limited number of records. Reference: \u003chttps://en.wikipedia.org/wiki/Percentile\u003e \n\nAfter the vector is sorted, we assume that the element with index i correspond to the percentile 100\\*(i+0.5)/size. For percentiles before the first element (resp. after the last one) we return the first element (resp. the last). And otherwise we do a linear interpolation between the two element around the asked percentile.\n\n| Method ||\n|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|\n| [`AddRecord`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/util.h#L323) | Return type: `void ` Arguments: `double record` \u003cbr /\u003e |\n| [`GetPercentile`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/util.h#L329) | Return type: `double ` Arguments: `double percent` Note that this is not fast and runs in O(n log n) for n records. |\n| [`NumRecords`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/util.h#L326) | Return type: `int64_t ` Returns number of stored records. |\n| [`Percentile`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/util.h#L321) | Return type: `explicit ` Arguments: `int record_limit` \u003cbr /\u003e |"]]