#include <ckpttn/FMGainMgr.hpp>
template<typename Gnl, typename GainCalc, class Derived>
FMGainMgr class
Fiduccia-Mattheyses Gain Manager.
| Template parameters | |
|---|---|
| Gnl | The hypergraph type |
| GainCalc | The gain calculator type |
| Derived | The derived gain manager type (CRTP) |
The FMGainMgr class is a CRTP base class for managing the gain calculation and bucket structure used in the Fiduccia-Mattheyses partitioning algorithm. It provides methods for initializing gains, selecting vertices to move, and updating gain values after moves.
Constructors, destructors, conversion operators
Public functions
- auto init(std::span<const std::uint8_t> part) -> int -> auto
- Initializes the FMGainMgr with the given partition information.
- auto is_empty_togo(uint8_t to_part) const -> bool -> auto
- Checks if the gain bucket for the given partition is empty.
- auto is_empty() const -> bool -> auto
- Checks if all the gain buckets are empty.
- auto select(std::span<const std::uint8_t> part) -> std::pair< MoveInfoV< node_t >, int > -> auto
- Selects a set of moves to perform on the given partition.
- auto select_togo(uint8_t to_part) -> std::pair< node_t, int > -> auto
- Selects a node to move to the given partition.
- auto update_move(std::span<const std::uint8_t> part, const MoveInfoV<node_t>& move_info_v) -> void -> auto
- Updates the gain information for the given set of moves.
Public variables
- GainCalc gain_calc
- Gain calculator instance.
Protected variables
- Dllist<std::pair<node_t, uint32_t>> waiting_list
- Waiting list for vertices awaiting movement.
- const Gnl& hyprgraph
- Reference to the hypergraph being partitioned.
- std::vector<BPQueue<node_t>> gain_bucket
- Gain buckets for each partition (used in bucket-based gain management)
- std::uint8_t num_parts
- Number of partitions.
Function documentation
template<typename Gnl, typename GainCalc, class Derived>
FMGainMgr<Gnl, GainCalc, Derived>:: FMGainMgr(const Gnl& hyprgraph,
std::uint8_t num_parts)
Constructs a new FMGainMgr object.
| Parameters | |
|---|---|
| hyprgraph in | The hypergraph to manage the gains for. |
| num_parts in | The number of partitions in the hypergraph. |
template<typename Gnl, typename GainCalc, class Derived>
auto FMGainMgr<Gnl, GainCalc, Derived>:: init(std::span<const std::uint8_t> part) -> int
Initializes the FMGainMgr with the given partition information.
| Parameters | |
|---|---|
| part in | The partition information to initialize the FMGainMgr with. |
| Returns | int The result of the initialization. |
template<typename Gnl, typename GainCalc, class Derived>
auto FMGainMgr<Gnl, GainCalc, Derived>:: is_empty_togo(uint8_t to_part) const -> bool
Checks if the gain bucket for the given partition is empty.
| Parameters | |
|---|---|
| to_part in | The partition to check. |
| Returns | true If the gain bucket for the given partition is empty. |
template<typename Gnl, typename GainCalc, class Derived>
auto FMGainMgr<Gnl, GainCalc, Derived>:: is_empty() const -> bool
Checks if all the gain buckets are empty.
| Returns | true If all the gain buckets are empty. |
|---|
template<typename Gnl, typename GainCalc, class Derived>
auto FMGainMgr<Gnl, GainCalc, Derived>:: select(std::span<const std::uint8_t> part) -> std::pair< MoveInfoV< node_t >, int >
Selects a set of moves to perform on the given partition.
| Parameters | |
|---|---|
| part in | The current partition information. |
| Returns | std::pair<MoveInfoV<node_t>, int> A pair containing the selected moves and the total gain of the moves. |
template<typename Gnl, typename GainCalc, class Derived>
auto FMGainMgr<Gnl, GainCalc, Derived>:: select_togo(uint8_t to_part) -> std::pair< node_t, int >
Selects a node to move to the given partition.
| Parameters | |
|---|---|
| to_part in | The partition to select a node to move to. |
| Returns | std::pair<node_t, int> A pair containing the selected node and the gain of moving that node. |
template<typename Gnl, typename GainCalc, class Derived>
auto FMGainMgr<Gnl, GainCalc, Derived>:: update_move(std::span<const std::uint8_t> part,
const MoveInfoV<node_t>& move_info_v) -> void
Updates the gain information for the given set of moves.
| Parameters | |
|---|---|
| part in | The current partition information. |
| move_info_v in | The set of moves to update the gain information for. |