GUI: Add sorting functionality for equilibria - #1077
Merged
tturocy merged 7 commits intoAug 31, 2026
Conversation
tturocy
requested changes
Aug 26, 2026
| } | ||
|
|
||
| template <class T> | ||
| std::optional<double> AnalysisProfileList<T>::GetActionProbValue(int p_action, int p_index) const |
Member
There was a problem hiding this comment.
Is there a rationale for casting to double even when the type is T=Rational? Rationals should sort just fine as well.
Contributor
Author
There was a problem hiding this comment.
I think it was because this way it could compare cached keys, but now it calls back per comparison. However, I think for sorting a few equilibria, this should be fine, right?
I have made the changes!
| By default the equilibria are listed in the order in which they were | ||
| computed. Whenever more than one equilibrium has been found, each | ||
| column label in the profiles listing carries a small | ||
| :guilabel:`↕` marker, indicating that the list can be sorted on that |
Member
There was a problem hiding this comment.
I found the this marker to be very difficult to see on my screen or understand what it means. Can we just do without it? I've seen many interfaces where we don't explicitly mark "hey you can sort this".
tturocy
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the changes in this PR
This PR makes the list of computed equilibria sortable, in both the extensive-form (behavior profile) and strategic-form (mixed profile) panels. Previously equilibria could only be read in the order the algorithm produced them, which makes them hard to compare or locate in a long list.
Clicking a column label sorts the equilibria by the probability with which that action or strategy is played; clicking again reverses the direction. Ties are broken by comparing profiles entry-by-entry from the leftmost column, so sorting on the first column lists them lexicographically by profile. Clicking the # corner restores the computed order.
Sorting only changes the display order: the row number identifies the equilibrium itself and stays with it, so selection and the bold highlight follow the profile, not the row.
For discoverability, each column label carries a ▲/▼ on the sorted column; the label windows also use a hand cursor and carry tooltips. In addition, this PR makes the permanent light blue highlight (on the first cell in the second column and the first cell of the second row) dynamic to emphasize which column is used for sorting, and which row is bolded.
The ordering lives in a new ProfileSortOrder (src/gui/profilesort.{h,cc}) shared by both panels. It compares numeric values rather than the formatted cell strings, so 1/3 and 0.333 order correctly (that is what the new GetStrategyProbValue/GetActionProbValue accessors on AnalysisOutput are for). Entries undefined for a profile (shown as *) sort last. doc/gui.nash.rst is updated to match.
How to review this PR