Skip to content

[Pack] List of Feasible Candidates Should be a Priority Queue #2859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AlexandreSinger opened this issue Jan 14, 2025 · 1 comment
Open
Assignees

Comments

@AlexandreSinger
Copy link
Contributor

In the GreedyCandidateSelector class, used within the packer, a list of feasible blocks is maintained which is used to select the next candidate to propose:

/// @brief Array of feasible blocks to select from [0..max_array_size-1]
///
/// Sorted in ascending gain order so that the last cluster_ctx.blocks is
/// the most desirable (this makes it easy to pop blocks off the list.
std::vector<t_pack_molecule*> feasible_blocks;
int num_feasible_blocks;

Currently this is stored as a vector where it is ordered based on the gain of the block. To maintain the order, an insertion sort is used every time a block is added to the list. Not only is this code confusing to read, it may also be slow. This should instead be an std::priority_queue.

@RonZ13
Copy link

RonZ13 commented Jan 14, 2025

I ll take this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants